Version 1.11.0-dev.4.0

Merge commit '40e925078f9caa0d03c4b9c13f9554906d6eaa9a' into dev
diff --git a/DEPS b/DEPS
index dee9ad3..b6de9ff 100644
--- a/DEPS
+++ b/DEPS
@@ -17,10 +17,22 @@
   # If you do not know, use the full path while defining your new deps entry.
   "googlecode_url": "http://%s.googlecode.com/svn",
 
-  "dart_github": "https://github.com/dart-lang/%s.git",
+  # We use mirrors of all github repos to guarantee reproducibility and
+  # consistency between what users see and what the bots see.
+  # We need the mirrors to not have 100+ bots pulling github constantly.
+  # We mirror our github repos on chromium git servers.
+  # DO NOT use this var if you don't see a mirror here:
+  #   https://chromium.googlesource.com/
+  # named like:
+  #   external/github.com/dart-lang/NAME
+  # It is ok to add a dependency directly on dart-lang (dart-lang only)
+  # github repo until the mirror has been created, but please do file a bug
+  # against infra to make that happen.
+  "github_mirror":
+      "https://chromium.googlesource.com/external/github.com/dart-lang/%s.git",
 
   "gyp_rev": "@1752",
-  "co19_rev": "@801",
+  "co19_rev": "@f95f109fea67127a220958794ef5200a63cb454c",
   "chromium_url": "http://src.chromium.org/svn",
   "chromium_git": "https://chromium.googlesource.com",
 
@@ -64,12 +76,13 @@
   "oauth2_rev": "@1bff41f4d54505c36f2d1a001b83b8b745c452f5",
   "observe_rev": "@eee2b8ec34236fa46982575fbccff84f61202ac6",
   "observatory_pub_packages_rev": "@45565",
-  "package_config_rev": "@286f9cf48448c4563e735a142c6f9442ab57674e",
+  "package_config_tag": "@0.0.2+4",
   "path_rev": "@93b3e2aa1db0ac0c8bab9d341588d77acda60320",
   "petitparser_rev" : "@37878",
   "ply_rev": "@604b32590ffad5cbb82e4afef1d305512d06ae93",
   "plugin_tag": "@0.1.0",
   "pool_rev": "@22e12aeb16ad0b626900dbe79e4a25391ddfb28c",
+  "pub_rev": "@f6d3dceb51789b6ba7ae28e87b667663792a7aa9",
   "pub_semver_tag": "@1.2.1",
   "scheduled_test_tag": "@0.11.8+1",
   "shelf_rev": "@1e87b79b21ac5e6fa2f93576d6c06eaa65285ef4",
@@ -105,8 +118,8 @@
   Var("dart_root") + "/third_party/gyp":
       (Var("googlecode_url") % "gyp") + "/trunk" + Var("gyp_rev"),
 
-  Var("dart_root") + "/tests/co19/src": ((Var("googlecode_url") % "co19") +
-      "/trunk/co19/tests/co19/src" + Var("co19_rev")),
+  Var("dart_root") + "/tests/co19/src":
+      "https://github.com/dart-lang/co19.git" + Var("co19_rev"),
 
   Var("dart_root") + "/third_party/nss":
       Var("chromium_git") + "/chromium/deps/nss.git" + Var("nss_rev"),
@@ -158,118 +171,120 @@
       Var("observatory_pub_packages_rev"),
 
   Var("dart_root") + "/third_party/dart-services":
-      (Var("dart_github") % "dart-services") +
+      (Var("github_mirror") % "dart-services") +
       Var("dart_services_rev"),
 
   Var("dart_root") + "/third_party/pkg_tested/analyzer_cli":
-      (Var("dart_github") % "analyzer_cli") + Var("analyzer_cli_tag"),
+      (Var("github_mirror") % "analyzer_cli") + Var("analyzer_cli_tag"),
   Var("dart_root") + "/third_party/pkg/args":
-      (Var("dart_github") % "args") + Var("args_tag"),
+      (Var("github_mirror") % "args") + Var("args_tag"),
   Var("dart_root") + "/third_party/pkg/async_await":
-      (Var("dart_github") % "async_await") + Var("async_await_rev"),
+      (Var("github_mirror") % "async_await") + Var("async_await_rev"),
   Var("dart_root") + "/third_party/pkg/barback":
-      (Var("dart_github") % "barback") + Var("barback_rev"),
+      (Var("github_mirror") % "barback") + Var("barback_rev"),
   Var("dart_root") + "/third_party/pkg/charcode":
-      (Var("dart_github") % "charcode") + Var("charcode_tag"),
+      "https://github.com/dart-lang/charcode.git" + Var("charcode_tag"),
   Var("dart_root") + "/third_party/pkg/cli_util":
-      "https://github.com/dart-lang/cli_util.git" + Var("cli_util_tag"),        
+      "https://github.com/dart-lang/cli_util.git" + Var("cli_util_tag"),
   Var("dart_root") + "/third_party/pkg/collection":
-      (Var("dart_github") % "collection") + Var("collection_rev"),
+      (Var("github_mirror") % "collection") + Var("collection_rev"),
   Var("dart_root") + "/third_party/pkg/crypto":
-      (Var("dart_github") % "crypto") + Var("crypto_rev"),
+      (Var("github_mirror") % "crypto") + Var("crypto_rev"),
   Var("dart_root") + "/third_party/pkg/csslib":
-      (Var("dart_github") % "csslib") + Var("csslib_tag"),
+      (Var("github_mirror") % "csslib") + Var("csslib_tag"),
   Var("dart_root") + "/third_party/pkg_tested/dart_style":
-      (Var("dart_github") % "dart_style") + Var("dart_style_tag"),
+      (Var("github_mirror") % "dart_style") + Var("dart_style_tag"),
   Var("dart_root") + "/third_party/pkg/glob":
-      (Var("dart_github") % "glob") + Var("glob_rev"),
+      (Var("github_mirror") % "glob") + Var("glob_rev"),
   Var("dart_root") + "/third_party/pkg/html":
-      (Var("dart_github") % "html") + Var("html_tag"),
+      (Var("github_mirror") % "html") + Var("html_tag"),
   Var("dart_root") + "/third_party/pkg/http":
-      (Var("dart_github") % "http") + Var("http_rev"),
+      (Var("github_mirror") % "http") + Var("http_rev"),
   Var("dart_root") + "/third_party/pkg/http_multi_server":
-      (Var("dart_github") % "http_multi_server") +
+      (Var("github_mirror") % "http_multi_server") +
       Var("http_multi_server_tag"),
   Var("dart_root") + "/third_party/pkg/http_parser":
-      (Var("dart_github") % "http_parser") + Var("http_parser_rev"),
+      (Var("github_mirror") % "http_parser") + Var("http_parser_rev"),
   Var("dart_root") + "/third_party/pkg/http_throttle":
-      (Var("dart_github") % "http_throttle") +
+      (Var("github_mirror") % "http_throttle") +
       Var("http_throttle_rev"),
   Var("dart_root") + "/third_party/pkg/intl":
-      (Var("dart_github") % "intl") + Var("intl_rev"),
+      (Var("github_mirror") % "intl") + Var("intl_rev"),
   Var("dart_root") + "/third_party/pkg/json_rpc_2":
-      (Var("dart_github") % "json_rpc_2") + Var("json_rpc_2_rev"),
+      (Var("github_mirror") % "json_rpc_2") + Var("json_rpc_2_rev"),
   Var("dart_root") + "/third_party/pkg/linter":
-      (Var("dart_github") % "linter") + Var("linter_tag"),
+      (Var("github_mirror") % "linter") + Var("linter_tag"),
   Var("dart_root") + "/third_party/pkg/logging":
-      (Var("dart_github") % "logging") + Var("logging_rev"),
+      (Var("github_mirror") % "logging") + Var("logging_rev"),
   Var("dart_root") + "/third_party/pkg/markdown":
       "https://github.com/dpeek/dart-markdown.git" + Var("markdown_rev"),
   Var("dart_root") + "/third_party/pkg/matcher":
-      (Var("dart_github") % "matcher") + Var("matcher_tag"),
+      (Var("github_mirror") % "matcher") + Var("matcher_tag"),
   Var("dart_root") + "/third_party/pkg/metatest":
-      (Var("dart_github") % "metatest") + Var("metatest_rev"),
+      (Var("github_mirror") % "metatest") + Var("metatest_rev"),
   Var("dart_root") + "/third_party/pkg/mime":
-      (Var("dart_github") % "mime") + Var("mime_rev"),
+      (Var("github_mirror") % "mime") + Var("mime_rev"),
   Var("dart_root") + "/third_party/pkg/oauth2":
-      (Var("dart_github") % "oauth2") + Var("oauth2_rev"),
+      (Var("github_mirror") % "oauth2") + Var("oauth2_rev"),
   Var("dart_root") + "/third_party/pkg/observe":
-      (Var("dart_github") % "observe") + Var("observe_rev"),
+      (Var("github_mirror") % "observe") + Var("observe_rev"),
   Var("dart_root") + "/third_party/pkg/package_config":
-      (Var("dart_github") % "package_config") +
-      Var("package_config_rev"),
+      (Var("github_mirror") % "package_config") +
+      Var("package_config_tag"),
   Var("dart_root") + "/third_party/pkg/path":
-      (Var("dart_github") % "path") + Var("path_rev"),
+      (Var("github_mirror") % "path") + Var("path_rev"),
   Var("dart_root") + "/third_party/pkg/plugin":
-      (Var("dart_github") % "plugin") + Var("plugin_tag"),
+      (Var("github_mirror") % "plugin") + Var("plugin_tag"),
   Var("dart_root") + "/third_party/pkg/pool":
-      (Var("dart_github") % "pool") + Var("pool_rev"),
+      (Var("github_mirror") % "pool") + Var("pool_rev"),
   Var("dart_root") + "/third_party/pkg/pub_semver":
-      (Var("dart_github") % "pub_semver") + Var("pub_semver_tag"),
+      (Var("github_mirror") % "pub_semver") + Var("pub_semver_tag"),
+  Var("dart_root") + "/third_party/pkg_tested/pub":
+      ("https://github.com/dart-lang/pub.git") + Var("pub_rev"),
   Var("dart_root") + "/third_party/pkg/scheduled_test":
-      (Var("dart_github") % "scheduled_test") +
+      (Var("github_mirror") % "scheduled_test") +
       Var("scheduled_test_tag"),
   Var("dart_root") + "/third_party/pkg/shelf":
-      (Var("dart_github") % "shelf") + Var("shelf_rev"),
+      (Var("github_mirror") % "shelf") + Var("shelf_rev"),
   Var("dart_root") + "/third_party/pkg/shelf_web_socket":
-      (Var("dart_github") % "shelf_web_socket") +
+      (Var("github_mirror") % "shelf_web_socket") +
       Var("shelf_web_socket_rev"),
   Var("dart_root") + "/third_party/pkg/smoke":
-      (Var("dart_github") % "smoke") + Var("smoke_rev"),
+      (Var("github_mirror") % "smoke") + Var("smoke_rev"),
   Var("dart_root") + "/third_party/pkg/source_maps":
-      (Var("dart_github") % "source_maps") + Var("source_maps_rev"),
+      (Var("github_mirror") % "source_maps") + Var("source_maps_rev"),
   Var("dart_root") + "/third_party/pkg/source_span":
-      (Var("dart_github") % "source_span") + Var("source_span_rev"),
+      (Var("github_mirror") % "source_span") + Var("source_span_rev"),
   Var("dart_root") + "/third_party/pkg/stack_trace":
-      (Var("dart_github") % "stack_trace") + Var("stack_trace_tag"),
+      (Var("github_mirror") % "stack_trace") + Var("stack_trace_tag"),
   Var("dart_root") + "/third_party/pkg/string_scanner":
-      (Var("dart_github") % "string_scanner") +
+      (Var("github_mirror") % "string_scanner") +
       Var("string_scanner_rev"),
   Var("dart_root") + "/third_party/sunflower":
-      (Var("dart_github") % "sample-sunflower") +
+      (Var("github_mirror") % "sample-sunflower") +
       Var("sunflower_rev"),
   Var("dart_root") + "/third_party/pkg/test":
-      (Var("dart_github") % "test") + Var("test_tag"),
+      (Var("github_mirror") % "test") + Var("test_tag"),
   Var("dart_root") + "/third_party/pkg/test_reflective_loader":
-      (Var("dart_github") % "test_reflective_loader") + 
+      (Var("github_mirror") % "test_reflective_loader") +
       Var("test_reflective_loader_tag"),
   Var("dart_root") + "/third_party/pkg/unittest":
-      (Var("dart_github") % "test") + Var("unittest_tag"),
+      (Var("github_mirror") % "test") + Var("unittest_tag"),
   Var("dart_root") + "/third_party/pkg/usage":
-      (Var("dart_github") % "usage") + Var("usage_rev"),
+      (Var("github_mirror") % "usage") + Var("usage_rev"),
   Var("dart_root") + "/third_party/pkg/utf":
-      (Var("dart_github") % "utf") + Var("utf_rev"),
+      (Var("github_mirror") % "utf") + Var("utf_rev"),
   Var("dart_root") + "/third_party/pkg/watcher":
-      (Var("dart_github") % "watcher") + Var("watcher_tag"),
+      (Var("github_mirror") % "watcher") + Var("watcher_tag"),
   Var("dart_root") + "/third_party/pkg/web_components":
-      (Var("dart_github") % "web-components") +
+      (Var("github_mirror") % "web-components") +
       Var("web_components_rev"),
   Var("dart_root") + "/third_party/pkg/when":
-      "https://github.com/dart-lang/when.git" + Var("when_tag"),    
+      "https://github.com/dart-lang/when.git" + Var("when_tag"),
   Var("dart_root") + "/third_party/pkg/which":
-      "https://github.com/dart-lang/which.git"+ Var("which_tag"),    
+      "https://github.com/dart-lang/which.git"+ Var("which_tag"),
   Var("dart_root") + "/third_party/pkg/yaml":
-      (Var("dart_github") % "yaml") + Var("yaml_rev"),
+      (Var("github_mirror") % "yaml") + Var("yaml_rev"),
 
   # These specific versions of barback and source_maps are used for testing and
   # should be pulled from bleeding_edge even on channels.
diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html
index 2b31520..4353e57 100644
--- a/pkg/analysis_server/doc/api.html
+++ b/pkg/analysis_server/doc/api.html
@@ -43,7 +43,7 @@
 </style></head>
   <body>
     <h1>Analysis Server API Specification</h1>
-    <h1 style="color:#999999">Version 1.6.2</h1>
+    <h1 style="color:#999999">Version 1.7.0</h1>
     <p>
       This document contains a specification of the API provided by the
       analysis server.  The API in this document is currently under
@@ -1525,6 +1525,7 @@
     "<b>file</b>": <a href="#type_FilePath">FilePath</a>
     "<b>selectionOffset</b>": int
     "<b>selectionLength</b>": int
+    "<b>lineLength</b>": <span style="color:#999999">optional</span> int
   }
 }</pre><br><pre>response: {
   "id": String
@@ -1569,6 +1570,11 @@
             <p>
               The length of the current selection in the file.
             </p>
+          </dd><dt class="field"><b><i>lineLength ( <span style="color:#999999">optional</span> int )</i></b></dt><dd>
+            
+            <p>
+              The line length to be used by the formatter.
+            </p>
           </dd></dl><h4>Returns</h4><dl><dt class="field"><b><i>edits ( List&lt;<a href="#type_SourceEdit">SourceEdit</a>&gt; )</i></b></dt><dd>
             
             <p>
diff --git a/pkg/analysis_server/lib/analysis/index/index_core.dart b/pkg/analysis_server/lib/analysis/index/index_core.dart
index e712495..81d232d 100644
--- a/pkg/analysis_server/lib/analysis/index/index_core.dart
+++ b/pkg/analysis_server/lib/analysis/index/index_core.dart
@@ -5,19 +5,107 @@
 library analysis_server.analysis.index.index_core;
 
 import 'dart:async';
+import 'dart:collection';
 
+import 'package:analysis_server/src/services/index/index.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/source.dart';
 
 /**
  * An object that can have a [Relationship] with various [Location]s in a code
- * base.
+ * base. The object is abstractly represented by a [kind] and an [offset] within
+ * a [source].
+ *
+ * Clients must ensure that two distinct objects in the same source cannot have
+ * the same kind and offset. Failure to do so will make it impossible for
+ * clients to identify the model element corresponding to the indexable object.
  *
  * Clients are expected to subtype this class when implementing plugins.
  */
 abstract class IndexableObject {
-  // TODO(brianwilkerson) Figure out the subset of the Element API that is used
-  // by the index.
+  /**
+   * Return the kind of this object.
+   */
+  IndexableObjectKind get kind;
+
+  /**
+   * Return the length of the indexable object within its source.
+   */
+  int get length;
+
+  /**
+   * Return the name of this element.
+   */
+  // TODO(brianwilkerson) Remove the need for this getter.
+  String get name;
+
+  /**
+   * Return the offset of the indexable object within its source.
+   */
+  int get offset;
+
+  /**
+   * Return the source containing the indexable object.
+   */
+  Source get source;
+}
+
+/**
+ * The kind associated with an [IndexableObject].
+ *
+ * Clients are expected to implement this class when implementing plugins.
+ */
+abstract class IndexableObjectKind {
+  /**
+   * The next available index for a newly created kind of indexable object.
+   */
+  static int _nextIndex = 0;
+
+  /**
+   * A table mapping indexes to object kinds.
+   */
+  static Map<int, IndexableObjectKind> _registry =
+      new HashMap<int, IndexableObjectKind>();
+
+  /**
+   * Return the next available index for a newly created kind of indexable
+   * object.
+   */
+  static int get nextIndex => _nextIndex++;
+
+  /**
+   * Return the unique index for this kind of indexable object. Implementations
+   * should invoke [nextIndex] to allocate an index that cannot be used by any
+   * other object kind.
+   */
+  int get index;
+
+  /**
+   * Return the indexable object of this kind that exists in the given
+   * [context], in the source with the given [filePath], and at the given
+   * [offset].
+   */
+  IndexableObject decode(AnalysisContext context, String filePath, int offset);
+
+  /**
+   * Return the object kind with the given [index].
+   */
+  static IndexableObjectKind getKind(int index) {
+    return _registry[index];
+  }
+
+  /**
+   * Register the given object [kind] so that it can be found by it's unique
+   * index. The index of the [kind] must not be changed after it is passed to
+   * this method.
+   */
+  static void register(IndexableObjectKind kind) {
+    int index = kind.index;
+    if (_registry.containsKey(index)) {
+      throw new ArgumentError('duplicate index for kind: $index');
+    }
+    _registry[index] = kind;
+  }
 }
 
 /**
@@ -181,5 +269,6 @@
    * has already been created, then it will be returned, otherwise a new
    * relationship will be created
    */
-  factory Relationship(String identifier) => null;
+  factory Relationship(String identifier) =>
+      RelationshipImpl.getRelationship(identifier);
 }
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 40a4458..9d8f6b3 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -23,6 +23,8 @@
 import 'package:analysis_server/src/source/optimizing_pub_package_map_provider.dart';
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/instrumentation/instrumentation.dart';
+import 'package:analyzer/src/context/cache.dart';
+import 'package:analyzer/src/context/context.dart' as newContext;
 import 'package:analyzer/src/generated/ast.dart';
 import 'package:analyzer/src/generated/element.dart';
 import 'package:analyzer/src/generated/engine.dart';
@@ -31,6 +33,8 @@
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/generated/source_io.dart';
 import 'package:analyzer/src/generated/utilities_general.dart';
+import 'package:analyzer/src/task/dart.dart';
+import 'package:analyzer/task/dart.dart';
 import 'package:plugin/plugin.dart';
 
 typedef void OptionUpdater(AnalysisOptionsImpl options);
@@ -68,7 +72,7 @@
    * The version of the analysis server. The value should be replaced
    * automatically during the build.
    */
-  static final String VERSION = '1.6.2';
+  static final String VERSION = '1.7.0';
 
   /**
    * The number of milliseconds to perform operations before inserting
@@ -1025,10 +1029,21 @@
   void test_flushResolvedUnit(String file) {
     if (AnalysisEngine.isDartFileName(file)) {
       ContextSourcePair contextSource = getContextSourcePair(file);
-      AnalysisContextImpl context = contextSource.context;
+      AnalysisContext context = contextSource.context;
       Source source = contextSource.source;
-      DartEntry dartEntry = context.getReadableSourceEntryOrNull(source);
-      dartEntry.flushAstStructures();
+      if (context is AnalysisContextImpl) {
+        DartEntry dartEntry = context.getReadableSourceEntryOrNull(source);
+        dartEntry.flushAstStructures();
+      } else if (context is newContext.AnalysisContextImpl) {
+        CacheEntry entry = context.getCacheEntry(source);
+        entry.setState(RESOLVED_UNIT1, CacheState.FLUSHED);
+        entry.setState(RESOLVED_UNIT2, CacheState.FLUSHED);
+        entry.setState(RESOLVED_UNIT3, CacheState.FLUSHED);
+        entry.setState(RESOLVED_UNIT4, CacheState.FLUSHED);
+        entry.setState(RESOLVED_UNIT5, CacheState.FLUSHED);
+        entry.setState(RESOLVED_UNIT6, CacheState.FLUSHED);
+        entry.setState(RESOLVED_UNIT, CacheState.FLUSHED);
+      }
     }
   }
 
diff --git a/pkg/analysis_server/lib/src/computer/computer_overrides.dart b/pkg/analysis_server/lib/src/computer/computer_overrides.dart
index ba7cb76..4c8cc8f 100644
--- a/pkg/analysis_server/lib/src/computer/computer_overrides.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_overrides.dart
@@ -29,10 +29,16 @@
         _currentClass = unitMember.element;
         for (ClassMember classMember in unitMember.members) {
           if (classMember is MethodDeclaration) {
+            if (classMember.isStatic) {
+              continue;
+            }
             SimpleIdentifier nameNode = classMember.name;
             _addOverride(nameNode.offset, nameNode.length, nameNode.name);
           }
           if (classMember is FieldDeclaration) {
+            if (classMember.isStatic) {
+              continue;
+            }
             List<VariableDeclaration> fields = classMember.fields.variables;
             for (VariableDeclaration field in fields) {
               SimpleIdentifier nameNode = field.name;
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart
index 8bb2432..ee26dd8 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -91,7 +91,7 @@
         isCompilationUnit: true,
         selectionStart: start,
         selectionLength: length);
-    DartFormatter formatter = new DartFormatter();
+    DartFormatter formatter = new DartFormatter(pageWidth: params.lineLength);
     SourceCode formattedResult;
     try {
       formattedResult = formatter.formatSource(code);
diff --git a/pkg/analysis_server/lib/src/generated_protocol.dart b/pkg/analysis_server/lib/src/generated_protocol.dart
index 57fcf60..9a7d1f2 100644
--- a/pkg/analysis_server/lib/src/generated_protocol.dart
+++ b/pkg/analysis_server/lib/src/generated_protocol.dart
@@ -4494,6 +4494,7 @@
  *   "file": FilePath
  *   "selectionOffset": int
  *   "selectionLength": int
+ *   "lineLength": optional int
  * }
  */
 class EditFormatParams implements HasToJson {
@@ -4503,6 +4504,8 @@
 
   int _selectionLength;
 
+  int _lineLength;
+
   /**
    * The file containing the code to be formatted.
    */
@@ -4542,10 +4545,23 @@
     this._selectionLength = value;
   }
 
-  EditFormatParams(String file, int selectionOffset, int selectionLength) {
+  /**
+   * The line length to be used by the formatter.
+   */
+  int get lineLength => _lineLength;
+
+  /**
+   * The line length to be used by the formatter.
+   */
+  void set lineLength(int value) {
+    this._lineLength = value;
+  }
+
+  EditFormatParams(String file, int selectionOffset, int selectionLength, {int lineLength}) {
     this.file = file;
     this.selectionOffset = selectionOffset;
     this.selectionLength = selectionLength;
+    this.lineLength = lineLength;
   }
 
   factory EditFormatParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
@@ -4571,7 +4587,11 @@
       } else {
         throw jsonDecoder.missingKey(jsonPath, "selectionLength");
       }
-      return new EditFormatParams(file, selectionOffset, selectionLength);
+      int lineLength;
+      if (json.containsKey("lineLength")) {
+        lineLength = jsonDecoder._decodeInt(jsonPath + ".lineLength", json["lineLength"]);
+      }
+      return new EditFormatParams(file, selectionOffset, selectionLength, lineLength: lineLength);
     } else {
       throw jsonDecoder.mismatch(jsonPath, "edit.format params");
     }
@@ -4587,6 +4607,9 @@
     result["file"] = file;
     result["selectionOffset"] = selectionOffset;
     result["selectionLength"] = selectionLength;
+    if (lineLength != null) {
+      result["lineLength"] = lineLength;
+    }
     return result;
   }
 
@@ -4602,7 +4625,8 @@
     if (other is EditFormatParams) {
       return file == other.file &&
           selectionOffset == other.selectionOffset &&
-          selectionLength == other.selectionLength;
+          selectionLength == other.selectionLength &&
+          lineLength == other.lineLength;
     }
     return false;
   }
@@ -4613,6 +4637,7 @@
     hash = _JenkinsSmiHash.combine(hash, file.hashCode);
     hash = _JenkinsSmiHash.combine(hash, selectionOffset.hashCode);
     hash = _JenkinsSmiHash.combine(hash, selectionLength.hashCode);
+    hash = _JenkinsSmiHash.combine(hash, lineLength.hashCode);
     return _JenkinsSmiHash.finish(hash);
   }
 }
diff --git a/pkg/analysis_server/lib/src/plugin/server_plugin.dart b/pkg/analysis_server/lib/src/plugin/server_plugin.dart
index 8bed905..be413c6 100644
--- a/pkg/analysis_server/lib/src/plugin/server_plugin.dart
+++ b/pkg/analysis_server/lib/src/plugin/server_plugin.dart
@@ -148,7 +148,7 @@
    * Return a list containing all of the index contributors that were
    * contributed.
    */
-  List<IndexContributor> get indexContributor =>
+  List<IndexContributor> get indexContributors =>
       indexContributorExtensionPoint.extensions;
 
   @override
diff --git a/pkg/analysis_server/lib/src/protocol_server.dart b/pkg/analysis_server/lib/src/protocol_server.dart
index 913e1f2..071b678 100644
--- a/pkg/analysis_server/lib/src/protocol_server.dart
+++ b/pkg/analysis_server/lib/src/protocol_server.dart
@@ -87,7 +87,12 @@
   String elementTypeParameters = _getTypeParametersString(element);
   String elementParameters = _getParametersString(element);
   String elementReturnType = _getReturnTypeString(element);
-  return new Element(newElementKind_fromEngine(element.kind), name, Element
+  ElementKind kind = newElementKind_fromEngine(element.kind);
+  // TODO(danrubel) this check should be in newElementKind_fromEngine
+  if (element is engine.ClassElement && element.isEnum) {
+    kind = ElementKind.ENUM;
+  }
+  return new Element(kind, name, Element
           .makeFlags(
               isPrivate: element.isPrivate,
               isDeprecated: element.isDeprecated,
@@ -106,6 +111,7 @@
  */
 ElementKind newElementKind_fromEngine(engine.ElementKind kind) {
   if (kind == engine.ElementKind.CLASS) {
+    // TODO(danrubel) check if element.isEnum and return ElementKind.ENUM
     return ElementKind.CLASS;
   }
   if (kind == engine.ElementKind.COMPILATION_UNIT) {
diff --git a/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart b/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart
index 9f31d75..ce253e9 100644
--- a/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart
@@ -150,6 +150,24 @@
   }
 
   @override
+  visitInstanceCreationExpression(InstanceCreationExpression node) {
+    if (entity == node.constructorName) {
+      // no keywords in 'new ^' expression
+    } else {
+      super.visitInstanceCreationExpression(node);
+    }
+  }
+
+  @override
+  visitMethodInvocation(MethodInvocation node) {
+    if (entity == node.methodName) {
+      // no keywords in '.' expression
+    } else {
+      super.visitMethodInvocation(node);
+    }
+  }
+
+  @override
   visitExpressionFunctionBody(ExpressionFunctionBody node) {
     if (entity == node.expression) {
       _addExpressionKeywords(node);
diff --git a/pkg/analysis_server/lib/src/services/completion/local_declaration_visitor.dart b/pkg/analysis_server/lib/src/services/completion/local_declaration_visitor.dart
index 9032b05..ac99637 100644
--- a/pkg/analysis_server/lib/src/services/completion/local_declaration_visitor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/local_declaration_visitor.dart
@@ -25,6 +25,8 @@
 
   void declaredClassTypeAlias(ClassTypeAlias declaration);
 
+  void declaredEnum(EnumDeclaration declaration) {}
+
   void declaredField(FieldDeclaration fieldDecl, VariableDeclaration varDecl);
 
   void declaredFunction(FunctionDeclaration declaration);
@@ -123,8 +125,7 @@
       if (declaration is ClassDeclaration) {
         declaredClass(declaration);
       } else if (declaration is EnumDeclaration) {
-        // TODO (danrubel) enum support
-//        declaredEnum(........)
+        declaredEnum(declaration);
       } else if (declaration is FunctionDeclaration) {
         declaredFunction(declaration);
       } else if (declaration is TopLevelVariableDeclaration) {
diff --git a/pkg/analysis_server/lib/src/services/completion/local_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/local_reference_contributor.dart
index 7701bb8..598a58a 100644
--- a/pkg/analysis_server/lib/src/services/completion/local_reference_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/local_reference_contributor.dart
@@ -93,50 +93,32 @@
   }
 
   @override
-  void declaredClassTypeAlias(ClassTypeAlias declaration) {
-    // TODO: implement declaredClassTypeAlias
-  }
+  void declaredClassTypeAlias(ClassTypeAlias declaration) {}
 
   @override
-  void declaredField(FieldDeclaration fieldDecl, VariableDeclaration varDecl) {
-    // TODO: implement declaredField
-  }
+  void declaredField(FieldDeclaration fieldDecl, VariableDeclaration varDecl) {}
 
   @override
-  void declaredFunction(FunctionDeclaration declaration) {
-    // TODO: implement declaredFunction
-  }
+  void declaredFunction(FunctionDeclaration declaration) {}
 
   @override
-  void declaredFunctionTypeAlias(FunctionTypeAlias declaration) {
-    // TODO: implement declaredFunctionTypeAlias
-  }
+  void declaredFunctionTypeAlias(FunctionTypeAlias declaration) {}
 
   @override
-  void declaredLabel(Label label, bool isCaseLabel) {
-    // TODO: implement declaredLabel
-  }
+  void declaredLabel(Label label, bool isCaseLabel) {}
 
   @override
-  void declaredLocalVar(SimpleIdentifier name, TypeName type) {
-    // TODO: implement declaredLocalVar
-  }
+  void declaredLocalVar(SimpleIdentifier name, TypeName type) {}
 
   @override
-  void declaredMethod(MethodDeclaration declaration) {
-    // TODO: implement declaredMethod
-  }
+  void declaredMethod(MethodDeclaration declaration) {}
 
   @override
-  void declaredParam(SimpleIdentifier name, TypeName type) {
-    // TODO: implement declaredParam
-  }
+  void declaredParam(SimpleIdentifier name, TypeName type) {}
 
   @override
   void declaredTopLevelVar(
-      VariableDeclarationList varList, VariableDeclaration varDecl) {
-    // TODO: implement declaredTopLevelVar
-  }
+      VariableDeclarationList varList, VariableDeclaration varDecl) {}
 
   /**
    * For the given class and constructor,
@@ -405,6 +387,22 @@
   }
 
   @override
+  void declaredEnum(EnumDeclaration declaration) {
+    SimpleIdentifier enumId = declaration.name;
+    if (enumId != null) {
+      bool deprecated = isDeprecated(declaration);
+      if (optype.includeTypeNameSuggestions) {
+        CompletionSuggestion suggestion = _addSuggestion(
+            enumId, NO_RETURN_TYPE, deprecated, DART_RELEVANCE_DEFAULT);
+        if (suggestion != null) {
+          suggestion.element = createElement(protocol.ElementKind.ENUM, enumId,
+              returnType: NO_RETURN_TYPE, isDeprecated: deprecated);
+        }
+      }
+    }
+  }
+
+  @override
   void declaredField(FieldDeclaration fieldDecl, VariableDeclaration varDecl) {
     if (optype.includeReturnValueSuggestions) {
       CompletionSuggestion suggestion =
diff --git a/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart
index 07ee074..157a9e0 100644
--- a/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart
@@ -227,7 +227,8 @@
       }
     }
     if (element.isSynthetic) {
-      if (element is PropertyAccessorElement || element is FieldElement) {
+      if ((element is PropertyAccessorElement) ||
+          element is FieldElement && !_isSpecialEnumField(element)) {
         return;
       }
     }
@@ -241,6 +242,20 @@
       request.addSuggestion(suggestion);
     }
   }
+
+  /**
+   * Determine if the given element is one of the synthetic enum accessors
+   * for which we should generate a suggestion.
+   */
+  bool _isSpecialEnumField(FieldElement element) {
+    Element parent = element.enclosingElement;
+    if (parent is ClassElement && parent.isEnum) {
+      if (element.name == 'values') {
+        return true;
+      }
+    }
+    return false;
+  }
 }
 
 /**
diff --git a/pkg/analysis_server/lib/src/services/correction/fix.dart b/pkg/analysis_server/lib/src/services/correction/fix.dart
index d4caf3a..46ae81f 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix.dart
@@ -43,6 +43,11 @@
       const FixKind('ADD_ASYNC', 50, "Add 'async' modifier");
   static const ADD_FIELD_FORMAL_PARAMETERS = const FixKind(
       'ADD_FIELD_FORMAL_PARAMETERS', 30, "Add final field formal parameters");
+  static const ADD_MISSING_PARAMETER_POSITIONAL = const FixKind(
+      'ADD_MISSING_PARAMETER_POSITIONAL', 31,
+      "Add optional positional parameter");
+  static const ADD_MISSING_PARAMETER_REQUIRED = const FixKind(
+      'ADD_MISSING_PARAMETER_REQUIRED', 30, "Add required parameter");
   static const ADD_PACKAGE_DEPENDENCY = const FixKind(
       'ADD_PACKAGE_DEPENDENCY', 50, "Add dependency on package '{0}'");
   static const ADD_PART_OF =
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 bd00f6c..9dc36d0 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -202,6 +202,7 @@
     }
     if (errorCode == StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS) {
       _addFix_createConstructor_insteadOfSyntheticDefault();
+      _addFix_addMissingParameter();
     }
     if (errorCode == StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR) {
       _addFix_createConstructor_named();
@@ -347,6 +348,67 @@
     return false;
   }
 
+  void _addFix_addMissingParameter() {
+    if (node is SimpleIdentifier && node.parent is MethodInvocation) {
+      MethodInvocation invocation = node.parent;
+      SimpleIdentifier methodName = invocation.methodName;
+      ArgumentList argumentList = invocation.argumentList;
+      if (methodName == node && argumentList != null) {
+        Element targetElement = methodName.bestElement;
+        List<Expression> arguments = argumentList.arguments;
+        if (targetElement is ExecutableElement) {
+          List<ParameterElement> parameters = targetElement.parameters;
+          int numParameters = parameters.length;
+          Expression argument = arguments[numParameters];
+          // prepare target
+          int targetOffset;
+          if (numParameters != 0) {
+            ParameterElement parameterElement = parameters.last;
+            AstNode parameterNode = parameterElement.computeNode();
+            targetOffset = parameterNode.end;
+          } else {
+            AstNode targetNode = targetElement.computeNode();
+            if (targetNode is FunctionDeclaration) {
+              FunctionExpression function = targetNode.functionExpression;
+              targetOffset = function.parameters.leftParenthesis.end;
+            } else if (targetNode is MethodDeclaration) {
+              targetOffset = targetNode.parameters.leftParenthesis.end;
+            } else {
+              return;
+            }
+          }
+          String targetFile = targetElement.source.fullName;
+          // required
+          {
+            SourceBuilder sb = new SourceBuilder(targetFile, targetOffset);
+            // append source
+            if (numParameters != 0) {
+              sb.append(', ');
+            }
+            _appendParameterForArgument(sb, numParameters, argument);
+            // add proposal
+            _insertBuilder(sb, targetElement);
+            _addFix(DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, []);
+          }
+          // optional positional
+          {
+            SourceBuilder sb = new SourceBuilder(targetFile, targetOffset);
+            // append source
+            if (numParameters != 0) {
+              sb.append(', ');
+            }
+            sb.append('[');
+            _appendParameterForArgument(sb, numParameters, argument);
+            sb.append(']');
+            // add proposal
+            _insertBuilder(sb, targetElement);
+            _addFix(DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL, []);
+          }
+        }
+      }
+    }
+  }
+
   void _addFix_addPartOfDirective() {
     if (node is SimpleStringLiteral && node.parent is PartDirective) {
       PartDirective directive = node.parent;
@@ -372,39 +434,79 @@
   }
 
   void _addFix_createClass() {
-    if (!_mayBeTypeIdentifier(node)) {
+    Element prefixElement = null;
+    String name = null;
+    if (node is SimpleIdentifier) {
+      AstNode parent = node.parent;
+      if (parent is PrefixedIdentifier) {
+        PrefixedIdentifier prefixedIdentifier = parent;
+        prefixElement = prefixedIdentifier.prefix.staticElement;
+        parent = prefixedIdentifier.parent;
+        name = prefixedIdentifier.identifier.name;
+      } else {
+        name = (node as SimpleIdentifier).name;
+      }
+      if (parent is! TypeName) {
+        return;
+      }
+    } else {
       return;
     }
-    String name = (node as SimpleIdentifier).name;
     // prepare environment
-    CompilationUnitMember enclosingMember =
-        node.getAncestor((node) => node.parent is CompilationUnit);
-    if (enclosingMember == null) {
-      return;
-    }
-    int offset = enclosingMember.end;
+    Element targetUnit;
+    SourceBuilder sb;
     String prefix = '';
+    String suffix = '';
+    if (prefixElement == null) {
+      targetUnit = unitElement;
+      CompilationUnitMember enclosingMember =
+          node.getAncestor((node) => node.parent is CompilationUnit);
+      if (enclosingMember == null) {
+        return;
+      }
+      int offset = enclosingMember.end;
+      sb = new SourceBuilder(file, offset);
+      prefix = '$eol$eol';
+    } else {
+      for (ImportElement import in unitLibraryElement.imports) {
+        if (prefixElement is PrefixElement && import.prefix == prefixElement) {
+          targetUnit = import.importedLibrary.definingCompilationUnit;
+          Source targetSource = targetUnit.source;
+          int offset = targetSource.contents.data.length;
+          sb = new SourceBuilder(targetSource.fullName, offset);
+          prefix = '$eol';
+          suffix = '$eol';
+          break;
+        }
+      }
+      if (sb == null) {
+        return;
+      }
+    }
     // prepare source
-    SourceBuilder sb = new SourceBuilder(file, offset);
     {
-      sb.append('$eol$eol');
       sb.append(prefix);
       // "class"
       sb.append('class ');
       // append name
-      {
+      if (prefixElement == null) {
         sb.startPosition('NAME');
         sb.append(name);
         sb.endPosition();
+      } else {
+        sb.append(name);
       }
       // no members
       sb.append(' {');
       sb.append(eol);
       sb.append('}');
+      sb.append(suffix);
     }
     // insert source
-    _insertBuilder(sb, unitElement);
-    _addLinkedPosition('NAME', sb, rf.rangeNode(node));
+    _insertBuilder(sb, targetUnit);
+    if (prefixElement == null) {
+      _addLinkedPosition('NAME', sb, rf.rangeNode(node));
+    }
     // add proposal
     _addFix(DartFixKind.CREATE_CLASS, [name]);
   }
@@ -1022,7 +1124,10 @@
       }
       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);
     // EOL management
@@ -1791,7 +1896,6 @@
       SourceBuilder sb, ArgumentList argumentList) {
     // append parameters
     sb.append('(');
-    Set<String> excluded = new Set();
     List<Expression> arguments = argumentList.arguments;
     for (int i = 0; i < arguments.length; i++) {
       Expression argument = arguments[i];
@@ -1799,27 +1903,8 @@
       if (i != 0) {
         sb.append(', ');
       }
-      // append type name
-      DartType type = argument.bestType;
-      String typeSource = utils.getTypeSource(type, librariesToImport);
-      if (typeSource != 'dynamic') {
-        sb.startPosition('TYPE$i');
-        sb.append(typeSource);
-        _addSuperTypeProposals(sb, new Set(), type);
-        sb.endPosition();
-        sb.append(' ');
-      }
-      // append parameter name
-      {
-        List<String> suggestions =
-            _getArgumentNameSuggestions(excluded, type, argument, i);
-        String favorite = suggestions[0];
-        excluded.add(favorite);
-        sb.startPosition('ARG$i');
-        sb.append(favorite);
-        sb.addSuggestions(LinkedEditSuggestionKind.PARAMETER, suggestions);
-        sb.endPosition();
-      }
+      // append parameter
+      _appendParameterForArgument(sb, i, argument);
     }
   }
 
@@ -2087,6 +2172,32 @@
     _addEdit(target, edit);
   }
 
+  void _appendParameterForArgument(
+      SourceBuilder sb, int index, Expression argument) {
+    // append type name
+    DartType type = argument.bestType;
+    String typeSource = utils.getTypeSource(type, librariesToImport);
+    if (typeSource != 'dynamic') {
+      sb.startPosition('TYPE$index');
+      sb.append(typeSource);
+      _addSuperTypeProposals(sb, new Set(), type);
+      sb.endPosition();
+      sb.append(' ');
+    }
+    // append parameter name
+    {
+      Set<String> excluded = new Set<String>();
+      List<String> suggestions =
+          _getArgumentNameSuggestions(excluded, type, argument, index);
+      String favorite = suggestions[0];
+      excluded.add(favorite);
+      sb.startPosition('ARG$index');
+      sb.append(favorite);
+      sb.addSuggestions(LinkedEditSuggestionKind.PARAMETER, suggestions);
+      sb.endPosition();
+    }
+  }
+
   void _appendParameters(SourceBuilder sb, List<ParameterElement> parameters) {
     sb.append('(');
     bool firstParameter = true;
diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart
index 9a2a812..c4082fa 100644
--- a/pkg/analysis_server/lib/src/services/correction/util.dart
+++ b/pkg/analysis_server/lib/src/services/correction/util.dart
@@ -1030,6 +1030,10 @@
    */
   String getTypeSource(DartType type, Set<LibraryElement> librariesToImport) {
     StringBuffer sb = new StringBuffer();
+    // type parameter
+    if (!_isTypeVisible(type)) {
+      return 'dynamic';
+    }
     // just a Function, not FunctionTypeAliasElement
     if (type is FunctionType && type.element is! FunctionTypeAliasElement) {
       return "Function";
diff --git a/pkg/analysis_server/lib/src/services/index/index.dart b/pkg/analysis_server/lib/src/services/index/index.dart
index 00bfeab..374ccaf 100644
--- a/pkg/analysis_server/lib/src/services/index/index.dart
+++ b/pkg/analysis_server/lib/src/services/index/index.dart
@@ -6,6 +6,8 @@
 
 import 'dart:async';
 
+import 'package:analysis_server/analysis/index/index_core.dart';
+import 'package:analysis_server/src/services/index/indexable_element.dart';
 import 'package:analyzer/src/generated/ast.dart';
 import 'package:analyzer/src/generated/element.dart';
 import 'package:analyzer/src/generated/engine.dart';
@@ -19,41 +21,25 @@
 
 /**
  * The interface [Index] defines the behavior of objects that maintain an index
- * storing relations between [Element]s.
+ * storing relations between indexable objects.
  *
  * Any modification operations are executed before any read operation.
  * There is no guarantee about the order in which the [Future]s for read
  * operations will complete.
  */
-abstract class Index {
+abstract class Index implements IndexStore {
+  /**
+   * Set the index contributors used by this index to the given list of
+   * [contributors].
+   */
+  void set contributors(List<IndexContributor> contributors);
+
   /**
    * Answers index statistics.
    */
   String get statistics;
 
   /**
-   * Removes from the index all the information.
-   */
-  void clear();
-
-  /**
-   * Asynchronously returns a list containing all of the locations of the
-   * elements that have the given [relationship] with the given [element].
-   *
-   * For example, if the element represents a function and the relationship is
-   * the `is-invoked-by` relationship, then the locations will be all of the
-   * places where the function is invoked.
-   *
-   * [element] - the element that has the relationship with the locations to be
-   * returned.
-   *
-   * [relationship] - the relationship between the given element and the
-   * locations to be returned.
-   */
-  Future<List<LocationImpl>> getRelationships(
-      Element element, RelationshipImpl relationship);
-
-  /**
    * Returns top-level [Element]s whose names satisfy to [nameFilter].
    */
   List<Element> getTopLevelDeclarations(ElementNameFilter nameFilter);
@@ -75,41 +61,6 @@
   void indexUnit(AnalysisContext context, CompilationUnit unit);
 
   /**
-   * Removes from the index all of the information associated with [context].
-   *
-   * This method should be invoked when [context] is disposed.
-   */
-  void removeContext(AnalysisContext context);
-
-  /**
-   * Removes from the index all of the information associated with elements or
-   * locations in [source]. This includes relationships between an element in
-   * [source] and any other locations, relationships between any other elements
-   * and a location within [source].
-   *
-   * This method should be invoked when [source] is no longer part of the code
-   * base.
-   *
-   * [context] - the [AnalysisContext] in which [source] being removed
-   * [source] - the [Source] being removed
-   */
-  void removeSource(AnalysisContext context, Source source);
-
-  /**
-   * Removes from the index all of the information associated with elements or
-   * locations in the given sources. This includes relationships between an
-   * element in the given sources and any other locations, relationships between
-   * any other elements and a location within the given sources.
-   *
-   * This method should be invoked when multiple sources are no longer part of
-   * the code base.
-   *
-   * [context] - the [AnalysisContext] in which [Source]s being removed.
-   * [container] - the [SourceContainer] holding the sources being removed.
-   */
-  void removeSources(AnalysisContext context, SourceContainer container);
-
-  /**
    * Starts the index.
    * Should be called before any other method.
    */
@@ -123,6 +74,70 @@
 }
 
 /**
+ * An [Element] which is used to index references to the name without specifying
+ * a concrete kind of this name - field, method or something else.
+ */
+class IndexableName implements IndexableObject {
+  // TODO(brianwilkerson) Replace NameElement with this class. This will require
+  // generalizing the search engine to use IndexableObject rather than Element.
+  /**
+   * The name to be indexed.
+   */
+  final String name;
+
+  /**
+   * Initialize a newly created indexable name to represent the given [name].
+   */
+  IndexableName(this.name);
+
+  @override
+  IndexableObjectKind get kind => IndexableNameKind.INSTANCE;
+
+  @override
+  int get length => 0;
+
+  @override
+  int get offset {
+    return -1;
+  }
+
+  @override
+  Source get source => null;
+
+  @override
+  String toString() => name;
+}
+
+/**
+ * The kind of an indexable name.
+ */
+class IndexableNameKind implements IndexableObjectKind {
+  /**
+   * The unique instance of this class.
+   */
+  static final IndexableNameKind INSTANCE =
+      new IndexableNameKind._(IndexableObjectKind.nextIndex);
+
+  /**
+   * The index uniquely identifying this kind.
+   */
+  final int index;
+
+  /**
+   * Initialize a newly created kind to have the given [index].
+   */
+  IndexableNameKind._(this.index) {
+    IndexableObjectKind.register(this);
+  }
+
+  @override
+  IndexableObject decode(AnalysisContext context, String filePath, int offset) {
+    throw new UnsupportedError(
+        'Indexable names cannot be decoded through their kind');
+  }
+}
+
+/**
  * Constants used when populating and accessing the index.
  */
 class IndexConstants {
@@ -217,7 +232,7 @@
  * to the resource containing the element rather than the start of the element
  * within that resource.
  */
-class LocationImpl {
+class LocationImpl implements Location {
   static const int _FLAG_QUALIFIED = 1 << 0;
   static const int _FLAG_RESOLVED = 1 << 1;
 
@@ -227,9 +242,9 @@
   static const List<LocationImpl> EMPTY_LIST = const <LocationImpl>[];
 
   /**
-   * The element containing this location.
+   * The indexable object containing this location.
    */
-  final Element element;
+  final IndexableObject indexable;
 
   /**
    * The offset of this location within the resource containing the element.
@@ -247,17 +262,13 @@
   int _flags;
 
   /**
-   * Initializes a newly created location to be relative to the given element at
-   * the given [offset] with the given [length].
-   *
-   * [element] - the [Element] containing this location.
-   * [offset] - the offset within the resource containing [element].
-   * [length] - the length of this location
+   * Initializes a newly created location to be relative to the given
+   * [indexable] object at the given [offset] with the given [length].
    */
-  LocationImpl(this.element, this.offset, this.length,
+  LocationImpl(this.indexable, this.offset, this.length,
       {bool isQualified: false, bool isResolved: true}) {
-    if (element == null) {
-      throw new ArgumentError("element location cannot be null");
+    if (indexable == null) {
+      throw new ArgumentError("indexable object cannot be null");
     }
     _flags = 0;
     if (isQualified) {
@@ -269,13 +280,20 @@
   }
 
   /**
-   * Returns `true` if this location is a qualified reference.
+   * The element containing this location.
    */
+  @deprecated
+  Element get element {
+    if (indexable is IndexableElement) {
+      return (indexable as IndexableElement).element;
+    }
+    return null;
+  }
+
+  @override
   bool get isQualified => (_flags & _FLAG_QUALIFIED) != 0;
 
-  /**
-   * Returns `true` if this location is a resolved reference.
-   */
+  @override
   bool get isResolved => (_flags & _FLAG_RESOLVED) != 0;
 
   @override
@@ -287,7 +305,7 @@
     if (isResolved) {
       flagsStr += ' resolved';
     }
-    return '[${offset} - ${(offset + length)}) $flagsStr in ${element}';
+    return '[${offset} - ${(offset + length)}) $flagsStr in ${indexable}';
   }
 }
 
@@ -298,7 +316,7 @@
   final D data;
 
   LocationWithData(LocationImpl location, this.data)
-      : super(location.element, location.offset, location.length);
+      : super(location.indexable, location.offset, location.length);
 }
 
 /**
@@ -319,7 +337,7 @@
  * Relationship between an element and a location. Relationships are identified
  * by a globally unique identifier.
  */
-class RelationshipImpl {
+class RelationshipImpl implements Relationship {
   /**
    * A table mapping relationship identifiers to relationships.
    */
diff --git a/pkg/analysis_server/lib/src/services/index/index_contributor.dart b/pkg/analysis_server/lib/src/services/index/index_contributor.dart
index b5bef6b..0143375 100644
--- a/pkg/analysis_server/lib/src/services/index/index_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/index/index_contributor.dart
@@ -6,9 +6,12 @@
 
 import 'dart:collection' show Queue;
 
+import 'package:analysis_server/analysis/index/index_core.dart';
+import 'package:analysis_server/analysis/index/index_dart.dart';
 import 'package:analysis_server/src/services/correction/namespace.dart';
 import 'package:analysis_server/src/services/index/index.dart';
 import 'package:analysis_server/src/services/index/index_store.dart';
+import 'package:analysis_server/src/services/index/indexable_element.dart';
 import 'package:analyzer/src/generated/ast.dart';
 import 'package:analyzer/src/generated/element.dart';
 import 'package:analyzer/src/generated/engine.dart';
@@ -65,6 +68,19 @@
 }
 
 /**
+ * An [IndexContributor] that can be used to contribute relationships for Dart
+ * files.
+ */
+class DefaultDartIndexContributor extends DartIndexContributor {
+  @override
+  void internalContributeTo(IndexStore store, CompilationUnit unit) {
+    _IndexContributor contributor =
+        new _IndexContributor(store as InternalIndexStore);
+    unit.accept(contributor);
+  }
+}
+
+/**
  * Visits a resolved AST and adds relationships into [InternalIndexStore].
  */
 class _IndexContributor extends GeneralizingAstVisitor {
@@ -90,12 +106,13 @@
   }
 
   /**
-   * @return the inner-most enclosing [Element], may be `null`.
+   * Return the inner-most enclosing [Element], wrapped as an indexable object,
+   * or `null` if there is no enclosing element.
    */
-  Element peekElement() {
+  IndexableElement peekElement() {
     for (Element element in _elementStack) {
       if (element != null) {
-        return element;
+        return new IndexableElement(element);
       }
     }
     return null;
@@ -108,7 +125,8 @@
   void recordRelationship(
       Element element, RelationshipImpl relationship, LocationImpl location) {
     if (element != null && location != null) {
-      _store.recordRelationship(element, relationship, location);
+      _store.recordRelationship(
+          new IndexableElement(element), relationship, location);
     }
   }
 
@@ -231,8 +249,7 @@
     if (fieldName != null) {
       Element element = fieldName.staticElement;
       LocationImpl location = _createLocationForNode(fieldName);
-      _store.recordRelationship(
-          element, IndexConstants.IS_WRITTEN_BY, location);
+      recordRelationship(element, IndexConstants.IS_WRITTEN_BY, location);
     }
     // index expression
     if (expression != null) {
@@ -374,9 +391,8 @@
     }
     // name invocation
     {
-      Element nameElement = new NameElement(name.name);
-      _store.recordRelationship(
-          nameElement, IndexConstants.IS_INVOKED_BY, location);
+      recordRelationship(
+          new NameElement(name.name), IndexConstants.IS_INVOKED_BY, location);
     }
     _recordImportElementReferenceWithoutPrefix(name);
     super.visitMethodInvocation(node);
@@ -426,8 +442,11 @@
 
   @override
   visitSimpleIdentifier(SimpleIdentifier node) {
-    Element nameElement = new NameElement(node.name);
+    NameElement nameElement = new NameElement(node.name);
     LocationImpl location = _createLocationForNode(node);
+    if (location == null) {
+      return;
+    }
     // name in declaration
     if (node.inDeclarationContext()) {
       recordRelationship(
@@ -446,22 +465,20 @@
       bool inGetterContext = node.inGetterContext();
       bool inSetterContext = node.inSetterContext();
       if (inGetterContext && inSetterContext) {
-        _store.recordRelationship(
+        recordRelationship(
             nameElement, IndexConstants.IS_READ_WRITTEN_BY, location);
       } else if (inGetterContext) {
-        _store.recordRelationship(
-            nameElement, IndexConstants.IS_READ_BY, location);
+        recordRelationship(nameElement, IndexConstants.IS_READ_BY, location);
       } else if (inSetterContext) {
-        _store.recordRelationship(
-            nameElement, IndexConstants.IS_WRITTEN_BY, location);
+        recordRelationship(nameElement, IndexConstants.IS_WRITTEN_BY, location);
       }
     }
     // this.field parameter
     if (element is FieldFormalParameterElement) {
-      RelationshipImpl relationship = peekElement() == element
+      RelationshipImpl relationship = peekElement().element == element
           ? IndexConstants.IS_WRITTEN_BY
           : IndexConstants.IS_REFERENCED_BY;
-      _store.recordRelationship(element.field, relationship, location);
+      recordRelationship(element.field, relationship, location);
       return;
     }
     // record specific relations
@@ -585,8 +602,8 @@
     if (node is SimpleIdentifier) {
       isResolved = node.bestElement != null;
     }
-    Element element = peekElement();
-    return new LocationImpl(element, node.offset, node.length,
+    IndexableObject indexable = peekElement();
+    return new LocationImpl(indexable, node.offset, node.length,
         isQualified: isQualified, isResolved: isResolved);
   }
 
@@ -598,7 +615,7 @@
    * inner-most [Element].
    */
   LocationImpl _createLocationForOffset(int offset, int length) {
-    Element element = peekElement();
+    IndexableObject element = peekElement();
     return new LocationImpl(element, offset, length);
   }
 
@@ -606,7 +623,7 @@
    * @return the [LocationImpl] representing location of the [Token].
    */
   LocationImpl _createLocationForToken(Token token, bool isResolved) {
-    Element element = peekElement();
+    IndexableObject element = peekElement();
     return new LocationImpl(element, token.offset, token.length,
         isQualified: true, isResolved: isResolved);
   }
@@ -744,21 +761,14 @@
    * Records the [Element] definition in the library and universe.
    */
   void _recordTopLevelElementDefinition(Element element) {
-    LocationImpl location = createLocation(element);
-    recordRelationship(_libraryElement, IndexConstants.DEFINES, location);
-    _store.recordTopLevelDeclaration(element);
-  }
-
-  /**
-   * Creates a [LocationImpl] representing declaration of the [Element].
-   */
-  static LocationImpl createLocation(Element element) {
     if (element != null) {
-      int offset = element.nameOffset;
-      int length = element.displayName.length;
-      return new LocationImpl(element, offset, length);
+      IndexableElement indexable = new IndexableElement(element);
+      int offset = indexable.offset;
+      int length = indexable.length;
+      LocationImpl location = new LocationImpl(indexable, offset, length);
+      recordRelationship(_libraryElement, IndexConstants.DEFINES, location);
+      _store.recordTopLevelDeclaration(element);
     }
-    return null;
   }
 
   /**
diff --git a/pkg/analysis_server/lib/src/services/index/index_store.dart b/pkg/analysis_server/lib/src/services/index/index_store.dart
index 8dd931a..1d61e7a 100644
--- a/pkg/analysis_server/lib/src/services/index/index_store.dart
+++ b/pkg/analysis_server/lib/src/services/index/index_store.dart
@@ -4,18 +4,16 @@
 
 library services.index_store;
 
-import 'dart:async';
-
+import 'package:analysis_server/analysis/index/index_core.dart';
 import 'package:analysis_server/src/services/index/index.dart';
 import 'package:analyzer/src/generated/element.dart';
 import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/source.dart';
 
 /**
  * A container with information computed by an index - relations between
  * elements.
  */
-abstract class InternalIndexStore {
+abstract class InternalIndexStore extends IndexStore {
   /**
    * Answers index statistics.
    */
@@ -53,11 +51,6 @@
   bool aboutToIndexHtml(AnalysisContext context, HtmlElement htmlElement);
 
   /**
-   * Removes all of the information.
-   */
-  void clear();
-
-  /**
    * Notifies that index store that the current Dart or HTML unit indexing is
    * done.
    *
@@ -67,91 +60,12 @@
   void doneIndex();
 
   /**
-   * Returns a [Future] that completes with locations of the elements that have
-   * the given [relationship] with the given [element].
-   *
-   * For example, if the [element] represents a function and the relationship is
-   * the `is-invoked-by` relationship, then the returned locations will be all
-   * of the places where the function is invoked.
-   *
-   * [element] - the the [Element] that has the relationship with the locations
-   *    to be returned.
-   * [relationship] - the [RelationshipImpl] between the given element and the
-   *    locations to be returned
-   */
-  Future<List<LocationImpl>> getRelationships(
-      Element element, RelationshipImpl relationship);
-
-  /**
    * Returns top-level [Element]s whose names satisfy to [nameFilter].
    */
   List<Element> getTopLevelDeclarations(ElementNameFilter nameFilter);
 
   /**
-   * Records that the given [element] and [location] have the given
-   * [relationship].
-   *
-   * For example, if the [relationship] is the `is-invoked-by` relationship,
-   * then [element] would be the function being invoked and [location] would be
-   * the point at which it is referenced. Each element can have the same
-   * relationship with multiple locations. In other words, if the following code
-   * were executed
-   *
-   *     recordRelationship(element, isReferencedBy, location1);
-   *     recordRelationship(element, isReferencedBy, location2);
-   *
-   * then both relationships would be maintained in the index and the result of executing
-   *
-   *     getRelationship(element, isReferencedBy);
-   *
-   * would be a list containing both `location1` and `location2`.
-   *
-   * [element] - the [Element] that is related to the location.
-   * [relationship] - the [RelationshipImpl] between the element and the location.
-   * [location] the [LocationImpl] where relationship happens.
-   */
-  void recordRelationship(
-      Element element, RelationshipImpl relationship, LocationImpl location);
-
-  /**
    * Records the declaration of the given top-level [element].
    */
   void recordTopLevelDeclaration(Element element);
-
-  /**
-   * Removes from the index all of the information associated with [context].
-   *
-   * This method should be invoked when [context] is disposed.
-   *
-   * [context] - the [AnalysisContext] being removed.
-   */
-  void removeContext(AnalysisContext context);
-
-  /**
-   * Removes from the index all of the information associated with elements or
-   * locations in [source]. This includes relationships between an element in
-   * [source] and any other locations, relationships between any other elements
-   * and locations within [source].
-   *
-   * This method should be invoked when [source] is no longer part of the code
-   * base.
-   *
-   * [context] - the [AnalysisContext] in which [source] being removed.
-   * [source] - the [Source] being removed
-   */
-  void removeSource(AnalysisContext context, Source source);
-
-  /**
-   * Removes from the index all of the information associated with elements or
-   * locations in the given sources. This includes relationships between an
-   * element in the given sources and any other locations, relationships between
-   * any other elements and a location within the given sources.
-   *
-   * This method should be invoked when multiple sources are no longer part of
-   * the code base.
-   *
-   * [context] - the [AnalysisContext] in which [Source]s being removed.
-   * [container] - the [SourceContainer] holding the sources being removed.
-   */
-  void removeSources(AnalysisContext context, SourceContainer container);
 }
diff --git a/pkg/analysis_server/lib/src/services/index/indexable_element.dart b/pkg/analysis_server/lib/src/services/index/indexable_element.dart
new file mode 100644
index 0000000..c0a30e7
--- /dev/null
+++ b/pkg/analysis_server/lib/src/services/index/indexable_element.dart
@@ -0,0 +1,162 @@
+// 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 src.services.index;
+
+import 'dart:collection';
+
+import 'package:analysis_server/analysis/index/index_core.dart';
+import 'package:analyzer/src/generated/element.dart';
+import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/source.dart';
+
+/**
+ * A wrapper around an [Element] that implements the [IndexableObject] interface.
+ */
+class IndexableElement implements IndexableObject {
+  /**
+   * The element being wrapped.
+   */
+  final Element element;
+
+  /**
+   * Initialize a newly created wrapper to wrap the given [element].
+   */
+  IndexableElement(this.element) {
+    if (element == null) {
+      throw new ArgumentError.notNull('element');
+    }
+  }
+
+  @override
+  int get hashCode => element.hashCode;
+
+  @override
+  IndexableObjectKind get kind => IndexableElementKind.forElement(element);
+
+  @override
+  int get length => element.displayName.length;
+
+  @override
+  String get name => element.displayName;
+
+  @override
+  int get offset {
+    if (element is ConstructorElement) {
+      return element.enclosingElement.nameOffset;
+    }
+    return element.nameOffset;
+  }
+
+  @override
+  Source get source => element.source;
+
+  @override
+  bool operator ==(Object object) =>
+      object is IndexableElement && element == object.element;
+
+  @override
+  String toString() => element.toString();
+}
+
+/**
+ * The kind associated with an [IndexableElement].
+ */
+class IndexableElementKind implements IndexableObjectKind {
+  /**
+   * A table mapping element kinds to the corresponding indexable element kind.
+   */
+  static Map<ElementKind, IndexableElementKind> _kindMap =
+      new HashMap<ElementKind, IndexableElementKind>();
+
+  /**
+   * A table mapping the index of a constructor (in the lexically-ordered list
+   * of constructors associated with a class) to the indexable element kind used
+   * to represent it.
+   */
+  static Map<int, IndexableElementKind> _constructorKinds =
+      new HashMap<int, IndexableElementKind>();
+
+  @override
+  final int index = IndexableObjectKind.nextIndex;
+
+  /**
+   * The element kind represented by this index element kind.
+   */
+  final ElementKind elementKind;
+
+  /**
+   * Initialize a newly created kind to have the given [index] and be associated
+   * with the given [elementKind].
+   */
+  IndexableElementKind._(this.elementKind) {
+    IndexableObjectKind.register(this);
+  }
+
+  /**
+   * Return the index of the constructor with this indexable element kind.
+   */
+  int get constructorIndex {
+    for (int index in _constructorKinds.keys) {
+      if (_constructorKinds[index] == this) {
+        return index;
+      }
+    }
+    return -1;
+  }
+
+  @override
+  IndexableObject decode(AnalysisContext context, String filePath, int offset) {
+    List<Source> unitSources = context.getSourcesWithFullName(filePath);
+    for (Source unitSource in unitSources) {
+      List<Source> libSources = context.getLibrariesContaining(unitSource);
+      for (Source libSource in libSources) {
+        CompilationUnitElement unitElement =
+            context.getCompilationUnitElement(unitSource, libSource);
+        if (unitElement == null) {
+          return null;
+        }
+        if (elementKind == ElementKind.LIBRARY) {
+          return new IndexableElement(unitElement.library);
+        } else if (elementKind == ElementKind.COMPILATION_UNIT) {
+          return new IndexableElement(unitElement);
+        } else {
+          Element element = unitElement.getElementAt(offset);
+          if (element == null) {
+            return null;
+          }
+          if (element is ClassElement &&
+              elementKind == ElementKind.CONSTRUCTOR) {
+            return new IndexableElement(element.constructors[constructorIndex]);
+          }
+          if (element is PropertyInducingElement) {
+            if (elementKind == ElementKind.GETTER) {
+              return new IndexableElement(element.getter);
+            }
+            if (elementKind == ElementKind.SETTER) {
+              return new IndexableElement(element.setter);
+            }
+          }
+          return new IndexableElement(element);
+        }
+      }
+    }
+    return null;
+  }
+
+  /**
+   * Return the indexable element kind representing the given [element].
+   */
+  static IndexableElementKind forElement(Element element) {
+    if (element is ConstructorElement) {
+      ClassElement classElement = element.enclosingElement;
+      int constructorIndex = classElement.constructors.indexOf(element);
+      return _constructorKinds.putIfAbsent(constructorIndex,
+          () => new IndexableElementKind._(ElementKind.CONSTRUCTOR));
+    }
+    ElementKind elementKind = element.kind;
+    return _kindMap.putIfAbsent(
+        elementKind, () => new IndexableElementKind._(elementKind));
+  }
+}
diff --git a/pkg/analysis_server/lib/src/services/index/local_index.dart b/pkg/analysis_server/lib/src/services/index/local_index.dart
index a11db6d..887a003 100644
--- a/pkg/analysis_server/lib/src/services/index/local_index.dart
+++ b/pkg/analysis_server/lib/src/services/index/local_index.dart
@@ -6,9 +6,10 @@
 
 import 'dart:async';
 
+import 'package:analysis_server/analysis/index/index_core.dart';
 import 'package:analysis_server/src/services/index/index.dart';
 import 'package:analysis_server/src/services/index/index_contributor.dart'
-    as contributors;
+    as oldContributors;
 import 'package:analysis_server/src/services/index/store/split_store.dart';
 import 'package:analyzer/src/generated/ast.dart';
 import 'package:analyzer/src/generated/element.dart';
@@ -20,6 +21,11 @@
  * A local implementation of [Index].
  */
 class LocalIndex extends Index {
+  /**
+   * The index contributors used by this index.
+   */
+  List<IndexContributor> contributors;
+
   SplitIndexStore _store;
 
   LocalIndex(NodeManager nodeManager) {
@@ -52,8 +58,8 @@
    */
   @override
   Future<List<LocationImpl>> getRelationships(
-      Element element, RelationshipImpl relationship) {
-    return _store.getRelationships(element, relationship);
+      IndexableObject indexable, RelationshipImpl relationship) {
+    return _store.getRelationships(indexable, relationship);
   }
 
   @override
@@ -63,12 +69,18 @@
 
   @override
   void indexHtmlUnit(AnalysisContext context, HtmlUnit unit) {
-    contributors.indexHtmlUnit(_store, context, unit);
+    oldContributors.indexHtmlUnit(_store, context, unit);
   }
 
   @override
   void indexUnit(AnalysisContext context, CompilationUnit unit) {
-    contributors.indexDartUnit(_store, context, unit);
+    oldContributors.indexDartUnit(_store, context, unit);
+  }
+
+  @override
+  void recordRelationship(
+      IndexableObject indexable, Relationship relationship, Location location) {
+    _store.recordRelationship(indexable, relationship, location);
   }
 
   @override
diff --git a/pkg/analysis_server/lib/src/services/index/store/codec.dart b/pkg/analysis_server/lib/src/services/index/store/codec.dart
index 0c2f816..062eae6 100644
--- a/pkg/analysis_server/lib/src/services/index/store/codec.dart
+++ b/pkg/analysis_server/lib/src/services/index/store/codec.dart
@@ -6,7 +6,9 @@
 
 import 'dart:collection';
 
+import 'package:analysis_server/analysis/index/index_core.dart';
 import 'package:analysis_server/src/services/index/index.dart';
+import 'package:analysis_server/src/services/index/indexable_element.dart';
 import 'package:analyzer/src/generated/element.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/source.dart';
@@ -63,55 +65,28 @@
 }
 
 /**
- * A helper that encodes/decodes [Element]s to/from integers.
+ * A helper that encodes/decodes [IndexableObject]s to/from integers.
  */
 class ElementCodec {
-  static const int _CONSTRUCTOR_KIND_BASE = -100;
-
+  // TODO(brianwilkerson) Rename this class now that if encodes indexable
+  // objects rather than elements.
   final StringCodec _stringCodec;
 
   ElementCodec(this._stringCodec);
 
   /**
-   * Returns an [Element] that corresponds to the given identifiers.
+   * Returns an [IndexableObject] that corresponds to the given identifiers.
    */
-  Element decode(AnalysisContext context, int fileId, int offset, int kindId) {
+  IndexableObject decode(
+      AnalysisContext context, int fileId, int offset, int kindId) {
     String filePath = _stringCodec.decode(fileId);
-    List<Source> unitSources = context.getSourcesWithFullName(filePath);
-    for (Source unitSource in unitSources) {
-      List<Source> libSources = context.getLibrariesContaining(unitSource);
-      for (Source libSource in libSources) {
-        CompilationUnitElement unitElement =
-            context.getCompilationUnitElement(unitSource, libSource);
-        if (unitElement == null) {
-          return null;
-        }
-        if (kindId == ElementKind.LIBRARY.ordinal) {
-          return unitElement.library;
-        } else if (kindId == ElementKind.COMPILATION_UNIT.ordinal) {
-          return unitElement;
-        } else {
-          Element element = unitElement.getElementAt(offset);
-          if (element == null) {
-            return null;
-          }
-          if (element is ClassElement && kindId <= _CONSTRUCTOR_KIND_BASE) {
-            int constructorIndex = -1 * (kindId - _CONSTRUCTOR_KIND_BASE);
-            return element.constructors[constructorIndex];
-          }
-          if (element is PropertyInducingElement) {
-            if (kindId == ElementKind.GETTER.ordinal) {
-              return element.getter;
-            }
-            if (kindId == ElementKind.SETTER.ordinal) {
-              return element.setter;
-            }
-          }
-          return element;
-        }
-      }
+    IndexableObjectKind kind = IndexableObjectKind.getKind(kindId);
+    if (kind == null) {
+      return null;
+    } else if (kind is IndexableNameKind) {
+      return new IndexableElement(new NameElement(_stringCodec.decode(offset)));
     }
-    return null;
+    return kind.decode(context, filePath, offset);
   }
 
   /**
@@ -119,8 +94,8 @@
    * In the most cases it is an encoding of the [element]'s file path.
    * If the given [element] is not defined in a file, returns `-1`.
    */
-  int encode1(Element element) {
-    Source source = element.source;
+  int encode1(IndexableObject indexable) {
+    Source source = indexable.source;
     if (source == null) {
       return -1;
     }
@@ -132,44 +107,43 @@
    * Returns the second component of the [element] id.
    * In the most cases it is the [element]'s name offset.
    */
-  int encode2(Element element) {
-    if (element is NameElement) {
-      String name = element.name;
+  int encode2(IndexableObject indexable) {
+    if (indexable is IndexableName) {
+      String name = indexable.name;
       return _stringCodec.encode(name);
     }
-    if (element is ConstructorElement) {
-      return element.enclosingElement.nameOffset;
+    int offset = indexable.offset;
+    if (offset < 0) {
+      return _stringCodec.encode(indexable.name);
     }
-    return element.nameOffset;
+    return offset;
   }
 
   /**
    * Returns the third component of the [element] id.
    * In the most cases it is the [element]'s kind.
    */
-  int encode3(Element element) {
-    if (element is ConstructorElement) {
-      ClassElement classElement = element.enclosingElement;
-      int constructorIndex = classElement.constructors.indexOf(element);
-      return _CONSTRUCTOR_KIND_BASE - constructorIndex;
-    }
-    return element.kind.ordinal;
+  int encode3(IndexableObject indexable) {
+    return indexable.kind.index;
   }
 
   /**
    * Returns an integer that corresponds to the name of [element].
    */
-  int encodeHash(Element element) {
-    String elementName = element.displayName;
+  int encodeHash(IndexableObject indexable) {
+    // TODO(brianwilkerson) Consider moving this to IndexableObjectKind so that
+    // we don't have to break encapsulation.
+    String elementName = indexable.name; // was: indexable.displayName;
     int elementNameId = _stringCodec.encode(elementName);
-    LibraryElement libraryElement = element.library;
-    if (libraryElement != null) {
-      String libraryPath = libraryElement.source.fullName;
-      int libraryPathId = _stringCodec.encode(libraryPath);
-      return JenkinsSmiHash.combine(libraryPathId, elementNameId);
-    } else {
-      return elementNameId;
+    if (indexable is IndexableElement) {
+      LibraryElement libraryElement = indexable.element.library;
+      if (libraryElement != null) {
+        String libraryPath = libraryElement.source.fullName;
+        int libraryPathId = _stringCodec.encode(libraryPath);
+        return JenkinsSmiHash.combine(libraryPathId, elementNameId);
+      }
     }
+    return elementNameId;
   }
 }
 
diff --git a/pkg/analysis_server/lib/src/services/index/store/split_store.dart b/pkg/analysis_server/lib/src/services/index/store/split_store.dart
index 594e18d..1859a41 100644
--- a/pkg/analysis_server/lib/src/services/index/store/split_store.dart
+++ b/pkg/analysis_server/lib/src/services/index/store/split_store.dart
@@ -8,9 +8,11 @@
 import 'dart:collection';
 import 'dart:typed_data';
 
+import 'package:analysis_server/analysis/index/index_core.dart';
 import 'package:analysis_server/src/analysis_server.dart';
 import 'package:analysis_server/src/services/index/index.dart';
 import 'package:analysis_server/src/services/index/index_store.dart';
+import 'package:analysis_server/src/services/index/indexable_element.dart';
 import 'package:analysis_server/src/services/index/store/codec.dart';
 import 'package:analysis_server/src/services/index/store/collection.dart';
 import 'package:analyzer/src/generated/element.dart';
@@ -276,10 +278,10 @@
    *    locations to be returned
    */
   List<LocationImpl> getRelationships(
-      Element element, RelationshipImpl relationship) {
+      IndexableObject indexable, RelationshipImpl relationship) {
     // prepare key
     RelationKeyData key = new RelationKeyData.forObject(
-        _elementCodec, _relationshipCodec, element, relationship);
+        _elementCodec, _relationshipCodec, indexable, relationship);
     // find LocationData(s)
     List<LocationData> locationDatas = _relations[key];
     if (locationDatas == null) {
@@ -324,10 +326,10 @@
    * [relationship] - the [RelationshipImpl] between [element] and [location].
    * [location] - the [LocationImpl] where relationship happens.
    */
-  void recordRelationship(
-      Element element, RelationshipImpl relationship, LocationImpl location) {
+  void recordRelationship(IndexableObject indexable,
+      RelationshipImpl relationship, LocationImpl location) {
     RelationKeyData key = new RelationKeyData.forObject(
-        _elementCodec, _relationshipCodec, element, relationship);
+        _elementCodec, _relationshipCodec, indexable, relationship);
     // prepare LocationData(s)
     List<LocationData> locationDatas = _relations[key];
     if (locationDatas == null) {
@@ -369,9 +371,9 @@
       this.offset, this.length, this.flags);
 
   LocationData.forObject(ElementCodec elementCodec, LocationImpl location)
-      : elementId1 = elementCodec.encode1(location.element),
-        elementId2 = elementCodec.encode2(location.element),
-        elementId3 = elementCodec.encode3(location.element),
+      : elementId1 = elementCodec.encode1(location.indexable),
+        elementId2 = elementCodec.encode2(location.indexable),
+        elementId3 = elementCodec.encode3(location.indexable),
         offset = location.offset,
         length = location.length,
         flags = (location.isQualified ? _FLAG_QUALIFIED : 0) |
@@ -406,14 +408,14 @@
    * Returns a {@link Location} that is represented by this {@link LocationData}.
    */
   LocationImpl getLocation(AnalysisContext context, ElementCodec elementCodec) {
-    Element element =
+    IndexableObject indexable =
         elementCodec.decode(context, elementId1, elementId2, elementId3);
-    if (element == null) {
+    if (indexable == null) {
       return null;
     }
     bool isQualified = (flags & _FLAG_QUALIFIED) != 0;
     bool isResovled = (flags & _FLAG_RESOLVED) != 0;
-    return new LocationImpl(element, offset, length,
+    return new LocationImpl(indexable, offset, length,
         isQualified: isQualified, isResolved: isResovled);
   }
 }
@@ -481,11 +483,11 @@
       this.elementId1, this.elementId2, this.elementId3, this.relationshipId);
 
   RelationKeyData.forObject(ElementCodec elementCodec,
-      RelationshipCodec relationshipCodec, Element element,
+      RelationshipCodec relationshipCodec, IndexableObject indexable,
       RelationshipImpl relationship)
-      : elementId1 = elementCodec.encode1(element),
-        elementId2 = elementCodec.encode2(element),
-        elementId3 = elementCodec.encode3(element),
+      : elementId1 = elementCodec.encode1(indexable),
+        elementId2 = elementCodec.encode2(indexable),
+        elementId3 = elementCodec.encode3(indexable),
         relationshipId = relationshipCodec.encode(relationship);
 
   @override
@@ -712,11 +714,11 @@
   }
 
   Future<List<LocationImpl>> getRelationships(
-      Element element, RelationshipImpl relationship) {
+      IndexableObject indexable, RelationshipImpl relationship) {
     // prepare node names
     List<int> nodeNameIds;
     {
-      int nameId = _elementCodec.encodeHash(element);
+      int nameId = _elementCodec.encodeHash(indexable);
       IntToIntSetMap nameToNodeNames = _relToNameMap[relationship];
       if (nameToNodeNames != null) {
         nodeNameIds = nameToNodeNames.get(nameId);
@@ -735,7 +737,7 @@
           // TODO(scheglov) remove node
           return LocationImpl.EMPTY_LIST;
         }
-        return node.getRelationships(element, relationship);
+        return node.getRelationships(indexable, relationship);
       });
       nodeFutures.add(locationsFuture);
     }
@@ -759,9 +761,10 @@
         for (List<_TopElementData> topDataList in contextLocations.values) {
           for (_TopElementData topData in topDataList) {
             if (nameFilter(topData.name)) {
-              Element element = topData.getElement(context, _elementCodec);
-              if (element != null) {
-                elements.add(element);
+              IndexableObject indexable =
+                  topData.getElement(context, _elementCodec);
+              if (indexable is IndexableElement) {
+                elements.add(indexable.element);
               }
             }
           }
@@ -813,17 +816,19 @@
   }
 
   @override
-  void recordRelationship(
-      Element element, RelationshipImpl relationship, LocationImpl location) {
-    if (element == null || element is MultiplyDefinedElement) {
+  void recordRelationship(IndexableObject indexable,
+      RelationshipImpl relationship, LocationImpl location) {
+    if (indexable == null ||
+        (indexable is IndexableElement &&
+            indexable.element is MultiplyDefinedElement)) {
       return;
     }
     if (location == null) {
       return;
     }
     // other elements
-    _recordNodeNameForElement(element, relationship);
-    _currentNode.recordRelationship(element, relationship, location);
+    _recordNodeNameForElement(indexable, relationship);
+    _currentNode.recordRelationship(indexable, relationship, location);
   }
 
   void recordTopLevelDeclaration(Element element) {
@@ -841,7 +846,8 @@
       nodeDeclarations[_currentNodeNameId] = declarations;
     }
     // record LocationData
-    declarations.add(new _TopElementData(_elementCodec, element));
+    declarations
+        .add(new _TopElementData(_elementCodec, new IndexableElement(element)));
   }
 
   @override
@@ -931,13 +937,13 @@
   }
 
   void _recordNodeNameForElement(
-      Element element, RelationshipImpl relationship) {
+      IndexableObject indexable, RelationshipImpl relationship) {
     IntToIntSetMap nameToNodeNames = _relToNameMap[relationship];
     if (nameToNodeNames == null) {
       nameToNodeNames = new IntToIntSetMap();
       _relToNameMap[relationship] = nameToNodeNames;
     }
-    int nameId = _elementCodec.encodeHash(element);
+    int nameId = _elementCodec.encodeHash(indexable);
     nameToNodeNames.add(nameId, _currentNodeNameId);
   }
 
@@ -1027,15 +1033,18 @@
   final int elementId2;
   final int elementId3;
 
-  factory _TopElementData(ElementCodec elementCodec, Element element) {
-    return new _TopElementData._(element.name, elementCodec.encode1(element),
-        elementCodec.encode2(element), elementCodec.encode3(element));
+  factory _TopElementData(
+      ElementCodec elementCodec, IndexableObject indexable) {
+    return new _TopElementData._(indexable.name,
+        elementCodec.encode1(indexable), elementCodec.encode2(indexable),
+        elementCodec.encode3(indexable));
   }
 
   _TopElementData._(
       this.name, this.elementId1, this.elementId2, this.elementId3);
 
-  Element getElement(AnalysisContext context, ElementCodec elementCodec) {
+  IndexableObject getElement(
+      AnalysisContext context, ElementCodec elementCodec) {
     return elementCodec.decode(context, elementId1, elementId2, elementId3);
   }
 }
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 7cb5306..791f4b8 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
@@ -16,6 +16,7 @@
 import 'package:analysis_server/src/services/refactoring/rename.dart';
 import 'package:analysis_server/src/services/search/hierarchy.dart';
 import 'package:analysis_server/src/services/search/search_engine.dart';
+import 'package:analyzer/src/generated/ast.dart' show Identifier;
 import 'package:analyzer/src/generated/element.dart';
 import 'package:analyzer/src/generated/java_core.dart';
 
@@ -123,29 +124,32 @@
  */
 class _ClassMemberValidator {
   final SearchEngine searchEngine;
+  final LibraryElement library;
   final Element element;
   final ClassElement elementClass;
   final ElementKind elementKind;
   final String name;
   final bool isRename;
 
+  final RefactoringStatus result = new RefactoringStatus();
   Set<Element> elements = new Set<Element>();
   List<SearchMatch> references = <SearchMatch>[];
 
   _ClassMemberValidator.forCreate(
       this.searchEngine, this.elementClass, this.name)
       : isRename = false,
+        library = null,
         element = null,
         elementKind = ElementKind.METHOD;
 
   _ClassMemberValidator.forRename(this.searchEngine, Element element, this.name)
       : isRename = true,
+        library = element.library,
         element = element,
         elementClass = element.enclosingElement,
         elementKind = element.kind;
 
   Future<RefactoringStatus> validate() async {
-    RefactoringStatus result = new RefactoringStatus();
     // check if there is a member with "newName" in the same ClassElement
     for (Element newNameMember in getChildren(elementClass, name)) {
       result.addError(format(
@@ -198,6 +202,10 @@
         }
       }
     }
+    // visibility
+    if (isRename) {
+      _validateWillBeInvisible();
+    }
     // done
     return result;
   }
@@ -227,4 +235,22 @@
       references.addAll(elementReferences);
     });
   }
+
+  /**
+   * Validates if any usage of [element] renamed to [name] will be invisible.
+   */
+  void _validateWillBeInvisible() {
+    if (!Identifier.isPrivateName(name)) {
+      return;
+    }
+    for (SearchMatch reference in references) {
+      Element refElement = reference.element;
+      LibraryElement refLibrary = refElement.library;
+      if (refLibrary != library) {
+        String message = format("Renamed {0} will be invisible in '{1}'.",
+            getElementKindName(element), getElementQualifiedName(refLibrary));
+        result.addError(message, newLocation_fromMatch(reference));
+      }
+    }
+  }
 }
diff --git a/pkg/analysis_server/lib/src/services/refactoring/rename_unit_member.dart b/pkg/analysis_server/lib/src/services/refactoring/rename_unit_member.dart
index 51f27c4..2d2f797 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/rename_unit_member.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/rename_unit_member.dart
@@ -15,6 +15,7 @@
 import 'package:analysis_server/src/services/refactoring/rename.dart';
 import 'package:analysis_server/src/services/search/element_visitors.dart';
 import 'package:analysis_server/src/services/search/search_engine.dart';
+import 'package:analyzer/src/generated/ast.dart' show Identifier;
 import 'package:analyzer/src/generated/element.dart';
 import 'package:analyzer/src/generated/java_core.dart';
 
@@ -117,6 +118,7 @@
   ElementKind elementKind;
   final String name;
   final bool isRename;
+  List<SearchMatch> references = <SearchMatch>[];
 
   final RefactoringStatus result = new RefactoringStatus();
 
@@ -127,14 +129,16 @@
   _RenameUnitMemberValidator.forRename(
       this.searchEngine, this.element, this.name)
       : isRename = true {
-    library = element.getAncestor((e) => e is LibraryElement);
+    library = element.library;
     elementKind = element.kind;
   }
 
   Future<RefactoringStatus> validate() async {
     _validateWillConflict();
     if (isRename) {
-      await _validateWillBeShadowed();
+      references = await searchEngine.searchReferences(element);
+      _validateWillBeInvisible();
+      _validateWillBeShadowed();
     }
     await _validateWillShadow();
     return result;
@@ -165,13 +169,27 @@
   }
 
   /**
-   * Validates if any usage of [element] renamed to [name] will be shadowed.
+   * Validates if any usage of [element] renamed to [name] will be invisible.
    */
-  Future _validateWillBeShadowed() async {
-    if (!isRename) {
+  void _validateWillBeInvisible() {
+    if (!Identifier.isPrivateName(name)) {
       return;
     }
-    List<SearchMatch> references = await searchEngine.searchReferences(element);
+    for (SearchMatch reference in references) {
+      Element refElement = reference.element;
+      LibraryElement refLibrary = refElement.library;
+      if (refLibrary != library) {
+        String message = format("Renamed {0} will be invisible in '{1}'.",
+            getElementKindName(element), getElementQualifiedName(refLibrary));
+        result.addError(message, newLocation_fromMatch(reference));
+      }
+    }
+  }
+
+  /**
+   * Validates if any usage of [element] renamed to [name] will be shadowed.
+   */
+  void _validateWillBeShadowed() {
     for (SearchMatch reference in references) {
       Element refElement = reference.element;
       ClassElement refClass = refElement.getAncestor((e) => e is ClassElement);
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 d97cf42..be37a96 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
@@ -6,8 +6,10 @@
 
 import 'dart:async';
 
+import 'package:analysis_server/analysis/index/index_core.dart';
 import 'package:analysis_server/src/services/correction/source_range.dart';
 import 'package:analysis_server/src/services/index/index.dart';
+import 'package:analysis_server/src/services/index/indexable_element.dart';
 import 'package:analysis_server/src/services/search/search_engine.dart';
 import 'package:analyzer/src/generated/element.dart';
 import 'package:analyzer/src/generated/source.dart';
@@ -198,13 +200,17 @@
   _Requestor(this.index);
 
   void add(Element element, RelationshipImpl relationship, MatchKind kind) {
-    Future relationsFuture = index.getRelationships(element, relationship);
+    Future relationsFuture =
+        index.getRelationships(new IndexableElement(element), relationship);
     Future matchesFuture = relationsFuture.then((List<LocationImpl> locations) {
       List<SearchMatch> matches = <SearchMatch>[];
       for (LocationImpl location in locations) {
-        matches.add(new SearchMatch(kind, location.element,
-            new SourceRange(location.offset, location.length),
-            location.isResolved, location.isQualified));
+        IndexableObject indexable = location.indexable;
+        if (indexable is IndexableElement) {
+          matches.add(new SearchMatch(kind, indexable.element,
+              new SourceRange(location.offset, location.length),
+              location.isResolved, location.isQualified));
+        }
       }
       return matches;
     });
diff --git a/pkg/analysis_server/lib/src/socket_server.dart b/pkg/analysis_server/lib/src/socket_server.dart
index 28e08ce..5f95186 100644
--- a/pkg/analysis_server/lib/src/socket_server.dart
+++ b/pkg/analysis_server/lib/src/socket_server.dart
@@ -71,6 +71,7 @@
     Index index = null;
     if (!analysisServerOptions.noIndex) {
       index = createLocalFileIndex();
+      index.contributors = serverPlugin.indexContributors;
       index.run();
     }
 
diff --git a/pkg/analysis_server/lib/src/status/element_writer.dart b/pkg/analysis_server/lib/src/status/element_writer.dart
index 6ca70a5..fd73cef 100644
--- a/pkg/analysis_server/lib/src/status/element_writer.dart
+++ b/pkg/analysis_server/lib/src/status/element_writer.dart
@@ -54,7 +54,7 @@
       properties['isEnum'] = element.isEnum;
       properties['isOrInheritsProxy'] = element.isOrInheritsProxy;
       properties['isProxy'] = element.isProxy;
-      properties['isTypedef'] = element.isTypedef;
+      properties['isTypedef'] = element.isMixinApplication;
       properties['isValidMixin'] = element.isValidMixin;
       properties['mixins'] = element.mixins;
       properties['supertype'] = element.supertype;
diff --git a/pkg/analysis_server/pubspec.yaml b/pkg/analysis_server/pubspec.yaml
index abb7167..49f6084 100644
--- a/pkg/analysis_server/pubspec.yaml
+++ b/pkg/analysis_server/pubspec.yaml
@@ -6,7 +6,7 @@
 environment:
   sdk: '>=1.9.0 <2.0.0'
 dependencies:
-  analyzer: '>=0.25.1-alpha.0 <0.26.0'
+  analyzer: '>=0.25.1-alpha.1 <0.26.0'
   args: '>=0.13.0 <0.14.0'
   dart_style: '>=0.1.7 <0.2.0'
   logging: any
diff --git a/pkg/analysis_server/test/analysis/notification_overrides_test.dart b/pkg/analysis_server/test/analysis/notification_overrides_test.dart
index cf272a0..86b1dc1 100644
--- a/pkg/analysis_server/test/analysis/notification_overrides_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_overrides_test.dart
@@ -226,6 +226,26 @@
     });
   }
 
+  test_staticMembers() {
+    addTestFile('''
+class A {
+  static int F = 0;
+  static void M() {}
+  static int get G => 0;
+  static void set S(int v) {}
+}
+class B extends A {
+  static int F = 0;
+  static void M() {}
+  static int get G => 0;
+  static void set S(int v) {}
+}
+''');
+    return prepareOverrides().then((_) {
+      expect(overridesList, isEmpty);
+    });
+  }
+
   test_super_fieldByField() {
     addTestFile('''
 class A {
diff --git a/pkg/analysis_server/test/completion_test.dart b/pkg/analysis_server/test/completion_test.dart
index 0d96743..883170b 100644
--- a/pkg/analysis_server/test/completion_test.dart
+++ b/pkg/analysis_server/test/completion_test.dart
@@ -984,7 +984,7 @@
 enum MyEnum {A, B, C}
 main() {
   MyEnum.!1;
-}''', <String>["1+values", "1+A", "1+B", "1+C"], failingTests: '1');
+}''', <String>["1+values", "1+A", "1+B", "1+C"]);
 
     buildTests('testCompletion_exactPrefix_hasHigherRelevance', '''
 var STR;
diff --git a/pkg/analysis_server/test/edit/format_test.dart b/pkg/analysis_server/test/edit/format_test.dart
index 8d9d011..20dbdb3 100644
--- a/pkg/analysis_server/test/edit/format_test.dart
+++ b/pkg/analysis_server/test/edit/format_test.dart
@@ -31,7 +31,7 @@
     handler = new EditDomainHandler(server);
   }
 
-  Future test_formatNoOp() {
+  Future test_format_noOp() {
     // Already formatted source
     addTestFile('''
 main() {
@@ -45,7 +45,7 @@
     });
   }
 
-  Future test_formatNoSelection() async {
+  Future test_format_noSelection() async {
     addTestFile('''
 main() { int x = 3; }
 ''');
@@ -65,7 +65,7 @@
     expect(formatResult.selectionLength, equals(0));
   }
 
-  Future test_formatSimple() {
+  Future test_format_simple() {
     addTestFile('''
 main() { int x = 3; }
 ''');
@@ -86,7 +86,25 @@
     });
   }
 
-  Future test_withErrors() {
+  Future test_format_longLine() {
+    String content = '''
+fun(firstParam, secondParam, thirdParam, fourthParam) {
+  if (firstParam.noNull && secondParam.noNull && thirdParam.noNull && fourthParam.noNull) {}
+}
+''';
+    addTestFile(content);
+    return waitForTasksFinished().then((_) {
+      EditFormatResult formatResult = _formatAt(0, 3, lineLength: 100);
+
+      expect(formatResult.edits, isNotNull);
+      expect(formatResult.edits, hasLength(0));
+
+      expect(formatResult.selectionOffset, equals(0));
+      expect(formatResult.selectionLength, equals(3));
+    });
+  }
+
+  Future test_format_withErrors() {
     addTestFile('''
 main() { int x = 
 ''');
@@ -97,9 +115,9 @@
     });
   }
 
-  EditFormatResult _formatAt(int selectionOffset, int selectionLength) {
+  EditFormatResult _formatAt(int selectionOffset, int selectionLength, {int lineLength}) {
     Request request = new EditFormatParams(
-        testFile, selectionOffset, selectionLength).toRequest('0');
+        testFile, selectionOffset, selectionLength, lineLength: lineLength).toRequest('0');
     Response response = handleSuccessfulRequest(request);
     return new EditFormatResult.fromResponse(response);
   }
diff --git a/pkg/analysis_server/test/integration/integration_test_methods.dart b/pkg/analysis_server/test/integration/integration_test_methods.dart
index eba2bda..3b609f2 100644
--- a/pkg/analysis_server/test/integration/integration_test_methods.dart
+++ b/pkg/analysis_server/test/integration/integration_test_methods.dart
@@ -1090,6 +1090,10 @@
    *
    *   The length of the current selection in the file.
    *
+   * lineLength ( optional int )
+   *
+   *   The line length to be used by the formatter.
+   *
    * Returns
    *
    * edits ( List<SourceEdit> )
@@ -1105,8 +1109,8 @@
    *
    *   The length of the selection after formatting the code.
    */
-  Future<EditFormatResult> sendEditFormat(String file, int selectionOffset, int selectionLength) {
-    var params = new EditFormatParams(file, selectionOffset, selectionLength).toJson();
+  Future<EditFormatResult> sendEditFormat(String file, int selectionOffset, int selectionLength, {int lineLength}) {
+    var params = new EditFormatParams(file, selectionOffset, selectionLength, lineLength: lineLength).toJson();
     return server.send("edit.format", params)
         .then((result) {
       ResponseDecoder decoder = new ResponseDecoder(null);
diff --git a/pkg/analysis_server/test/integration/protocol_matchers.dart b/pkg/analysis_server/test/integration/protocol_matchers.dart
index 42d9ee9..60515ea 100644
--- a/pkg/analysis_server/test/integration/protocol_matchers.dart
+++ b/pkg/analysis_server/test/integration/protocol_matchers.dart
@@ -643,6 +643,7 @@
  *   "file": FilePath
  *   "selectionOffset": int
  *   "selectionLength": int
+ *   "lineLength": optional int
  * }
  */
 final Matcher isEditFormatParams = new LazyMatcher(() => new MatchesJsonObject(
@@ -650,6 +651,8 @@
     "file": isFilePath,
     "selectionOffset": isInt,
     "selectionLength": isInt
+  }, optionalFields: {
+    "lineLength": isInt
   }));
 
 /**
diff --git a/pkg/analysis_server/test/services/completion/completion_test_util.dart b/pkg/analysis_server/test/services/completion/completion_test_util.dart
index 6e76a4e..83ca4e5 100644
--- a/pkg/analysis_server/test/services/completion/completion_test_util.dart
+++ b/pkg/analysis_server/test/services/completion/completion_test_util.dart
@@ -65,7 +65,8 @@
         content.substring(completionOffset + 1);
     testSource = addSource(testFile, content);
     cache = new DartCompletionCache(context, testSource);
-    AnalysisServer server = new AnalysisServerMock(searchEngine: searchEngine, resourceProvider: provider);
+    AnalysisServer server = new AnalysisServerMock(
+        searchEngine: searchEngine, resourceProvider: provider);
     request = new DartCompletionRequest(
         server, context, testSource, completionOffset, cache);
   }
@@ -552,6 +553,26 @@
     // Subclasses override
   }
 
+  CompletionSuggestion assertSuggestEnum(String completion,
+      {bool isDeprecated: false}) {
+    CompletionSuggestion suggestion =
+        assertSuggest(completion, isDeprecated: isDeprecated);
+    expect(suggestion.isDeprecated, isDeprecated);
+    expect(suggestion.element.kind, protocol.ElementKind.ENUM);
+    return suggestion;
+  }
+
+  CompletionSuggestion assertSuggestEnumConst(String completion,
+      {bool isDeprecated: false}) {
+    CompletionSuggestion suggestion =
+        assertSuggest(completion, isDeprecated: isDeprecated);
+    expect(suggestion.isDeprecated, isDeprecated);
+    // TODO(danrubel) : Perhaps should be protocol.ElementKind.ENUM_CONST
+    // but element model represents them as FIELD
+    expect(suggestion.element.kind, protocol.ElementKind.FIELD);
+    return suggestion;
+  }
+
   CompletionSuggestion assertSuggestImportedClass(String name,
       {CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION,
       int relevance: DART_RELEVANCE_DEFAULT, String importUri}) {
diff --git a/pkg/analysis_server/test/services/completion/imported_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/imported_reference_contributor_test.dart
index 561d877..c33ec14 100644
--- a/pkg/analysis_server/test/services/completion/imported_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/imported_reference_contributor_test.dart
@@ -4,6 +4,7 @@
 
 library test.services.completion.toplevel;
 
+import 'package:analysis_server/src/analysis_server.dart';
 import 'package:analysis_server/src/protocol.dart' as protocol
     show Element, ElementKind;
 import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind;
@@ -18,9 +19,8 @@
 import 'package:unittest/unittest.dart';
 
 import '../../abstract_context.dart';
-import 'completion_test_util.dart';
-import 'package:analysis_server/src/analysis_server.dart';
 import '../../operation/operation_queue_test.dart';
+import 'completion_test_util.dart';
 
 main() {
   groupSep = ' | ';
@@ -210,6 +210,18 @@
     return cs;
   }
 
+  fail_enum_deprecated() {
+    addSource('/libA.dart', 'library A; @deprecated enum E { one, two }');
+    addTestSource('import "/libA.dart"; main() {^}');
+    return computeFull((bool result) {
+      // TODO(danrube) investigate why suggestion/element is not deprecated
+      // when AST node has correct @deprecated annotation
+      assertSuggestEnum('E', isDeprecated: true);
+      assertNotSuggested('one');
+      assertNotSuggested('two');
+    });
+  }
+
   bool isCached(List<CompletionSuggestion> suggestions, String completion) =>
       suggestions.any((CompletionSuggestion s) => s.completion == completion);
 
@@ -307,6 +319,16 @@
     });
   }
 
+  test_enum() {
+    addSource('/libA.dart', 'library A; enum E { one, two }');
+    addTestSource('import "/libA.dart"; main() {^}');
+    return computeFull((bool result) {
+      assertSuggestEnum('E');
+      assertNotSuggested('one');
+      assertNotSuggested('two');
+    });
+  }
+
   test_function_parameters_mixed_required_and_named() {
     addSource('/libA.dart', '''
 void m(x, {int y}) {}
diff --git a/pkg/analysis_server/test/services/completion/keyword_contributor_test.dart b/pkg/analysis_server/test/services/completion/keyword_contributor_test.dart
index a5219ff..cbf3794 100644
--- a/pkg/analysis_server/test/services/completion/keyword_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/keyword_contributor_test.dart
@@ -939,6 +939,30 @@
     assertSuggestKeywords([]);
   }
 
+  test_newInstance() {
+    addTestSource('class A { foo() {new ^}}');
+    expect(computeFast(), isTrue);
+    assertSuggestKeywords([]);
+  }
+
+  test_newInstance2() {
+    addTestSource('class A { foo() {new ^ print("foo");}}');
+    expect(computeFast(), isTrue);
+    assertSuggestKeywords([]);
+  }
+
+  test_newInstance_prefixed() {
+    addTestSource('class A { foo() {new A.^}}');
+    expect(computeFast(), isTrue);
+    assertSuggestKeywords([]);
+  }
+
+  test_newInstance_prefixed2() {
+    addTestSource('class A { foo() {new A.^ print("foo");}}');
+    expect(computeFast(), isTrue);
+    assertSuggestKeywords([]);
+  }
+
   test_part_of() {
     addTestSource('part of foo;^');
     expect(computeFast(), isTrue);
@@ -960,6 +984,30 @@
         relevance: DART_RELEVANCE_HIGH);
   }
 
+  test_prefixed_field() {
+    addTestSource('class A { int x; foo() {x.^}}');
+    expect(computeFast(), isTrue);
+    assertSuggestKeywords([]);
+  }
+
+  test_prefixed_field2() {
+    addTestSource('class A { int x; foo() {x.^ print("foo");}}');
+    expect(computeFast(), isTrue);
+    assertSuggestKeywords([]);
+  }
+
+  test_prefixed_local() {
+    addTestSource('class A { foo() {int x; x.^}}');
+    expect(computeFast(), isTrue);
+    assertSuggestKeywords([]);
+  }
+
+  test_prefixed_local2() {
+    addTestSource('class A { foo() {int x; x.^ print("foo");}}');
+    expect(computeFast(), isTrue);
+    assertSuggestKeywords([]);
+  }
+
   test_switch_expression() {
     addTestSource('main() {switch(^) {}}');
     expect(computeFast(), isTrue);
diff --git a/pkg/analysis_server/test/services/completion/local_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/local_reference_contributor_test.dart
index 77c43f0..e46a771 100644
--- a/pkg/analysis_server/test/services/completion/local_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/local_reference_contributor_test.dart
@@ -4,7 +4,9 @@
 
 library test.services.completion.dart.local;
 
-import 'package:analysis_server/src/protocol_server.dart';
+import 'package:analysis_server/src/protocol.dart' as protocol
+    show Element, ElementKind;
+import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind;
 import 'package:analysis_server/src/services/completion/dart_completion_manager.dart';
 import 'package:analysis_server/src/services/completion/local_reference_contributor.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -98,9 +100,9 @@
     CompletionSuggestion cs = assertSuggest(name,
         csKind: CompletionSuggestionKind.INVOCATION, relevance: relevance);
     expect(cs.returnType, returnType != null ? returnType : 'dynamic');
-    Element element = cs.element;
+    protocol.Element element = cs.element;
     expect(element, isNotNull);
-    expect(element.kind, equals(ElementKind.LOCAL_VARIABLE));
+    expect(element.kind, equals(protocol.ElementKind.LOCAL_VARIABLE));
     expect(element.name, equals(name));
     expect(element.parameters, isNull);
     expect(element.returnType, returnType != null ? returnType : 'dynamic');
@@ -113,9 +115,9 @@
     CompletionSuggestion cs = assertSuggest(name,
         csKind: CompletionSuggestionKind.INVOCATION, relevance: relevance);
     expect(cs.returnType, returnType != null ? returnType : 'dynamic');
-    Element element = cs.element;
+    protocol.Element element = cs.element;
     expect(element, isNotNull);
-    expect(element.kind, equals(ElementKind.PARAMETER));
+    expect(element.kind, equals(protocol.ElementKind.PARAMETER));
     expect(element.name, equals(name));
     expect(element.parameters, isNull);
     expect(element.returnType,
@@ -462,6 +464,22 @@
     assertSuggestLabel('foo');
   }
 
+  test_enum() {
+    addTestSource('enum E { one, two } main() {^}');
+    expect(computeFast(), isTrue);
+    assertSuggestEnum('E');
+    assertNotSuggested('one');
+    assertNotSuggested('two');
+  }
+
+  test_enum_deprecated() {
+    addTestSource('@deprecated enum E { one, two } main() {^}');
+    expect(computeFast(), isTrue);
+    assertSuggestEnum('E', isDeprecated: true);
+    assertNotSuggested('one');
+    assertNotSuggested('two');
+  }
+
   test_function_parameters_mixed_required_and_named() {
     addTestSource('''
 void m(x, {int y}) {}
diff --git a/pkg/analysis_server/test/services/completion/optype_test.dart b/pkg/analysis_server/test/services/completion/optype_test.dart
index 69107b7..27e32b7 100644
--- a/pkg/analysis_server/test/services/completion/optype_test.dart
+++ b/pkg/analysis_server/test/services/completion/optype_test.dart
@@ -1286,5 +1286,8 @@
   @override
   String get shortName => fullName;
 
+  @override
+  Source get source => this;
+
   noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
 }
diff --git a/pkg/analysis_server/test/services/completion/prefixed_element_contributor_test.dart b/pkg/analysis_server/test/services/completion/prefixed_element_contributor_test.dart
index 8015d8f..7e77a87 100644
--- a/pkg/analysis_server/test/services/completion/prefixed_element_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/prefixed_element_contributor_test.dart
@@ -60,6 +60,19 @@
     });
   }
 
+  fail_enumConst_deprecated() {
+    addTestSource('@deprecated enum E { one, two } main() {E.^}');
+    return computeFull((bool result) {
+      assertNotSuggested('E');
+      // TODO(danrubel) Investigate why enum suggestion is not marked
+      // as deprecated if enum ast element is deprecated
+      assertSuggestEnumConst('one', isDeprecated: true);
+      assertSuggestEnumConst('two', isDeprecated: true);
+      assertNotSuggested('index');
+      assertSuggestField('values', 'List<E>', isDeprecated: true);
+    });
+  }
+
   fail_test_PrefixedIdentifier_trailingStmt_const_untyped() {
     // SimpleIdentifier  PrefixedIdentifier  ExpressionStatement
     addTestSource('const g = "hello"; f() {g.^ int y = 0;}');
@@ -74,6 +87,72 @@
     contributor = new PrefixedElementContributor();
   }
 
+  test_enumConst() {
+    addTestSource('enum E { one, two } main() {E.^}');
+    return computeFull((bool result) {
+      assertNotSuggested('E');
+      assertSuggestEnumConst('one');
+      assertSuggestEnumConst('two');
+      assertNotSuggested('index');
+      assertSuggestField('values', 'List<E>');
+    });
+  }
+
+  test_enumConst2() {
+    addTestSource('enum E { one, two } main() {E.o^}');
+    return computeFull((bool result) {
+      assertNotSuggested('E');
+      assertSuggestEnumConst('one');
+      assertSuggestEnumConst('two');
+      assertNotSuggested('index');
+      assertSuggestField('values', 'List<E>');
+    });
+  }
+
+  test_enumConst3() {
+    addTestSource('enum E { one, two } main() {E.^ int g;}');
+    return computeFull((bool result) {
+      assertNotSuggested('E');
+      assertSuggestEnumConst('one');
+      assertSuggestEnumConst('two');
+      assertNotSuggested('index');
+      assertSuggestField('values', 'List<E>');
+    });
+  }
+
+  test_enumConst_index() {
+    addTestSource('enum E { one, two } main() {E.one.^}');
+    return computeFull((bool result) {
+      assertNotSuggested('E');
+      assertNotSuggested('one');
+      assertNotSuggested('two');
+      assertSuggestField('index', 'int');
+      assertNotSuggested('values');
+    });
+  }
+
+  test_enumConst_index2() {
+    addTestSource('enum E { one, two } main() {E.one.i^}');
+    return computeFull((bool result) {
+      assertNotSuggested('E');
+      assertNotSuggested('one');
+      assertNotSuggested('two');
+      assertSuggestField('index', 'int');
+      assertNotSuggested('values');
+    });
+  }
+
+  test_enumConst_index3() {
+    addTestSource('enum E { one, two } main() {E.one.^ int g;}');
+    return computeFull((bool result) {
+      assertNotSuggested('E');
+      assertNotSuggested('one');
+      assertNotSuggested('two');
+      assertSuggestField('index', 'int');
+      assertNotSuggested('values');
+    });
+  }
+
   test_generic_field() {
     addTestSource('''
 class C<T> {
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart
index 30c16e5..0778532 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -162,6 +162,108 @@
 ''');
   }
 
+  void test_addMissingParameter_function_positional_hasZero() {
+    resolveTestUnit('''
+test() {}
+main() {
+  test(1);
+}
+''');
+    assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL, '''
+test([int i]) {}
+main() {
+  test(1);
+}
+''');
+  }
+
+  void test_addMissingParameter_function_required_hasOne() {
+    resolveTestUnit('''
+test(int a) {}
+main() {
+  test(1, 2.0);
+}
+''');
+    assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, '''
+test(int a, double d) {}
+main() {
+  test(1, 2.0);
+}
+''');
+  }
+
+  void test_addMissingParameter_function_required_hasZero() {
+    resolveTestUnit('''
+test() {}
+main() {
+  test(1);
+}
+''');
+    assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, '''
+test(int i) {}
+main() {
+  test(1);
+}
+''');
+  }
+
+  void test_addMissingParameter_method_positional_hasOne() {
+    resolveTestUnit('''
+class A {
+  test(int a) {}
+  main() {
+    test(1, 2.0);
+  }
+}
+''');
+    assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL, '''
+class A {
+  test(int a, [double d]) {}
+  main() {
+    test(1, 2.0);
+  }
+}
+''');
+  }
+
+  void test_addMissingParameter_method_required_hasOne() {
+    resolveTestUnit('''
+class A {
+  test(int a) {}
+  main() {
+    test(1, 2.0);
+  }
+}
+''');
+    assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, '''
+class A {
+  test(int a, double d) {}
+  main() {
+    test(1, 2.0);
+  }
+}
+''');
+  }
+
+  void test_addMissingParameter_method_required_hasZero() {
+    resolveTestUnit('''
+class A {
+  test() {}
+  main() {
+    test(1);
+  }
+}
+''');
+    assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, '''
+class A {
+  test(int i) {}
+  main() {
+    test(1);
+  }
+}
+''');
+  }
+
   void test_addPartOfDirective() {
     String partCode = r'''
 // Comment first.
@@ -389,6 +491,40 @@
     _assertLinkedGroup(change.linkedEditGroups[0], ['Test v =', 'Test {']);
   }
 
+  void test_createClass_inLibraryOfPrefix() {
+    String libCode = r'''
+library my.lib;
+
+class A {}
+''';
+    addSource('/lib.dart', libCode);
+    resolveTestUnit('''
+import 'lib.dart' as lib;
+
+main() {
+  lib.A a = null;
+  lib.Test t = null;
+}
+''');
+    AnalysisError error = _findErrorToFix();
+    fix = _assertHasFix(DartFixKind.CREATE_CLASS, error);
+    change = fix.change;
+    // apply to "lib.dart"
+    List<SourceFileEdit> fileEdits = change.edits;
+    expect(fileEdits, hasLength(1));
+    SourceFileEdit fileEdit = change.edits[0];
+    expect(fileEdit.file, '/lib.dart');
+    expect(SourceEdit.applySequence(libCode, fileEdit.edits), r'''
+library my.lib;
+
+class A {}
+
+class Test {
+}
+''');
+    expect(change.linkedEditGroups, isEmpty);
+  }
+
   void test_createClass_innerLocalFunction() {
     resolveTestUnit('''
 f() {
@@ -1510,7 +1646,7 @@
 ''');
   }
 
-  void test_createMissingOverrides_generics() {
+  void test_createMissingOverrides_generics_typeArguments() {
     resolveTestUnit('''
 class Iterator<T> {
 }
@@ -1538,6 +1674,29 @@
 ''');
   }
 
+  void test_createMissingOverrides_generics_typeParameters() {
+    resolveTestUnit('''
+abstract class ItemProvider<T> {
+  List<T> getItems();
+}
+
+class Test<V> extends ItemProvider<V> {
+}
+''');
+    assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, '''
+abstract class ItemProvider<T> {
+  List<T> getItems();
+}
+
+class Test<V> extends ItemProvider<V> {
+  @override
+  List<V> getItems() {
+    // TODO: implement getItems
+  }
+}
+''');
+  }
+
   void test_createMissingOverrides_getter() {
     resolveTestUnit('''
 abstract class A {
@@ -3233,7 +3392,7 @@
     assertNoFix(DartFixKind.CREATE_METHOD);
   }
 
-  void test_undefinedMethod_create_generic_BAD() {
+  void test_undefinedMethod_create_generic_BAD_argumentType() {
     resolveTestUnit('''
 class A<T> {
   B b;
@@ -3262,6 +3421,31 @@
 ''');
   }
 
+  void test_undefinedMethod_create_generic_BAD_returnType() {
+    resolveTestUnit('''
+class A<T> {
+  main() {
+    T t = new B().compute();
+  }
+}
+
+class B {
+}
+''');
+    assertHasFix(DartFixKind.CREATE_METHOD, '''
+class A<T> {
+  main() {
+    T t = new B().compute();
+  }
+}
+
+class B {
+  dynamic compute() {
+  }
+}
+''');
+  }
+
   void test_undefinedMethod_create_generic_OK_literal() {
     resolveTestUnit('''
 class A {
diff --git a/pkg/analysis_server/test/services/index/dart_index_contributor_test.dart b/pkg/analysis_server/test/services/index/dart_index_contributor_test.dart
index 38ecc46..d3fe203 100644
--- a/pkg/analysis_server/test/services/index/dart_index_contributor_test.dart
+++ b/pkg/analysis_server/test/services/index/dart_index_contributor_test.dart
@@ -4,9 +4,11 @@
 
 library test.services.src.index.dart_index_contributor;
 
+import 'package:analysis_server/analysis/index/index_core.dart';
 import 'package:analysis_server/src/services/index/index.dart';
 import 'package:analysis_server/src/services/index/index_contributor.dart';
 import 'package:analysis_server/src/services/index/index_store.dart';
+import 'package:analysis_server/src/services/index/indexable_element.dart';
 import 'package:analyzer/src/generated/ast.dart';
 import 'package:analyzer/src/generated/element.dart';
 import 'package:analyzer/src/generated/source.dart';
@@ -42,9 +44,9 @@
 }
 
 bool _equalsRecordedRelation(RecordedRelation recordedRelation,
-    Element expectedElement, RelationshipImpl expectedRelationship,
+    IndexableObject expectedIndexable, RelationshipImpl expectedRelationship,
     ExpectedLocation expectedLocation) {
-  return expectedElement == recordedRelation.element &&
+  return expectedIndexable == recordedRelation.indexable &&
       (expectedRelationship == null ||
           expectedRelationship == recordedRelation.relationship) &&
       (expectedLocation == null ||
@@ -66,10 +68,10 @@
     super.setUp();
     when(store.aboutToIndexDart(context, anyObject)).thenReturn(true);
     when(store.recordRelationship(anyObject, anyObject, anyObject))
-        .thenInvoke((Element element, RelationshipImpl relationship,
+        .thenInvoke((IndexableObject indexable, RelationshipImpl relationship,
             LocationImpl location) {
       recordedRelations
-          .add(new RecordedRelation(element, relationship, location));
+          .add(new RecordedRelation(indexable, relationship, location));
     });
     when(store.recordTopLevelDeclaration(anyObject))
         .thenInvoke((Element element) {
@@ -77,6 +79,15 @@
     });
   }
 
+  void test_bad_unresolvedFieldFormalParameter() {
+    verifyNoTestUnitErrors = false;
+    _indexTestUnit('''
+class Test {
+  final field;
+  Test(this.fie);
+}''');
+  }
+
   void test_definesClass() {
     _indexTestUnit('class A {}');
     // prepare elements
@@ -137,8 +148,8 @@
     Element mainElement = findElement("main");
     VariableElement variableElement = findElement("v");
     // verify
-    _assertNoRecordedRelation(variableElement, IndexConstants.IS_READ_BY,
-        _expectedLocation(mainElement, 'v in []'));
+    _assertNoRecordedRelationForElement(variableElement,
+        IndexConstants.IS_READ_BY, _expectedLocation(mainElement, 'v in []'));
   }
 
   void test_isDefinedBy_NameElement_method() {
@@ -150,7 +161,8 @@
     Element methodElement = findElement("m");
     Element nameElement = new NameElement("m");
     // verify
-    _assertRecordedRelation(nameElement, IndexConstants.NAME_IS_DEFINED_BY,
+    _assertRecordedRelationForElement(nameElement,
+        IndexConstants.NAME_IS_DEFINED_BY,
         _expectedLocation(methodElement, 'm() {}'));
   }
 
@@ -163,7 +175,8 @@
     Element methodElement = findElement("+");
     Element nameElement = new NameElement("+");
     // verify
-    _assertRecordedRelation(nameElement, IndexConstants.NAME_IS_DEFINED_BY,
+    _assertRecordedRelationForElement(nameElement,
+        IndexConstants.NAME_IS_DEFINED_BY,
         _expectedLocation(methodElement, '+(o) {}', length: 1));
   }
 
@@ -176,7 +189,8 @@
     ClassElement classElementA = findElement("A");
     ClassElement classElementB = findElement("B");
     // verify
-    _assertRecordedRelation(classElementA, IndexConstants.IS_EXTENDED_BY,
+    _assertRecordedRelationForElement(classElementA,
+        IndexConstants.IS_EXTENDED_BY,
         _expectedLocation(classElementB, 'A {} // 2'));
   }
 
@@ -188,7 +202,8 @@
     ClassElement classElementA = findElement("A");
     ClassElement classElementObject = classElementA.supertype.element;
     // verify
-    _assertRecordedRelation(classElementObject, IndexConstants.IS_EXTENDED_BY,
+    _assertRecordedRelationForElement(classElementObject,
+        IndexConstants.IS_EXTENDED_BY,
         _expectedLocation(classElementA, 'A {}', length: 0));
   }
 
@@ -202,7 +217,8 @@
     ClassElement classElementA = findElement("A");
     ClassElement classElementC = findElement("C");
     // verify
-    _assertRecordedRelation(classElementA, IndexConstants.IS_EXTENDED_BY,
+    _assertRecordedRelationForElement(classElementA,
+        IndexConstants.IS_EXTENDED_BY,
         _expectedLocation(classElementC, 'A with'));
   }
 
@@ -215,7 +231,8 @@
     ClassElement classElementA = findElement("A");
     ClassElement classElementB = findElement("B");
     // verify
-    _assertRecordedRelation(classElementA, IndexConstants.IS_IMPLEMENTED_BY,
+    _assertRecordedRelationForElement(classElementA,
+        IndexConstants.IS_IMPLEMENTED_BY,
         _expectedLocation(classElementB, 'A {} // 2'));
   }
 
@@ -229,7 +246,8 @@
     ClassElement classElementB = findElement("B");
     ClassElement classElementC = findElement("C");
     // verify
-    _assertRecordedRelation(classElementB, IndexConstants.IS_IMPLEMENTED_BY,
+    _assertRecordedRelationForElement(classElementB,
+        IndexConstants.IS_IMPLEMENTED_BY,
         _expectedLocation(classElementC, 'B; // 3'));
   }
 
@@ -246,10 +264,11 @@
     Element mainElement = findElement("main");
     FieldElement fieldElement = findElement("field");
     PropertyAccessorElement getterElement = fieldElement.getter;
+    IndexableElement indexable = new IndexableElement(getterElement);
     // verify
-    _assertRecordedRelation(getterElement, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, 'field(); // q'));
-    _assertRecordedRelation(getterElement, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_INVOKED_BY,
         _expectedLocation(mainElement, 'field(); // nq'));
   }
 
@@ -268,10 +287,11 @@
     // prepare elements
     Element mainElement = findElement("main");
     FunctionElement functionElement = importedUnit().functions[0];
+    IndexableElement indexable = new IndexableElement(functionElement);
     // verify
-    _assertRecordedRelation(functionElement, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_INVOKED_BY,
         _expectedLocation(mainElement, 'foo(); // q'));
-    _assertRecordedRelation(functionElement, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_INVOKED_BY,
         _expectedLocation(mainElement, 'foo(); // nq'));
   }
 
@@ -285,7 +305,7 @@
     Element mainElement = findElement("main");
     Element element = findElement("v");
     // verify
-    _assertRecordedRelation(element, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForElement(element, IndexConstants.IS_INVOKED_BY,
         _expectedLocation(mainElement, 'v();'));
   }
 
@@ -301,10 +321,11 @@
     // prepare elements
     Element mainElement = findElement("main");
     Element methodElement = findElement("foo");
+    IndexableElement indexable = new IndexableElement(methodElement);
     // verify
-    _assertRecordedRelation(methodElement, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, 'foo(); // q'));
-    _assertRecordedRelation(methodElement, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_INVOKED_BY,
         _expectedLocation(mainElement, 'foo(); // nq'));
   }
 
@@ -322,7 +343,8 @@
     Element mainElement = findElement("main");
     Element methodElement = findElement("foo");
     // verify
-    _assertRecordedRelation(methodElement, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForElement(methodElement,
+        IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, 'foo();'));
   }
 
@@ -341,14 +363,15 @@
     // prepare elements
     MethodElement element = findElement('+');
     Element mainElement = findElement('main');
+    IndexableElement indexable = new IndexableElement(element);
     // verify
-    _assertRecordedRelation(element, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, '+ 1', length: 1));
-    _assertRecordedRelation(element, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, '+= 2', length: 2));
-    _assertRecordedRelation(element, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, '++a;', length: 2));
-    _assertRecordedRelation(element, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, '++;', length: 2));
   }
 
@@ -368,9 +391,10 @@
     MethodElement writeElement = findElement("[]=");
     Element mainElement = findElement('main');
     // verify
-    _assertRecordedRelation(readElement, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForElement(readElement, IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, '[0]', length: 1));
-    _assertRecordedRelation(writeElement, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForElement(writeElement,
+        IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, '[1] =', length: 1));
   }
 
@@ -387,7 +411,7 @@
     MethodElement element = findElement("~");
     Element mainElement = findElement('main');
     // verify
-    _assertRecordedRelation(element, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForElement(element, IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, '~a', length: 1));
   }
 
@@ -400,7 +424,7 @@
     Element mainElement = findElement("main");
     Element element = findElement("p");
     // verify
-    _assertRecordedRelation(element, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForElement(element, IndexConstants.IS_INVOKED_BY,
         _expectedLocation(mainElement, 'p();'));
   }
 
@@ -413,7 +437,8 @@
     ClassElement classElementA = findElement("A");
     ClassElement classElementB = findElement("B");
     // verify
-    _assertRecordedRelation(classElementA, IndexConstants.IS_MIXED_IN_BY,
+    _assertRecordedRelationForElement(classElementA,
+        IndexConstants.IS_MIXED_IN_BY,
         _expectedLocation(classElementB, 'A {} // 2'));
   }
 
@@ -426,7 +451,8 @@
     ClassElement classElementA = findElement("A");
     ClassElement classElementB = findElement("B");
     // verify
-    _assertRecordedRelation(classElementA, IndexConstants.IS_MIXED_IN_BY,
+    _assertRecordedRelationForElement(classElementA,
+        IndexConstants.IS_MIXED_IN_BY,
         _expectedLocation(classElementB, 'A; // 2'));
   }
 
@@ -440,8 +466,8 @@
     Element mainElement = findElement("main");
     Element parameterElement = findElement("p");
     // verify
-    _assertRecordedRelation(parameterElement, IndexConstants.IS_READ_BY,
-        _expectedLocation(mainElement, 'p);'));
+    _assertRecordedRelationForElement(parameterElement,
+        IndexConstants.IS_READ_BY, _expectedLocation(mainElement, 'p);'));
   }
 
   void test_isReadBy_VariableElement() {
@@ -455,8 +481,8 @@
     Element mainElement = findElement("main");
     Element variableElement = findElement("v");
     // verify
-    _assertRecordedRelation(variableElement, IndexConstants.IS_READ_BY,
-        _expectedLocation(mainElement, 'v);'));
+    _assertRecordedRelationForElement(variableElement,
+        IndexConstants.IS_READ_BY, _expectedLocation(mainElement, 'v);'));
   }
 
   void test_isReadWrittenBy_ParameterElement() {
@@ -469,7 +495,8 @@
     Element mainElement = findElement("main");
     Element parameterElement = findElement("p");
     // verify
-    _assertRecordedRelation(parameterElement, IndexConstants.IS_READ_WRITTEN_BY,
+    _assertRecordedRelationForElement(parameterElement,
+        IndexConstants.IS_READ_WRITTEN_BY,
         _expectedLocation(mainElement, 'p += 1'));
   }
 
@@ -484,7 +511,8 @@
     Element mainElement = findElement("main");
     Element variableElement = findElement("v");
     // verify
-    _assertRecordedRelation(variableElement, IndexConstants.IS_READ_WRITTEN_BY,
+    _assertRecordedRelationForElement(variableElement,
+        IndexConstants.IS_READ_WRITTEN_BY,
         _expectedLocation(mainElement, 'v += 1'));
   }
 
@@ -505,16 +533,17 @@
     Element mainElement = findElement("main");
     ParameterElement pElement = findElement("p");
     VariableElement vElement = findElement("v");
+    IndexableElement indexable = new IndexableElement(aElement);
     // verify
-    _assertRecordedRelation(aElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(pElement, 'A p) {'));
-    _assertRecordedRelation(aElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(vElement, 'A v;'));
-    _assertRecordedRelation(aElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'A(); // 2'));
-    _assertRecordedRelation(aElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'A.field = 1;'));
-    _assertRecordedRelation(aElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'A.field); // 3'));
   }
 
@@ -530,10 +559,11 @@
     ClassElement bElement = findElement("B");
     ParameterElement pElement = findElement("p");
     VariableElement vElement = findElement("v");
+    IndexableElement indexable = new IndexableElement(bElement);
     // verify
-    _assertRecordedRelation(bElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(pElement, 'B p) {'));
-    _assertRecordedRelation(bElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(vElement, 'B v;'));
   }
 
@@ -548,7 +578,8 @@
     LibraryElement libElement = testLibraryElement.exportedLibraries[0];
     CompilationUnitElement libUnitElement = libElement.definingCompilationUnit;
     // verify
-    _assertRecordedRelation(libUnitElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(libUnitElement,
+        IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(testUnitElement, "'lib.dart'", length: 10));
   }
 
@@ -563,7 +594,8 @@
     LibraryElement libElement = testLibraryElement.imports[0].importedLibrary;
     CompilationUnitElement libUnitElement = libElement.definingCompilationUnit;
     // verify
-    _assertRecordedRelation(libUnitElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(libUnitElement,
+        IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(testUnitElement, "'lib.dart'", length: 10));
   }
 
@@ -576,7 +608,8 @@
     // prepare elements
     CompilationUnitElement myUnitElement = testLibraryElement.parts[0];
     // verify
-    _assertRecordedRelation(myUnitElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(myUnitElement,
+        IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(testUnitElement, "'my_unit.dart';", length: 14));
   }
 
@@ -607,17 +640,19 @@
         findNodeElementAtString("B.foo()", isConstructor);
     ConstructorElement consB_bar =
         findNodeElementAtString("B.bar()", isConstructor);
+    IndexableElement indexableA = new IndexableElement(consA);
+    IndexableElement indexableA_foo = new IndexableElement(consA_foo);
     // A()
-    _assertRecordedRelation(consA, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexableA, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(consB, '(); // marker-1', length: 0));
-    _assertRecordedRelation(consA, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexableA, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, '(); // marker-main-1', length: 0));
     // A.foo()
-    _assertRecordedRelation(consA_foo, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexableA_foo, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(consB_foo, '.foo(); // marker-2', length: 4));
-    _assertRecordedRelation(consA_foo, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexableA_foo, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(consB_bar, '.foo; // marker-3', length: 4));
-    _assertRecordedRelation(consA_foo, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexableA_foo, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, '.foo(); // marker-main-2', length: 4));
   }
 
@@ -641,11 +676,11 @@
     ConstructorElement consA_named =
         findNodeElementAtString("A.named()", isConstructor);
     // verify
-    _assertRecordedRelation(consA, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(consA, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, '(); // marker-main-1', length: 0));
-    _assertRecordedRelation(consA_named, IndexConstants.IS_REFERENCED_BY,
-        _expectedLocation(mainElement, '.named(); // marker-main-2',
-            length: 6));
+    _assertRecordedRelationForElement(consA_named,
+        IndexConstants.IS_REFERENCED_BY, _expectedLocation(
+            mainElement, '.named(); // marker-main-2', length: 6));
   }
 
   void test_isReferencedBy_ConstructorElement_redirection() {
@@ -665,10 +700,12 @@
     ConstructorElement constructorA_bar =
         findNodeElementAtString("A.bar()", isConstructor);
     // A()
-    _assertRecordedRelation(constructorA, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(constructorA,
+        IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(constructorA_foo, '(); // marker', length: 0));
     // A.foo()
-    _assertRecordedRelation(constructorA_bar, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(constructorA_bar,
+        IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(constructorA, '.bar();', length: 4));
   }
 
@@ -694,17 +731,20 @@
     FieldElement fieldElement = findElement("field");
     PropertyAccessorElement getter = fieldElement.getter;
     PropertyAccessorElement setter = fieldElement.setter;
+    IndexableElement indexableGetter = new IndexableElement(getter);
+    IndexableElement indexableSetter = new IndexableElement(setter);
     // m()
-    _assertRecordedRelation(setter, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexableSetter, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mElement, 'field = 1; // nq'));
-    _assertRecordedRelation(getter, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexableGetter, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mElement, 'field); // nq'));
     // main()
-    _assertRecordedRelation(setter, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexableSetter, IndexConstants.IS_REFERENCED_BY,
         _expectedLocationQ(mainElement, 'field = 2; // q'));
-    _assertRecordedRelation(getter, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexableGetter, IndexConstants.IS_REFERENCED_BY,
         _expectedLocationQ(mainElement, 'field); // q'));
-    _assertRecordedRelation(fieldElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(fieldElement,
+        IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'field: 3'));
   }
 
@@ -719,14 +759,15 @@
     // prepare elements
     FunctionElement element = findElement("foo");
     Element mainElement = findElement("main");
+    IndexableElement indexable = new IndexableElement(element);
     // "referenced" here
-    _assertRecordedRelation(element, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'foo);'));
     // only "invoked", but not "referenced"
     {
-      _assertRecordedRelation(element, IndexConstants.IS_INVOKED_BY,
+      _assertRecordedRelation(indexable, IndexConstants.IS_INVOKED_BY,
           _expectedLocation(mainElement, 'foo());'));
-      _assertNoRecordedRelation(element, IndexConstants.IS_REFERENCED_BY,
+      _assertNoRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
           _expectedLocation(mainElement, 'foo());'));
     }
   }
@@ -741,7 +782,7 @@
     Element aElement = findElement('A');
     Element pElement = findElement('p');
     // verify
-    _assertRecordedRelation(aElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(aElement, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(pElement, 'A p) {'));
   }
 
@@ -761,10 +802,11 @@
     // prepare elements
     Element aElement = findElement('A');
     Element variableElement = findElement('myVariable');
+    IndexableElement indexable = new IndexableElement(aElement);
     // verify
-    _assertRecordedRelation(aElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(testUnitElement, 'A] text'));
-    _assertNoRecordedRelation(aElement, IndexConstants.IS_REFERENCED_BY,
+    _assertNoRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(variableElement, 'A] text'));
   }
 
@@ -786,19 +828,20 @@
     // prepare elements
     ImportElement importElement = testLibraryElement.imports[0];
     Element mainElement = findElement('main');
+    IndexableElement indexable = new IndexableElement(importElement);
     // verify
-    _assertRecordedRelation(importElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'myVar = 1;', length: 0));
-    _assertRecordedRelation(importElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'myFunction();', length: 0));
-    _assertNoRecordedRelation(importElement, IndexConstants.IS_REFERENCED_BY,
+    _assertNoRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'print(0);', length: 0));
     // no references from import combinators
-    _assertNoRecordedRelation(importElement, IndexConstants.IS_REFERENCED_BY,
+    _assertNoRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(testUnitElement, 'myVar, ', length: 0));
-    _assertNoRecordedRelation(importElement, IndexConstants.IS_REFERENCED_BY,
+    _assertNoRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(testUnitElement, 'myFunction hide', length: 0));
-    _assertNoRecordedRelation(importElement, IndexConstants.IS_REFERENCED_BY,
+    _assertNoRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(testUnitElement, 'myToHide;', length: 0));
   }
 
@@ -824,9 +867,11 @@
     ImportElement importElementB = testLibraryElement.imports[1];
     Element mainElement = findElement('main');
     // verify
-    _assertRecordedRelation(importElementA, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(importElementA,
+        IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'pref.myVar = 1;', length: 5));
-    _assertRecordedRelation(importElementB, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(importElementB,
+        IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'pref.MyClass();', length: 5));
   }
 
@@ -851,9 +896,11 @@
     ImportElement importElementB = testLibraryElement.imports[1];
     Element mainElement = findElement('main');
     // verify
-    _assertRecordedRelation(importElementA, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(importElementA,
+        IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'pref.A();', length: 5));
-    _assertRecordedRelation(importElementB, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(importElementB,
+        IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'pref.B();', length: 5));
   }
 
@@ -872,7 +919,8 @@
     ImportElement importElement = testLibraryElement.imports[0];
     Element mainElement = findElement('main');
     // verify
-    _assertRecordedRelation(importElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(importElement,
+        IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'pref.myFunc();', length: 5));
   }
 
@@ -892,7 +940,8 @@
     ImportElement importElement = testLibraryElement.imports[0];
     Element mainElement = findElement('main');
     // verify
-    _assertRecordedRelation(importElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(importElement,
+        IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'pref.A();', length: 5));
   }
 
@@ -940,7 +989,7 @@
     Element mainElement = findElement('main');
     Element element = findElement('L');
     // verify
-    _assertRecordedRelation(element, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(element, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'L;'));
   }
 
@@ -956,7 +1005,8 @@
     testLibraryElement = testUnitElement.library;
     indexDartUnit(store, context, testUnit);
     // verify
-    _assertRecordedRelation(testLibraryElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(testLibraryElement,
+        IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(testUnitElement, "lib;"));
   }
 
@@ -972,10 +1022,11 @@
     // prepare elements
     Element mainElement = findElement("main");
     MethodElement methodElement = findElement("method");
+    IndexableElement indexable = new IndexableElement(methodElement);
     // verify
-    _assertRecordedRelation(methodElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocationQ(mainElement, 'method); // q'));
-    _assertRecordedRelation(methodElement, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'method); // nq'));
   }
 
@@ -990,7 +1041,7 @@
     Element mainElement = findElement('main');
     Element element = findElement('p');
     // verify
-    _assertRecordedRelation(element, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(element, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'p: 1'));
   }
 
@@ -1006,12 +1057,13 @@
     PrefixElement element = findNodeElementAtString('ppp;');
     Element elementA = findElement('a');
     Element elementB = findElement('b');
+    IndexableElement indexable = new IndexableElement(element);
     // verify
-    _assertRecordedRelation(element, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(elementA, 'ppp.Future'));
-    _assertRecordedRelation(element, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(elementB, 'ppp.Stream'));
-    _assertNoRecordedRelation(element, null, _expectedLocation(null, 'ppp;'));
+    _assertNoRecordedRelation(indexable, null, _expectedLocation(null, 'ppp;'));
   }
 
   void test_isReferencedBy_TopLevelVariableElement() {
@@ -1031,16 +1083,18 @@
     // prepare elements
     TopLevelVariableElement variable = importedUnit().topLevelVariables[0];
     Element mainElement = findElement("main");
+    IndexableElement indexableGetter = new IndexableElement(variable.getter);
+    IndexableElement indexableSetter = new IndexableElement(variable.setter);
     // verify
-    _assertRecordedRelation(variable, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(variable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(testUnitElement, 'V; // imp'));
-    _assertRecordedRelation(variable.setter, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexableSetter, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'V = 5; // q'));
-    _assertRecordedRelation(variable.getter, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexableGetter, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'V); // q'));
-    _assertRecordedRelation(variable.setter, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexableSetter, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'V = 5; // nq'));
-    _assertRecordedRelation(variable.getter, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexableGetter, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(mainElement, 'V); // nq'));
   }
 
@@ -1053,7 +1107,8 @@
     Element classElementA = findElement('A');
     Element variableElement = findElement('myVariable');
     // verify
-    _assertRecordedRelation(classElementA, IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelationForElement(classElementA,
+        IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(variableElement, 'A myVariable'));
   }
 
@@ -1071,15 +1126,13 @@
     Element fieldElement = findElement('f');
     Element parameterElement = findElement('p');
     Element variableElement = findElement('v');
+    IndexableElement indexable = new IndexableElement(typeParameterElement);
     // verify
-    _assertRecordedRelation(typeParameterElement,
-        IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(fieldElement, 'T f'));
-    _assertRecordedRelation(typeParameterElement,
-        IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(parameterElement, 'T p'));
-    _assertRecordedRelation(typeParameterElement,
-        IndexConstants.IS_REFERENCED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_REFERENCED_BY,
         _expectedLocation(variableElement, 'T v'));
   }
 
@@ -1095,7 +1148,8 @@
     ConstructorElement constructorElement = classElement.constructors[0];
     FieldElement fieldElement = findElement("field");
     // verify
-    _assertRecordedRelation(fieldElement, IndexConstants.IS_WRITTEN_BY,
+    _assertRecordedRelationForElement(fieldElement,
+        IndexConstants.IS_WRITTEN_BY,
         _expectedLocation(constructorElement, 'field = 5'));
   }
 
@@ -1110,7 +1164,8 @@
     FieldElement fieldElement = findElement("field");
     Element fieldParameterElement = findNodeElementAtString("field);");
     // verify
-    _assertRecordedRelation(fieldElement, IndexConstants.IS_WRITTEN_BY,
+    _assertRecordedRelationForElement(fieldElement,
+        IndexConstants.IS_WRITTEN_BY,
         _expectedLocation(fieldParameterElement, 'field);'));
   }
 
@@ -1123,7 +1178,7 @@
     Element mainElement = findElement("main");
     ParameterElement pElement = findElement("p");
     // verify
-    _assertRecordedRelation(pElement, IndexConstants.IS_WRITTEN_BY,
+    _assertRecordedRelationForElement(pElement, IndexConstants.IS_WRITTEN_BY,
         _expectedLocation(mainElement, 'p = 1'));
   }
 
@@ -1137,7 +1192,7 @@
     Element mainElement = findElement("main");
     LocalVariableElement vElement = findElement("v");
     // verify
-    _assertRecordedRelation(vElement, IndexConstants.IS_WRITTEN_BY,
+    _assertRecordedRelationForElement(vElement, IndexConstants.IS_WRITTEN_BY,
         _expectedLocation(mainElement, 'v = 1'));
   }
 
@@ -1158,15 +1213,15 @@
     // prepare elements
     Element mainElement = findElement('main');
     FieldElement fieldElement = findElement('field');
-    Element nameElement = new NameElement('field');
+    IndexableElement indexable = new IndexableElement(new NameElement('field'));
     // verify
-    _assertRecordedRelation(nameElement, IndexConstants.NAME_IS_DEFINED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.NAME_IS_DEFINED_BY,
         _expectedLocation(fieldElement, 'field;'));
-    _assertRecordedRelation(nameElement, IndexConstants.IS_READ_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_READ_BY,
         _expectedLocationQ(mainElement, 'field); // r'));
-    _assertRecordedRelation(nameElement, IndexConstants.IS_READ_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_READ_BY,
         _expectedLocationQU(mainElement, 'field); // ur'));
-    _assertNoRecordedRelation(nameElement, IndexConstants.IS_READ_BY,
+    _assertNoRecordedRelation(indexable, IndexConstants.IS_READ_BY,
         _expectedLocation(mainElement, 'field); // not a member'));
   }
 
@@ -1181,9 +1236,9 @@
 ''');
     // prepare elements
     LocalVariableElement testElement = findElement('test');
-    Element nameElement = new NameElement('test');
+    IndexableElement indexable = new IndexableElement(new NameElement('test'));
     // verify
-    _assertRecordedRelation(nameElement, IndexConstants.NAME_IS_DEFINED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.NAME_IS_DEFINED_BY,
         _expectedLocation(testElement, 'test in []'));
   }
 
@@ -1200,13 +1255,14 @@
     // prepare elements
     Element mainElement = findElement('main');
     MethodElement methodElement = findElement('method');
-    Element nameElement = new NameElement('method');
+    IndexableElement indexable =
+        new IndexableElement(new NameElement('method'));
     // verify
-    _assertRecordedRelation(nameElement, IndexConstants.NAME_IS_DEFINED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.NAME_IS_DEFINED_BY,
         _expectedLocation(methodElement, 'method() {}'));
-    _assertRecordedRelation(nameElement, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, 'method(); // r'));
-    _assertRecordedRelation(nameElement, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_INVOKED_BY,
         _expectedLocationQU(mainElement, 'method(); // ur'));
   }
 
@@ -1232,23 +1288,23 @@
     // prepare elements
     Element mainElement = findElement('main');
     // binary
-    _assertRecordedRelation(new NameElement('+'), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('+', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, '+ 5', length: 1));
-    _assertRecordedRelation(new NameElement('+'), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('+', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, '+= 5', length: 2));
-    _assertRecordedRelation(new NameElement('=='), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('==', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, '== 5', length: 2));
     // prefix
-    _assertRecordedRelation(new NameElement('+'), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('+', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, '++a', length: 2));
-    _assertRecordedRelation(new NameElement('-'), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('-', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, '--a', length: 2));
-    _assertRecordedRelation(new NameElement('~'), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('~', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, '~a', length: 1));
     // postfix
-    _assertRecordedRelation(new NameElement('+'), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('+', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, '++;', length: 2));
-    _assertRecordedRelation(new NameElement('-'), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('-', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, '--;', length: 2));
   }
 
@@ -1274,23 +1330,23 @@
     // prepare elements
     Element mainElement = findElement('main');
     // binary
-    _assertRecordedRelation(new NameElement('+'), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('+', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQU(mainElement, '+ 5', length: 1));
-    _assertRecordedRelation(new NameElement('+'), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('+', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQU(mainElement, '+= 5', length: 2));
-    _assertRecordedRelation(new NameElement('=='), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('==', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQU(mainElement, '== 5', length: 2));
     // prefix
-    _assertRecordedRelation(new NameElement('+'), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('+', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQU(mainElement, '++a', length: 2));
-    _assertRecordedRelation(new NameElement('-'), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('-', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQU(mainElement, '--a', length: 2));
-    _assertRecordedRelation(new NameElement('~'), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('~', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQU(mainElement, '~a', length: 1));
     // postfix
-    _assertRecordedRelation(new NameElement('+'), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('+', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQU(mainElement, '++;', length: 2));
-    _assertRecordedRelation(new NameElement('-'), IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelationForName('-', IndexConstants.IS_INVOKED_BY,
         _expectedLocationQU(mainElement, '--;', length: 2));
   }
 
@@ -1305,13 +1361,13 @@
 }''');
     // prepare elements
     Element mainElement = findElement("main");
-    Element nameElement = new NameElement('test');
+    IndexableElement indexable = new IndexableElement(new NameElement('test'));
     // verify
-    _assertRecordedRelation(nameElement, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_INVOKED_BY,
         _expectedLocationQ(mainElement, 'test(1)'));
-    _assertRecordedRelation(nameElement, IndexConstants.IS_INVOKED_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_INVOKED_BY,
         _expectedLocationQU(mainElement, 'test(2)'));
-    _assertNoRecordedRelation(nameElement, IndexConstants.IS_READ_BY,
+    _assertNoRecordedRelation(indexable, IndexConstants.IS_READ_BY,
         _expectedLocationQU(mainElement, 'test(2)'));
   }
 
@@ -1326,11 +1382,11 @@
 }''');
     // prepare elements
     Element mainElement = findElement("main");
-    Element nameElement = new NameElement('test');
+    IndexableElement indexable = new IndexableElement(new NameElement('test'));
     // verify
-    _assertRecordedRelation(nameElement, IndexConstants.IS_READ_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_READ_BY,
         _expectedLocationQ(mainElement, 'test); // a'));
-    _assertRecordedRelation(nameElement, IndexConstants.IS_READ_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_READ_BY,
         _expectedLocationQU(mainElement, 'test); // p'));
   }
 
@@ -1345,11 +1401,11 @@
 }''');
     // prepare elements
     Element mainElement = findElement("main");
-    Element nameElement = new NameElement('test');
+    IndexableElement indexable = new IndexableElement(new NameElement('test'));
     // verify
-    _assertRecordedRelation(nameElement, IndexConstants.IS_READ_WRITTEN_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_READ_WRITTEN_BY,
         _expectedLocationQ(mainElement, 'test += 1'));
-    _assertRecordedRelation(nameElement, IndexConstants.IS_READ_WRITTEN_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_READ_WRITTEN_BY,
         _expectedLocationQU(mainElement, 'test += 2'));
   }
 
@@ -1364,11 +1420,11 @@
 }''');
     // prepare elements
     Element mainElement = findElement("main");
-    Element nameElement = new NameElement('test');
+    IndexableElement indexable = new IndexableElement(new NameElement('test'));
     // verify
-    _assertRecordedRelation(nameElement, IndexConstants.IS_WRITTEN_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_WRITTEN_BY,
         _expectedLocationQ(mainElement, 'test = 1'));
-    _assertRecordedRelation(nameElement, IndexConstants.IS_WRITTEN_BY,
+    _assertRecordedRelation(indexable, IndexConstants.IS_WRITTEN_BY,
         _expectedLocationQU(mainElement, 'test = 2'));
   }
 
@@ -1384,7 +1440,7 @@
   void _assertDefinesTopLevelElement(Element element) {
     ExpectedLocation location = new ExpectedLocation(
         element, element.nameOffset, element.name.length, false, true);
-    _assertRecordedRelation(
+    _assertRecordedRelationForElement(
         testLibraryElement, IndexConstants.DEFINES, location);
     expect(recordedTopElements, contains(element));
   }
@@ -1392,11 +1448,11 @@
   /**
    * Asserts that [recordedRelations] has no item with the specified properties.
    */
-  void _assertNoRecordedRelation(Element element, RelationshipImpl relationship,
-      ExpectedLocation location) {
+  void _assertNoRecordedRelation(IndexableObject expectedIndexable,
+      RelationshipImpl relationship, ExpectedLocation location) {
     for (RecordedRelation recordedRelation in recordedRelations) {
       if (_equalsRecordedRelation(
-          recordedRelation, element, relationship, location)) {
+          recordedRelation, expectedIndexable, relationship, location)) {
         fail('not expected: ${recordedRelation} in\n' +
             recordedRelations.join('\n'));
       }
@@ -1404,23 +1460,52 @@
   }
 
   /**
+   * Asserts that [recordedRelations] has no item with the specified properties.
+   */
+  void _assertNoRecordedRelationForElement(Element expectedElement,
+      RelationshipImpl relationship, ExpectedLocation location) {
+    _assertNoRecordedRelation(
+        new IndexableElement(expectedElement), relationship, location);
+  }
+
+  /**
    * Asserts that [recordedRelations] has an item with the expected properties.
    */
-  LocationImpl _assertRecordedRelation(Element expectedElement,
+  LocationImpl _assertRecordedRelation(IndexableObject expectedIndexable,
       RelationshipImpl expectedRelationship,
       ExpectedLocation expectedLocation) {
     for (RecordedRelation recordedRelation in recordedRelations) {
-      if (_equalsRecordedRelation(recordedRelation, expectedElement,
+      if (_equalsRecordedRelation(recordedRelation, expectedIndexable,
           expectedRelationship, expectedLocation)) {
         return recordedRelation.location;
       }
     }
     fail(
-        "not found\n$expectedElement $expectedRelationship " "in $expectedLocation in\n" +
+        "not found\n$expectedIndexable $expectedRelationship " "in $expectedLocation in\n" +
             recordedRelations.join('\n'));
     return null;
   }
 
+  /**
+   * Asserts that [recordedRelations] has an item with the expected properties.
+   */
+  LocationImpl _assertRecordedRelationForElement(Element expectedElement,
+      RelationshipImpl expectedRelationship,
+      ExpectedLocation expectedLocation) {
+    return _assertRecordedRelation(new IndexableElement(expectedElement),
+        expectedRelationship, expectedLocation);
+  }
+
+  /**
+   * Asserts that [recordedRelations] has an item with the expected properties.
+   */
+  LocationImpl _assertRecordedRelationForName(String expectedName,
+      RelationshipImpl expectedRelationship,
+      ExpectedLocation expectedLocation) {
+    _assertRecordedRelationForElement(
+        new NameElement(expectedName), expectedRelationship, expectedLocation);
+  }
+
   ExpectedLocation _expectedLocation(Element element, String search,
       {int length: -1, bool isQualified: false, bool isResolved: true}) {
     int offset = findOffset(search);
@@ -1474,15 +1559,15 @@
  * Information about a relation recorded into {@link IndexStore}.
  */
 class RecordedRelation {
-  final Element element;
+  final IndexableObject indexable;
   final RelationshipImpl relationship;
   final LocationImpl location;
 
-  RecordedRelation(this.element, this.relationship, this.location);
+  RecordedRelation(this.indexable, this.relationship, this.location);
 
   @override
   String toString() {
-    return 'RecordedRelation(element=$element; relationship=$relationship; '
+    return 'RecordedRelation(indexable=$indexable; relationship=$relationship; '
         'location=$location; flags=' '${location.isQualified ? "Q" : ""}'
         '${location.isResolved ? "R" : ""})';
   }
diff --git a/pkg/analysis_server/test/services/index/store/codec_test.dart b/pkg/analysis_server/test/services/index/store/codec_test.dart
index 7c134ed..3c0eb1a 100644
--- a/pkg/analysis_server/test/services/index/store/codec_test.dart
+++ b/pkg/analysis_server/test/services/index/store/codec_test.dart
@@ -4,7 +4,9 @@
 
 library test.services.src.index.store.codec;
 
+import 'package:analysis_server/analysis/index/index_core.dart';
 import 'package:analysis_server/src/services/index/index.dart';
+import 'package:analysis_server/src/services/index/indexable_element.dart';
 import 'package:analysis_server/src/services/index/store/codec.dart';
 import 'package:analyzer/src/generated/element.dart';
 import 'package:analyzer/src/generated/engine.dart';
@@ -83,29 +85,27 @@
     {
       Element element = testLibraryElement.definingCompilationUnit;
       expect(element.source.fullName, '/test.dart');
-      int id1 = codec.encode1(element);
-      int id2 = codec.encode2(element);
-      int id3 = codec.encode3(element);
+      IndexableObject indexable = new IndexableElement(element);
+      int id1 = codec.encode1(indexable);
+      int id2 = codec.encode2(indexable);
+      int id3 = codec.encode3(indexable);
       expect(id1, isNonNegative);
-      expect(id2, element.nameOffset);
-      expect(id3, ElementKind.COMPILATION_UNIT.ordinal);
-      // decode
-      Element element2 = codec.decode(context, id1, id2, id3);
-      expect(element2, element);
+      expect(id2, isNonNegative);
+      expect(id3, IndexableElementKind.forElement(element).index);
+      validateDecode(id1, id2, id3, element);
     }
     // part
     {
       Element element = testLibraryElement.parts[0];
       expect(element.source.fullName, '/my_part.dart');
-      int id1 = codec.encode1(element);
-      int id2 = codec.encode2(element);
-      int id3 = codec.encode3(element);
+      IndexableObject indexable = new IndexableElement(element);
+      int id1 = codec.encode1(indexable);
+      int id2 = codec.encode2(indexable);
+      int id3 = codec.encode3(indexable);
       expect(id1, isNonNegative);
-      expect(id2, element.nameOffset);
-      expect(id3, ElementKind.COMPILATION_UNIT.ordinal);
-      // decode
-      Element element2 = codec.decode(context, id1, id2, id3);
-      expect(element2, element);
+      expect(id2, isNonNegative);
+      expect(id3, IndexableElementKind.forElement(element).index);
+      validateDecode(id1, id2, id3, element);
     }
   }
 
@@ -117,15 +117,14 @@
 ''');
     ClassElement classA = findElement('A');
     ConstructorElement element = classA.constructors[0];
-    int id1 = codec.encode1(element);
-    int id2 = codec.encode2(element);
-    int id3 = codec.encode3(element);
+    IndexableObject indexable = new IndexableElement(element);
+    int id1 = codec.encode1(indexable);
+    int id2 = codec.encode2(indexable);
+    int id3 = codec.encode3(indexable);
     expect(id1, isNonNegative);
     expect(id2, classA.nameOffset);
-    expect(id3, -100);
-    // decode
-    Element element2 = codec.decode(context, id1, id2, id3);
-    expect(element2, element);
+    expect(id3, IndexableElementKind.forElement(element).index);
+    validateDecode(id1, id2, id3, element);
   }
 
   void test_encode_ConstructorElement_default_synthetic() {
@@ -135,15 +134,14 @@
 ''');
     ClassElement classA = findElement('A');
     ConstructorElement element = classA.constructors[0];
-    int id1 = codec.encode1(element);
-    int id2 = codec.encode2(element);
-    int id3 = codec.encode3(element);
+    IndexableObject indexable = new IndexableElement(element);
+    int id1 = codec.encode1(indexable);
+    int id2 = codec.encode2(indexable);
+    int id3 = codec.encode3(indexable);
     expect(id1, isNonNegative);
     expect(id2, classA.nameOffset);
-    expect(id3, -100);
-    // decode
-    Element element2 = codec.decode(context, id1, id2, id3);
-    expect(element2, element);
+    expect(id3, IndexableElementKind.forElement(element).index);
+    validateDecode(id1, id2, id3, element);
   }
 
   void test_encode_ConstructorElement_named_real() {
@@ -157,28 +155,26 @@
     // A.aaa()
     {
       ConstructorElement element = classA.getNamedConstructor('aaa');
-      int id1 = codec.encode1(element);
-      int id2 = codec.encode2(element);
-      int id3 = codec.encode3(element);
+      IndexableObject indexable = new IndexableElement(element);
+      int id1 = codec.encode1(indexable);
+      int id2 = codec.encode2(indexable);
+      int id3 = codec.encode3(indexable);
       expect(id1, isNonNegative);
       expect(id2, classA.nameOffset);
-      expect(id3, -100);
-      // decode
-      Element element2 = codec.decode(context, id1, id2, id3);
-      expect(element2, element);
+      expect(id3, IndexableElementKind.forElement(element).index);
+      validateDecode(id1, id2, id3, element);
     }
     // A.bbb()
     {
       ConstructorElement element = classA.getNamedConstructor('bbb');
-      int id1 = codec.encode1(element);
-      int id2 = codec.encode2(element);
-      int id3 = codec.encode3(element);
+      IndexableObject indexable = new IndexableElement(element);
+      int id1 = codec.encode1(indexable);
+      int id2 = codec.encode2(indexable);
+      int id3 = codec.encode3(indexable);
       expect(id1, isNonNegative);
       expect(id2, classA.nameOffset);
-      expect(id3, -101);
-      // decode
-      Element element2 = codec.decode(context, id1, id2, id3);
-      expect(element2, element);
+      expect(id3, IndexableElementKind.forElement(element).index);
+      validateDecode(id1, id2, id3, element);
     }
   }
 
@@ -195,28 +191,26 @@
     // X.aaa()
     {
       ConstructorElement element = classX.getNamedConstructor('aaa');
-      int id1 = codec.encode1(element);
-      int id2 = codec.encode2(element);
-      int id3 = codec.encode3(element);
+      IndexableObject indexable = new IndexableElement(element);
+      int id1 = codec.encode1(indexable);
+      int id2 = codec.encode2(indexable);
+      int id3 = codec.encode3(indexable);
       expect(id1, isNonNegative);
       expect(id2, classX.nameOffset);
-      expect(id3, -100);
-      // decode
-      Element element2 = codec.decode(context, id1, id2, id3);
-      expect(element2, element);
+      expect(id3, IndexableElementKind.forElement(element).index);
+      validateDecode(id1, id2, id3, element);
     }
     // X.bbb()
     {
       ConstructorElement element = classX.getNamedConstructor('bbb');
-      int id1 = codec.encode1(element);
-      int id2 = codec.encode2(element);
-      int id3 = codec.encode3(element);
+      IndexableObject indexable = new IndexableElement(element);
+      int id1 = codec.encode1(indexable);
+      int id2 = codec.encode2(indexable);
+      int id3 = codec.encode3(indexable);
       expect(id1, isNonNegative);
       expect(id2, classX.nameOffset);
-      expect(id3, -101);
-      // decode
-      Element element2 = codec.decode(context, id1, id2, id3);
-      expect(element2, element);
+      expect(id3, IndexableElementKind.forElement(element).index);
+      validateDecode(id1, id2, id3, element);
     }
   }
 
@@ -227,15 +221,14 @@
 }
 ''');
     PropertyAccessorElement element = findElement('test', ElementKind.GETTER);
-    int id1 = codec.encode1(element);
-    int id2 = codec.encode2(element);
-    int id3 = codec.encode3(element);
+    IndexableObject indexable = new IndexableElement(element);
+    int id1 = codec.encode1(indexable);
+    int id2 = codec.encode2(indexable);
+    int id3 = codec.encode3(indexable);
     expect(id1, isNonNegative);
     expect(id2, element.nameOffset);
-    expect(id3, ElementKind.GETTER.ordinal);
-    // decode
-    Element element2 = codec.decode(context, id1, id2, id3);
-    expect(element2, element);
+    expect(id3, IndexableElementKind.forElement(element).index);
+    validateDecode(id1, id2, id3, element);
   }
 
   void test_encode_getter_synthetic() {
@@ -246,15 +239,14 @@
 ''');
     FieldElement field = findElement('test', ElementKind.FIELD);
     PropertyAccessorElement element = field.getter;
-    int id1 = codec.encode1(element);
-    int id2 = codec.encode2(element);
-    int id3 = codec.encode3(element);
+    IndexableObject indexable = new IndexableElement(element);
+    int id1 = codec.encode1(indexable);
+    int id2 = codec.encode2(indexable);
+    int id3 = codec.encode3(indexable);
     expect(id1, isNonNegative);
     expect(id2, element.nameOffset);
-    expect(id3, ElementKind.GETTER.ordinal);
-    // decode
-    Element element2 = codec.decode(context, id1, id2, id3);
-    expect(element2, element);
+    expect(id3, IndexableElementKind.forElement(element).index);
+    validateDecode(id1, id2, id3, element);
   }
 
   void test_encode_LibraryElement() {
@@ -264,15 +256,14 @@
 }
 ''');
     Element element = testLibraryElement;
-    int id1 = codec.encode1(element);
-    int id2 = codec.encode2(element);
-    int id3 = codec.encode3(element);
+    IndexableObject indexable = new IndexableElement(element);
+    int id1 = codec.encode1(indexable);
+    int id2 = codec.encode2(indexable);
+    int id3 = codec.encode3(indexable);
     expect(id1, isNonNegative);
-    expect(id2, element.nameOffset);
-    expect(id3, ElementKind.LIBRARY.ordinal);
-    // decode
-    Element element2 = codec.decode(context, id1, id2, id3);
-    expect(element2, element);
+    expect(id2, isNonNegative);
+    expect(id3, IndexableElementKind.forElement(element).index);
+    validateDecode(id1, id2, id3, element);
   }
 
   void test_encode_MethodElement() {
@@ -282,25 +273,25 @@
 }
 ''');
     Element element = findElement('test');
-    int id1 = codec.encode1(element);
-    int id2 = codec.encode2(element);
-    int id3 = codec.encode3(element);
+    IndexableObject indexable = new IndexableElement(element);
+    int id1 = codec.encode1(indexable);
+    int id2 = codec.encode2(indexable);
+    int id3 = codec.encode3(indexable);
     expect(id1, isNonNegative);
     expect(id2, element.nameOffset);
-    expect(id3, ElementKind.METHOD.ordinal);
-    // decode
-    Element element2 = codec.decode(context, id1, id2, id3);
-    expect(element2, element);
+    expect(id3, IndexableElementKind.forElement(element).index);
+    validateDecode(id1, id2, id3, element);
   }
 
   void test_encode_NameElement() {
     Element element = new NameElement('test');
-    int id1 = codec.encode1(element);
-    int id2 = codec.encode2(element);
-    int id3 = codec.encode3(element);
+    IndexableObject indexable = new IndexableElement(element);
+    int id1 = codec.encode1(indexable);
+    int id2 = codec.encode2(indexable);
+    int id3 = codec.encode3(indexable);
     expect(id1, -1);
     expect(id2, isNonNegative);
-    expect(id3, ElementKind.NAME.ordinal);
+    expect(id3, IndexableElementKind.forElement(element).index);
   }
 
   void test_encode_nullLibraryElement() {
@@ -308,13 +299,13 @@
 test() {}
 ''');
     Element element = findElement('test');
-    int id1 = codec.encode1(element);
-    int id2 = codec.encode2(element);
-    int id3 = codec.encode3(element);
+    IndexableObject indexable = new IndexableElement(element);
+    int id1 = codec.encode1(indexable);
+    int id2 = codec.encode2(indexable);
+    int id3 = codec.encode3(indexable);
     context.setContents(testSource, '');
-    // decode
-    Element element2 = codec.decode(context, id1, id2, id3);
-    expect(element2, isNull);
+    IndexableObject object2 = codec.decode(context, id1, id2, id3);
+    expect(object2, isNull);
   }
 
   void test_encode_setter_real() {
@@ -324,15 +315,14 @@
 }
 ''');
     PropertyAccessorElement element = findElement('test=', ElementKind.SETTER);
-    int id1 = codec.encode1(element);
-    int id2 = codec.encode2(element);
-    int id3 = codec.encode3(element);
+    IndexableObject indexable = new IndexableElement(element);
+    int id1 = codec.encode1(indexable);
+    int id2 = codec.encode2(indexable);
+    int id3 = codec.encode3(indexable);
     expect(id1, isNonNegative);
     expect(id2, element.nameOffset);
-    expect(id3, ElementKind.SETTER.ordinal);
-    // decode
-    Element element2 = codec.decode(context, id1, id2, id3);
-    expect(element2, element);
+    expect(id3, IndexableElementKind.forElement(element).index);
+    validateDecode(id1, id2, id3, element);
   }
 
   void test_encode_setter_synthetic() {
@@ -343,15 +333,14 @@
 ''');
     FieldElement field = findElement('test', ElementKind.FIELD);
     PropertyAccessorElement element = field.setter;
-    int id1 = codec.encode1(element);
-    int id2 = codec.encode2(element);
-    int id3 = codec.encode3(element);
+    IndexableObject indexable = new IndexableElement(element);
+    int id1 = codec.encode1(indexable);
+    int id2 = codec.encode2(indexable);
+    int id3 = codec.encode3(indexable);
     expect(id1, isNonNegative);
     expect(id2, element.nameOffset);
-    expect(id3, ElementKind.SETTER.ordinal);
-    // decode
-    Element element2 = codec.decode(context, id1, id2, id3);
-    expect(element2, element);
+    expect(id3, IndexableElementKind.forElement(element).index);
+    validateDecode(id1, id2, id3, element);
   }
 
   void test_encodeHash_notLocal() {
@@ -371,12 +360,19 @@
     Element fooA = mainA.localVariables[0];
     Element fooB = mainB.localVariables[0];
     Element bar = mainB.localVariables[1];
-    int id_fooA = codec.encodeHash(fooA);
-    int id_fooB = codec.encodeHash(fooB);
-    int id_bar = codec.encodeHash(bar);
+    int id_fooA = codec.encodeHash(new IndexableElement(fooA));
+    int id_fooB = codec.encodeHash(new IndexableElement(fooB));
+    int id_bar = codec.encodeHash(new IndexableElement(bar));
     expect(id_fooA == id_fooB, isTrue);
     expect(id_fooA == id_bar, isFalse);
   }
+
+  void validateDecode(int id1, int id2, int id3, Element element) {
+    IndexableObject object2 = codec.decode(context, id1, id2, id3);
+    expect(object2, new isInstanceOf<IndexableElement>());
+    Element element2 = (object2 as IndexableElement).element;
+    expect(element2, element);
+  }
 }
 
 @reflectiveTest
diff --git a/pkg/analysis_server/test/services/index/store/split_store_test.dart b/pkg/analysis_server/test/services/index/store/split_store_test.dart
index a5e1943..02fa3fe 100644
--- a/pkg/analysis_server/test/services/index/store/split_store_test.dart
+++ b/pkg/analysis_server/test/services/index/store/split_store_test.dart
@@ -6,7 +6,9 @@
 
 import 'dart:async';
 
+import 'package:analysis_server/analysis/index/index_core.dart';
 import 'package:analysis_server/src/services/index/index.dart';
+import 'package:analysis_server/src/services/index/indexable_element.dart';
 import 'package:analysis_server/src/services/index/store/codec.dart';
 import 'package:analysis_server/src/services/index/store/memory_node_manager.dart';
 import 'package:analysis_server/src/services/index/store/split_store.dart';
@@ -30,11 +32,10 @@
   defineReflectiveTests(_SplitIndexStoreTest);
 }
 
-void _assertHasLocation(
-    List<LocationImpl> locations, Element element, int offset, int length,
-    {bool isQualified: false, bool isResolved: true}) {
+void _assertHasLocation(List<LocationImpl> locations, IndexableElement element,
+    int offset, int length, {bool isQualified: false, bool isResolved: true}) {
   for (LocationImpl location in locations) {
-    if ((element == null || location.element == element) &&
+    if ((element == null || location.indexable == element) &&
         location.offset == offset &&
         location.length == length &&
         location.isQualified == isQualified &&
@@ -46,8 +47,8 @@
       '(element=$element, offset=$offset, length=$length)');
 }
 
-void _assertHasLocationQ(
-    List<LocationImpl> locations, Element element, int offset, int length) {
+void _assertHasLocationQ(List<LocationImpl> locations, IndexableElement element,
+    int offset, int length) {
   _assertHasLocation(locations, element, offset, length, isQualified: true);
 }
 
@@ -164,9 +165,9 @@
       bytes = bs;
     });
     // prepare elements
-    Element elementA = _mockElement();
-    Element elementB = _mockElement();
-    Element elementC = _mockElement();
+    IndexableElement elementA = _mockElement();
+    IndexableElement elementB = _mockElement();
+    IndexableElement elementC = _mockElement();
     RelationshipImpl relationship =
         RelationshipImpl.getRelationship('my-relationship');
     // put Node
@@ -233,16 +234,17 @@
     verify(fileManager.delete(name)).once();
   }
 
-  Element _mockElement() {
+  IndexableElement _mockElement() {
     int id1 = nextElementId++;
     int id2 = nextElementId++;
     int id3 = nextElementId++;
     Element element = new MockElement();
-    when(elementCodec.encode1(element)).thenReturn(id1);
-    when(elementCodec.encode2(element)).thenReturn(id2);
-    when(elementCodec.encode3(element)).thenReturn(id3);
-    when(elementCodec.decode(context, id1, id2, id3)).thenReturn(element);
-    return element;
+    IndexableObject indexable = new IndexableElement(element);
+    when(elementCodec.encode1(indexable)).thenReturn(id1);
+    when(elementCodec.encode2(indexable)).thenReturn(id2);
+    when(elementCodec.encode3(indexable)).thenReturn(id3);
+    when(elementCodec.decode(context, id1, id2, id3)).thenReturn(indexable);
+    return indexable;
   }
 }
 
@@ -265,9 +267,9 @@
   }
 
   void test_recordRelationship() {
-    Element elementA = _mockElement();
-    Element elementB = _mockElement();
-    Element elementC = _mockElement();
+    IndexableElement elementA = _mockElement();
+    IndexableElement elementB = _mockElement();
+    IndexableElement elementC = _mockElement();
     RelationshipImpl relationship =
         RelationshipImpl.getRelationship('my-relationship');
     LocationImpl locationA = new LocationImpl(elementB, 1, 2);
@@ -298,9 +300,9 @@
   }
 
   void test_setRelations() {
-    Element elementA = _mockElement();
-    Element elementB = _mockElement();
-    Element elementC = _mockElement();
+    IndexableElement elementA = _mockElement();
+    IndexableElement elementB = _mockElement();
+    IndexableElement elementC = _mockElement();
     RelationshipImpl relationship =
         RelationshipImpl.getRelationship('my-relationship');
     // record
@@ -322,16 +324,17 @@
     _assertHasLocationQ(locations, elementC, 2, 20);
   }
 
-  Element _mockElement() {
+  IndexableElement _mockElement() {
     int id1 = nextElementId++;
     int id2 = nextElementId++;
     int id3 = nextElementId++;
     Element element = new MockElement();
-    when(elementCodec.encode1(element)).thenReturn(id1);
-    when(elementCodec.encode2(element)).thenReturn(id2);
-    when(elementCodec.encode3(element)).thenReturn(id3);
-    when(elementCodec.decode(context, id1, id2, id3)).thenReturn(element);
-    return element;
+    IndexableElement indexable = new IndexableElement(element);
+    when(elementCodec.encode1(indexable)).thenReturn(id1);
+    when(elementCodec.encode2(indexable)).thenReturn(id2);
+    when(elementCodec.encode3(indexable)).thenReturn(id3);
+    when(elementCodec.decode(context, id1, id2, id3)).thenReturn(indexable);
+    return indexable;
   }
 }
 
@@ -343,10 +346,11 @@
 
   void test_newForData() {
     Element element = new MockElement();
-    when(elementCodec.decode(context, 11, 12, 13)).thenReturn(element);
+    IndexableElement indexable = new IndexableElement(element);
+    when(elementCodec.decode(context, 11, 12, 13)).thenReturn(indexable);
     LocationData locationData = new LocationData.forData(11, 12, 13, 1, 2, 0);
     LocationImpl location = locationData.getLocation(context, elementCodec);
-    expect(location.element, element);
+    expect(location.indexable, indexable);
     expect(location.offset, 1);
     expect(location.length, 2);
     expect(location.isQualified, isFalse);
@@ -356,12 +360,13 @@
   void test_newForObject() {
     // prepare Element
     Element element = new MockElement();
-    when(elementCodec.encode1(element)).thenReturn(11);
-    when(elementCodec.encode2(element)).thenReturn(12);
-    when(elementCodec.encode3(element)).thenReturn(13);
-    when(elementCodec.decode(context, 11, 12, 13)).thenReturn(element);
+    IndexableElement indexable = new IndexableElement(element);
+    when(elementCodec.encode1(indexable)).thenReturn(11);
+    when(elementCodec.encode2(indexable)).thenReturn(12);
+    when(elementCodec.encode3(indexable)).thenReturn(13);
+    when(elementCodec.decode(context, 11, 12, 13)).thenReturn(indexable);
     // create
-    LocationImpl location = new LocationImpl(element, 1, 2);
+    LocationImpl location = new LocationImpl(indexable, 1, 2);
     LocationData locationData =
         new LocationData.forObject(elementCodec, location);
     // touch 'hashCode'
@@ -373,7 +378,7 @@
     {
       LocationImpl newLocation =
           locationData.getLocation(context, elementCodec);
-      expect(newLocation.element, element);
+      expect(newLocation.indexable, indexable);
       expect(newLocation.offset, 1);
       expect(newLocation.length, 2);
     }
@@ -398,7 +403,7 @@
 
   @override
   int get hashCode {
-    return 31 * (31 * location.element.hashCode + location.offset) +
+    return 31 * (31 * location.indexable.hashCode + location.offset) +
         location.length;
   }
 
@@ -407,7 +412,7 @@
     if (other is _LocationEqualsWrapper) {
       return other.location.offset == location.offset &&
           other.location.length == location.length &&
-          other.location.element == location.element;
+          other.location.indexable == location.indexable;
     }
     return false;
   }
@@ -439,15 +444,16 @@
 
   void test_newFromObjects() {
     // prepare Element
-    Element element;
+    IndexableElement indexable;
     {
-      element = new MockElement();
+      Element element = new MockElement();
+      indexable = new IndexableElement(element);
       ElementLocation location = new ElementLocationImpl.con3(['foo', 'bar']);
       when(element.location).thenReturn(location);
-      when(context.getElement(location)).thenReturn(element);
-      when(elementCodec.encode1(element)).thenReturn(11);
-      when(elementCodec.encode2(element)).thenReturn(12);
-      when(elementCodec.encode3(element)).thenReturn(13);
+      when(context.getElement(location)).thenReturn(indexable);
+      when(elementCodec.encode1(indexable)).thenReturn(11);
+      when(elementCodec.encode2(indexable)).thenReturn(12);
+      when(elementCodec.encode3(indexable)).thenReturn(13);
     }
     // prepare relationship
     RelationshipImpl relationship =
@@ -456,7 +462,7 @@
     when(relationshipCodec.encode(relationship)).thenReturn(relationshipId);
     // create RelationKeyData
     RelationKeyData keyData = new RelationKeyData.forObject(
-        elementCodec, relationshipCodec, element, relationship);
+        elementCodec, relationshipCodec, indexable, relationship);
     // touch
     keyData.hashCode;
     // equals
@@ -479,6 +485,11 @@
   Element elementC = new MockElement('elementC');
   Element elementD = new MockElement('elementD');
 
+  IndexableElement indexableA;
+  IndexableElement indexableB;
+  IndexableElement indexableC;
+  IndexableElement indexableD;
+
   HtmlElement htmlElementA = new MockHtmlElement();
   HtmlElement htmlElementB = new MockHtmlElement();
   LibraryElement libraryElement = new MockLibraryElement();
@@ -499,24 +510,29 @@
   CompilationUnitElement unitElementD = new MockCompilationUnitElement();
 
   void setUp() {
+    indexableA = new IndexableElement(elementA);
+    indexableB = new IndexableElement(elementB);
+    indexableC = new IndexableElement(elementC);
+    indexableD = new IndexableElement(elementD);
+
     nodeManager.elementCodec = elementCodec;
     store = new SplitIndexStore(nodeManager);
-    when(elementCodec.encode1(elementA)).thenReturn(11);
-    when(elementCodec.encode2(elementA)).thenReturn(12);
-    when(elementCodec.encode3(elementA)).thenReturn(13);
-    when(elementCodec.encode1(elementB)).thenReturn(21);
-    when(elementCodec.encode2(elementB)).thenReturn(22);
-    when(elementCodec.encode3(elementB)).thenReturn(23);
-    when(elementCodec.encode1(elementC)).thenReturn(31);
-    when(elementCodec.encode2(elementC)).thenReturn(32);
-    when(elementCodec.encode3(elementC)).thenReturn(33);
-    when(elementCodec.encode1(elementD)).thenReturn(41);
-    when(elementCodec.encode2(elementD)).thenReturn(42);
-    when(elementCodec.encode3(elementD)).thenReturn(43);
-    when(elementCodec.decode(contextA, 11, 12, 13)).thenReturn(elementA);
-    when(elementCodec.decode(contextA, 21, 22, 23)).thenReturn(elementB);
-    when(elementCodec.decode(contextA, 31, 32, 33)).thenReturn(elementC);
-    when(elementCodec.decode(contextA, 41, 42, 43)).thenReturn(elementD);
+    when(elementCodec.encode1(indexableA)).thenReturn(11);
+    when(elementCodec.encode2(indexableA)).thenReturn(12);
+    when(elementCodec.encode3(indexableA)).thenReturn(13);
+    when(elementCodec.encode1(indexableB)).thenReturn(21);
+    when(elementCodec.encode2(indexableB)).thenReturn(22);
+    when(elementCodec.encode3(indexableB)).thenReturn(23);
+    when(elementCodec.encode1(indexableC)).thenReturn(31);
+    when(elementCodec.encode2(indexableC)).thenReturn(32);
+    when(elementCodec.encode3(indexableC)).thenReturn(33);
+    when(elementCodec.encode1(indexableD)).thenReturn(41);
+    when(elementCodec.encode2(indexableD)).thenReturn(42);
+    when(elementCodec.encode3(indexableD)).thenReturn(43);
+    when(elementCodec.decode(contextA, 11, 12, 13)).thenReturn(indexableA);
+    when(elementCodec.decode(contextA, 21, 22, 23)).thenReturn(indexableB);
+    when(elementCodec.decode(contextA, 31, 32, 33)).thenReturn(indexableC);
+    when(elementCodec.decode(contextA, 41, 42, 43)).thenReturn(indexableD);
     when(contextA.isDisposed).thenReturn(false);
     when(contextB.isDisposed).thenReturn(false);
     when(contextC.isDisposed).thenReturn(false);
@@ -571,28 +587,28 @@
       store.doneIndex();
     }
     return store
-        .getRelationships(elementA, relationship)
+        .getRelationships(indexableA, relationship)
         .then((List<LocationImpl> locations) {
       assertLocations(locations, []);
     });
   }
 
   test_aboutToIndexDart_library_secondWithoutOneUnit() {
-    LocationImpl locationA = mockLocation(elementA);
-    LocationImpl locationB = mockLocation(elementB);
+    LocationImpl locationA = mockLocation(indexableA);
+    LocationImpl locationB = mockLocation(indexableB);
     {
       store.aboutToIndexDart(contextA, unitElementA);
-      store.recordRelationship(elementA, relationship, locationA);
+      store.recordRelationship(indexableA, relationship, locationA);
       store.doneIndex();
     }
     {
       store.aboutToIndexDart(contextA, unitElementB);
-      store.recordRelationship(elementA, relationship, locationB);
+      store.recordRelationship(indexableA, relationship, locationB);
       store.doneIndex();
     }
     // "A" and "B" locations
     return store
-        .getRelationships(elementA, relationship)
+        .getRelationships(indexableA, relationship)
         .then((List<LocationImpl> locations) {
       assertLocations(locations, [locationA, locationB]);
       // apply "libraryUnitElement", only with "B"
@@ -603,7 +619,7 @@
       }
     }).then((_) {
       return store
-          .getRelationships(elementA, relationship)
+          .getRelationships(indexableA, relationship)
           .then((List<LocationImpl> locations) {
         assertLocations(locations, [locationB]);
       });
@@ -625,21 +641,21 @@
   }
 
   test_aboutToIndexHtml_() {
-    LocationImpl locationA = mockLocation(elementA);
-    LocationImpl locationB = mockLocation(elementB);
+    LocationImpl locationA = mockLocation(indexableA);
+    LocationImpl locationB = mockLocation(indexableB);
     {
       store.aboutToIndexHtml(contextA, htmlElementA);
-      store.recordRelationship(elementA, relationship, locationA);
+      store.recordRelationship(indexableA, relationship, locationA);
       store.doneIndex();
     }
     {
       store.aboutToIndexHtml(contextA, htmlElementB);
-      store.recordRelationship(elementA, relationship, locationB);
+      store.recordRelationship(indexableA, relationship, locationB);
       store.doneIndex();
     }
     // "A" and "B" locations
     return store
-        .getRelationships(elementA, relationship)
+        .getRelationships(indexableA, relationship)
         .then((List<LocationImpl> locations) {
       assertLocations(locations, [locationA, locationB]);
     });
@@ -651,9 +667,9 @@
   }
 
   void test_clear() {
-    LocationImpl locationA = mockLocation(elementA);
+    LocationImpl locationA = mockLocation(indexableA);
     store.aboutToIndexDart(contextA, unitElementA);
-    store.recordRelationship(elementA, relationship, locationA);
+    store.recordRelationship(indexableA, relationship, locationA);
     store.doneIndex();
     expect(nodeManager.isEmpty(), isFalse);
     // clear
@@ -663,7 +679,7 @@
 
   test_getRelationships_empty() {
     return store
-        .getRelationships(elementA, relationship)
+        .getRelationships(indexableA, relationship)
         .then((List<LocationImpl> locations) {
       expect(locations, isEmpty);
     });
@@ -677,16 +693,16 @@
       expect(statistics, contains('0 sources'));
     }
     // add 2 locations
-    LocationImpl locationA = mockLocation(elementA);
-    LocationImpl locationB = mockLocation(elementB);
+    LocationImpl locationA = mockLocation(indexableA);
+    LocationImpl locationB = mockLocation(indexableB);
     {
       store.aboutToIndexDart(contextA, unitElementA);
-      store.recordRelationship(elementA, relationship, locationA);
+      store.recordRelationship(indexableA, relationship, locationA);
       store.doneIndex();
     }
     {
       store.aboutToIndexDart(contextA, unitElementB);
-      store.recordRelationship(elementA, relationship, locationB);
+      store.recordRelationship(indexableA, relationship, locationB);
       store.doneIndex();
     }
     {
@@ -699,94 +715,95 @@
   void test_recordRelationship_multiplyDefinedElement() {
     Element multiplyElement =
         new MultiplyDefinedElementImpl(contextA, <Element>[elementA, elementB]);
-    LocationImpl location = mockLocation(elementA);
-    store.recordRelationship(multiplyElement, relationship, location);
+    LocationImpl location = mockLocation(indexableA);
+    store.recordRelationship(
+        new IndexableElement(multiplyElement), relationship, location);
     store.doneIndex();
     expect(nodeManager.isEmpty(), isTrue);
   }
 
   void test_recordRelationship_nullElement() {
-    LocationImpl locationA = mockLocation(elementA);
+    LocationImpl locationA = mockLocation(indexableA);
     store.recordRelationship(null, relationship, locationA);
     store.doneIndex();
     expect(nodeManager.isEmpty(), isTrue);
   }
 
   void test_recordRelationship_nullLocation() {
-    store.recordRelationship(elementA, relationship, null);
+    store.recordRelationship(indexableA, relationship, null);
     store.doneIndex();
     expect(nodeManager.isEmpty(), isTrue);
   }
 
   test_recordRelationship_oneElement_twoNodes() {
-    LocationImpl locationA = mockLocation(elementA);
-    LocationImpl locationB = mockLocation(elementB);
+    LocationImpl locationA = mockLocation(indexableA);
+    LocationImpl locationB = mockLocation(indexableB);
     {
       store.aboutToIndexDart(contextA, unitElementA);
-      store.recordRelationship(elementA, relationship, locationA);
+      store.recordRelationship(indexableA, relationship, locationA);
       store.doneIndex();
     }
     {
       store.aboutToIndexDart(contextA, unitElementB);
-      store.recordRelationship(elementA, relationship, locationB);
+      store.recordRelationship(indexableA, relationship, locationB);
       store.doneIndex();
     }
     return store
-        .getRelationships(elementA, relationship)
+        .getRelationships(indexableA, relationship)
         .then((List<LocationImpl> locations) {
       assertLocations(locations, [locationA, locationB]);
     });
   }
 
   test_recordRelationship_oneLocation() {
-    LocationImpl locationA = mockLocation(elementA);
+    LocationImpl locationA = mockLocation(indexableA);
     store.aboutToIndexDart(contextA, unitElementA);
-    store.recordRelationship(elementA, relationship, locationA);
+    store.recordRelationship(indexableA, relationship, locationA);
     store.doneIndex();
     return store
-        .getRelationships(elementA, relationship)
+        .getRelationships(indexableA, relationship)
         .then((List<LocationImpl> locations) {
       assertLocations(locations, [locationA]);
     });
   }
 
   test_recordRelationship_twoLocations() {
-    LocationImpl locationA = mockLocation(elementA);
-    LocationImpl locationB = mockLocation(elementA);
+    LocationImpl locationA = mockLocation(indexableA);
+    LocationImpl locationB = mockLocation(indexableA);
     store.aboutToIndexDart(contextA, unitElementA);
-    store.recordRelationship(elementA, relationship, locationA);
-    store.recordRelationship(elementA, relationship, locationB);
+    store.recordRelationship(indexableA, relationship, locationA);
+    store.recordRelationship(indexableA, relationship, locationB);
     store.doneIndex();
     return store
-        .getRelationships(elementA, relationship)
+        .getRelationships(indexableA, relationship)
         .then((List<LocationImpl> locations) {
       assertLocations(locations, [locationA, locationB]);
     });
   }
 
   test_removeContext() {
-    LocationImpl locationA = mockLocation(elementA);
-    LocationImpl locationB = mockLocation(elementB);
+    LocationImpl locationA = mockLocation(indexableA);
+    LocationImpl locationB = mockLocation(indexableB);
     {
       store.aboutToIndexDart(contextA, unitElementA);
-      store.recordRelationship(elementA, relationship, locationA);
+      store.recordRelationship(indexableA, relationship, locationA);
       store.doneIndex();
     }
     {
       store.aboutToIndexDart(contextA, unitElementB);
-      store.recordRelationship(elementA, relationship, locationB);
+      store.recordRelationship(indexableA, relationship, locationB);
       store.doneIndex();
     }
     // "A" and "B" locations
     return store
-        .getRelationships(elementA, relationship)
+        .getRelationships(indexableA, relationship)
         .then((List<LocationImpl> locations) {
       assertLocations(locations, [locationA, locationB]);
       // remove "A" context
       store.removeContext(contextA);
     }).then((_) {
       return store
-          .getRelationships(elementA, relationship)
+          .getRelationships(indexableA, relationship)
           .then((List<LocationImpl> locations) {
         assertLocations(locations, []);
       });
@@ -798,34 +815,34 @@
   }
 
   test_removeSource_library() {
-    LocationImpl locationA = mockLocation(elementA);
-    LocationImpl locationB = mockLocation(elementB);
-    LocationImpl locationC = mockLocation(elementC);
+    LocationImpl locationA = mockLocation(indexableA);
+    LocationImpl locationB = mockLocation(indexableB);
+    LocationImpl locationC = mockLocation(indexableC);
     {
       store.aboutToIndexDart(contextA, unitElementA);
-      store.recordRelationship(elementA, relationship, locationA);
+      store.recordRelationship(indexableA, relationship, locationA);
       store.doneIndex();
     }
     {
       store.aboutToIndexDart(contextA, unitElementB);
-      store.recordRelationship(elementA, relationship, locationB);
+      store.recordRelationship(indexableA, relationship, locationB);
       store.doneIndex();
     }
     {
       store.aboutToIndexDart(contextA, unitElementC);
-      store.recordRelationship(elementA, relationship, locationC);
+      store.recordRelationship(indexableA, relationship, locationC);
       store.doneIndex();
     }
     // "A", "B" and "C" locations
     return store
-        .getRelationships(elementA, relationship)
+        .getRelationships(indexableA, relationship)
         .then((List<LocationImpl> locations) {
       assertLocations(locations, [locationA, locationB, locationC]);
     }).then((_) {
       // remove "librarySource"
       store.removeSource(contextA, librarySource);
       return store
-          .getRelationships(elementA, relationship)
+          .getRelationships(indexableA, relationship)
           .then((List<LocationImpl> locations) {
         assertLocations(locations, []);
       });
@@ -837,34 +854,34 @@
   }
 
   test_removeSource_unit() {
-    LocationImpl locationA = mockLocation(elementA);
-    LocationImpl locationB = mockLocation(elementB);
-    LocationImpl locationC = mockLocation(elementC);
+    LocationImpl locationA = mockLocation(indexableA);
+    LocationImpl locationB = mockLocation(indexableB);
+    LocationImpl locationC = mockLocation(indexableC);
     {
       store.aboutToIndexDart(contextA, unitElementA);
-      store.recordRelationship(elementA, relationship, locationA);
+      store.recordRelationship(indexableA, relationship, locationA);
       store.doneIndex();
     }
     {
       store.aboutToIndexDart(contextA, unitElementB);
-      store.recordRelationship(elementA, relationship, locationB);
+      store.recordRelationship(indexableA, relationship, locationB);
       store.doneIndex();
     }
     {
       store.aboutToIndexDart(contextA, unitElementC);
-      store.recordRelationship(elementA, relationship, locationC);
+      store.recordRelationship(indexableA, relationship, locationC);
       store.doneIndex();
     }
     // "A", "B" and "C" locations
     return store
-        .getRelationships(elementA, relationship)
+        .getRelationships(indexableA, relationship)
         .then((List<LocationImpl> locations) {
       assertLocations(locations, [locationA, locationB, locationC]);
     }).then((_) {
       // remove "A" source
       store.removeSource(contextA, sourceA);
       return store
-          .getRelationships(elementA, relationship)
+          .getRelationships(indexableA, relationship)
           .then((List<LocationImpl> locations) {
         assertLocations(locations, [locationB, locationC]);
       });
@@ -872,28 +889,28 @@
   }
 
   test_removeSources_library() {
-    LocationImpl locationA = mockLocation(elementA);
-    LocationImpl locationB = mockLocation(elementB);
+    LocationImpl locationA = mockLocation(indexableA);
+    LocationImpl locationB = mockLocation(indexableB);
     {
       store.aboutToIndexDart(contextA, unitElementA);
-      store.recordRelationship(elementA, relationship, locationA);
+      store.recordRelationship(indexableA, relationship, locationA);
       store.doneIndex();
     }
     {
       store.aboutToIndexDart(contextA, unitElementB);
-      store.recordRelationship(elementA, relationship, locationB);
+      store.recordRelationship(indexableA, relationship, locationB);
       store.doneIndex();
     }
     // "A" and "B" locations
     return store
-        .getRelationships(elementA, relationship)
+        .getRelationships(indexableA, relationship)
         .then((List<LocationImpl> locations) {
       assertLocations(locations, [locationA, locationB]);
     }).then((_) {
       // remove "librarySource"
       store.removeSources(contextA, new SingleSourceContainer(librarySource));
       return store
-          .getRelationships(elementA, relationship)
+          .getRelationships(indexableA, relationship)
           .then((List<LocationImpl> locations) {
         assertLocations(locations, []);
       });
@@ -935,8 +952,10 @@
   }
 
   void test_universe_aboutToIndex() {
-    when(elementCodec.decode(contextA, 11, 12, 13)).thenReturn(elementA);
-    when(elementCodec.decode(contextB, 21, 22, 23)).thenReturn(elementB);
+    when(elementCodec.decode(contextA, 11, 12, 13))
+        .thenReturn(new IndexableElement(elementA));
+    when(elementCodec.decode(contextB, 21, 22, 23))
+        .thenReturn(new IndexableElement(elementB));
     {
       store.aboutToIndexDart(contextA, unitElementA);
       store.recordTopLevelDeclaration(elementA);
@@ -964,8 +983,10 @@
   }
 
   void test_universe_clear() {
-    when(elementCodec.decode(contextA, 11, 12, 13)).thenReturn(elementA);
-    when(elementCodec.decode(contextB, 21, 22, 23)).thenReturn(elementB);
+    when(elementCodec.decode(contextA, 11, 12, 13))
+        .thenReturn(new IndexableElement(elementA));
+    when(elementCodec.decode(contextB, 21, 22, 23))
+        .thenReturn(new IndexableElement(elementB));
     {
       store.aboutToIndexDart(contextA, unitElementA);
       store.recordTopLevelDeclaration(elementA);
@@ -990,8 +1011,10 @@
   }
 
   void test_universe_removeContext() {
-    when(elementCodec.decode(contextA, 11, 12, 13)).thenReturn(elementA);
-    when(elementCodec.decode(contextB, 21, 22, 23)).thenReturn(elementB);
+    when(elementCodec.decode(contextA, 11, 12, 13))
+        .thenReturn(new IndexableElement(elementA));
+    when(elementCodec.decode(contextB, 21, 22, 23))
+        .thenReturn(new IndexableElement(elementB));
     {
       store.aboutToIndexDart(contextA, unitElementA);
       store.recordTopLevelDeclaration(elementA);
@@ -1016,8 +1039,10 @@
   }
 
   void test_universe_removeSource() {
-    when(elementCodec.decode(contextA, 11, 12, 13)).thenReturn(elementA);
-    when(elementCodec.decode(contextB, 21, 22, 23)).thenReturn(elementB);
+    when(elementCodec.decode(contextA, 11, 12, 13))
+        .thenReturn(new IndexableElement(elementA));
+    when(elementCodec.decode(contextB, 21, 22, 23))
+        .thenReturn(new IndexableElement(elementB));
     {
       store.aboutToIndexDart(contextA, unitElementA);
       store.recordTopLevelDeclaration(elementA);
@@ -1057,9 +1082,9 @@
   /**
    * @return the new [LocationImpl] mock.
    */
-  static LocationImpl mockLocation(Element element) {
+  static LocationImpl mockLocation(IndexableElement indexable) {
     LocationImpl location = new MockLocation();
-    when(location.element).thenReturn(element);
+    when(location.indexable).thenReturn(indexable);
     when(location.offset).thenReturn(0);
     when(location.length).thenReturn(0);
     when(location.isQualified).thenReturn(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 f32a9ba..5e376f3 100644
--- a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
@@ -2384,6 +2384,39 @@
 ''');
   }
 
+  test_statements_parameters_ignoreInnerPropagatedType() async {
+    indexTestUnit('''
+main(Object x) {
+// start
+  if (x is int) {
+    print('int');
+  }
+  if (x is bool) {
+    print('bool');
+  }
+// end
+}
+''');
+    _createRefactoringForStartEndComments();
+    // apply refactoring
+    return _assertSuccessfulRefactoring('''
+main(Object x) {
+// start
+  res(x);
+// end
+}
+
+void res(Object x) {
+  if (x is int) {
+    print('int');
+  }
+  if (x is bool) {
+    print('bool');
+  }
+}
+''');
+  }
+
   test_statements_parameters_importType() {
     _addLibraryReturningAsync();
     indexTestUnit('''
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 a3dd17d..cbae32f 100644
--- a/pkg/analysis_server/test/services/refactoring/move_file_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/move_file_test.dart
@@ -145,14 +145,18 @@
     String pathA = '/project/000/1111/a.dart';
     testFile = '/project/000/1111/22/test.dart';
     addSource(pathA, '''
+library lib;
 part '22/test.dart';
 ''');
-    addTestSource('');
+    addTestSource('''
+part of lib;
+''');
     _performAnalysis();
     // perform refactoring
     _createRefactoring('/project/000/1111/22/new_name.dart');
     await _assertSuccessfulRefactoring();
     assertFileChangeResult(pathA, '''
+library lib;
 part '22/new_name.dart';
 ''');
     assertNoFileChange(testFile);
@@ -163,20 +167,26 @@
     String pathB = '/project/000/b.dart';
     testFile = '/project/000/1111/22/test.dart';
     addSource(pathA, '''
+library lib;
 part '22/test.dart';
 ''');
     addSource(pathB, '''
+library lib;
 part '1111/22/test.dart';
 ''');
-    addTestSource('');
+    addTestSource('''
+part of lib;
+''');
     _performAnalysis();
     // perform refactoring
     _createRefactoring('/project/000/1111/22/new_name.dart');
     await _assertSuccessfulRefactoring();
     assertFileChangeResult(pathA, '''
+library lib;
 part '22/new_name.dart';
 ''');
     assertFileChangeResult(pathB, '''
+library lib;
 part '1111/22/new_name.dart';
 ''');
     assertNoFileChange(testFile);
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 d8e2a68..e88f489 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
@@ -55,6 +55,28 @@
     assertRefactoringStatusOK(status);
   }
 
+  test_checkFinalConditions_publicToPrivate_usedInOtherLibrary() async {
+    indexTestUnit('''
+class A {
+  test() {}
+}
+''');
+    indexUnit('/lib.dart', '''
+library my.lib;
+import 'test.dart';
+
+main(A a) {
+  a.test();
+}
+''');
+    createRenameRefactoringAtString('test() {}');
+    // check status
+    refactoring.newName = '_newName';
+    RefactoringStatus status = await refactoring.checkFinalConditions();
+    assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
+        expectedMessage: "Renamed method will be invisible in 'my.lib'.");
+  }
+
   test_checkFinalConditions_shadowed_byLocal_inSameClass() async {
     indexTestUnit('''
 class A {
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 6e0427f..229d1be 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
@@ -65,6 +65,26 @@
     assertRefactoringStatusOK(status);
   }
 
+  test_checkFinalConditions_publicToPrivate_usedInOtherLibrary() async {
+    indexTestUnit('''
+class Test {}
+''');
+    indexUnit('/lib.dart', '''
+library my.lib;
+import 'test.dart';
+
+main() {
+  new Test();
+}
+''');
+    createRenameRefactoringAtString('Test {}');
+    // check status
+    refactoring.newName = '_NewName';
+    RefactoringStatus status = await refactoring.checkFinalConditions();
+    assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
+        expectedMessage: "Renamed class will be invisible in 'my.lib'.");
+  }
+
   test_checkFinalConditions_shadowedBy_MethodElement() async {
     indexTestUnit('''
 class Test {}
diff --git a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
index 2f39f5e..1132dd8 100644
--- a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
+++ b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
@@ -269,8 +269,9 @@
    * @param file The file containing the code to be formatted.
    * @param selectionOffset The offset of the current selection in the file.
    * @param selectionLength The length of the current selection in the file.
+   * @param lineLength The line length to be used by the formatter.
    */
-  public void edit_format(String file, int selectionOffset, int selectionLength, FormatConsumer consumer);
+  public void edit_format(String file, int selectionOffset, int selectionLength, int lineLength, FormatConsumer consumer);
 
   /**
    * {@code edit.getAssists}
diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html
index 87c3340..b2e68fc 100644
--- a/pkg/analysis_server/tool/spec/spec_input.html
+++ b/pkg/analysis_server/tool/spec/spec_input.html
@@ -5,7 +5,7 @@
   </head>
   <body>
     <h1>Analysis Server API Specification</h1>
-    <h1 style="color:#999999">Version <version>1.6.2</version></h1>
+    <h1 style="color:#999999">Version <version>1.7.0</version></h1>
     <p>
       This document contains a specification of the API provided by the
       analysis server.  The API in this document is currently under
@@ -1362,6 +1362,12 @@
             </p>
           </field>
           -->
+          <field name="lineLength" optional="true">
+            <ref>int</ref>
+            <p>
+              The line length to be used by the formatter.
+            </p>
+          </field>
         </params>
         <result>
           <field name="edits">
diff --git a/pkg/analyzer/lib/src/cancelable_future.dart b/pkg/analyzer/lib/src/cancelable_future.dart
index c072be2..4ec7b26 100644
--- a/pkg/analyzer/lib/src/cancelable_future.dart
+++ b/pkg/analyzer/lib/src/cancelable_future.dart
@@ -278,7 +278,7 @@
   _WrappedFuture(this._future);
 
   @override
-  Stream asStream() => _future.asStream();
+  Stream<T> asStream() => _future.asStream();
 
   @override
   void cancel() {}
@@ -296,5 +296,5 @@
       _future.timeout(timeLimit, onTimeout: onTimeout);
 
   @override
-  Future whenComplete(action()) => _future.whenComplete(action);
+  Future<T> whenComplete(action()) => _future.whenComplete(action);
 }
diff --git a/pkg/analyzer/lib/src/context/cache.dart b/pkg/analyzer/lib/src/context/cache.dart
index 531f84f..d9fada4 100644
--- a/pkg/analyzer/lib/src/context/cache.dart
+++ b/pkg/analyzer/lib/src/context/cache.dart
@@ -158,7 +158,8 @@
    */
   MapIterator<AnalysisTarget, CacheEntry> iterator() {
     int count = _partitions.length;
-    List<Map<AnalysisTarget, CacheEntry>> maps = new List<Map>(count);
+    List<Map<AnalysisTarget, CacheEntry>> maps =
+        new List<Map<AnalysisTarget, CacheEntry>>(count);
     for (int i = 0; i < count; i++) {
       maps[i] = _partitions[i].map;
     }
diff --git a/pkg/analyzer/lib/src/generated/ast.dart b/pkg/analyzer/lib/src/generated/ast.dart
index ee68939..3a2822f 100644
--- a/pkg/analyzer/lib/src/generated/ast.dart
+++ b/pkg/analyzer/lib/src/generated/ast.dart
@@ -594,10 +594,8 @@
   Token get beginToken => _expression.beginToken;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(_expression)
-    ..add(asOperator)
-    ..add(_type);
+  Iterable get childEntities =>
+      new ChildEntities()..add(_expression)..add(asOperator)..add(_type);
 
   @override
   Token get endToken => _type.endToken;
@@ -3192,9 +3190,8 @@
   }
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(awaitKeyword)
-    ..add(_expression);
+  Iterable get childEntities =>
+      new ChildEntities()..add(awaitKeyword)..add(_expression);
 
   @override
   Token get endToken => _expression.endToken;
@@ -3288,10 +3285,8 @@
   }
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(_leftOperand)
-    ..add(operator)
-    ..add(_rightOperand);
+  Iterable get childEntities =>
+      new ChildEntities()..add(_leftOperand)..add(operator)..add(_rightOperand);
 
   @override
   Token get endToken => _rightOperand.endToken;
@@ -3496,10 +3491,8 @@
   }
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(keyword)
-    ..add(star)
-    ..add(_block);
+  Iterable get childEntities =>
+      new ChildEntities()..add(keyword)..add(star)..add(_block);
 
   @override
   Token get endToken => _block.endToken;
@@ -3665,10 +3658,8 @@
   Token get beginToken => breakKeyword;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(breakKeyword)
-    ..add(_label)
-    ..add(semicolon);
+  Iterable get childEntities =>
+      new ChildEntities()..add(breakKeyword)..add(_label)..add(semicolon);
 
   @override
   Token get endToken => semicolon;
@@ -4575,9 +4566,8 @@
   Token get beginToken => _identifier.beginToken;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(newKeyword)
-    ..add(_identifier);
+  Iterable get childEntities =>
+      new ChildEntities()..add(newKeyword)..add(_identifier);
 
   @override
   Token get endToken => _identifier.endToken;
@@ -4718,9 +4708,7 @@
   Iterable get childEntities {
     ChildEntities result = new ChildEntities()..add(_scriptTag);
     if (_directivesAreBeforeDeclarations) {
-      result
-        ..addAll(_directives)
-        ..addAll(_declarations);
+      result..addAll(_directives)..addAll(_declarations);
     } else {
       result.addAll(sortedDirectivesAndDeclarations);
     }
@@ -5683,10 +5671,8 @@
   Token get beginToken => _type.beginToken;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(_type)
-    ..add(period)
-    ..add(_name);
+  Iterable get childEntities =>
+      new ChildEntities()..add(_type)..add(period)..add(_name);
 
   @override
   Token get endToken {
@@ -5776,10 +5762,8 @@
   Token get beginToken => continueKeyword;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(continueKeyword)
-    ..add(_label)
-    ..add(semicolon);
+  Iterable get childEntities =>
+      new ChildEntities()..add(continueKeyword)..add(_label)..add(semicolon);
 
   @override
   Token get endToken => semicolon;
@@ -5880,10 +5864,8 @@
   }
 
   @override
-  Iterable get childEntities => super._childEntities
-    ..add(keyword)
-    ..add(_type)
-    ..add(_identifier);
+  Iterable get childEntities =>
+      super._childEntities..add(keyword)..add(_type)..add(_identifier);
 
   @override
   LocalVariableElement get element {
@@ -6004,10 +5986,8 @@
   Token get beginToken => _parameter.beginToken;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(_parameter)
-    ..add(separator)
-    ..add(_defaultValue);
+  Iterable get childEntities =>
+      new ChildEntities()..add(_parameter)..add(separator)..add(_defaultValue);
 
   /**
    * Return the expression computing the default value for the parameter, or
@@ -6960,9 +6940,8 @@
   Token get beginToken => _expression.beginToken;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(_expression)
-    ..add(semicolon);
+  Iterable get childEntities =>
+      new ChildEntities()..add(_expression)..add(semicolon);
 
   @override
   Token get endToken {
@@ -7024,9 +7003,8 @@
   Token get beginToken => extendsKeyword;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(extendsKeyword)
-    ..add(_superclass);
+  Iterable get childEntities =>
+      new ChildEntities()..add(extendsKeyword)..add(_superclass);
 
   @override
   Token get endToken => _superclass.endToken;
@@ -7102,10 +7080,8 @@
   }
 
   @override
-  Iterable get childEntities => super._childEntities
-    ..add(staticKeyword)
-    ..add(_fieldList)
-    ..add(semicolon);
+  Iterable get childEntities =>
+      super._childEntities..add(staticKeyword)..add(_fieldList)..add(semicolon);
 
   @override
   Element get element => null;
@@ -7609,9 +7585,7 @@
       }
       result.add(parameter);
     }
-    return result
-      ..add(rightDelimiter)
-      ..add(rightParenthesis);
+    return result..add(rightDelimiter)..add(rightParenthesis);
   }
 
   @override
@@ -8088,9 +8062,8 @@
   }
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(_parameters)
-    ..add(_body);
+  Iterable get childEntities =>
+      new ChildEntities()..add(_parameters)..add(_body);
 
   @override
   Token get endToken {
@@ -8203,9 +8176,8 @@
   }
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(_function)
-    ..add(_argumentList);
+  Iterable get childEntities =>
+      new ChildEntities()..add(_function)..add(_argumentList);
 
   @override
   Token get endToken => _argumentList.endToken;
@@ -8388,10 +8360,8 @@
   }
 
   @override
-  Iterable get childEntities => super._childEntities
-    ..add(_returnType)
-    ..add(identifier)
-    ..add(parameters);
+  Iterable get childEntities =>
+      super._childEntities..add(_returnType)..add(identifier)..add(parameters);
 
   @override
   Token get endToken => _parameters.endToken;
@@ -10945,9 +10915,7 @@
   Token get beginToken => _label.beginToken;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(_label)
-    ..add(colon);
+  Iterable get childEntities => new ChildEntities()..add(_label)..add(colon);
 
   @override
   Token get endToken => colon;
@@ -11079,10 +11047,8 @@
   }
 
   @override
-  Iterable get childEntities => super._childEntities
-    ..add(libraryKeyword)
-    ..add(_name)
-    ..add(semicolon);
+  Iterable get childEntities =>
+      super._childEntities..add(libraryKeyword)..add(_name)..add(semicolon);
 
   @override
   Token get endToken => semicolon;
@@ -11398,10 +11364,8 @@
   Token get beginToken => _key.beginToken;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(_key)
-    ..add(separator)
-    ..add(_value);
+  Iterable get childEntities =>
+      new ChildEntities()..add(_key)..add(separator)..add(_value);
 
   @override
   Token get endToken => _value.endToken;
@@ -11893,9 +11857,8 @@
   Token get beginToken => _name.beginToken;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(_name)
-    ..add(_expression);
+  Iterable get childEntities =>
+      new ChildEntities()..add(_name)..add(_expression);
 
   /**
    * Return the element representing the parameter being named by this
@@ -12029,9 +11992,8 @@
   Token get beginToken => nativeKeyword;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(nativeKeyword)
-    ..add(_name);
+  Iterable get childEntities =>
+      new ChildEntities()..add(nativeKeyword)..add(_name);
 
   @override
   Token get endToken => _name.endToken;
@@ -13832,10 +13794,8 @@
       : super(comment, metadata, partUri);
 
   @override
-  Iterable get childEntities => super._childEntities
-    ..add(partKeyword)
-    ..add(_uri)
-    ..add(semicolon);
+  Iterable get childEntities =>
+      super._childEntities..add(partKeyword)..add(_uri)..add(semicolon);
 
   @override
   Token get endToken => semicolon;
@@ -14031,9 +13991,8 @@
   }
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(_operand)
-    ..add(operator);
+  Iterable get childEntities =>
+      new ChildEntities()..add(_operand)..add(operator);
 
   @override
   Token get endToken => operator;
@@ -14163,10 +14122,8 @@
   }
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(_prefix)
-    ..add(period)
-    ..add(_identifier);
+  Iterable get childEntities =>
+      new ChildEntities()..add(_prefix)..add(period)..add(_identifier);
 
   @override
   Token get endToken => _identifier.endToken;
@@ -14307,9 +14264,8 @@
   }
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(operator)
-    ..add(_operand);
+  Iterable get childEntities =>
+      new ChildEntities()..add(operator)..add(_operand);
 
   @override
   Token get endToken => _operand.endToken;
@@ -14439,10 +14395,8 @@
   }
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(_target)
-    ..add(operator)
-    ..add(_propertyName);
+  Iterable get childEntities =>
+      new ChildEntities()..add(_target)..add(operator)..add(_propertyName);
 
   @override
   Token get endToken => _propertyName.endToken;
@@ -15368,10 +15322,8 @@
   Token get beginToken => returnKeyword;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(returnKeyword)
-    ..add(_expression)
-    ..add(semicolon);
+  Iterable get childEntities =>
+      new ChildEntities()..add(returnKeyword)..add(_expression)..add(semicolon);
 
   @override
   Token get endToken => semicolon;
@@ -16055,10 +16007,8 @@
   }
 
   @override
-  Iterable get childEntities => super._childEntities
-    ..add(keyword)
-    ..add(_type)
-    ..add(identifier);
+  Iterable get childEntities =>
+      super._childEntities..add(keyword)..add(_type)..add(identifier);
 
   @override
   Token get endToken => identifier.endToken;
@@ -17336,9 +17286,8 @@
   Token get beginToken => throwKeyword;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(throwKeyword)
-    ..add(_expression);
+  Iterable get childEntities =>
+      new ChildEntities()..add(throwKeyword)..add(_expression);
 
   @override
   Token get endToken {
@@ -17417,9 +17366,8 @@
   }
 
   @override
-  Iterable get childEntities => super._childEntities
-    ..add(_variableList)
-    ..add(semicolon);
+  Iterable get childEntities =>
+      super._childEntities..add(_variableList)..add(semicolon);
 
   @override
   Element get element => null;
@@ -18831,9 +18779,8 @@
     _typeArguments = _becomeParentOf(typeArguments);
   }
 
-  ChildEntities get _childEntities => new ChildEntities()
-    ..add(constKeyword)
-    ..add(_typeArguments);
+  ChildEntities get _childEntities =>
+      new ChildEntities()..add(constKeyword)..add(_typeArguments);
 
   @override
   void visitChildren(AstVisitor visitor) {
@@ -18877,9 +18824,8 @@
   Token get beginToken => _name.beginToken;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(_name)
-    ..add(_typeArguments);
+  Iterable get childEntities =>
+      new ChildEntities()..add(_name)..add(_typeArguments);
 
   @override
   Token get endToken {
@@ -18994,10 +18940,8 @@
   }
 
   @override
-  Iterable get childEntities => super._childEntities
-    ..add(_name)
-    ..add(extendsKeyword)
-    ..add(_bound);
+  Iterable get childEntities =>
+      super._childEntities..add(_name)..add(extendsKeyword)..add(_bound);
 
   @override
   TypeParameterElement get element =>
@@ -19617,10 +19561,8 @@
   }
 
   @override
-  Iterable get childEntities => super._childEntities
-    ..add(_name)
-    ..add(equals)
-    ..add(_initializer);
+  Iterable get childEntities =>
+      super._childEntities..add(_name)..add(equals)..add(_initializer);
 
   /**
    * This overridden implementation of getDocumentationComment() looks in the
@@ -19850,9 +19792,8 @@
   Token get beginToken => _variableList.beginToken;
 
   @override
-  Iterable get childEntities => new ChildEntities()
-    ..add(_variableList)
-    ..add(semicolon);
+  Iterable get childEntities =>
+      new ChildEntities()..add(_variableList)..add(semicolon);
 
   @override
   Token get endToken => semicolon;
diff --git a/pkg/analyzer/lib/src/generated/element.dart b/pkg/analyzer/lib/src/generated/element.dart
index 5ad1e91..0fd8b81 100644
--- a/pkg/analyzer/lib/src/generated/element.dart
+++ b/pkg/analyzer/lib/src/generated/element.dart
@@ -84,27 +84,45 @@
   bool operator ==(Object object) => identical(object, this);
 
   @override
-  bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) =>
-      identical(object, this);
+  bool isMoreSpecificThan(DartType type,
+      [bool withDynamic = false, Set<Element> visitedElements]) => true;
 
   @override
-  int internalHashCode(List<DartType> visitedTypes) => hashCode;
-
-  @override
-  bool isMoreSpecificThan(DartType type, [Set<Element> thisExpansions,
-      Set<Element> typeExpansions, bool withDynamic = false,
-      Set<Element> visitedElements]) => true;
-
-  @override
-  bool isSubtypeOf(DartType type,
-      [Set<Element> thisExpansions, Set<Element> typeExpansions]) => true;
+  bool isSubtypeOf(DartType type) => true;
 
   @override
   bool isSupertypeOf(DartType type) => false;
 
   @override
+  TypeImpl pruned(List<FunctionTypeAliasElement> prune) => this;
+
+  @override
   BottomTypeImpl substitute2(
-      List<DartType> argumentTypes, List<DartType> parameterTypes) => this;
+      List<DartType> argumentTypes, List<DartType> parameterTypes,
+      [List<FunctionTypeAliasElement> prune]) => this;
+}
+
+/**
+ * Type created internally if a circular reference is ever detected.  Behaves
+ * like `dynamic`, except that when converted to a string it is displayed as
+ * `...`.
+ */
+class CircularTypeImpl extends DynamicTypeImpl {
+  CircularTypeImpl() : super._circular();
+
+  @override
+  int get hashCode => 1;
+
+  @override
+  bool operator ==(Object object) => object is CircularTypeImpl;
+
+  @override
+  void appendTo(StringBuffer buffer) {
+    buffer.write('...');
+  }
+
+  @override
+  TypeImpl pruned(List<FunctionTypeAliasElement> prune) => this;
 }
 
 /**
@@ -197,8 +215,10 @@
   bool get isProxy;
 
   /**
-   * Return `true` if this class is defined by a typedef construct.
+   * Return `true` if this class is a mixin application.  Deprecated--please
+   * use [isMixinApplication] instead.
    */
+  @deprecated
   bool get isTypedef;
 
   /**
@@ -232,16 +252,6 @@
   List<InterfaceType> get mixins;
 
   /**
-   * Return the resolved [ClassDeclaration] or [EnumDeclaration] node that
-   * declares this [ClassElement].
-   *
-   * This method is expensive, because resolved AST might be evicted from cache,
-   * so parsing and resolving will be performed.
-   */
-  @override
-  NamedCompilationUnitMember get node;
-
-  /**
    * Return the superclass of this class, or `null` if the class represents the
    * class 'Object'. All other classes will have a non-`null` superclass. If the
    * superclass was not explicitly declared then the implicit superclass
@@ -276,6 +286,16 @@
   ConstructorElement get unnamedConstructor;
 
   /**
+   * Return the resolved [ClassDeclaration] or [EnumDeclaration] node that
+   * declares this [ClassElement].
+   *
+   * This method is expensive, because resolved AST might be evicted from cache,
+   * so parsing and resolving will be performed.
+   */
+  @override
+  NamedCompilationUnitMember computeNode();
+
+  /**
    * Return the field (synthetic or explicit) defined in this class that has the
    * given [name], or `null` if this class does not define a field with the
    * given name.
@@ -685,7 +705,8 @@
   }
 
   @override
-  bool get isTypedef => hasModifier(Modifier.TYPEDEF);
+  @deprecated
+  bool get isTypedef => isMixinApplication;
 
   @override
   bool get isValidMixin => hasModifier(Modifier.MIXIN);
@@ -724,23 +745,6 @@
   }
 
   @override
-  NamedCompilationUnitMember get node {
-    if (isEnum) {
-      return getNodeMatching((node) => node is EnumDeclaration);
-    } else {
-      return getNodeMatching(
-          (node) => node is ClassDeclaration || node is ClassTypeAlias);
-    }
-  }
-
-  /**
-   * Set whether this class is defined by a typedef construct.
-   */
-  void set typedef(bool isTypedef) {
-    setModifier(Modifier.TYPEDEF, isTypedef);
-  }
-
-  @override
   List<TypeParameterElement> get typeParameters => _typeParameters;
 
   /**
@@ -797,6 +801,16 @@
   }
 
   @override
+  NamedCompilationUnitMember computeNode() {
+    if (isEnum) {
+      return getNodeMatching((node) => node is EnumDeclaration);
+    } else {
+      return getNodeMatching(
+          (node) => node is ClassDeclaration || node is ClassTypeAlias);
+    }
+  }
+
+  @override
   ElementImpl getChild(String identifier) {
     //
     // The casts in this method are safe because the set methods would have
@@ -1220,15 +1234,6 @@
   bool get hasLoadLibraryFunction;
 
   /**
-   * Return the resolved [CompilationUnit] node that declares this element.
-   *
-   * This method is expensive, because resolved AST might be evicted from cache,
-   * so parsing and resolving will be performed.
-   */
-  @override
-  CompilationUnit get node;
-
-  /**
    * Return a list containing all of the top-level variables contained in this
    * compilation unit.
    */
@@ -1241,6 +1246,15 @@
   List<ClassElement> get types;
 
   /**
+   * Return the resolved [CompilationUnit] node that declares this element.
+   *
+   * This method is expensive, because resolved AST might be evicted from cache,
+   * so parsing and resolving will be performed.
+   */
+  @override
+  CompilationUnit computeNode();
+
+  /**
    * Return the element at the given [offset], maybe `null` if no such element.
    */
   Element getElementAt(int offset);
@@ -1399,9 +1413,6 @@
   ElementKind get kind => ElementKind.COMPILATION_UNIT;
 
   @override
-  CompilationUnit get node => unit;
-
-  @override
   List<TopLevelVariableElement> get topLevelVariables => _variables;
 
   /**
@@ -1463,6 +1474,9 @@
   }
 
   @override
+  CompilationUnit computeNode() => unit;
+
+  @override
   ElementImpl getChild(String identifier) {
     //
     // The casts in this method are safe because the set methods would have
@@ -1667,16 +1681,6 @@
   int get nameEnd;
 
   /**
-   * Return the resolved [ConstructorDeclaration] node that declares this
-   * [ConstructorElement] .
-   *
-   * This method is expensive, because resolved AST might be evicted from cache,
-   * so parsing and resolving will be performed.
-   */
-  @override
-  ConstructorDeclaration get node;
-
-  /**
    * Return the offset of the `.` before this constructor name, or `null` if
    * not named.
    */
@@ -1688,6 +1692,16 @@
    * library containing this constructor has not yet been resolved.
    */
   ConstructorElement get redirectedConstructor;
+
+  /**
+   * Return the resolved [ConstructorDeclaration] node that declares this
+   * [ConstructorElement] .
+   *
+   * This method is expensive, because resolved AST might be evicted from cache,
+   * so parsing and resolving will be performed.
+   */
+  @override
+  ConstructorDeclaration computeNode();
 }
 
 /**
@@ -1788,10 +1802,6 @@
   ElementKind get kind => ElementKind.CONSTRUCTOR;
 
   @override
-  ConstructorDeclaration get node =>
-      getNodeMatching((node) => node is ConstructorDeclaration);
-
-  @override
   accept(ElementVisitor visitor) => visitor.visitConstructorElement(this);
 
   @override
@@ -1817,6 +1827,10 @@
     }
     super.appendTo(buffer);
   }
+
+  @override
+  ConstructorDeclaration computeNode() =>
+      getNodeMatching((node) => node is ConstructorDeclaration);
 }
 
 /**
@@ -1853,9 +1867,6 @@
   int get nameEnd => baseElement.nameEnd;
 
   @override
-  ConstructorDeclaration get node => baseElement.node;
-
-  @override
   int get periodOffset => baseElement.periodOffset;
 
   @override
@@ -1866,6 +1877,9 @@
   accept(ElementVisitor visitor) => visitor.visitConstructorElement(this);
 
   @override
+  ConstructorDeclaration computeNode() => baseElement.computeNode();
+
+  @override
   String toString() {
     ConstructorElement baseElement = this.baseElement;
     List<ParameterElement> parameters = this.parameters;
@@ -2079,7 +2093,7 @@
    * type directly.
    *
    * Note too that the current implementation of this method is only guaranteed
-   * to work when the argument types are type variables.
+   * to work when the parameter types are type variables.
    */
   DartType substitute2(
       List<DartType> argumentTypes, List<DartType> parameterTypes);
@@ -2133,7 +2147,7 @@
   }
 
   @override
-  DefaultFormalParameter get node =>
+  DefaultFormalParameter computeNode() =>
       getNodeMatching((node) => node is DefaultFormalParameter);
 }
 
@@ -2191,6 +2205,12 @@
     (element as DynamicElementImpl).type = this;
   }
 
+  /**
+   * Constructor used by [CircularTypeImpl].
+   */
+  DynamicTypeImpl._circular()
+      : super(_INSTANCE.element, Keyword.DYNAMIC.syntax);
+
   @override
   int get hashCode => 1;
 
@@ -2201,16 +2221,8 @@
   bool operator ==(Object object) => identical(object, this);
 
   @override
-  bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) =>
-      identical(object, this);
-
-  @override
-  int internalHashCode(List<DartType> visitedTypes) => hashCode;
-
-  @override
-  bool isMoreSpecificThan(DartType type, [Set<Element> thisExpansions,
-      Set<Element> typeExpansions, bool withDynamic = false,
-      Set<Element> visitedElements]) {
+  bool isMoreSpecificThan(DartType type,
+      [bool withDynamic = false, Set<Element> visitedElements]) {
     // T is S
     if (identical(this, type)) {
       return true;
@@ -2220,15 +2232,18 @@
   }
 
   @override
-  bool isSubtypeOf(DartType type,
-      [Set<Element> thisExpansions, Set<Element> typeExpansions]) => true;
+  bool isSubtypeOf(DartType type) => true;
 
   @override
   bool isSupertypeOf(DartType type) => true;
 
   @override
+  TypeImpl pruned(List<FunctionTypeAliasElement> prune) => this;
+
+  @override
   DartType substitute2(
-      List<DartType> argumentTypes, List<DartType> parameterTypes) {
+      List<DartType> argumentTypes, List<DartType> parameterTypes,
+      [List<FunctionTypeAliasElement> prune]) {
     int length = parameterTypes.length;
     for (int i = 0; i < length; i++) {
       if (parameterTypes[i] == this) {
@@ -2382,6 +2397,7 @@
    *
    * <b>Note:</b> This method cannot be used in an async environment.
    */
+  @deprecated
   AstNode get node;
 
   /**
@@ -2418,6 +2434,18 @@
   String computeDocumentationComment();
 
   /**
+   * Return the resolved [AstNode] node that declares this element, or `null` if
+   * this element is synthetic or isn't contained in a compilation unit, such as
+   * a [LibraryElement].
+   *
+   * This method is expensive, because resolved AST might be evicted from cache,
+   * so parsing and resolving will be performed.
+   *
+   * <b>Note:</b> This method cannot be used in an async environment.
+   */
+  AstNode computeNode();
+
+  /**
    * Return the most immediate ancestor of this element for which the
    * [predicate] returns `true`, or `null` if there is no such ancestor. Note
    * that this element will never be returned.
@@ -2767,8 +2795,9 @@
     _cachedLocation = null;
   }
 
+  @deprecated
   @override
-  AstNode get node => getNodeMatching((node) => node is AstNode);
+  AstNode get node => computeNode();
 
   @override
   Source get source {
@@ -2822,6 +2851,9 @@
     return context.computeDocumentationComment(this);
   }
 
+  @override
+  AstNode computeNode() => getNodeMatching((node) => node is AstNode);
+
   /**
    * Set this element as the enclosing element for given [element].
    */
@@ -3220,60 +3252,6 @@
 }
 
 /**
- * A pair of [Element]s. [Object.==] and
- * [Object.hashCode] so this class can be used in hashed data structures.
- */
-class ElementPair {
-  /**
-   * The first [Element].
-   */
-  final Element _first;
-
-  /**
-   * The second [Element].
-   */
-  final Element _second;
-
-  /**
-   * A cached copy of the calculated hashCode for this element.
-   */
-  int _cachedHashCode;
-
-  /**
-   * Initialize a newly created pair of elements consisting of the [_first] and
-   * [_second] elements.
-   */
-  ElementPair(this._first, this._second) {
-    _cachedHashCode = JenkinsSmiHash.hash2(_first.hashCode, _second.hashCode);
-  }
-
-  /**
-   * Return the first element.
-   */
-  Element get firstElt => _first;
-
-  @override
-  int get hashCode {
-    return _cachedHashCode;
-  }
-
-  /**
-   * Return the second element
-   */
-  Element get secondElt => _second;
-
-  @override
-  bool operator ==(Object object) {
-    if (identical(object, this)) {
-      return true;
-    }
-    return object is ElementPair &&
-        _first == object._first &&
-        _second == object._second;
-  }
-}
-
-/**
  * An object that can be used to visit an element structure.
  */
 abstract class ElementVisitor<R> {
@@ -3885,7 +3863,7 @@
    * so parsing and resolving will be performed.
    */
   @override
-  AstNode get node;
+  AstNode computeNode();
 }
 
 /**
@@ -3923,15 +3901,6 @@
   @override
   ElementKind get kind => ElementKind.FIELD;
 
-  @override
-  AstNode get node {
-    if (isEnumConstant) {
-      return getNodeMatching((node) => node is EnumConstantDeclaration);
-    } else {
-      return getNodeMatching((node) => node is VariableDeclaration);
-    }
-  }
-
   /**
    * Set whether this field is static.
    */
@@ -3941,6 +3910,15 @@
 
   @override
   accept(ElementVisitor visitor) => visitor.visitFieldElement(this);
+
+  @override
+  AstNode computeNode() {
+    if (isEnumConstant) {
+      return getNodeMatching((node) => node is EnumConstantDeclaration);
+    } else {
+      return getNodeMatching((node) => node is VariableDeclaration);
+    }
+  }
 }
 
 /**
@@ -4038,9 +4016,6 @@
   bool get isStatic => baseElement.isStatic;
 
   @override
-  VariableDeclaration get node => baseElement.node;
-
-  @override
   DartType get propagatedType => substituteFor(baseElement.propagatedType);
 
   @override
@@ -4051,6 +4026,9 @@
   accept(ElementVisitor visitor) => visitor.visitFieldElement(this);
 
   @override
+  VariableDeclaration computeNode() => baseElement.computeNode();
+
+  @override
   String toString() => '$type $displayName';
 
   /**
@@ -4149,7 +4127,7 @@
    * so parsing and resolving will be performed.
    */
   @override
-  FunctionDeclaration get node;
+  FunctionDeclaration computeNode();
 }
 
 /**
@@ -4212,10 +4190,6 @@
   ElementKind get kind => ElementKind.FUNCTION;
 
   @override
-  FunctionDeclaration get node =>
-      getNodeMatching((node) => node is FunctionDeclaration);
-
-  @override
   SourceRange get visibleRange {
     if (_visibleRangeLength < 0) {
       return null;
@@ -4235,6 +4209,10 @@
     super.appendTo(buffer);
   }
 
+  @override
+  FunctionDeclaration computeNode() =>
+      getNodeMatching((node) => node is FunctionDeclaration);
+
   /**
    * Set the visible range for this element to the range starting at the given
    * [offset] with the given [length].
@@ -4387,15 +4365,6 @@
   CompilationUnitElement get enclosingElement;
 
   /**
-   * Return the resolved function type alias node that declares this element.
-   *
-   * This method is expensive, because resolved AST might be evicted from cache,
-   * so parsing and resolving will be performed.
-   */
-  @override
-  FunctionTypeAlias get node;
-
-  /**
    * Return a list containing all of the parameters defined by this type alias.
    */
   List<ParameterElement> get parameters;
@@ -4414,6 +4383,15 @@
    * Return a list containing all of the type parameters defined for this type.
    */
   List<TypeParameterElement> get typeParameters;
+
+  /**
+   * Return the resolved function type alias node that declares this element.
+   *
+   * This method is expensive, because resolved AST might be evicted from cache,
+   * so parsing and resolving will be performed.
+   */
+  @override
+  FunctionTypeAlias computeNode();
 }
 
 /**
@@ -4471,10 +4449,6 @@
   ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS;
 
   @override
-  FunctionTypeAlias get node =>
-      getNodeMatching((node) => node is FunctionTypeAlias);
-
-  @override
   List<ParameterElement> get parameters => _parameters;
 
   /**
@@ -4540,6 +4514,10 @@
   }
 
   @override
+  FunctionTypeAlias computeNode() =>
+      getNodeMatching((node) => node is FunctionTypeAlias);
+
+  @override
   ElementImpl getChild(String identifier) {
     for (VariableElement parameter in _parameters) {
       if ((parameter as VariableElementImpl).identifier == identifier) {
@@ -4591,17 +4569,26 @@
   List<DartType> typeArguments = DartType.EMPTY_LIST;
 
   /**
+   * The set of typedefs which should not be expanded when exploring this type,
+   * to avoid creating infinite types in response to self-referential typedefs.
+   */
+  final List<FunctionTypeAliasElement> prunedTypedefs;
+
+  /**
    * Initialize a newly created function type to be declared by the given
    * [element].
    */
-  FunctionTypeImpl(ExecutableElement element) : super(element, null);
+  FunctionTypeImpl(ExecutableElement element, [this.prunedTypedefs])
+      : super(element, null);
 
   /**
    * Initialize a newly created function type to be declared by the given
    * [element].
    */
   @deprecated // Use new FunctionTypeImpl(element)
-  FunctionTypeImpl.con1(ExecutableElement element) : super(element, null);
+  FunctionTypeImpl.con1(ExecutableElement element)
+      : prunedTypedefs = null,
+        super(element, null);
 
   /**
    * Initialize a newly created function type to be declared by the given
@@ -4609,16 +4596,24 @@
    */
   @deprecated // Use new FunctionTypeImpl.forTypedef(element)
   FunctionTypeImpl.con2(FunctionTypeAliasElement element)
-      : super(element, element == null ? null : element.name);
+      : prunedTypedefs = null,
+        super(element, element == null ? null : element.name);
 
   /**
    * Initialize a newly created function type to be declared by the given
    * [element].
    */
-  FunctionTypeImpl.forTypedef(FunctionTypeAliasElement element)
+  FunctionTypeImpl.forTypedef(FunctionTypeAliasElement element,
+      [this.prunedTypedefs])
       : super(element, element == null ? null : element.name);
 
   /**
+   * Private constructor.
+   */
+  FunctionTypeImpl._(Element element, String name, this.prunedTypedefs)
+      : super(element, name);
+
+  /**
    * Return the base parameter elements of this function element.
    */
   List<ParameterElement> get baseParameters {
@@ -4714,7 +4709,27 @@
   }
 
   @override
-  int get hashCode => internalHashCode(<DartType>[]);
+  int get hashCode {
+    if (element == null) {
+      return 0;
+    }
+    // Reference the arrays of parameters
+    List<DartType> normalParameterTypes = this.normalParameterTypes;
+    List<DartType> optionalParameterTypes = this.optionalParameterTypes;
+    Iterable<DartType> namedParameterTypes = this.namedParameterTypes.values;
+    // Generate the hashCode
+    int code = (returnType as TypeImpl).hashCode;
+    for (int i = 0; i < normalParameterTypes.length; i++) {
+      code = (code << 1) + (normalParameterTypes[i] as TypeImpl).hashCode;
+    }
+    for (int i = 0; i < optionalParameterTypes.length; i++) {
+      code = (code << 1) + (optionalParameterTypes[i] as TypeImpl).hashCode;
+    }
+    for (DartType type in namedParameterTypes) {
+      code = (code << 1) + (type as TypeImpl).hashCode;
+    }
+    return code;
+  }
 
   @override
   Map<String, DartType> get namedParameterTypes {
@@ -4731,7 +4746,10 @@
         DartType type = parameter.type;
         if (typeArguments.length != 0 &&
             typeArguments.length == typeParameters.length) {
-          type = type.substitute2(typeArguments, typeParameters);
+          type = (type as TypeImpl).substitute2(
+              typeArguments, typeParameters, newPrune);
+        } else {
+          type = (type as TypeImpl).pruned(newPrune);
         }
         namedParameterTypes[parameter.name] = type;
       }
@@ -4739,6 +4757,27 @@
     return namedParameterTypes;
   }
 
+  /**
+   * Determine the new set of typedefs which should be pruned when expanding
+   * this function type.
+   */
+  List<FunctionTypeAliasElement> get newPrune {
+    Element element = this.element;
+    if (element is FunctionTypeAliasElement && !element.isSynthetic) {
+      // This typedef should be pruned, along with anything that was previously
+      // pruned.
+      if (prunedTypedefs == null) {
+        return <FunctionTypeAliasElement>[element];
+      } else {
+        return new List<FunctionTypeAliasElement>.from(prunedTypedefs)
+          ..add(element);
+      }
+    } else {
+      // This is not a typedef, so nothing additional needs to be pruned.
+      return prunedTypedefs;
+    }
+  }
+
   @override
   List<DartType> get normalParameterTypes {
     List<ParameterElement> parameters = baseParameters;
@@ -4753,7 +4792,10 @@
         DartType type = parameter.type;
         if (typeArguments.length != 0 &&
             typeArguments.length == typeParameters.length) {
-          type = type.substitute2(typeArguments, typeParameters);
+          type = (type as TypeImpl).substitute2(
+              typeArguments, typeParameters, newPrune);
+        } else {
+          type = (type as TypeImpl).pruned(newPrune);
         }
         types.add(type);
       }
@@ -4775,7 +4817,10 @@
         DartType type = parameter.type;
         if (typeArguments.length != 0 &&
             typeArguments.length == typeParameters.length) {
-          type = type.substitute2(typeArguments, typeParameters);
+          type = (type as TypeImpl).substitute2(
+              typeArguments, typeParameters, newPrune);
+        } else {
+          type = (type as TypeImpl).pruned(newPrune);
         }
         types.add(type);
       }
@@ -4812,10 +4857,10 @@
     // match the parameter size, return the base return type.
     if (typeArguments.length == 0 ||
         typeArguments.length != typeParameters.length) {
-      return baseReturnType;
+      return (baseReturnType as TypeImpl).pruned(newPrune);
     }
-    return baseReturnType.substitute2(
-        typeArguments, TypeParameterTypeImpl.getTypes(typeParameters));
+    return (baseReturnType as TypeImpl).substitute2(typeArguments,
+        TypeParameterTypeImpl.getTypes(typeParameters), newPrune);
   }
 
   @override
@@ -4833,15 +4878,21 @@
   }
 
   @override
-  bool operator ==(Object object) =>
-      internalEquals(object, new HashSet<ElementPair>());
+  bool operator ==(Object object) {
+    if (object is! FunctionTypeImpl) {
+      return false;
+    }
+    FunctionTypeImpl otherType = object as FunctionTypeImpl;
+    return TypeImpl.equalArrays(
+            normalParameterTypes, otherType.normalParameterTypes) &&
+        TypeImpl.equalArrays(
+            optionalParameterTypes, otherType.optionalParameterTypes) &&
+        _equals(namedParameterTypes, otherType.namedParameterTypes) &&
+        returnType == otherType.returnType;
+  }
 
   @override
-  void appendTo(StringBuffer buffer, Set<DartType> visitedTypes) {
-    if (!visitedTypes.add(this)) {
-      buffer.write(name == null ? '...' : name);
-      return;
-    }
+  void appendTo(StringBuffer buffer) {
     List<DartType> normalParameterTypes = this.normalParameterTypes;
     List<DartType> optionalParameterTypes = this.optionalParameterTypes;
     Map<String, DartType> namedParameterTypes = this.namedParameterTypes;
@@ -4855,7 +4906,7 @@
         } else {
           needsComma = true;
         }
-        (type as TypeImpl).appendTo(buffer, visitedTypes);
+        (type as TypeImpl).appendTo(buffer);
       }
     }
     if (optionalParameterTypes.length > 0) {
@@ -4870,7 +4921,7 @@
         } else {
           needsComma = true;
         }
-        (type as TypeImpl).appendTo(buffer, visitedTypes);
+        (type as TypeImpl).appendTo(buffer);
       }
       buffer.write("]");
       needsComma = true;
@@ -4889,7 +4940,7 @@
         }
         buffer.write(name);
         buffer.write(": ");
-        (type as TypeImpl).appendTo(buffer, visitedTypes);
+        (type as TypeImpl).appendTo(buffer);
       });
       buffer.write("}");
       needsComma = true;
@@ -4899,78 +4950,20 @@
     if (returnType == null) {
       buffer.write("null");
     } else {
-      (returnType as TypeImpl).appendTo(buffer, visitedTypes);
+      (returnType as TypeImpl).appendTo(buffer);
     }
   }
 
   @override
-  bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) {
-    if (object is! FunctionTypeImpl) {
-      return false;
-    }
-    FunctionTypeImpl otherType = object as FunctionTypeImpl;
-    // If the visitedTypePairs already has the pair (this, type),
-    // use the elements to determine equality
-    ElementPair elementPair = new ElementPair(element, otherType.element);
-    if (!visitedElementPairs.add(elementPair)) {
-      return elementPair.firstElt == elementPair.secondElt;
-    }
-    // Compute the result
-    bool result = TypeImpl.equalArrays(normalParameterTypes,
-            otherType.normalParameterTypes, visitedElementPairs) &&
-        TypeImpl.equalArrays(optionalParameterTypes,
-            otherType.optionalParameterTypes, visitedElementPairs) &&
-        _equals(namedParameterTypes, otherType.namedParameterTypes,
-            visitedElementPairs) &&
-        (returnType as TypeImpl).internalEquals(
-            otherType.returnType, visitedElementPairs);
-    // Remove the pair from our visited pairs list
-    visitedElementPairs.remove(elementPair);
-    // Return the result
-    return result;
-  }
-
-  @override
-  int internalHashCode(List<DartType> visitedTypes) {
-    if (element == null) {
-      return 0;
-    } else if (visitedTypes.contains(this)) {
-      return 3;
-    }
-    visitedTypes.add(this);
-    // Reference the arrays of parameters
-    List<DartType> normalParameterTypes = this.normalParameterTypes;
-    List<DartType> optionalParameterTypes = this.optionalParameterTypes;
-    Iterable<DartType> namedParameterTypes = this.namedParameterTypes.values;
-    // Generate the hashCode
-    int code = (returnType as TypeImpl).internalHashCode(visitedTypes);
-    for (int i = 0; i < normalParameterTypes.length; i++) {
-      code = (code << 1) +
-          (normalParameterTypes[i] as TypeImpl).internalHashCode(visitedTypes);
-    }
-    for (int i = 0; i < optionalParameterTypes.length; i++) {
-      code = (code << 1) +
-          (optionalParameterTypes[i] as TypeImpl)
-              .internalHashCode(visitedTypes);
-    }
-    for (DartType type in namedParameterTypes) {
-      code = (code << 1) + (type as TypeImpl).internalHashCode(visitedTypes);
-    }
-    return code;
-  }
-
-  @override
-  bool isAssignableTo(DartType type,
-      [Set<Element> thisExpansions, Set<Element> typeExpansions]) {
+  bool isAssignableTo(DartType type) {
     // A function type T may be assigned to a function type S, written T <=> S,
     // iff T <: S.
-    return isSubtypeOf(type, thisExpansions, typeExpansions);
+    return isSubtypeOf(type);
   }
 
   @override
-  bool isMoreSpecificThan(DartType type, [Set<Element> thisExpansions,
-      Set<Element> typeExpansions, bool withDynamic = false,
-      Set<Element> visitedElements]) {
+  bool isMoreSpecificThan(DartType type,
+      [bool withDynamic = false, Set<Element> visitedElements]) {
     // Note: visitedElements is only used for breaking recursion in the type
     // hierarchy; we don't use it when recursing into the function type.
 
@@ -4989,129 +4982,104 @@
     }
     FunctionType t = this;
     FunctionType s = type as FunctionType;
-    if (thisExpansions == null) {
-      thisExpansions = new HashSet<Element>();
-    } else if (thisExpansions.contains(this.element)) {
-      // [this] contains a reference to itself, which is illegal (and is
-      // checked elsewhere).  To avoid cascading errors, consider T to be a
-      // subtype of S.
-      return true;
+    List<DartType> tTypes = t.normalParameterTypes;
+    List<DartType> tOpTypes = t.optionalParameterTypes;
+    List<DartType> sTypes = s.normalParameterTypes;
+    List<DartType> sOpTypes = s.optionalParameterTypes;
+    // If one function has positional and the other has named parameters,
+    // return false.
+    if ((sOpTypes.length > 0 && t.namedParameterTypes.length > 0) ||
+        (tOpTypes.length > 0 && s.namedParameterTypes.length > 0)) {
+      return false;
     }
-    if (typeExpansions == null) {
-      typeExpansions = new HashSet<Element>();
-    } else if (typeExpansions.contains(type.element)) {
-      // [type] contains a reference to itself, which is illegal (and is
-      // checked elsewhere).  To avoid cascading errors, consider T to be a
-      // subtype of S.
-      return true;
-    }
-    thisExpansions.add(this.element);
-    typeExpansions.add(type.element);
-    try {
-      List<DartType> tTypes = t.normalParameterTypes;
-      List<DartType> tOpTypes = t.optionalParameterTypes;
-      List<DartType> sTypes = s.normalParameterTypes;
-      List<DartType> sOpTypes = s.optionalParameterTypes;
-      // If one function has positional and the other has named parameters,
-      // return false.
-      if ((sOpTypes.length > 0 && t.namedParameterTypes.length > 0) ||
-          (tOpTypes.length > 0 && s.namedParameterTypes.length > 0)) {
+    // named parameters case
+    if (t.namedParameterTypes.length > 0) {
+      // check that the number of required parameters are equal, and check that
+      // every t_i is more specific than every s_i
+      if (t.normalParameterTypes.length != s.normalParameterTypes.length) {
+        return false;
+      } else if (t.normalParameterTypes.length > 0) {
+        for (int i = 0; i < tTypes.length; i++) {
+          if (!(tTypes[i] as TypeImpl).isMoreSpecificThan(
+              sTypes[i], withDynamic)) {
+            return false;
+          }
+        }
+      }
+      Map<String, DartType> namedTypesT = t.namedParameterTypes;
+      Map<String, DartType> namedTypesS = s.namedParameterTypes;
+      // if k >= m is false, return false: the passed function type has more
+      // named parameter types than this
+      if (namedTypesT.length < namedTypesS.length) {
         return false;
       }
-      // named parameters case
-      if (t.namedParameterTypes.length > 0) {
-        // check that the number of required parameters are equal, and check that
-        // every t_i is more specific than every s_i
-        if (t.normalParameterTypes.length != s.normalParameterTypes.length) {
-          return false;
-        } else if (t.normalParameterTypes.length > 0) {
-          for (int i = 0; i < tTypes.length; i++) {
-            if (!(tTypes[i] as TypeImpl).isMoreSpecificThan(
-                sTypes[i], thisExpansions, typeExpansions, withDynamic)) {
-              return false;
-            }
-          }
-        }
-        Map<String, DartType> namedTypesT = t.namedParameterTypes;
-        Map<String, DartType> namedTypesS = s.namedParameterTypes;
-        // if k >= m is false, return false: the passed function type has more
-        // named parameter types than this
-        if (namedTypesT.length < namedTypesS.length) {
+      // Loop through each element in S verifying that T has a matching
+      // parameter name and that the corresponding type is more specific then
+      // the type in S.
+      for (String keyS in namedTypesS.keys) {
+        DartType typeT = namedTypesT[keyS];
+        if (typeT == null) {
           return false;
         }
-        // Loop through each element in S verifying that T has a matching
-        // parameter name and that the corresponding type is more specific then
-        // the type in S.
-        for (String keyS in namedTypesS.keys) {
-          DartType typeT = namedTypesT[keyS];
-          if (typeT == null) {
-            return false;
-          }
-          if (!(typeT as TypeImpl).isMoreSpecificThan(
-              namedTypesS[keyS], thisExpansions, typeExpansions, withDynamic)) {
-            return false;
-          }
+        if (!(typeT as TypeImpl).isMoreSpecificThan(
+            namedTypesS[keyS], withDynamic)) {
+          return false;
         }
-      } else if (s.namedParameterTypes.length > 0) {
+      }
+    } else if (s.namedParameterTypes.length > 0) {
+      return false;
+    } else {
+      // positional parameter case
+      int tArgLength = tTypes.length + tOpTypes.length;
+      int sArgLength = sTypes.length + sOpTypes.length;
+      // Check that the total number of parameters in t is greater than or equal
+      // to the number of parameters in s and that the number of required
+      // parameters in s is greater than or equal to the number of required
+      // parameters in t.
+      if (tArgLength < sArgLength || sTypes.length < tTypes.length) {
         return false;
+      }
+      if (tOpTypes.length == 0 && sOpTypes.length == 0) {
+        // No positional arguments, don't copy contents to new array
+        for (int i = 0; i < sTypes.length; i++) {
+          if (!(tTypes[i] as TypeImpl).isMoreSpecificThan(
+              sTypes[i], withDynamic)) {
+            return false;
+          }
+        }
       } else {
-        // positional parameter case
-        int tArgLength = tTypes.length + tOpTypes.length;
-        int sArgLength = sTypes.length + sOpTypes.length;
-        // Check that the total number of parameters in t is greater than or equal
-        // to the number of parameters in s and that the number of required
-        // parameters in s is greater than or equal to the number of required
-        // parameters in t.
-        if (tArgLength < sArgLength || sTypes.length < tTypes.length) {
-          return false;
+        // Else, we do have positional parameters, copy required and positional
+        // parameter types into arrays to do the compare (for loop below).
+        List<DartType> tAllTypes = new List<DartType>(sArgLength);
+        for (int i = 0; i < tTypes.length; i++) {
+          tAllTypes[i] = tTypes[i];
         }
-        if (tOpTypes.length == 0 && sOpTypes.length == 0) {
-          // No positional arguments, don't copy contents to new array
-          for (int i = 0; i < sTypes.length; i++) {
-            if (!(tTypes[i] as TypeImpl).isMoreSpecificThan(
-                sTypes[i], thisExpansions, typeExpansions, withDynamic)) {
-              return false;
-            }
-          }
-        } else {
-          // Else, we do have positional parameters, copy required and positional
-          // parameter types into arrays to do the compare (for loop below).
-          List<DartType> tAllTypes = new List<DartType>(sArgLength);
-          for (int i = 0; i < tTypes.length; i++) {
-            tAllTypes[i] = tTypes[i];
-          }
-          for (int i = tTypes.length, j = 0; i < sArgLength; i++, j++) {
-            tAllTypes[i] = tOpTypes[j];
-          }
-          List<DartType> sAllTypes = new List<DartType>(sArgLength);
-          for (int i = 0; i < sTypes.length; i++) {
-            sAllTypes[i] = sTypes[i];
-          }
-          for (int i = sTypes.length, j = 0; i < sArgLength; i++, j++) {
-            sAllTypes[i] = sOpTypes[j];
-          }
-          for (int i = 0; i < sAllTypes.length; i++) {
-            if (!(tAllTypes[i] as TypeImpl).isMoreSpecificThan(
-                sAllTypes[i], thisExpansions, typeExpansions, withDynamic)) {
-              return false;
-            }
+        for (int i = tTypes.length, j = 0; i < sArgLength; i++, j++) {
+          tAllTypes[i] = tOpTypes[j];
+        }
+        List<DartType> sAllTypes = new List<DartType>(sArgLength);
+        for (int i = 0; i < sTypes.length; i++) {
+          sAllTypes[i] = sTypes[i];
+        }
+        for (int i = sTypes.length, j = 0; i < sArgLength; i++, j++) {
+          sAllTypes[i] = sOpTypes[j];
+        }
+        for (int i = 0; i < sAllTypes.length; i++) {
+          if (!(tAllTypes[i] as TypeImpl).isMoreSpecificThan(
+              sAllTypes[i], withDynamic)) {
+            return false;
           }
         }
       }
-      DartType tRetType = t.returnType;
-      DartType sRetType = s.returnType;
-      return sRetType.isVoid ||
-          (tRetType as TypeImpl).isMoreSpecificThan(
-              sRetType, thisExpansions, typeExpansions, withDynamic);
-    } finally {
-      thisExpansions.remove(this.element);
-      typeExpansions.remove(type.element);
     }
+    DartType tRetType = t.returnType;
+    DartType sRetType = s.returnType;
+    return sRetType.isVoid ||
+        (tRetType as TypeImpl).isMoreSpecificThan(sRetType, withDynamic);
   }
 
   @override
-  bool isSubtypeOf(DartType type,
-      [Set<Element> thisExpansions, Set<Element> typeExpansions]) {
+  bool isSubtypeOf(DartType type) {
     // trivial base cases
     if (type == null) {
       return false;
@@ -5127,141 +5095,142 @@
     }
     FunctionType t = this;
     FunctionType s = type as FunctionType;
-    if (thisExpansions == null) {
-      thisExpansions = new HashSet<Element>();
-    } else if (thisExpansions.contains(this.element)) {
-      // [this] contains a reference to itself, which is illegal (and is
-      // checked elsewhere).  To avoid cascading errors, consider T to be a
-      // subtype of S.
-      return true;
+    List<DartType> tTypes = t.normalParameterTypes;
+    List<DartType> tOpTypes = t.optionalParameterTypes;
+    List<DartType> sTypes = s.normalParameterTypes;
+    List<DartType> sOpTypes = s.optionalParameterTypes;
+    // If one function has positional and the other has named parameters,
+    // return false.
+    if ((sOpTypes.length > 0 && t.namedParameterTypes.length > 0) ||
+        (tOpTypes.length > 0 && s.namedParameterTypes.length > 0)) {
+      return false;
     }
-    if (typeExpansions == null) {
-      typeExpansions = new HashSet<Element>();
-    } else if (typeExpansions.contains(type.element)) {
-      // [type] contains a reference to itself, which is illegal (and is
-      // checked elsewhere).  To avoid cascading errors, consider T to be a
-      // subtype of S.
-      return true;
-    }
-    thisExpansions.add(this.element);
-    typeExpansions.add(type.element);
-    try {
-      List<DartType> tTypes = t.normalParameterTypes;
-      List<DartType> tOpTypes = t.optionalParameterTypes;
-      List<DartType> sTypes = s.normalParameterTypes;
-      List<DartType> sOpTypes = s.optionalParameterTypes;
-      // If one function has positional and the other has named parameters,
-      // return false.
-      if ((sOpTypes.length > 0 && t.namedParameterTypes.length > 0) ||
-          (tOpTypes.length > 0 && s.namedParameterTypes.length > 0)) {
+    // named parameters case
+    if (t.namedParameterTypes.length > 0) {
+      // check that the number of required parameters are equal,
+      // and check that every t_i is assignable to every s_i
+      if (t.normalParameterTypes.length != s.normalParameterTypes.length) {
+        return false;
+      } else if (t.normalParameterTypes.length > 0) {
+        for (int i = 0; i < tTypes.length; i++) {
+          if (!(tTypes[i] as TypeImpl).isAssignableTo(sTypes[i])) {
+            return false;
+          }
+        }
+      }
+      Map<String, DartType> namedTypesT = t.namedParameterTypes;
+      Map<String, DartType> namedTypesS = s.namedParameterTypes;
+      // if k >= m is false, return false: the passed function type has more
+      // named parameter types than this
+      if (namedTypesT.length < namedTypesS.length) {
         return false;
       }
-      // named parameters case
-      if (t.namedParameterTypes.length > 0) {
-        // check that the number of required parameters are equal,
-        // and check that every t_i is assignable to every s_i
-        if (t.normalParameterTypes.length != s.normalParameterTypes.length) {
-          return false;
-        } else if (t.normalParameterTypes.length > 0) {
-          for (int i = 0; i < tTypes.length; i++) {
-            if (!(tTypes[i] as TypeImpl).isAssignableTo(
-                sTypes[i], thisExpansions, typeExpansions)) {
-              return false;
-            }
-          }
-        }
-        Map<String, DartType> namedTypesT = t.namedParameterTypes;
-        Map<String, DartType> namedTypesS = s.namedParameterTypes;
-        // if k >= m is false, return false: the passed function type has more
-        // named parameter types than this
-        if (namedTypesT.length < namedTypesS.length) {
+      // Loop through each element in S verifying that T has a matching
+      // parameter name and that the corresponding type is assignable to the
+      // type in S.
+      for (String keyS in namedTypesS.keys) {
+        DartType typeT = namedTypesT[keyS];
+        if (typeT == null) {
           return false;
         }
-        // Loop through each element in S verifying that T has a matching
-        // parameter name and that the corresponding type is assignable to the
-        // type in S.
-        for (String keyS in namedTypesS.keys) {
-          DartType typeT = namedTypesT[keyS];
-          if (typeT == null) {
-            return false;
-          }
-          if (!(typeT as TypeImpl).isAssignableTo(
-              namedTypesS[keyS], thisExpansions, typeExpansions)) {
-            return false;
-          }
+        if (!(typeT as TypeImpl).isAssignableTo(namedTypesS[keyS])) {
+          return false;
         }
-      } else if (s.namedParameterTypes.length > 0) {
+      }
+    } else if (s.namedParameterTypes.length > 0) {
+      return false;
+    } else {
+      // positional parameter case
+      int tArgLength = tTypes.length + tOpTypes.length;
+      int sArgLength = sTypes.length + sOpTypes.length;
+      // Check that the total number of parameters in t is greater than or
+      // equal to the number of parameters in s and that the number of
+      // required parameters in s is greater than or equal to the number of
+      // required parameters in t.
+      if (tArgLength < sArgLength || sTypes.length < tTypes.length) {
         return false;
+      }
+      if (tOpTypes.length == 0 && sOpTypes.length == 0) {
+        // No positional arguments, don't copy contents to new array
+        for (int i = 0; i < sTypes.length; i++) {
+          if (!(tTypes[i] as TypeImpl).isAssignableTo(sTypes[i])) {
+            return false;
+          }
+        }
       } else {
-        // positional parameter case
-        int tArgLength = tTypes.length + tOpTypes.length;
-        int sArgLength = sTypes.length + sOpTypes.length;
-        // Check that the total number of parameters in t is greater than or
-        // equal to the number of parameters in s and that the number of
-        // required parameters in s is greater than or equal to the number of
-        // required parameters in t.
-        if (tArgLength < sArgLength || sTypes.length < tTypes.length) {
-          return false;
+        // Else, we do have positional parameters, copy required and
+        // positional parameter types into arrays to do the compare (for loop
+        // below).
+        List<DartType> tAllTypes = new List<DartType>(sArgLength);
+        for (int i = 0; i < tTypes.length; i++) {
+          tAllTypes[i] = tTypes[i];
         }
-        if (tOpTypes.length == 0 && sOpTypes.length == 0) {
-          // No positional arguments, don't copy contents to new array
-          for (int i = 0; i < sTypes.length; i++) {
-            if (!(tTypes[i] as TypeImpl).isAssignableTo(
-                sTypes[i], thisExpansions, typeExpansions)) {
-              return false;
-            }
-          }
-        } else {
-          // Else, we do have positional parameters, copy required and
-          // positional parameter types into arrays to do the compare (for loop
-          // below).
-          List<DartType> tAllTypes = new List<DartType>(sArgLength);
-          for (int i = 0; i < tTypes.length; i++) {
-            tAllTypes[i] = tTypes[i];
-          }
-          for (int i = tTypes.length, j = 0; i < sArgLength; i++, j++) {
-            tAllTypes[i] = tOpTypes[j];
-          }
-          List<DartType> sAllTypes = new List<DartType>(sArgLength);
-          for (int i = 0; i < sTypes.length; i++) {
-            sAllTypes[i] = sTypes[i];
-          }
-          for (int i = sTypes.length, j = 0; i < sArgLength; i++, j++) {
-            sAllTypes[i] = sOpTypes[j];
-          }
-          for (int i = 0; i < sAllTypes.length; i++) {
-            if (!(tAllTypes[i] as TypeImpl).isAssignableTo(
-                sAllTypes[i], thisExpansions, typeExpansions)) {
-              return false;
-            }
+        for (int i = tTypes.length, j = 0; i < sArgLength; i++, j++) {
+          tAllTypes[i] = tOpTypes[j];
+        }
+        List<DartType> sAllTypes = new List<DartType>(sArgLength);
+        for (int i = 0; i < sTypes.length; i++) {
+          sAllTypes[i] = sTypes[i];
+        }
+        for (int i = sTypes.length, j = 0; i < sArgLength; i++, j++) {
+          sAllTypes[i] = sOpTypes[j];
+        }
+        for (int i = 0; i < sAllTypes.length; i++) {
+          if (!(tAllTypes[i] as TypeImpl).isAssignableTo(sAllTypes[i])) {
+            return false;
           }
         }
       }
-      DartType tRetType = t.returnType;
-      DartType sRetType = s.returnType;
-      return sRetType.isVoid ||
-          (tRetType as TypeImpl).isAssignableTo(
-              sRetType, thisExpansions, typeExpansions);
-    } finally {
-      thisExpansions.remove(this.element);
-      typeExpansions.remove(type.element);
+    }
+    DartType tRetType = t.returnType;
+    DartType sRetType = s.returnType;
+    return sRetType.isVoid || (tRetType as TypeImpl).isAssignableTo(sRetType);
+  }
+
+  @override
+  TypeImpl pruned(List<FunctionTypeAliasElement> prune) {
+    if (prune == null) {
+      return this;
+    } else if (prune.contains(element)) {
+      // Circularity found.  Prune the type declaration.
+      return new CircularTypeImpl();
+    } else {
+      // There should never be a reason to prune a type that has already been
+      // pruned, since pruning is only done when expanding a function type
+      // alias, and function type aliases are always expanded by starting with
+      // base types.
+      assert(this.prunedTypedefs == null);
+      FunctionTypeImpl result = new FunctionTypeImpl._(element, name, prune);
+      result.typeArguments =
+          typeArguments.map((TypeImpl t) => t.pruned(prune)).toList();
+      return result;
     }
   }
 
   @override
-  FunctionTypeImpl substitute2(
-      List<DartType> argumentTypes, List<DartType> parameterTypes) {
+  DartType substitute2(
+      List<DartType> argumentTypes, List<DartType> parameterTypes,
+      [List<FunctionTypeAliasElement> prune]) {
+    // Pruned types should only ever result from peforming type variable
+    // substitution, and it doesn't make sense to substitute again after
+    // substituting once.
+    assert(this.prunedTypedefs == null);
     if (argumentTypes.length != parameterTypes.length) {
       throw new IllegalArgumentException(
           "argumentTypes.length (${argumentTypes.length}) != parameterTypes.length (${parameterTypes.length})");
     }
-    if (argumentTypes.length == 0) {
-      return this;
-    }
     Element element = this.element;
+    if (prune != null && prune.contains(element)) {
+      // Circularity found.  Prune the type declaration.
+      return new CircularTypeImpl();
+    }
+    if (argumentTypes.length == 0) {
+      return this.pruned(prune);
+    }
     FunctionTypeImpl newType = (element is ExecutableElement)
-        ? new FunctionTypeImpl(element)
-        : new FunctionTypeImpl.forTypedef(element as FunctionTypeAliasElement);
+        ? new FunctionTypeImpl(element, prune)
+        : new FunctionTypeImpl.forTypedef(
+            element as FunctionTypeAliasElement, prune);
     newType.typeArguments =
         TypeImpl.substitute(typeArguments, argumentTypes, parameterTypes);
     return newType;
@@ -5275,12 +5244,10 @@
    * Return `true` if all of the name/type pairs in the first map ([firstTypes])
    * are equal to the corresponding name/type pairs in the second map
    * ([secondTypes]). The maps are expected to iterate over their entries in the
-   * same order in which those entries were added to the map. The set of
-   * [visitedElementPairs] is used to prevent infinite recursion in the case of
-   * cyclic type structures.
+   * same order in which those entries were added to the map.
    */
-  static bool _equals(Map<String, DartType> firstTypes,
-      Map<String, DartType> secondTypes, Set<ElementPair> visitedElementPairs) {
+  static bool _equals(
+      Map<String, DartType> firstTypes, Map<String, DartType> secondTypes) {
     if (secondTypes.length != firstTypes.length) {
       return false;
     }
@@ -5291,8 +5258,7 @@
       String secondKey = secondKeys.current;
       TypeImpl firstType = firstTypes[firstKey];
       TypeImpl secondType = secondTypes[secondKey];
-      if (firstKey != secondKey ||
-          !firstType.internalEquals(secondType, visitedElementPairs)) {
+      if (firstKey != secondKey || firstType != secondType) {
         return false;
       }
     }
@@ -6096,29 +6062,47 @@
   List<DartType> typeArguments = DartType.EMPTY_LIST;
 
   /**
+   * The set of typedefs which should not be expanded when exploring this type,
+   * to avoid creating infinite types in response to self-referential typedefs.
+   */
+  final List<FunctionTypeAliasElement> prunedTypedefs;
+
+  /**
    * Initialize a newly created type to be declared by the given [element].
    */
-  InterfaceTypeImpl(ClassElement element) : super(element, element.displayName);
+  InterfaceTypeImpl(ClassElement element, [this.prunedTypedefs])
+      : super(element, element.displayName);
 
   /**
    * Initialize a newly created type to be declared by the given [element].
    */
   @deprecated // Use new InterfaceTypeImpl(element)
   InterfaceTypeImpl.con1(ClassElement element)
-      : super(element, element.displayName);
+      : prunedTypedefs = null,
+        super(element, element.displayName);
 
   /**
    * Initialize a newly created type to have the given [name]. This constructor
    * should only be used in cases where there is no declaration of the type.
    */
   @deprecated // Use new InterfaceTypeImpl.named(name)
-  InterfaceTypeImpl.con2(String name) : super(null, name);
+  InterfaceTypeImpl.con2(String name)
+      : prunedTypedefs = null,
+        super(null, name);
 
   /**
    * Initialize a newly created type to have the given [name]. This constructor
    * should only be used in cases where there is no declaration of the type.
    */
-  InterfaceTypeImpl.named(String name) : super(null, name);
+  InterfaceTypeImpl.named(String name)
+      : prunedTypedefs = null,
+        super(null, name);
+
+  /**
+   * Private constructor.
+   */
+  InterfaceTypeImpl._(Element element, String name, this.prunedTypedefs)
+      : super(element, name);
 
   @override
   List<PropertyAccessorElement> get accessors {
@@ -6263,15 +6247,16 @@
     if (identical(object, this)) {
       return true;
     }
-    return internalEquals(object, new HashSet<ElementPair>());
+    if (object is! InterfaceTypeImpl) {
+      return false;
+    }
+    InterfaceTypeImpl otherType = object as InterfaceTypeImpl;
+    return (element == otherType.element) &&
+        TypeImpl.equalArrays(typeArguments, otherType.typeArguments);
   }
 
   @override
-  void appendTo(StringBuffer buffer, Set<DartType> visitedTypes) {
-    if (!visitedTypes.add(this)) {
-      buffer.write(name == null ? '...' : name);
-      return;
-    }
+  void appendTo(StringBuffer buffer) {
     buffer.write(name);
     int argumentCount = typeArguments.length;
     if (argumentCount > 0) {
@@ -6280,7 +6265,7 @@
         if (i > 0) {
           buffer.write(", ");
         }
-        (typeArguments[i] as TypeImpl).appendTo(buffer, visitedTypes);
+        (typeArguments[i] as TypeImpl).appendTo(buffer);
       }
       buffer.write(">");
     }
@@ -6356,23 +6341,6 @@
       .from((element as ClassElementImpl).getSetter(setterName), this);
 
   @override
-  bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) {
-    if (identical(object, this)) {
-      return true;
-    }
-    if (object is! InterfaceTypeImpl) {
-      return false;
-    }
-    InterfaceTypeImpl otherType = object as InterfaceTypeImpl;
-    return (element == otherType.element) &&
-        TypeImpl.equalArrays(
-            typeArguments, otherType.typeArguments, visitedElementPairs);
-  }
-
-  @override
-  int internalHashCode(List<DartType> visitedTypes) => hashCode;
-
-  @override
   bool isDirectSupertypeOf(InterfaceType type) {
     InterfaceType i = this;
     InterfaceType j = type;
@@ -6421,9 +6389,8 @@
   }
 
   @override
-  bool isMoreSpecificThan(DartType type, [Set<Element> thisExpansions,
-      Set<Element> typeExpansions, bool withDynamic = false,
-      Set<Element> visitedElements]) {
+  bool isMoreSpecificThan(DartType type,
+      [bool withDynamic = false, Set<Element> visitedElements]) {
     //
     // S is dynamic.
     // The test to determine whether S is dynamic is done here because dynamic
@@ -6464,7 +6431,7 @@
         }
         for (int i = 0; i < tArguments.length; i++) {
           if (!(tArguments[i] as TypeImpl).isMoreSpecificThan(
-              sArguments[i], thisExpansions, typeExpansions, withDynamic)) {
+              sArguments[i], withDynamic)) {
             return false;
           }
         }
@@ -6490,19 +6457,18 @@
       // specific than S.
       InterfaceTypeImpl supertype = superclass;
       if (supertype != null &&
-          supertype.isMoreSpecificThan(type, thisExpansions, typeExpansions,
-              withDynamic, visitedElements)) {
+          supertype.isMoreSpecificThan(type, withDynamic, visitedElements)) {
         return true;
       }
-      for (InterfaceTypeImpl interfaceType in interfaces) {
-        if (interfaceType.isMoreSpecificThan(type, thisExpansions,
-            typeExpansions, withDynamic, visitedElements)) {
+      for (InterfaceType interfaceType in interfaces) {
+        if ((interfaceType as InterfaceTypeImpl).isMoreSpecificThan(
+            type, withDynamic, visitedElements)) {
           return true;
         }
       }
-      for (InterfaceTypeImpl mixinType in mixins) {
-        if (mixinType.isMoreSpecificThan(type, thisExpansions, typeExpansions,
-            withDynamic, visitedElements)) {
+      for (InterfaceType mixinType in mixins) {
+        if ((mixinType as InterfaceTypeImpl).isMoreSpecificThan(
+            type, withDynamic, visitedElements)) {
           return true;
         }
       }
@@ -6512,8 +6478,7 @@
       MethodElement callMethod = getMethod('call');
       if (callMethod != null && !callMethod.isStatic) {
         FunctionTypeImpl callType = callMethod.type;
-        if (callType.isMoreSpecificThan(type, thisExpansions, typeExpansions,
-            withDynamic, visitedElements)) {
+        if (callType.isMoreSpecificThan(type, withDynamic, visitedElements)) {
           return true;
         }
       }
@@ -6665,21 +6630,43 @@
   }
 
   @override
+  InterfaceTypeImpl pruned(List<FunctionTypeAliasElement> prune) {
+    if (prune == null) {
+      return this;
+    } else {
+      // There should never be a reason to prune a type that has already been
+      // pruned, since pruning is only done when expanding a function type
+      // alias, and function type aliases are always expanded by starting with
+      // base types.
+      assert(this.prunedTypedefs == null);
+      InterfaceTypeImpl result = new InterfaceTypeImpl._(element, name, prune);
+      result.typeArguments =
+          typeArguments.map((TypeImpl t) => t.pruned(prune)).toList();
+      return result;
+    }
+  }
+
+  @override
   InterfaceTypeImpl substitute2(
-      List<DartType> argumentTypes, List<DartType> parameterTypes) {
+      List<DartType> argumentTypes, List<DartType> parameterTypes,
+      [List<FunctionTypeAliasElement> prune]) {
+    // Pruned types should only ever result from performing type variable
+    // substitution, and it doesn't make sense to substitute again after
+    // substituting once.
+    assert(this.prunedTypedefs == null);
     if (argumentTypes.length != parameterTypes.length) {
       throw new IllegalArgumentException(
           "argumentTypes.length (${argumentTypes.length}) != parameterTypes.length (${parameterTypes.length})");
     }
     if (argumentTypes.length == 0 || typeArguments.length == 0) {
-      return this;
+      return this.pruned(prune);
     }
-    List<DartType> newTypeArguments =
-        TypeImpl.substitute(typeArguments, argumentTypes, parameterTypes);
+    List<DartType> newTypeArguments = TypeImpl.substitute(
+        typeArguments, argumentTypes, parameterTypes, prune);
     if (JavaArrays.equals(newTypeArguments, typeArguments)) {
       return this;
     }
-    InterfaceTypeImpl newType = new InterfaceTypeImpl(element);
+    InterfaceTypeImpl newType = new InterfaceTypeImpl(element, prune);
     newType.typeArguments = newTypeArguments;
     return newType;
   }
@@ -7505,7 +7492,7 @@
    * so parsing and resolving will be performed.
    */
   @override
-  VariableDeclaration get node;
+  VariableDeclaration computeNode();
 }
 
 /**
@@ -7562,10 +7549,6 @@
   ElementKind get kind => ElementKind.LOCAL_VARIABLE;
 
   @override
-  VariableDeclaration get node =>
-      getNodeMatching((node) => node is VariableDeclaration);
-
-  @override
   SourceRange get visibleRange {
     if (_visibleRangeLength < 0) {
       return null;
@@ -7583,6 +7566,10 @@
     buffer.write(displayName);
   }
 
+  @override
+  VariableDeclaration computeNode() =>
+      getNodeMatching((node) => node is VariableDeclaration);
+
   /**
    * Specifies that this variable is potentially mutated somewhere in closure.
    */
@@ -7679,8 +7666,9 @@
   @override
   int get nameOffset => _baseElement.nameOffset;
 
+  @deprecated
   @override
-  AstNode get node => _baseElement.node;
+  AstNode get node => computeNode();
 
   @override
   Source get source => _baseElement.source;
@@ -7693,6 +7681,9 @@
       _baseElement.computeDocumentationComment();
 
   @override
+  AstNode computeNode() => _baseElement.computeNode();
+
+  @override
   Element getAncestor(Predicate<Element> predicate) =>
       baseElement.getAncestor(predicate);
 
@@ -7776,7 +7767,7 @@
    * so parsing and resolving will be performed.
    */
   @override
-  MethodDeclaration get node;
+  MethodDeclaration computeNode();
 }
 
 /**
@@ -7849,10 +7840,6 @@
     return super.name;
   }
 
-  @override
-  MethodDeclaration get node =>
-      getNodeMatching((node) => node is MethodDeclaration);
-
   /**
    * Set whether this method is static.
    */
@@ -7868,6 +7855,10 @@
     buffer.write(displayName);
     super.appendTo(buffer);
   }
+
+  @override
+  MethodDeclaration computeNode() =>
+      getNodeMatching((node) => node is MethodDeclaration);
 }
 
 /**
@@ -7889,10 +7880,10 @@
   ClassElement get enclosingElement => baseElement.enclosingElement;
 
   @override
-  MethodDeclaration get node => baseElement.node;
+  accept(ElementVisitor visitor) => visitor.visitMethodElement(this);
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitMethodElement(this);
+  MethodDeclaration computeNode() => baseElement.computeNode();
 
   @override
   String toString() {
@@ -8060,12 +8051,6 @@
    */
   static const Modifier SYNTHETIC = const Modifier('SYNTHETIC', 18);
 
-  /**
-   * Indicates that a class was defined using an alias.
-   * TODO(brianwilkerson) This should be renamed to 'ALIAS'.
-   */
-  static const Modifier TYPEDEF = const Modifier('TYPEDEF', 19);
-
   static const List<Modifier> values = const [
     ABSTRACT,
     ASYNCHRONOUS,
@@ -8085,8 +8070,7 @@
     REFERENCES_SUPER,
     SETTER,
     STATIC,
-    SYNTHETIC,
-    TYPEDEF
+    SYNTHETIC
   ];
 
   const Modifier(String name, int ordinal) : super(name, ordinal);
@@ -8189,6 +8173,7 @@
   @override
   int get nameOffset => -1;
 
+  @deprecated
   @override
   AstNode get node => null;
 
@@ -8208,6 +8193,9 @@
   String computeDocumentationComment() => null;
 
   @override
+  AstNode computeNode() => null;
+
+  @override
   Element getAncestor(Predicate<Element> predicate) => null;
 
   @override
@@ -8396,9 +8384,6 @@
    */
   bool get isInitializingFormal;
 
-  @override
-  FormalParameter get node;
-
   /**
    * Return the kind of this parameter.
    */
@@ -8410,6 +8395,9 @@
    * parameter.
    */
   List<ParameterElement> get parameters;
+
+  @override
+  FormalParameter computeNode();
 }
 
 /**
@@ -8487,10 +8475,6 @@
   ElementKind get kind => ElementKind.PARAMETER;
 
   @override
-  FormalParameter get node =>
-      getNodeMatching((node) => node is FormalParameter);
-
-  @override
   List<ParameterElement> get parameters => _parameters;
 
   /**
@@ -8553,6 +8537,10 @@
   }
 
   @override
+  FormalParameter computeNode() =>
+      getNodeMatching((node) => node is FormalParameter);
+
+  @override
   ElementImpl getChild(String identifier) {
     for (ParameterElement parameter in _parameters) {
       if ((parameter as ParameterElementImpl).identifier == identifier) {
@@ -8637,9 +8625,6 @@
   bool get isInitializingFormal => baseElement.isInitializingFormal;
 
   @override
-  FormalParameter get node => baseElement.node;
-
-  @override
   ParameterKind get parameterKind => baseElement.parameterKind;
 
   @override
@@ -8665,6 +8650,9 @@
   accept(ElementVisitor visitor) => visitor.visitParameterElement(this);
 
   @override
+  FormalParameter computeNode() => baseElement.computeNode();
+
+  @override
   Element getAncestor(Predicate<Element> predicate) {
     Element element = baseElement.getAncestor(predicate);
     ParameterizedType definingType = this.definingType;
@@ -8999,20 +8987,6 @@
     return super.name;
   }
 
-  @override
-  AstNode get node {
-    if (isSynthetic) {
-      return null;
-    }
-    if (enclosingElement is ClassElement) {
-      return getNodeMatching((node) => node is MethodDeclaration);
-    }
-    if (enclosingElement is CompilationUnitElement) {
-      return getNodeMatching((node) => node is FunctionDeclaration);
-    }
-    return null;
-  }
-
   /**
    * Set whether this accessor is a setter.
    */
@@ -9040,6 +9014,20 @@
     buffer.write(variable.displayName);
     super.appendTo(buffer);
   }
+
+  @override
+  AstNode computeNode() {
+    if (isSynthetic) {
+      return null;
+    }
+    if (enclosingElement is ClassElement) {
+      return getNodeMatching((node) => node is MethodDeclaration);
+    }
+    if (enclosingElement is CompilationUnitElement) {
+      return getNodeMatching((node) => node is FunctionDeclaration);
+    }
+    return null;
+  }
 }
 
 /**
@@ -9568,7 +9556,7 @@
       const <TopLevelVariableElement>[];
 
   @override
-  VariableDeclaration get node;
+  VariableDeclaration computeNode();
 }
 
 /**
@@ -9602,11 +9590,11 @@
   ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE;
 
   @override
-  VariableDeclaration get node =>
-      getNodeMatching((node) => node is VariableDeclaration);
+  accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this);
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this);
+  VariableDeclaration computeNode() =>
+      getNodeMatching((node) => node is VariableDeclaration);
 }
 
 /**
@@ -9665,11 +9653,7 @@
    * Append a textual representation of this type to the given [buffer]. The set
    * of [visitedTypes] is used to prevent infinite recusion.
    */
-  void appendTo(StringBuffer buffer, Set<DartType> visitedTypes) {
-    if (!visitedTypes.add(this)) {
-      buffer.write(name == null ? '...' : name);
-      return;
-    }
+  void appendTo(StringBuffer buffer) {
     if (name == null) {
       buffer.write("<unnamed type>");
     } else {
@@ -9680,10 +9664,6 @@
   @override
   DartType getLeastUpperBound(DartType type) => null;
 
-  bool internalEquals(Object object, Set<ElementPair> visitedElementPairs);
-
-  int internalHashCode(List<DartType> visitedTypes);
-
   /**
    * Return `true` if this type is assignable to the given [type] (written in
    * the spec as "T <=> S", where T=[this] and S=[type]).
@@ -9696,25 +9676,16 @@
    * use these as sets of function type aliases that don't need to be expanded.
    */
   @override
-  bool isAssignableTo(TypeImpl type,
-      [Set<Element> thisExpansions, Set<Element> typeExpansions]) {
+  bool isAssignableTo(DartType type) {
     // An interface type T may be assigned to a type S, written T <=> S, iff
     // either T <: S or S <: T.
-    return isSubtypeOf(type, thisExpansions, typeExpansions) ||
-        type.isSubtypeOf(this, typeExpansions, thisExpansions);
+    return isSubtypeOf(type) || (type as TypeImpl).isSubtypeOf(this);
   }
 
   /**
    * Return `true` if this type is more specific than the given [type] (written
    * in the spec as "T << S", where T=[this] and S=[type]).
    *
-   * The sets [thisExpansions] and [typeExpansions], if given, are the sets of
-   * function type aliases that have been expanded so far in the process of
-   * reaching [this] and [type], respectively.  These are used to avoid
-   * infinite regress when analyzing invalid code; since the language spec
-   * forbids a typedef from referring to itself directly or indirectly, we can
-   * use these as sets of function type aliases that don't need to be expanded.
-   *
    * If [withDynamic] is `true`, then "dynamic" should be considered as a
    * subtype of any type (as though "dynamic" had been replaced with bottom).
    *
@@ -9726,9 +9697,8 @@
    * examined when walking the class hierarchy.
    */
   @override
-  bool isMoreSpecificThan(DartType type, [Set<Element> thisExpansions,
-      Set<Element> typeExpansions, bool withDynamic = false,
-      Set<Element> visitedElements]);
+  bool isMoreSpecificThan(DartType type,
+      [bool withDynamic = false, Set<Element> visitedElements]);
 
   /**
    * Return `true` if this type is a subtype of the given [type] (written in
@@ -9742,29 +9712,53 @@
    * use these as sets of function type aliases that don't need to be expanded.
    */
   @override
-  bool isSubtypeOf(DartType type,
-      [Set<Element> thisExpansions, Set<Element> typeExpansions]) {
+  bool isSubtypeOf(DartType type) {
     // For non-function types, T <: S iff [_|_/dynamic]T << S.
-    return isMoreSpecificThan(type, thisExpansions, typeExpansions, true);
+    return isMoreSpecificThan(type, true);
   }
 
   @override
   bool isSupertypeOf(DartType type) => type.isSubtypeOf(this);
 
+  /**
+   * Create a new [TypeImpl] that is identical to [this] except that when
+   * visiting type parameters, function parameter types, and function return
+   * types, function types listed in [prune] will not be expanded.  This is
+   * used to avoid creating infinite types in the presence of circular
+   * typedefs.
+   *
+   * If [prune] is null, then [this] is returned unchanged.
+   *
+   * Only legal to call on a [TypeImpl] that is not already subject to pruning.
+   */
+  TypeImpl pruned(List<FunctionTypeAliasElement> prune);
+
+  /**
+   * Return the type resulting from substituting the given [argumentTypes] for
+   * the given [parameterTypes] in this type.
+   *
+   * In all classes derived from [TypeImpl], a new optional argument
+   * [prune] is added.  If specified, it is a list of function typdefs
+   * which should not be expanded.  This is used to avoid creating infinite
+   * types in response to self-referential typedefs.
+   */
+  @override
+  DartType substitute2(
+      List<DartType> argumentTypes, List<DartType> parameterTypes,
+      [List<FunctionTypeAliasElement> prune]);
+
   @override
   String toString() {
     StringBuffer buffer = new StringBuffer();
-    appendTo(buffer, new HashSet<DartType>());
+    appendTo(buffer);
     return buffer.toString();
   }
 
   /**
    * Return `true` if corresponding elements of the [first] and [second] lists
-   * of type arguments are all equal. Use the set of [visitedElementPairs] to
-   * prevent infinite loops when the types are recursively defined.
+   * of type arguments are all equal.
    */
-  static bool equalArrays(List<DartType> first, List<DartType> second,
-      Set<ElementPair> visitedElementPairs) {
+  static bool equalArrays(List<DartType> first, List<DartType> second) {
     if (first.length != second.length) {
       return false;
     }
@@ -9778,8 +9772,7 @@
             .logInformation('Found null type argument in TypeImpl.equalArrays');
         return false;
       }
-      if (!(first[i] as TypeImpl).internalEquals(
-          second[i], visitedElementPairs)) {
+      if (first[i] != second[i]) {
         return false;
       }
     }
@@ -9789,16 +9782,22 @@
   /**
    * Return a list containing the results of using the given [argumentTypes] and
    * [parameterTypes] to perform a substitution on all of the given [types].
+   *
+   * If [prune] is specified, it is a list of function typdefs which should not
+   * be expanded.  This is used to avoid creating infinite types in response to
+   * self-referential typedefs.
    */
   static List<DartType> substitute(List<DartType> types,
-      List<DartType> argumentTypes, List<DartType> parameterTypes) {
+      List<DartType> argumentTypes, List<DartType> parameterTypes,
+      [List<FunctionTypeAliasElement> prune]) {
     int length = types.length;
     if (length == 0) {
       return types;
     }
     List<DartType> newTypes = new List<DartType>(length);
     for (int i = 0; i < length; i++) {
-      newTypes[i] = types[i].substitute2(argumentTypes, parameterTypes);
+      newTypes[i] = (types[i] as TypeImpl).substitute2(
+          argumentTypes, parameterTypes, prune);
     }
     return newTypes;
   }
@@ -9918,16 +9917,8 @@
       object is TypeParameterTypeImpl && (element == object.element);
 
   @override
-  bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) =>
-      this == object;
-
-  @override
-  int internalHashCode(List<DartType> visitedTypes) => hashCode;
-
-  @override
-  bool isMoreSpecificThan(DartType s, [Set<Element> thisExpansions,
-      Set<Element> typeExpansions, bool withDynamic = false,
-      Set<Element> visitedElements]) {
+  bool isMoreSpecificThan(DartType s,
+      [bool withDynamic = false, Set<Element> visitedElements]) {
     //
     // A type T is more specific than a type S, written T << S,
     // if one of the following conditions is met:
@@ -9973,21 +9964,22 @@
     }
     visitedElements.add(element);
     try {
-      return bound.isMoreSpecificThan(
-          s, thisExpansions, typeExpansions, withDynamic, visitedElements);
+      return bound.isMoreSpecificThan(s, withDynamic, visitedElements);
     } finally {
       visitedElements.remove(element);
     }
   }
 
   @override
-  bool isSubtypeOf(DartType type,
-          [Set<Element> thisExpansions, Set<Element> typeExpansions]) =>
-      isMoreSpecificThan(type, thisExpansions, typeExpansions, true);
+  bool isSubtypeOf(DartType type) => isMoreSpecificThan(type, true);
+
+  @override
+  TypeImpl pruned(List<FunctionTypeAliasElement> prune) => this;
 
   @override
   DartType substitute2(
-      List<DartType> argumentTypes, List<DartType> parameterTypes) {
+      List<DartType> argumentTypes, List<DartType> parameterTypes,
+      [List<FunctionTypeAliasElement> prune]) {
     int length = parameterTypes.length;
     for (int i = 0; i < length; i++) {
       if (parameterTypes[i] == this) {
@@ -10060,16 +10052,8 @@
   bool operator ==(Object object) => identical(object, this);
 
   @override
-  bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) =>
-      identical(object, this);
-
-  @override
-  int internalHashCode(List<DartType> visitedTypes) => hashCode;
-
-  @override
-  bool isMoreSpecificThan(DartType type, [Set<Element> thisExpansions,
-      Set<Element> typeExpansions, bool withDynamic = false,
-      Set<Element> visitedElements]) {
+  bool isMoreSpecificThan(DartType type,
+      [bool withDynamic = false, Set<Element> visitedElements]) {
     // T is S
     if (identical(this, type)) {
       return true;
@@ -10079,15 +10063,18 @@
   }
 
   @override
-  bool isSubtypeOf(DartType type,
-      [Set<Element> thisExpansions, Set<Element> typeExpansions]) => true;
+  bool isSubtypeOf(DartType type) => true;
 
   @override
   bool isSupertypeOf(DartType type) => true;
 
   @override
+  TypeImpl pruned(List<FunctionTypeAliasElement> prune) => this;
+
+  @override
   DartType substitute2(
-      List<DartType> argumentTypes, List<DartType> parameterTypes) {
+      List<DartType> argumentTypes, List<DartType> parameterTypes,
+      [List<FunctionTypeAliasElement> prune]) {
     int length = parameterTypes.length;
     for (int i = 0; i < length; i++) {
       if (parameterTypes[i] == this) {
@@ -10395,20 +10382,12 @@
   bool operator ==(Object object) => identical(object, this);
 
   @override
-  bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) =>
-      identical(object, this);
+  bool isMoreSpecificThan(DartType type,
+          [bool withDynamic = false, Set<Element> visitedElements]) =>
+      isSubtypeOf(type);
 
   @override
-  int internalHashCode(List<DartType> visitedTypes) => hashCode;
-
-  @override
-  bool isMoreSpecificThan(DartType type, [Set<Element> thisExpansions,
-      Set<Element> typeExpansions, bool withDynamic = false,
-      Set<Element> visitedElements]) => isSubtypeOf(type);
-
-  @override
-  bool isSubtypeOf(DartType type,
-      [Set<Element> thisExpansions, Set<Element> typeExpansions]) {
+  bool isSubtypeOf(DartType type) {
     // The only subtype relations that pertain to void are therefore:
     // void <: void (by reflexivity)
     // bottom <: void (as bottom is a subtype of all types).
@@ -10417,8 +10396,12 @@
   }
 
   @override
+  TypeImpl pruned(List<FunctionTypeAliasElement> prune) => this;
+
+  @override
   VoidTypeImpl substitute2(
-      List<DartType> argumentTypes, List<DartType> parameterTypes) => this;
+      List<DartType> argumentTypes, List<DartType> parameterTypes,
+      [List<FunctionTypeAliasElement> prune]) => this;
 }
 
 /**
diff --git a/pkg/analyzer/lib/src/generated/element_handle.dart b/pkg/analyzer/lib/src/generated/element_handle.dart
index 856483b..9b8c325 100644
--- a/pkg/analyzer/lib/src/generated/element_handle.dart
+++ b/pkg/analyzer/lib/src/generated/element_handle.dart
@@ -70,7 +70,8 @@
   bool get isProxy => actualElement.isProxy;
 
   @override
-  bool get isTypedef => actualElement.isTypedef;
+  @deprecated
+  bool get isTypedef => actualElement.isMixinApplication;
 
   @override
   bool get isValidMixin => actualElement.isValidMixin;
@@ -200,9 +201,6 @@
   ElementKind get kind => ElementKind.COMPILATION_UNIT;
 
   @override
-  CompilationUnit get node => actualElement.node;
-
-  @override
   Source get source => actualElement.source;
 
   @override
@@ -222,6 +220,9 @@
   int get uriOffset => actualElement.uriOffset;
 
   @override
+  CompilationUnit computeNode() => actualElement.computeNode();
+
+  @override
   Element getElementAt(int offset) {
     return actualElement.getElementAt(offset);
   }
@@ -269,14 +270,14 @@
   int get nameEnd => actualElement.nameEnd;
 
   @override
-  ConstructorDeclaration get node => actualElement.node;
-
-  @override
   int get periodOffset => actualElement.periodOffset;
 
   @override
   ConstructorElement get redirectedConstructor =>
       actualElement.redirectedConstructor;
+
+  @override
+  ConstructorDeclaration computeNode() => actualElement.computeNode();
 }
 
 /**
@@ -375,8 +376,9 @@
   @override
   int get nameOffset => actualElement.nameOffset;
 
+  @deprecated
   @override
-  AstNode get node => actualElement.node;
+  AstNode get node => computeNode();
 
   @override
   Source get source => actualElement.source;
@@ -396,6 +398,9 @@
       actualElement.computeDocumentationComment();
 
   @override
+  AstNode computeNode() => actualElement.computeNode();
+
+  @override
   Element getAncestor(Predicate<Element> predicate) =>
       actualElement.getAncestor(predicate);
 
@@ -605,7 +610,7 @@
   ElementKind get kind => ElementKind.FIELD;
 
   @override
-  VariableDeclaration get node => actualElement.node;
+  VariableDeclaration computeNode() => actualElement.computeNode();
 }
 
 /**
@@ -631,10 +636,10 @@
   ElementKind get kind => ElementKind.FUNCTION;
 
   @override
-  FunctionDeclaration get node => actualElement.node;
+  SourceRange get visibleRange => actualElement.visibleRange;
 
   @override
-  SourceRange get visibleRange => actualElement.visibleRange;
+  FunctionDeclaration computeNode() => actualElement.computeNode();
 }
 
 /**
@@ -663,9 +668,6 @@
   ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS;
 
   @override
-  FunctionTypeAlias get node => actualElement.node;
-
-  @override
   List<ParameterElement> get parameters => actualElement.parameters;
 
   @override
@@ -676,6 +678,9 @@
 
   @override
   List<TypeParameterElement> get typeParameters => actualElement.typeParameters;
+
+  @override
+  FunctionTypeAlias computeNode() => actualElement.computeNode();
 }
 
 /**
@@ -845,10 +850,10 @@
   ElementKind get kind => ElementKind.LOCAL_VARIABLE;
 
   @override
-  VariableDeclaration get node => actualElement.node;
+  SourceRange get visibleRange => actualElement.visibleRange;
 
   @override
-  SourceRange get visibleRange => actualElement.visibleRange;
+  VariableDeclaration computeNode() => actualElement.computeNode();
 }
 
 /**
@@ -876,7 +881,7 @@
   ElementKind get kind => ElementKind.METHOD;
 
   @override
-  MethodDeclaration get node => actualElement.node;
+  MethodDeclaration computeNode() => actualElement.computeNode();
 }
 
 /**
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 3650fc8..dfbac68 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -167,7 +167,8 @@
    */
   MapIterator<Source, SourceEntry> iterator() {
     int count = _partitions.length;
-    List<Map<Source, SourceEntry>> maps = new List<Map>(count);
+    List<Map<Source, SourceEntry>> maps =
+        new List<Map<Source, SourceEntry>>(count);
     for (int i = 0; i < count; i++) {
       maps[i] = _partitions[i].map;
     }
@@ -2505,7 +2506,8 @@
   }
 
   @override
-  bool shouldErrorsBeAnalyzed(Source source, DartEntry dartEntry) {
+  bool shouldErrorsBeAnalyzed(Source source, Object entry) {
+    DartEntry dartEntry = entry;
     if (source.isInSystemLibrary) {
       return _generateSdkErrors;
     } else if (!dartEntry.explicitlyAdded) {
@@ -2639,7 +2641,7 @@
           libraryElement.definingCompilationUnit;
       List<CompilationUnitElement> parts = libraryElement.parts;
       List<TimestampedData<CompilationUnit>> units =
-          new List<TimestampedData>(parts.length + 1);
+          new List<TimestampedData<CompilationUnit>>(parts.length + 1);
       units[0] = _getResolvedUnit(definingUnit, librarySource);
       if (units[0] == null) {
         Source source = definingUnit.source;
@@ -2693,7 +2695,7 @@
           libraryElement.definingCompilationUnit;
       List<CompilationUnitElement> parts = libraryElement.parts;
       List<TimestampedData<CompilationUnit>> units =
-          new List<TimestampedData>(parts.length + 1);
+          new List<TimestampedData<CompilationUnit>>(parts.length + 1);
       units[0] = _getResolvedUnit(definingUnit, librarySource);
       if (units[0] == null) {
         Source source = definingUnit.source;
@@ -3099,7 +3101,7 @@
         libraryElement.definingCompilationUnit;
     List<CompilationUnitElement> parts = libraryElement.parts;
     List<TimestampedData<CompilationUnit>> units =
-        new List<TimestampedData>(parts.length + 1);
+        new List<TimestampedData<CompilationUnit>>(parts.length + 1);
     units[0] = _getResolvedUnit(definingUnit, librarySource);
     if (units[0] == null) {
       // TODO(brianwilkerson) We should return a ResolveDartUnitTask
@@ -3132,7 +3134,7 @@
         libraryElement.definingCompilationUnit;
     List<CompilationUnitElement> parts = libraryElement.parts;
     List<TimestampedData<CompilationUnit>> units =
-        new List<TimestampedData>(parts.length + 1);
+        new List<TimestampedData<CompilationUnit>>(parts.length + 1);
     units[0] = _getResolvedUnit(definingUnit, librarySource);
     if (units[0] == null) {
       // TODO(brianwilkerson) We should return a ResolveDartUnitTask
@@ -11501,7 +11503,7 @@
    */
   WorkManager() {
     int queueCount = SourcePriority.values.length;
-    _workQueues = new List<List>(queueCount);
+    _workQueues = new List<List<Source>>(queueCount);
     for (int i = 0; i < queueCount; i++) {
       _workQueues[i] = new List<Source>();
     }
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index ebfbb3b..85ea901 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -4,8 +4,8 @@
 
 library engine.resolver.error_verifier;
 
-import "dart:math" as math;
 import 'dart:collection';
+import "dart:math" as math;
 
 import 'package:analyzer/src/generated/static_type_analyzer.dart';
 
@@ -4176,7 +4176,7 @@
     InterfaceType mixinSupertype = mixinElement.supertype;
     if (mixinSupertype != null) {
       if (!mixinSupertype.isObject ||
-          !mixinElement.isTypedef && mixinElement.mixins.length != 0) {
+          !mixinElement.isMixinApplication && mixinElement.mixins.length != 0) {
         _errorReporter.reportErrorForNode(
             CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, mixinName,
             [mixinElement.name]);
diff --git a/pkg/analyzer/lib/src/generated/incremental_resolver.dart b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
index c22ec67..82165c0 100644
--- a/pkg/analyzer/lib/src/generated/incremental_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
@@ -571,7 +571,7 @@
   }
 
   void _assertSameType(TypeName node, DartType type) {
-    // no return type == dynamic
+    // no type == dynamic
     if (node == null) {
       return _assertTrue(type == null || type.isDynamic);
     }
@@ -579,14 +579,18 @@
       return _assertTrue(false);
     }
     // prepare name
+    SimpleIdentifier prefixIdentifier = null;
     Identifier nameIdentifier = node.name;
     if (nameIdentifier is PrefixedIdentifier) {
-      nameIdentifier = (nameIdentifier as PrefixedIdentifier).identifier;
+      PrefixedIdentifier prefixedIdentifier = nameIdentifier;
+      prefixIdentifier = prefixedIdentifier.prefix;
+      nameIdentifier = prefixedIdentifier.identifier;
     }
     String nodeName = nameIdentifier.name;
     // check specific type kinds
     if (type is ParameterizedType) {
       _assertEquals(nodeName, type.name);
+      _assertElementVisibleWithPrefix(prefixIdentifier, type.element);
       // check arguments
       TypeArgumentList nodeArgumentList = node.typeArguments;
       List<DartType> typeArguments = type.typeArguments;
@@ -614,6 +618,29 @@
     }
   }
 
+  /**
+   * Asserts that there is an import with the same prefix as the given
+   * [prefixNode], which exposes the given [element].
+   */
+  void _assertElementVisibleWithPrefix(
+      SimpleIdentifier prefixNode, Element element) {
+    if (prefixNode == null) {
+      return;
+    }
+    String prefixName = prefixNode.name;
+    for (ImportElement import in _enclosingLibrary.imports) {
+      if (import.prefix != null && import.prefix.name == prefixName) {
+        Namespace namespace =
+            new NamespaceBuilder().createImportNamespaceForDirective(import);
+        Iterable<Element> visibleElements = namespace.definedNames.values;
+        if (visibleElements.contains(element)) {
+          return;
+        }
+      }
+    }
+    _assertTrue(false);
+  }
+
   void _assertSameTypeParameter(
       TypeParameter node, TypeParameterElement element) {
     _assertSameType(node.bound, element.bound);
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index b3b6594e..a56496f 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -4,8 +4,8 @@
 
 library engine.resolver;
 
-import "dart:math" as math;
 import 'dart:collection';
+import "dart:math" as math;
 
 import 'package:analyzer/src/generated/utilities_collection.dart';
 
@@ -2503,7 +2503,6 @@
     ClassElementImpl element = new ClassElementImpl.forNode(className);
     element.abstract = node.abstractKeyword != null;
     element.mixinApplication = true;
-    element.typedef = true;
     List<TypeParameterElement> typeParameters = holder.typeParameters;
     element.typeParameters = typeParameters;
     List<DartType> typeArguments = _createTypeParameterTypes(typeParameters);
@@ -5156,9 +5155,9 @@
   ImplicitConstructorBuilder(this.errorListener, this._callback);
 
   @override
-  void visitClassElement(ClassElementImpl classElement) {
-    classElement.mixinErrorsReported = false;
-    if (classElement.isTypedef) {
+  void visitClassElement(ClassElement classElement) {
+    (classElement as ClassElementImpl).mixinErrorsReported = false;
+    if (classElement.isMixinApplication) {
       _visitClassTypeAlias(classElement);
     } else {
       _visitClassDeclaration(classElement);
@@ -10509,13 +10508,15 @@
    * @param potentialType the potential type of the elements
    * @param allowPrecisionLoss see @{code overrideVariable} docs
    */
-  void overrideExpression(
-      Expression expression, DartType potentialType, bool allowPrecisionLoss) {
+  void overrideExpression(Expression expression, DartType potentialType,
+      bool allowPrecisionLoss, bool setExpressionType) {
     VariableElement element = getOverridableStaticElement(expression);
     if (element != null) {
       DartType newBestType =
           overrideVariable(element, potentialType, allowPrecisionLoss);
-      recordPropagatedTypeIfBetter(expression, newBestType);
+      if (setExpressionType) {
+        recordPropagatedTypeIfBetter(expression, newBestType);
+      }
     }
     element = getOverridablePropagatedElement(expression);
     if (element != null) {
@@ -10638,7 +10639,7 @@
     // Since an as-statement doesn't actually change the type, we don't
     // let it affect the propagated type when it would result in a loss
     // of precision.
-    overrideExpression(node.expression, node.type.type, false);
+    overrideExpression(node.expression, node.type.type, false, false);
     return null;
   }
 
@@ -11703,7 +11704,7 @@
         // Since an is-statement doesn't actually change the type, we don't
         // let it affect the propagated type when it would result in a loss
         // of precision.
-        overrideExpression(is2.expression, is2.type.type, false);
+        overrideExpression(is2.expression, is2.type.type, false, false);
       }
     } else if (condition is PrefixExpression) {
       PrefixExpression prefix = condition;
@@ -11744,7 +11745,7 @@
         // Since an is-statement doesn't actually change the type, we don't
         // let it affect the propagated type when it would result in a loss
         // of precision.
-        overrideExpression(is2.expression, is2.type.type, false);
+        overrideExpression(is2.expression, is2.type.type, false, false);
       }
     } else if (condition is PrefixExpression) {
       PrefixExpression prefix = condition;
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
index f69d2a4..d091b2a 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -156,7 +156,7 @@
         _resolver.recordPropagatedTypeIfBetter(node, propagatedType);
         overrideType = propagatedType;
       }
-      _resolver.overrideExpression(node.leftHandSide, overrideType, true);
+      _resolver.overrideExpression(node.leftHandSide, overrideType, true, true);
     } else if (operator == sc.TokenType.QUESTION_QUESTION_EQ) {
       // The static type of a compound assignment using ??= is the least upper
       // bound of the static types of the LHS and RHS.
diff --git a/pkg/analyzer/lib/src/generated/testing/element_factory.dart b/pkg/analyzer/lib/src/generated/testing/element_factory.dart
index d82da2a..164a666 100644
--- a/pkg/analyzer/lib/src/generated/testing/element_factory.dart
+++ b/pkg/analyzer/lib/src/generated/testing/element_factory.dart
@@ -55,7 +55,7 @@
             new List<TypeParameterTypeImpl>(count);
         for (int i = 0; i < count; i++) {
           TypeParameterElementImpl typeParameter =
-              new TypeParameterElementImpl(parameterNames[i], 0);
+              typeParameterElement(parameterNames[i]);
           typeParameters[i] = typeParameter;
           typeParameterTypes[i] = new TypeParameterTypeImpl(typeParameter);
           typeParameter.type = typeParameterTypes[i];
@@ -75,7 +75,7 @@
       [List<String> parameterNames]) {
     ClassElementImpl element =
         classElement(typeName, superclassType, parameterNames);
-    element.typedef = true;
+    element.mixinApplication = true;
     return element;
   }
 
@@ -346,6 +346,14 @@
     return functionElement;
   }
 
+  static FunctionTypeAliasElementImpl functionTypeAliasElement(String name) {
+    FunctionTypeAliasElementImpl functionTypeAliasElement =
+        new FunctionTypeAliasElementImpl(name, -1);
+    functionTypeAliasElement.type =
+        new FunctionTypeImpl.forTypedef(functionTypeAliasElement);
+    return functionTypeAliasElement;
+  }
+
   static PropertyAccessorElementImpl getterElement(
       String name, bool isStatic, DartType type) {
     FieldElementImpl field = new FieldElementImpl(name, -1);
@@ -537,4 +545,7 @@
     }
     return variable;
   }
+
+  static TypeParameterElementImpl typeParameterElement(String name) =>
+      new TypeParameterElementImpl(name, 0);
 }
diff --git a/pkg/analyzer/lib/src/generated/utilities_collection.dart b/pkg/analyzer/lib/src/generated/utilities_collection.dart
index bd03a10..e8abbbd 100644
--- a/pkg/analyzer/lib/src/generated/utilities_collection.dart
+++ b/pkg/analyzer/lib/src/generated/utilities_collection.dart
@@ -560,7 +560,7 @@
    */
   MultipleMapIterator(List<Map<K, V>> maps) {
     int count = maps.length;
-    _iterators = new List<MapIterator>(count);
+    _iterators = new List<MapIterator<K, V>>(count);
     for (int i = 0; i < count; i++) {
       _iterators[i] = new SingleMapIterator<K, V>(maps[i]);
     }
diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart
index 4225da6..29ab152 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -452,7 +452,7 @@
     //
     // ClassTypeAlias
     //
-    if (classElement.isTypedef) {
+    if (classElement.isMixinApplication) {
       List<ConstructorElement> implicitConstructors =
           new List<ConstructorElement>();
       void callback(ConstructorElement explicitConstructor,
@@ -476,7 +476,7 @@
     //
     // ClassDeclaration
     //
-    if (!classElement.isTypedef) {
+    if (!classElement.isMixinApplication) {
       bool constructorFound = false;
       void callback(ConstructorElement explicitConstructor,
           List<DartType> parameterTypes, List<DartType> argumentTypes) {
@@ -504,7 +504,7 @@
     Source librarySource = classElement.library.source;
     DartType superType = classElement.supertype;
     if (superType is InterfaceType) {
-      if (classElement.isTypedef || classElement.mixins.isNotEmpty) {
+      if (classElement.isMixinApplication || classElement.mixins.isNotEmpty) {
         ClassElement superElement = superType.element;
         return <String, TaskInput>{
           'libraryDep': LIBRARY_ELEMENT5.of(librarySource),
@@ -1463,7 +1463,7 @@
     for (CompilationUnitElement unit in library.parts) {
       _collectAccessors(getters, setters, unit);
     }
-    for (PropertyAccessorElementImpl setter in setters) {
+    for (PropertyAccessorElement setter in setters) {
       PropertyAccessorElement getter = getters[setter.displayName];
       if (getter != null) {
         TopLevelVariableElementImpl variable = getter.variable;
@@ -1471,7 +1471,7 @@
         CompilationUnitElementImpl setterUnit = setterVariable.enclosingElement;
         setterUnit.replaceTopLevelVariable(setterVariable, variable);
         variable.setter = setter;
-        setter.variable = variable;
+        (setter as PropertyAccessorElementImpl).variable = variable;
       }
     }
   }
@@ -3328,7 +3328,8 @@
   ResultDescriptor get currentResult => LIBRARY_ELEMENT2;
 
   @override
-  void set currentValue(LibraryElement library) {
+  void set currentValue(Object value) {
+    LibraryElement library = value;
     if (_libraries.add(library)) {
       if (kind == _SourceClosureKind.IMPORT ||
           kind == _SourceClosureKind.IMPORT_EXPORT) {
diff --git a/pkg/analyzer/lib/src/task/inputs.dart b/pkg/analyzer/lib/src/task/inputs.dart
index 3ff506b..5efac2c 100644
--- a/pkg/analyzer/lib/src/task/inputs.dart
+++ b/pkg/analyzer/lib/src/task/inputs.dart
@@ -187,7 +187,7 @@
   MapToFlattenListTaskInput(this.base, this.mapper);
 
   @override
-  TaskInputBuilder<List> createBuilder() {
+  TaskInputBuilder<List<E>> createBuilder() {
     return new MapToFlattenListTaskInputBuilder<K, V, E>(base, mapper);
   }
 }
diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml
index 2b8ca78..3ef3494 100644
--- a/pkg/analyzer/pubspec.yaml
+++ b/pkg/analyzer/pubspec.yaml
@@ -1,5 +1,5 @@
 name: analyzer
-version: 0.25.1-alpha.0
+version: 0.25.1-alpha.1
 author: Dart Team <misc@dartlang.org>
 description: Static analyzer for Dart.
 homepage: http://www.dartlang.org
diff --git a/pkg/analyzer/test/generated/element_test.dart b/pkg/analyzer/test/generated/element_test.dart
index 4a967c3..13d08e5 100644
--- a/pkg/analyzer/test/generated/element_test.dart
+++ b/pkg/analyzer/test/generated/element_test.dart
@@ -42,6 +42,61 @@
 
 @reflectiveTest
 class ClassElementImplTest extends EngineTestCase {
+  void test_computeNode_ClassDeclaration() {
+    AnalysisContextHelper contextHelper = new AnalysisContextHelper();
+    AnalysisContext context = contextHelper.context;
+    Source source = contextHelper.addSource("/test.dart", r'''
+class A {}
+class B {}
+enum C {C1, C2, C3}''');
+    // prepare CompilationUnitElement
+    LibraryElement libraryElement = context.computeLibraryElement(source);
+    CompilationUnitElement unitElement = libraryElement.definingCompilationUnit;
+    // A
+    {
+      ClassElement elementA = unitElement.getType("A");
+      ClassDeclaration nodeA = elementA.computeNode();
+      expect(nodeA, isNotNull);
+      expect(nodeA.name.name, "A");
+      expect(nodeA.element, same(elementA));
+    }
+    // B
+    {
+      ClassElement elementB = unitElement.getType("B");
+      ClassDeclaration nodeB = elementB.computeNode();
+      expect(nodeB, isNotNull);
+      expect(nodeB.name.name, "B");
+      expect(nodeB.element, same(elementB));
+    }
+    // C
+    {
+      ClassElement elementC = unitElement.getEnum("C");
+      EnumDeclaration nodeC = elementC.computeNode();
+      expect(nodeC, isNotNull);
+      expect(nodeC.name.name, "C");
+      expect(nodeC.element, same(elementC));
+    }
+  }
+
+  void test_computeNode_ClassTypeAlias() {
+    AnalysisContextHelper contextHelper = new AnalysisContextHelper();
+    AnalysisContext context = contextHelper.context;
+    Source source = contextHelper.addSource("/test.dart", r'''
+abstract class A<K, V> = Object with MapMixin<K, V>;
+''');
+    // prepare CompilationUnitElement
+    LibraryElement libraryElement = context.computeLibraryElement(source);
+    CompilationUnitElement unitElement = libraryElement.definingCompilationUnit;
+    // A
+    {
+      ClassElement elementA = unitElement.getType("A");
+      ClassTypeAlias nodeA = elementA.computeNode();
+      expect(nodeA, isNotNull);
+      expect(nodeA.name.name, "A");
+      expect(nodeA.element, same(elementA));
+    }
+  }
+
   void test_getAllSupertypes_interface() {
     ClassElement classA = ElementFactory.classElement2("A");
     ClassElement classB = ElementFactory.classElement("B", classA.type);
@@ -857,61 +912,6 @@
         <ClassElement>[classA, classB];
     expect(classA.lookUpSetter("s", library), isNull);
   }
-
-  void test_node_ClassDeclaration() {
-    AnalysisContextHelper contextHelper = new AnalysisContextHelper();
-    AnalysisContext context = contextHelper.context;
-    Source source = contextHelper.addSource("/test.dart", r'''
-class A {}
-class B {}
-enum C {C1, C2, C3}''');
-    // prepare CompilationUnitElement
-    LibraryElement libraryElement = context.computeLibraryElement(source);
-    CompilationUnitElement unitElement = libraryElement.definingCompilationUnit;
-    // A
-    {
-      ClassElement elementA = unitElement.getType("A");
-      ClassDeclaration nodeA = elementA.node;
-      expect(nodeA, isNotNull);
-      expect(nodeA.name.name, "A");
-      expect(nodeA.element, same(elementA));
-    }
-    // B
-    {
-      ClassElement elementB = unitElement.getType("B");
-      ClassDeclaration nodeB = elementB.node;
-      expect(nodeB, isNotNull);
-      expect(nodeB.name.name, "B");
-      expect(nodeB.element, same(elementB));
-    }
-    // C
-    {
-      ClassElement elementC = unitElement.getEnum("C");
-      EnumDeclaration nodeC = elementC.node;
-      expect(nodeC, isNotNull);
-      expect(nodeC.name.name, "C");
-      expect(nodeC.element, same(elementC));
-    }
-  }
-
-  void test_node_ClassTypeAlias() {
-    AnalysisContextHelper contextHelper = new AnalysisContextHelper();
-    AnalysisContext context = contextHelper.context;
-    Source source = contextHelper.addSource("/test.dart", r'''
-abstract class A<K, V> = Object with MapMixin<K, V>;
-''');
-    // prepare CompilationUnitElement
-    LibraryElement libraryElement = context.computeLibraryElement(source);
-    CompilationUnitElement unitElement = libraryElement.definingCompilationUnit;
-    // A
-    {
-      ClassElement elementA = unitElement.getType("A");
-      ClassTypeAlias nodeA = elementA.node;
-      expect(nodeA, isNotNull);
-      expect(nodeA.name.name, "A");
-      expect(nodeA.element, same(elementA));
-    }
-  }
 }
 
 @reflectiveTest
@@ -1220,7 +1220,7 @@
 
 @reflectiveTest
 class FieldElementImplTest extends EngineTestCase {
-  void test_node() {
+  void test_computeNode() {
     AnalysisContextHelper contextHelper = new AnalysisContextHelper();
     AnalysisContext context = contextHelper.context;
     Source source = contextHelper.addSource("/test.dart", r'''
@@ -1234,7 +1234,7 @@
     // A
     {
       FieldElement elementA = unitElement.getType("A").getField('a');
-      VariableDeclaration nodeA = elementA.node;
+      VariableDeclaration nodeA = elementA.computeNode();
       expect(nodeA, isNotNull);
       expect(nodeA.name.name, "a");
       expect(nodeA.element, same(elementA));
@@ -1242,7 +1242,7 @@
     // B
     {
       FieldElement elementB = unitElement.getEnum("B").getField('B2');
-      EnumConstantDeclaration nodeB = elementB.node;
+      EnumConstantDeclaration nodeB = elementB.computeNode();
       expect(nodeB, isNotNull);
       expect(nodeB.name.name, "B2");
       expect(nodeB.element, same(elementB));
@@ -1258,6 +1258,24 @@
         isNotNull);
   }
 
+  void test_equality_recursive() {
+    FunctionTypeAliasElementImpl s =
+        ElementFactory.functionTypeAliasElement('s');
+    FunctionTypeAliasElementImpl t =
+        ElementFactory.functionTypeAliasElement('t');
+    FunctionTypeAliasElementImpl u =
+        ElementFactory.functionTypeAliasElement('u');
+    FunctionTypeAliasElementImpl v =
+        ElementFactory.functionTypeAliasElement('v');
+    s.returnType = t.type;
+    t.returnType = s.type;
+    u.returnType = v.type;
+    v.returnType = u.type;
+    // We don't care whether the types compare equal or not.  We just need the
+    // computation to terminate.
+    expect(s.type == u.type, new isInstanceOf<bool>());
+  }
+
   void test_getElement() {
     FunctionElementImpl typeElement =
         new FunctionElementImpl.forNode(AstFactory.identifier3("f"));
@@ -1307,6 +1325,18 @@
     type.hashCode;
   }
 
+  void test_hashCode_recursive() {
+    FunctionTypeAliasElementImpl s =
+        ElementFactory.functionTypeAliasElement('s');
+    FunctionTypeAliasElementImpl t =
+        ElementFactory.functionTypeAliasElement('t');
+    s.returnType = t.type;
+    t.returnType = s.type;
+    // We don't care what the hash code is.  We just need its computation to
+    // terminate.
+    expect(t.type.hashCode, new isInstanceOf<int>());
+  }
+
   void test_isAssignableTo_normalAndPositionalArgs() {
     // ([a]) -> void <: (a) -> void
     ClassElement a = ElementFactory.classElement2("A");
@@ -1691,6 +1721,141 @@
     expect(s.isSubtypeOf(t), isFalse);
   }
 
+  void test_namedParameterTypes_pruned_no_type_arguments() {
+    FunctionTypeAliasElementImpl f =
+        ElementFactory.functionTypeAliasElement('f');
+    FunctionTypeAliasElementImpl g =
+        ElementFactory.functionTypeAliasElement('g');
+    f.parameters = [ElementFactory.namedParameter2('x', g.type)];
+    FunctionTypeImpl paramType = f.type.namedParameterTypes['x'];
+    expect(paramType.prunedTypedefs, hasLength(1));
+    expect(paramType.prunedTypedefs[0], same(f));
+  }
+
+  void test_namedParameterTypes_pruned_with_type_arguments() {
+    FunctionTypeAliasElementImpl f =
+        ElementFactory.functionTypeAliasElement('f');
+    FunctionTypeAliasElementImpl g =
+        ElementFactory.functionTypeAliasElement('g');
+    f.typeParameters = [ElementFactory.typeParameterElement('T')];
+    f.parameters = [ElementFactory.namedParameter2('x', g.type)];
+    FunctionTypeImpl paramType = f.type.namedParameterTypes['x'];
+    expect(paramType.prunedTypedefs, hasLength(1));
+    expect(paramType.prunedTypedefs[0], same(f));
+  }
+
+  void test_newPrune_no_previous_prune() {
+    FunctionTypeAliasElementImpl f =
+        ElementFactory.functionTypeAliasElement('f');
+    FunctionTypeImpl type = f.type;
+    List<FunctionTypeAliasElement> pruneList = type.newPrune;
+    expect(pruneList, hasLength(1));
+    expect(pruneList[0], same(f));
+  }
+
+  void test_newPrune_non_typedef() {
+    // No pruning needs to be done for function types that aren't associated
+    // with typedefs because those types can't be directly referred to by the
+    // user (and hence can't participate in circularities).
+    FunctionElementImpl f = ElementFactory.functionElement('f');
+    FunctionTypeImpl type = f.type;
+    expect(type.newPrune, isNull);
+  }
+
+  void test_newPrune_synthetic_typedef() {
+    // No pruning needs to be done for function types that are associated with
+    // synthetic typedefs because those types are only created for
+    // function-typed formal parameters, which can't be directly referred to by
+    // the user (and hence can't participate in circularities).
+    FunctionTypeAliasElementImpl f =
+        ElementFactory.functionTypeAliasElement('f');
+    f.synthetic = true;
+    FunctionTypeImpl type = f.type;
+    expect(type.newPrune, isNull);
+  }
+
+  void test_newPrune_with_previous_prune() {
+    FunctionTypeAliasElementImpl f =
+        ElementFactory.functionTypeAliasElement('f');
+    FunctionTypeAliasElementImpl g =
+        ElementFactory.functionTypeAliasElement('g');
+    FunctionTypeImpl type = f.type;
+    FunctionTypeImpl prunedType = type.pruned([g]);
+    List<FunctionTypeAliasElement> pruneList = prunedType.newPrune;
+    expect(pruneList, hasLength(2));
+    expect(pruneList, contains(f));
+    expect(pruneList, contains(g));
+  }
+
+  void test_normalParameterTypes_pruned_no_type_arguments() {
+    FunctionTypeAliasElementImpl f =
+        ElementFactory.functionTypeAliasElement('f');
+    FunctionTypeAliasElementImpl g =
+        ElementFactory.functionTypeAliasElement('g');
+    f.parameters = [ElementFactory.requiredParameter2('x', g.type)];
+    FunctionTypeImpl paramType = f.type.normalParameterTypes[0];
+    expect(paramType.prunedTypedefs, hasLength(1));
+    expect(paramType.prunedTypedefs[0], same(f));
+  }
+
+  void test_normalParameterTypes_pruned_with_type_arguments() {
+    FunctionTypeAliasElementImpl f =
+        ElementFactory.functionTypeAliasElement('f');
+    FunctionTypeAliasElementImpl g =
+        ElementFactory.functionTypeAliasElement('g');
+    f.typeParameters = [ElementFactory.typeParameterElement('T')];
+    f.parameters = [ElementFactory.requiredParameter2('x', g.type)];
+    FunctionTypeImpl paramType = f.type.normalParameterTypes[0];
+    expect(paramType.prunedTypedefs, hasLength(1));
+    expect(paramType.prunedTypedefs[0], same(f));
+  }
+
+  void test_optionalParameterTypes_pruned_no_type_arguments() {
+    FunctionTypeAliasElementImpl f =
+        ElementFactory.functionTypeAliasElement('f');
+    FunctionTypeAliasElementImpl g =
+        ElementFactory.functionTypeAliasElement('g');
+    f.parameters = [ElementFactory.positionalParameter2('x', g.type)];
+    FunctionTypeImpl paramType = f.type.optionalParameterTypes[0];
+    expect(paramType.prunedTypedefs, hasLength(1));
+    expect(paramType.prunedTypedefs[0], same(f));
+  }
+
+  void test_optionalParameterTypes_pruned_with_type_arguments() {
+    FunctionTypeAliasElementImpl f =
+        ElementFactory.functionTypeAliasElement('f');
+    FunctionTypeAliasElementImpl g =
+        ElementFactory.functionTypeAliasElement('g');
+    f.typeParameters = [ElementFactory.typeParameterElement('T')];
+    f.parameters = [ElementFactory.positionalParameter2('x', g.type)];
+    FunctionTypeImpl paramType = f.type.optionalParameterTypes[0];
+    expect(paramType.prunedTypedefs, hasLength(1));
+    expect(paramType.prunedTypedefs[0], same(f));
+  }
+
+  void test_returnType_pruned_no_type_arguments() {
+    FunctionTypeAliasElementImpl f =
+        ElementFactory.functionTypeAliasElement('f');
+    FunctionTypeAliasElementImpl g =
+        ElementFactory.functionTypeAliasElement('g');
+    f.returnType = g.type;
+    FunctionTypeImpl paramType = f.type.returnType;
+    expect(paramType.prunedTypedefs, hasLength(1));
+    expect(paramType.prunedTypedefs[0], same(f));
+  }
+
+  void test_returnType_pruned_with_type_arguments() {
+    FunctionTypeAliasElementImpl f =
+        ElementFactory.functionTypeAliasElement('f');
+    FunctionTypeAliasElementImpl g =
+        ElementFactory.functionTypeAliasElement('g');
+    f.typeParameters = [ElementFactory.typeParameterElement('T')];
+    f.returnType = g.type;
+    FunctionTypeImpl paramType = f.type.returnType;
+    expect(paramType.prunedTypedefs, hasLength(1));
+    expect(paramType.prunedTypedefs[0], same(f));
+  }
+
   void test_setTypeArguments() {
     ClassElementImpl enclosingClass = ElementFactory.classElement2("C", ["E"]);
     MethodElementImpl methodElement =
@@ -1773,12 +1938,22 @@
   }
 
   void test_toString_recursive() {
-    FunctionElementImpl t = ElementFactory.functionElement("t");
-    FunctionElementImpl s = ElementFactory.functionElement("s");
+    FunctionTypeAliasElementImpl t =
+        ElementFactory.functionTypeAliasElement("t");
+    FunctionTypeAliasElementImpl s =
+        ElementFactory.functionTypeAliasElement("s");
     t.returnType = s.type;
     s.returnType = t.type;
     expect(t.type.toString(), '() \u2192 () \u2192 ...');
   }
+
+  void test_toString_recursive_via_interface_type() {
+    FunctionTypeAliasElementImpl f =
+        ElementFactory.functionTypeAliasElement('f');
+    ClassElementImpl c = ElementFactory.classElement2('C', ['T']);
+    f.returnType = c.type.substitute4([f.type]);
+    expect(f.type.toString(), '() \u2192 C<...>');
+  }
 }
 
 @reflectiveTest
@@ -2171,6 +2346,26 @@
     expect(type.accessors.length, 0);
   }
 
+  void test_getConstructors() {
+    ClassElementImpl typeElement = ElementFactory.classElement2("A");
+    ConstructorElementImpl constructorOne =
+        ElementFactory.constructorElement(typeElement, 'one', false);
+    ConstructorElementImpl constructorTwo =
+        ElementFactory.constructorElement(typeElement, 'two', false);
+    typeElement.constructors = <ConstructorElement>[
+      constructorOne,
+      constructorTwo
+    ];
+    InterfaceTypeImpl type = new InterfaceTypeImpl(typeElement);
+    expect(type.constructors, hasLength(2));
+  }
+
+  void test_getConstructors_empty() {
+    ClassElementImpl typeElement = ElementFactory.classElement2("A");
+    InterfaceTypeImpl type = new InterfaceTypeImpl(typeElement);
+    expect(type.constructors, isEmpty);
+  }
+
   void test_getElement() {
     ClassElementImpl typeElement = ElementFactory.classElement2("A");
     InterfaceTypeImpl type = new InterfaceTypeImpl(typeElement);
@@ -2550,20 +2745,6 @@
     expect(typeA.getMethod("m"), isNull);
   }
 
-  void test_getConstructors() {
-    ClassElementImpl typeElement = ElementFactory.classElement2("A");
-    ConstructorElementImpl constructorOne =
-        ElementFactory.constructorElement(typeElement, 'one', false);
-    ConstructorElementImpl constructorTwo =
-        ElementFactory.constructorElement(typeElement, 'two', false);
-    typeElement.constructors = <ConstructorElement>[
-      constructorOne,
-      constructorTwo
-    ];
-    InterfaceTypeImpl type = new InterfaceTypeImpl(typeElement);
-    expect(type.constructors, hasLength(2));
-  }
-
   void test_getMethods() {
     ClassElementImpl typeElement = ElementFactory.classElement2("A");
     MethodElementImpl methodOne = ElementFactory.methodElement("one", null);
@@ -2579,12 +2760,6 @@
     expect(type.methods.length, 0);
   }
 
-  void test_getConstructors_empty() {
-    ClassElementImpl typeElement = ElementFactory.classElement2("A");
-    InterfaceTypeImpl type = new InterfaceTypeImpl(typeElement);
-    expect(type.constructors, isEmpty);
-  }
-
   void test_getMixins_nonParameterized() {
     //
     // class C extends Object with A, B
@@ -3732,7 +3907,7 @@
 
 @reflectiveTest
 class ParameterElementImplTest extends EngineTestCase {
-  void test_node_DefaultFormalParameter() {
+  void test_computeNode_DefaultFormalParameter() {
     AnalysisContextHelper contextHelper = new AnalysisContextHelper();
     AnalysisContext context = contextHelper.context;
     Source source = contextHelper.addSource("/test.dart", r'''
@@ -3744,14 +3919,14 @@
     // p
     {
       ParameterElement element = unitElement.functions[0].parameters[0];
-      DefaultFormalParameter node = element.node;
+      DefaultFormalParameter node = element.computeNode();
       expect(node, isNotNull);
       expect(node.identifier.name, 'p');
       expect(node.element, same(element));
     }
   }
 
-  void test_node_FieldFormalParameter() {
+  void test_computeNode_FieldFormalParameter() {
     AnalysisContextHelper contextHelper = new AnalysisContextHelper();
     AnalysisContext context = contextHelper.context;
     Source source = contextHelper.addSource("/test.dart", r'''
@@ -3768,14 +3943,14 @@
       ClassElement classA = unitElement.types[0];
       ConstructorElement constructorA = classA.constructors[0];
       FieldFormalParameterElement element = constructorA.parameters[0];
-      FieldFormalParameter node = element.node;
+      FieldFormalParameter node = element.computeNode();
       expect(node, isNotNull);
       expect(node.identifier.name, 'p');
       expect(node.element, same(element));
     }
   }
 
-  void test_node_FunctionTypedFormalParameter() {
+  void test_computeNode_FunctionTypedFormalParameter() {
     AnalysisContextHelper contextHelper = new AnalysisContextHelper();
     AnalysisContext context = contextHelper.context;
     Source source = contextHelper.addSource("/test.dart", r'''
@@ -3787,14 +3962,14 @@
     // p
     {
       ParameterElement element = unitElement.functions[0].parameters[0];
-      FunctionTypedFormalParameter node = element.node;
+      FunctionTypedFormalParameter node = element.computeNode();
       expect(node, isNotNull);
       expect(node.identifier.name, 'p');
       expect(node.element, same(element));
     }
   }
 
-  void test_node_SimpleFormalParameter() {
+  void test_computeNode_SimpleFormalParameter() {
     AnalysisContextHelper contextHelper = new AnalysisContextHelper();
     AnalysisContext context = contextHelper.context;
     Source source = contextHelper.addSource("/test.dart", r'''
@@ -3806,7 +3981,7 @@
     // p
     {
       ParameterElement element = unitElement.functions[0].parameters[0];
-      SimpleFormalParameter node = element.node;
+      SimpleFormalParameter node = element.computeNode();
       expect(node, isNotNull);
       expect(node.identifier.name, 'p');
       expect(node.element, same(element));
diff --git a/pkg/analyzer/test/generated/incremental_resolver_test.dart b/pkg/analyzer/test/generated/incremental_resolver_test.dart
index 0e8d130..3af917b 100644
--- a/pkg/analyzer/test/generated/incremental_resolver_test.dart
+++ b/pkg/analyzer/test/generated/incremental_resolver_test.dart
@@ -1264,6 +1264,34 @@
 ''');
   }
 
+  void test_false_method_parameters_type_edit_insertImportPrefix() {
+    _assertDoesNotMatchOK(r'''
+import 'dart:async' as a;
+
+class C {
+  void foo(Future f) {}
+}
+
+class Future {}
+
+bar(C c, a.Future f) {
+  c.foo(f);
+}
+''', r'''
+import 'dart:async' as a;
+
+class C {
+  void foo(a.Future f) {}
+}
+
+class Future {}
+
+bar(C c, a.Future f) {
+  c.foo(f);
+}
+''');
+  }
+
   void test_false_method_returnType_edit() {
     _assertDoesNotMatchOK(r'''
 class A {
@@ -2202,6 +2230,22 @@
 ''');
   }
 
+  void test_true_method_parameters_type_sameImportPrefix() {
+    _assertMatches(r'''
+import 'dart:async' as a;
+
+bar(a.Future f) {
+  print(f);
+}
+''', r'''
+import 'dart:async' as a;
+
+bar(a.Future ff) {
+  print(ff);
+}
+''');
+  }
+
   void test_true_part_list_reorder() {
     addNamedSource('/unitA.dart', 'part of lib; class A {}');
     addNamedSource('/unitB.dart', 'part of lib; class B {}');
diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart
index cf549d8..9974fc6 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -237,6 +237,40 @@
     verify([source]);
   }
 
+  void test_assignability_function_expr_rettype_from_typedef_cls() {
+    // 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.
+    Source source = addSource('''
+class C {}
+typedef C F();
+F f;
+main() {
+  F f2 = (() => f());
+}
+''');
+    resolve(source);
+    assertNoErrors(source);
+    verify([source]);
+  }
+
+  void test_assignability_function_expr_rettype_from_typedef_typedef() {
+    // 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.
+    Source source = addSource('''
+typedef G F();
+typedef G();
+F f;
+main() {
+  F f2 = (() => f());
+}
+''');
+    resolve(source);
+    assertNoErrors(source);
+    verify([source]);
+  }
+
   void test_assignmentToFinal_prefixNegate() {
     Source source = addSource(r'''
 f() {
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 5a62cc17..8307a9c 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -8076,7 +8076,7 @@
     // Verify that both the getter and setter for "x" in "new C().x" refer to
     // the accessors defined in M2.
     FunctionDeclaration main =
-        library.definingCompilationUnit.functions[0].node;
+        library.definingCompilationUnit.functions[0].computeNode();
     BlockFunctionBody body = main.functionExpression.body;
     ExpressionStatement stmt = body.block.statements[0];
     AssignmentExpression assignment = stmt.expression;
@@ -8217,7 +8217,7 @@
     AssignmentExpression assignment;
     {
       FunctionElement mainElement = unit.functions[0];
-      FunctionBody mainBody = mainElement.node.functionExpression.body;
+      FunctionBody mainBody = mainElement.computeNode().functionExpression.body;
       Statement statement = (mainBody as BlockFunctionBody).block.statements[1];
       ExpressionStatement expressionStatement =
           statement as ExpressionStatement;
@@ -8253,7 +8253,7 @@
     AssignmentExpression assignment;
     {
       FunctionElement mainElement = unit.functions[0];
-      FunctionBody mainBody = mainElement.node.functionExpression.body;
+      FunctionBody mainBody = mainElement.computeNode().functionExpression.body;
       Statement statement = (mainBody as BlockFunctionBody).block.statements[1];
       ExpressionStatement expressionStatement =
           statement as ExpressionStatement;
@@ -8286,7 +8286,7 @@
     AssignmentExpression assignment;
     {
       FunctionElement mainElement = unit.functions[0];
-      FunctionBody mainBody = mainElement.node.functionExpression.body;
+      FunctionBody mainBody = mainElement.computeNode().functionExpression.body;
       Statement statement = (mainBody as BlockFunctionBody).block.statements[1];
       ExpressionStatement expressionStatement =
           statement as ExpressionStatement;
@@ -8321,7 +8321,7 @@
     AssignmentExpression assignment;
     {
       FunctionElement mainElement = unit.functions[0];
-      FunctionBody mainBody = mainElement.node.functionExpression.body;
+      FunctionBody mainBody = mainElement.computeNode().functionExpression.body;
       Statement statement = (mainBody as BlockFunctionBody).block.statements[1];
       ExpressionStatement expressionStatement =
           statement as ExpressionStatement;
@@ -8797,7 +8797,7 @@
     // Verify that both the getter and setter for "x" in C.f() refer to the
     // accessors defined in M2.
     ClassElement classC = library.definingCompilationUnit.types[3];
-    MethodDeclaration f = classC.getMethod('f').node;
+    MethodDeclaration f = classC.getMethod('f').computeNode();
     BlockFunctionBody body = f.body;
     ExpressionStatement stmt = body.block.statements[0];
     AssignmentExpression assignment = stmt.expression;
@@ -8828,7 +8828,7 @@
     // Verify that the getter for "x" in C.f() refers to the getter defined in
     // M2.
     ClassElement classC = library.definingCompilationUnit.types[3];
-    MethodDeclaration f = classC.getMethod('f').node;
+    MethodDeclaration f = classC.getMethod('f').computeNode();
     BlockFunctionBody body = f.body;
     ReturnStatement stmt = body.block.statements[0];
     SimpleIdentifier x = stmt.expression;
@@ -8855,7 +8855,7 @@
     // Verify that the getter for "x" in "new C().x" refers to the getter
     // defined in M2.
     FunctionDeclaration main =
-        library.definingCompilationUnit.functions[0].node;
+        library.definingCompilationUnit.functions[0].computeNode();
     BlockFunctionBody body = main.functionExpression.body;
     VariableDeclarationStatement stmt = body.block.statements[0];
     PropertyAccess propertyAccess = stmt.variables.variables[0].initializer;
@@ -9367,7 +9367,7 @@
     verify([source]);
     // Verify that the "f" in "new C().f()" refers to the "f" defined in M2.
     FunctionDeclaration main =
-        library.definingCompilationUnit.functions[0].node;
+        library.definingCompilationUnit.functions[0].computeNode();
     BlockFunctionBody body = main.functionExpression.body;
     ExpressionStatement stmt = body.block.statements[0];
     MethodInvocation expr = stmt.expression;
@@ -9394,7 +9394,7 @@
     verify([source]);
     // Verify that the call to f() in C.g() refers to the method defined in M2.
     ClassElement classC = library.definingCompilationUnit.types[3];
-    MethodDeclaration g = classC.getMethod('g').node;
+    MethodDeclaration g = classC.getMethod('g').computeNode();
     BlockFunctionBody body = g.body;
     ExpressionStatement stmt = body.block.statements[0];
     MethodInvocation invocation = stmt.expression;
@@ -9422,7 +9422,7 @@
     // Verify that the call to f() in "new C().f()" refers to the method
     // defined in M2.
     FunctionDeclaration main =
-        library.definingCompilationUnit.functions[0].node;
+        library.definingCompilationUnit.functions[0].computeNode();
     BlockFunctionBody body = main.functionExpression.body;
     ExpressionStatement stmt = body.block.statements[0];
     MethodInvocation invocation = stmt.expression;
@@ -9511,7 +9511,7 @@
     // Verify that the setter for "x" in C.f() refers to the setter defined in
     // M2.
     ClassElement classC = library.definingCompilationUnit.types[3];
-    MethodDeclaration f = classC.getMethod('f').node;
+    MethodDeclaration f = classC.getMethod('f').computeNode();
     BlockFunctionBody body = f.body;
     ExpressionStatement stmt = body.block.statements[0];
     AssignmentExpression assignment = stmt.expression;
@@ -9539,7 +9539,7 @@
     // Verify that the setter for "x" in "new C().x" refers to the setter
     // defined in M2.
     FunctionDeclaration main =
-        library.definingCompilationUnit.functions[0].node;
+        library.definingCompilationUnit.functions[0].computeNode();
     BlockFunctionBody body = main.functionExpression.body;
     ExpressionStatement stmt = body.block.statements[0];
     AssignmentExpression assignment = stmt.expression;
@@ -12411,16 +12411,30 @@
     assertNoErrors(source);
     verify([source]);
     CompilationUnit unit = resolveCompilationUnit(source, library);
-    ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
-    InterfaceType typeA = classA.element.type;
+    // prepare A
+    InterfaceType typeA;
+    {
+      ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
+      typeA = classA.element.type;
+    }
+    // verify "f"
     FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
     IfStatement ifStatement = body.block.statements[0] as IfStatement;
-    ReturnStatement statement =
-        (ifStatement.thenStatement as Block).statements[0] as ReturnStatement;
-    SimpleIdentifier variableName = statement.expression as SimpleIdentifier;
-    expect(variableName.propagatedType, same(typeA));
+    // "p is A"
+    {
+      IsExpression isExpression = ifStatement.condition;
+      SimpleIdentifier variableName = isExpression.expression;
+      expect(variableName.propagatedType, isNull);
+    }
+    // "return p;"
+    {
+      ReturnStatement statement =
+          (ifStatement.thenStatement as Block).statements[0] as ReturnStatement;
+      SimpleIdentifier variableName = statement.expression as SimpleIdentifier;
+      expect(variableName.propagatedType, same(typeA));
+    }
   }
 
   void test_is_if_lessSpecific() {
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 0282d99..8e5a303 100644
--- a/pkg/analyzer/test/generated/static_type_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
@@ -80,6 +80,35 @@
     verify([source]);
   }
 
+  void test_bug21912() {
+    Source source = addSource('''
+class A {}
+class B extends A {}
+
+typedef T Function2<S, T>(S z);
+typedef B AToB(A x);
+typedef A BToA(B x);
+
+void main() {
+  {
+    Function2<Function2<A, B>, Function2<B, A>> t1;
+    Function2<AToB, BToA> t2;
+
+    Function2<Function2<int, double>, Function2<int, double>> left;
+
+    left = t1;
+    left = t2;
+  }
+}
+''');
+    resolve(source);
+    assertErrors(source, [
+      StaticTypeWarningCode.INVALID_ASSIGNMENT,
+      StaticTypeWarningCode.INVALID_ASSIGNMENT
+    ]);
+    verify([source]);
+  }
+
   void test_expectedOneListTypeArgument() {
     Source source = addSource(r'''
 main() {
diff --git a/pkg/analyzer/test/src/context/cache_test.dart b/pkg/analyzer/test/src/context/cache_test.dart
index 80f8166..cd28a42 100644
--- a/pkg/analyzer/test/src/context/cache_test.dart
+++ b/pkg/analyzer/test/src/context/cache_test.dart
@@ -497,6 +497,26 @@
     expect(entry.getValue(result), 1);
   }
 
+  test_setState_invalid_dependencyCycle() {
+    AnalysisTarget target1 = new TestSource('/a.dart');
+    AnalysisTarget target2 = new TestSource('/b.dart');
+    CacheEntry entry1 = new CacheEntry(target1);
+    CacheEntry entry2 = new CacheEntry(target2);
+    cache.put(entry1);
+    cache.put(entry2);
+    ResultDescriptor result = new ResultDescriptor('result', -1);
+    // Set each result as VALID with a dependency on on the other.
+    entry1.setValue(result, 100, [new TargetedResult(target2, result)]);
+    entry2.setValue(result, 200, [new TargetedResult(target1, result)]);
+    expect(entry1.getState(result), CacheState.VALID);
+    expect(entry2.getState(result), CacheState.VALID);
+    // Invalidate entry1.result; this should cause entry2 to be also
+    // cleared without going into an infinite regress.
+    entry1.setState(result, CacheState.INVALID);
+    expect(cache.get(target1), isNull);
+    expect(cache.get(target2), isNull);
+  }
+
   test_setState_invalid_invalidateDependent() {
     AnalysisTarget target = new TestSource();
     CacheEntry entry = new CacheEntry(target);
diff --git a/pkg/analyzer/test/src/context/context_test.dart b/pkg/analyzer/test/src/context/context_test.dart
index f1116d8..71040ca 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -75,7 +75,7 @@
     expect(context.sourcesNeedingProcessing, hasLength(0));
   }
 
-  Future fail_applyChanges_remove() {
+  Future test_applyChanges_remove() {
     SourcesChangedListener listener = new SourcesChangedListener();
     context.onSourcesChanged.listen(listener.onData);
     String libAContents = r'''
@@ -101,16 +101,13 @@
     expect(importedLibraries, hasLength(1));
     return pumpEventQueue().then((_) {
       listener.assertEvent(wereSourcesAdded: true);
-      listener.assertEvent(changedSources: [libA]);
       listener.assertEvent(wereSourcesAdded: true);
-      listener.assertEvent(changedSources: [libB]);
-      listener.assertEvent(changedSources: [libB]);
       listener.assertEvent(wereSourcesRemovedOrDeleted: true);
       listener.assertNoMoreEvents();
     });
   }
 
-  Future fail_applyChanges_removeContainer() {
+  Future test_applyChanges_removeContainer() {
     SourcesChangedListener listener = new SourcesChangedListener();
     context.onSourcesChanged.listen(listener.onData);
     String libAContents = r'''
@@ -133,9 +130,7 @@
     expect(sources[0], same(libA));
     return pumpEventQueue().then((_) {
       listener.assertEvent(wereSourcesAdded: true);
-      listener.assertEvent(changedSources: [libA]);
       listener.assertEvent(wereSourcesAdded: true);
-      listener.assertEvent(changedSources: [libB]);
       listener.assertEvent(wereSourcesRemovedOrDeleted: true);
       listener.assertNoMoreEvents();
     });
@@ -812,7 +807,7 @@
     fail("Implement this");
   }
 
-  void fail_resolveCompilationUnit_import_relative() {
+  void test_resolveCompilationUnit_import_relative() {
     Source sourceA =
         addSource("/libA.dart", "library libA; import 'libB.dart'; class A{}");
     addSource("/libB.dart", "library libB; class B{}");
@@ -823,10 +818,16 @@
     List<LibraryElement> importedLibraries = library.importedLibraries;
     assertNamedElements(importedLibraries, ["dart.core", "libB"]);
     List<LibraryElement> visibleLibraries = library.visibleLibraries;
-    assertNamedElements(visibleLibraries, ["dart.core", "libA", "libB"]);
+    assertNamedElements(visibleLibraries, [
+      "dart.core",
+      "dart.async",
+      "dart.math",
+      "libA",
+      "libB"
+    ]);
   }
 
-  void fail_resolveCompilationUnit_import_relative_cyclic() {
+  void test_resolveCompilationUnit_import_relative_cyclic() {
     Source sourceA =
         addSource("/libA.dart", "library libA; import 'libB.dart'; class A{}");
     addSource("/libB.dart", "library libB; import 'libA.dart'; class B{}");
@@ -837,7 +838,13 @@
     List<LibraryElement> importedLibraries = library.importedLibraries;
     assertNamedElements(importedLibraries, ["dart.core", "libB"]);
     List<LibraryElement> visibleLibraries = library.visibleLibraries;
-    assertNamedElements(visibleLibraries, ["dart.core", "libA", "libB"]);
+    assertNamedElements(visibleLibraries, [
+      "dart.core",
+      "dart.async",
+      "dart.math",
+      "libA",
+      "libB"
+    ]);
   }
 
   void fail_resolveHtmlUnit() {
diff --git a/pkg/compiler/lib/src/closure.dart b/pkg/compiler/lib/src/closure.dart
index 355e526..1b59ee3 100644
--- a/pkg/compiler/lib/src/closure.dart
+++ b/pkg/compiler/lib/src/closure.dart
@@ -741,7 +741,8 @@
     } else {
       Element element = elements[node];
       if (element != null && element.isTypeVariable) {
-        if (outermostElement.isConstructor) {
+        if (outermostElement.isConstructor ||
+            outermostElement.isField) {
           TypeVariableElement typeVariable = element;
           useTypeVariableAsLocal(typeVariable.type);
         } else {
@@ -1081,6 +1082,17 @@
     inTryStatement = oldInTryStatement;
   }
 
+  visitCatchBlock(CatchBlock node) {
+    if (node.type != null) {
+      // The "on T" clause may contain type variables.
+      analyzeType(elements.getType(node.type));
+    }
+    if (node.formals != null) {
+      node.formals.visitChildren(this);
+    }
+    node.block.accept(this);
+  }
+
   visitAsyncForIn(AsyncForIn node) {
     // An `await for` loop is enclosed in an implicit try-finally.
     bool oldInTryStatement = inTryStatement;
diff --git a/pkg/compiler/lib/src/compile_time_constants.dart b/pkg/compiler/lib/src/compile_time_constants.dart
index 6273efa..00112af 100644
--- a/pkg/compiler/lib/src/compile_time_constants.dart
+++ b/pkg/compiler/lib/src/compile_time_constants.dart
@@ -9,7 +9,7 @@
 import 'constants/expressions.dart';
 import 'constants/values.dart';
 import 'dart_types.dart';
-import 'dart2jslib.dart' show Compiler, CompilerTask, MessageKind, invariant;
+import 'dart2jslib.dart' show Compiler, CompilerTask, MessageKind, WorldImpact, invariant;
 import 'elements/elements.dart';
 import 'elements/modelx.dart' show FunctionElementX;
 import 'helpers/helpers.dart';
@@ -136,7 +136,9 @@
     }
     AstElement currentElement = element.analyzableElement;
     return compiler.withCurrentElement(currentElement, () {
-      compiler.analyzeElement(currentElement.declaration);
+      // TODO(johnniwinther): Avoid this eager analysis.
+      _analyzeElementEagerly(compiler, currentElement);
+
       ConstantExpression constant = compileVariableWithDefinitions(
           element, currentElement.resolvedAst.elements, isConst: isConst);
       return constant;
@@ -758,7 +760,7 @@
     // 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.
-    compiler.analyzeElement(constructor.declaration);
+    _analyzeElementEagerly(compiler, constructor);
 
     // The redirection chain of this element may not have been resolved through
     // a post-process action, so we have to make sure it is done here.
@@ -1004,7 +1006,7 @@
         this.definitions = new Map<Element, AstConstant>(),
         this.fieldValues = new Map<Element, AstConstant>(),
         super(handler,
-              compiler.resolver.resolveMethodElement(constructor.declaration),
+              _analyzeElementEagerly(compiler, constructor),
               compiler,
               isConst: true) {
     assert(invariant(constructor, constructor.isImplementation));
@@ -1140,7 +1142,7 @@
       ClassElement superClass = enclosingClass.superclass;
       if (enclosingClass != compiler.objectClass) {
         assert(superClass != null);
-        assert(superClass.resolutionState == STATE_DONE);
+        assert(superClass.isResolved);
 
         FunctionElement targetConstructor =
             superClass.lookupDefaultConstructor();
@@ -1225,3 +1227,10 @@
   ErroneousAstConstant(Element element, Node node)
       : super(element, node, new ErroneousConstantExpression());
 }
+
+// TODO(johnniwinther): Avoid the need for this hack.
+TreeElements _analyzeElementEagerly(Compiler compiler, AstElement element) {
+  WorldImpact worldImpact = compiler.analyzeElement(element.declaration);
+  compiler.enqueuer.resolution.applyImpact(element.declaration, worldImpact);
+  return element.resolvedAst.elements;
+}
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index 65d269c..98afea3 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -32,7 +32,7 @@
     assert(invariant(element, element.isDeclaration));
   }
 
-  void run(Compiler compiler, Enqueuer world);
+  WorldImpact run(Compiler compiler, Enqueuer world);
 }
 
 /// [WorkItem] used exclusively by the [ResolutionEnqueuer].
@@ -43,9 +43,10 @@
                      ItemCompilationContext compilationContext)
       : super(element, compilationContext);
 
-  void run(Compiler compiler, ResolutionEnqueuer world) {
-    compiler.analyze(this, world);
+  WorldImpact run(Compiler compiler, ResolutionEnqueuer world) {
+    WorldImpact impact = compiler.analyze(this, world);
     resolutionTree = element.resolvedAst.elements;
+    return impact;
   }
 
   bool isAnalyzed() => resolutionTree != null;
@@ -81,7 +82,7 @@
   }
 
   void registerInstantiatedClass(ClassElement element) {
-    world.registerInstantiatedClass(element, this);
+    world.registerInstantiatedType(element.rawType, this);
   }
 
   void registerInstantiatedType(InterfaceType type) {
@@ -120,7 +121,7 @@
   }
 
   void registerIsCheck(DartType type) {
-    world.registerIsCheck(type, this);
+    world.registerIsCheck(type);
     backend.registerIsCheckForCodegen(type, world, this);
   }
 
@@ -186,7 +187,7 @@
 
 /// [WorkItem] used exclusively by the [CodegenEnqueuer].
 class CodegenWorkItem extends WorkItem {
-  Registry registry;
+  CodegenRegistry registry;
 
   factory CodegenWorkItem(
       Compiler compiler,
@@ -211,11 +212,11 @@
 
   TreeElements get resolutionTree => element.resolvedAst.elements;
 
-  void run(Compiler compiler, CodegenEnqueuer world) {
-    if (world.isProcessed(element)) return;
+  WorldImpact run(Compiler compiler, CodegenEnqueuer world) {
+    if (world.isProcessed(element)) return const WorldImpact();
 
     registry = new CodegenRegistry(compiler, resolutionTree);
-    compiler.codegen(this, world);
+    return compiler.codegen(this, world);
   }
 }
 
@@ -249,8 +250,6 @@
   void registerInstantiation(InterfaceType type);
 
   void registerGetOfStaticFunction(FunctionElement element);
-
-  void registerAsyncMarker(FunctionElement element);
 }
 
 abstract class Backend {
@@ -287,7 +286,7 @@
   void initializeHelperClasses() {}
 
   void enqueueHelpers(ResolutionEnqueuer world, Registry registry);
-  void codegen(CodegenWorkItem work);
+  WorldImpact codegen(CodegenWorkItem work);
 
   // The backend determines the native resolution enqueuer, with a no-op
   // default, so tools like dart2dart can ignore the native classes.
@@ -1698,7 +1697,7 @@
       ClassElement cls = element;
       cls.ensureResolved(this);
       cls.forEachLocalMember(enqueuer.resolution.addToWorkList);
-      world.registerInstantiatedClass(element, globalDependencies);
+      world.registerInstantiatedType(cls.rawType, globalDependencies);
     } else {
       world.addToWorkList(element);
     }
@@ -1723,10 +1722,12 @@
       FunctionElement mainMethod = main;
       if (mainMethod.computeSignature(this).parameterCount != 0) {
         // The first argument could be a list of strings.
-        world.registerInstantiatedClass(
-            backend.listImplementation, globalDependencies);
-        world.registerInstantiatedClass(
-            backend.stringImplementation, globalDependencies);
+        backend.listImplementation.ensureResolved(this);
+        world.registerInstantiatedType(
+            backend.listImplementation.rawType, globalDependencies);
+        backend.stringImplementation.ensureResolved(this);
+        world.registerInstantiatedType(
+            backend.stringImplementation.rawType, globalDependencies);
 
         backend.registerMainHasArguments(world);
       }
@@ -1736,7 +1737,9 @@
       progress.reset();
     }
     world.forEach((WorkItem work) {
-      withCurrentElement(work.element, () => work.run(this, world));
+      withCurrentElement(work.element, () {
+        world.applyImpact(work.element, work.run(this, world));
+      });
     });
     world.queueIsClosed = true;
     assert(compilationFailed || world.checkNoEnqueuedInvokedInstanceMethods());
@@ -1782,7 +1785,7 @@
     }
   }
 
-  void analyzeElement(Element element) {
+  WorldImpact analyzeElement(Element element) {
     assert(invariant(element,
            element.impliesType ||
            element.isField ||
@@ -1795,22 +1798,23 @@
         message: 'Element $element is not analyzable.'));
     assert(invariant(element, element.isDeclaration));
     ResolutionEnqueuer world = enqueuer.resolution;
-    if (world.hasBeenResolved(element)) return;
+    if (world.hasBeenResolved(element)) {
+      return const WorldImpact();
+    }
     assert(parser != null);
     Node tree = parser.parse(element);
     assert(invariant(element, !element.isSynthesized || tree == null));
-    TreeElements elements = resolver.resolve(element);
-    if (elements != null) {
-      if (tree != null && !analyzeSignaturesOnly &&
-          !suppressWarnings) {
-        // Only analyze nodes with a corresponding [TreeElements].
-        checker.check(elements);
-      }
-      world.registerResolvedElement(element);
+    WorldImpact worldImpact = resolver.resolve(element);
+    if (tree != null && !analyzeSignaturesOnly &&
+        !suppressWarnings) {
+      // Only analyze nodes with a corresponding [TreeElements].
+      checker.check(element);
     }
+    world.registerResolvedElement(element);
+    return worldImpact;
   }
 
-  void analyze(ResolutionWorkItem work, ResolutionEnqueuer world) {
+  WorldImpact analyze(ResolutionWorkItem work, ResolutionEnqueuer world) {
     assert(invariant(work.element, identical(world, enqueuer.resolution)));
     assert(invariant(work.element, !work.isAnalyzed(),
         message: 'Element ${work.element} has already been analyzed'));
@@ -1824,12 +1828,15 @@
       }
     }
     AstElement element = work.element;
-    if (world.hasBeenResolved(element)) return;
-    analyzeElement(element);
+    if (world.hasBeenResolved(element)) {
+      return const WorldImpact();
+    }
+    WorldImpact worldImpact = analyzeElement(element);
     backend.onElementResolved(element, element.resolvedAst.elements);
+    return worldImpact;
   }
 
-  void codegen(CodegenWorkItem work, CodegenEnqueuer world) {
+  WorldImpact codegen(CodegenWorkItem work, CodegenEnqueuer world) {
     assert(invariant(work.element, identical(world, enqueuer.codegen)));
     if (shouldPrintProgress) {
       // TODO(ahe): Add structured diagnostics to the compiler API and
@@ -1837,7 +1844,7 @@
       log('Compiled ${enqueuer.codegen.generatedCode.length} methods.');
       progress.reset();
     }
-    backend.codegen(work);
+    return backend.codegen(work);
   }
 
   void reportError(Spannable node,
@@ -1927,11 +1934,14 @@
   }
 
   SourceSpan spanFromElement(Element element) {
+    if (element != null && element.sourcePosition != null) {
+      return element.sourcePosition;
+    }
     while (element != null && element.isSynthesized) {
       element = element.enclosingElement;
     }
     if (element != null &&
-        element.position == null &&
+        element.sourcePosition == null &&
         !element.isLibrary &&
         !element.isCompilationUnit) {
       // Sometimes, the backend fakes up elements that have no
@@ -1945,6 +1955,9 @@
     if (element == null) {
       element = currentElement;
     }
+    if (element.sourcePosition != null) {
+      return element.sourcePosition;
+    }
     Token position = element.position;
     Uri uri = element.compilationUnit.script.readableUri;
     return (position == null)
diff --git a/pkg/compiler/lib/src/constants/constructors.dart b/pkg/compiler/lib/src/constants/constructors.dart
index 3c09a94..2e83e56 100644
--- a/pkg/compiler/lib/src/constants/constructors.dart
+++ b/pkg/compiler/lib/src/constants/constructors.dart
@@ -4,16 +4,17 @@
 
 library dart2js.constants.constructors;
 
-import '../elements/elements.dart';
-import 'expressions.dart';
-import 'values.dart';
+import '../dart2jslib.dart';
 import '../dart_types.dart';
+import '../elements/elements.dart';
 import '../resolution/resolution.dart';
 import '../resolution/operators.dart';
 import '../resolution/semantic_visitor.dart';
 import '../resolution/send_structure.dart';
-import '../dart2jslib.dart';
 import '../tree/tree.dart';
+import '../universe/universe.dart' show CallStructure;
+import 'expressions.dart';
+import 'values.dart';
 
 ConstantConstructor computeConstantConstructor(ResolvedAst resolvedAst) {
   ConstantConstructorComputer visitor =
@@ -80,7 +81,7 @@
         _) {
     applyParameters(parameters, _);
     ConstructedConstantExpression constructorInvocation =
-        applyInitializers(initializers, _);
+        applyInitializers(node, _);
     return new GenerativeConstantConstructor(
         currentClass.thisType, defaultValues, fieldMap, constructorInvocation);
   }
@@ -93,7 +94,7 @@
       _) {
     applyParameters(parameters, _);
     ConstructedConstantExpression constructorInvocation =
-        applyInitializers(initializers, _);
+        applyInitializers(node, _);
     return new RedirectingGenerativeConstantConstructor(
         defaultValues, constructorInvocation);
   }
@@ -207,28 +208,18 @@
   }
 
   /// Apply this visitor to the constructor [initializers].
-  ConstructedConstantExpression applyInitializers(NodeList initializers, _) {
+  ConstructedConstantExpression applyInitializers(
+      FunctionExpression constructor, _) {
     ConstructedConstantExpression constructorInvocation;
-    if (initializers != null) {
-      for (Node initializer in initializers) {
-        InitializerStructure structure =
-            computeInitializerStructure(initializer);
-        if (structure is SuperConstructorInvokeStructure ||
-            structure is ThisConstructorInvokeStructure) {
-          constructorInvocation = structure.dispatch(this, initializer, _);
-        } else {
-          structure.dispatch(this, initializer, _);
-        }
+    InitializersStructure initializers =
+        computeInitializersStructure(constructor);
+    for (InitializerStructure structure in initializers.initializers) {
+      if (structure.isConstructorInvoke) {
+        constructorInvocation = structure.dispatch(this, _);
+      } else {
+        structure.dispatch(this, _);
       }
     }
-    if (constructorInvocation == null && !currentClass.isObject) {
-      constructorInvocation =
-          new ConstructedConstantExpression(null,
-              currentClass.supertype,
-              currentClass.superclass.lookupDefaultConstructor(),
-              CallStructure.NO_ARGS,
-              const <ConstantExpression>[]);
-    }
     return constructorInvocation;
   }
 
@@ -257,29 +248,41 @@
       ConstructorElement superConstructor,
       InterfaceType type,
       NodeList arguments,
-      Selector selector,
+      CallStructure callStructure,
       _) {
     List<ConstantExpression> argumentExpression =
         arguments.nodes.map((a) => apply(a)).toList();
     return new ConstructedConstantExpression(null,
         type,
         superConstructor,
-        selector.callStructure,
+        callStructure,
         argumentExpression);
   }
 
+  ConstructedConstantExpression visitImplicitSuperConstructorInvoke(
+      FunctionExpression node,
+      ConstructorElement superConstructor,
+      InterfaceType type,
+      _) {
+     return new ConstructedConstantExpression(null,
+         type,
+         superConstructor,
+         CallStructure.NO_ARGS,
+         const <ConstantExpression>[]);
+  }
+
   ConstructedConstantExpression visitThisConstructorInvoke(
       Send node,
       ConstructorElement thisConstructor,
       NodeList arguments,
-      Selector selector,
+      CallStructure callStructure,
       _) {
     List<ConstantExpression> argumentExpression =
         arguments.nodes.map((a) => apply(a)).toList();
     return new ConstructedConstantExpression(null,
         currentClass.thisType,
         thisConstructor,
-        selector.callStructure,
+        callStructure,
         argumentExpression);
   }
 
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
index 717bc06..4300917 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
@@ -111,6 +111,8 @@
     }
     return true;
   }
+
+  bool contains(Local local) => variable2index.containsKey(local);
 }
 
 /// The abstract base class of objects that emit jumps to a continuation and
@@ -364,6 +366,11 @@
     return (IrBuilder builder) => withBuilder(builder, () => build(node));
   }
 
+  /// Returns a closure that takes an [IrBuilder] and runs [f] in its context.
+  SubbuildFunction nested(f()) {
+    return (IrBuilder builder) => withBuilder(builder, f);
+  }
+
   /// Returns a closure that takes an [IrBuilder] and builds the sequence of
   /// [nodes] in its context using [build].
   // TODO(johnniwinther): Type [nodes] as `Iterable<N>` when `NodeList` uses
@@ -393,7 +400,7 @@
   ir.Parameter _thisParameter;
   ir.Parameter enclosingMethodThisParameter;
 
-  final List<ir.Definition> functionParameters = <ir.Definition>[];
+  final List<ir.Parameter> functionParameters = <ir.Parameter>[];
 
   IrBuilderSharedState(this.constantSystem, this.currentElement);
 
@@ -563,34 +570,8 @@
         ..mutableVariables = mutableVariables;
   }
 
-  /// Construct a builder for making constructor field initializers.
-  IrBuilder makeInitializerBuilder() {
-    return _makeInstance()
-        ..state = new IrBuilderSharedState(state.constantSystem,
-                                           state.currentElement)
-        ..environment = new Environment.from(environment)
-        ..mutableVariables = mutableVariables;
-  }
-
-  /// Construct a builder for an inner function.
-  IrBuilder makeInnerFunctionBuilder(ExecutableElement currentElement) {
-    IrBuilderSharedState innerState =
-        new IrBuilderSharedState(state.constantSystem, currentElement)
-          ..enclosingMethodThisParameter = state.enclosingMethodThisParameter;
-    return _makeInstance()
-        ..state = innerState
-        ..environment = new Environment.empty()
-        ..mutableVariables =
-            new Map<Local, ir.MutableVariable>.from(mutableVariables);
-  }
-
   bool get isOpen => _root == null || _current != null;
 
-
-  void buildFieldInitializerHeader({ClosureScope closureScope}) {
-    _enterScope(closureScope);
-  }
-
   List<ir.Primitive> buildFunctionHeader(Iterable<Local> parameters,
                                         {ClosureScope closureScope,
                                          ClosureEnvironment env}) {
@@ -830,87 +811,20 @@
     _current = null;
   }
 
-  ir.SuperInitializer makeSuperInitializer(ConstructorElement target,
-                                           List<ir.Body> arguments,
-                                           Selector selector) {
-    return new ir.SuperInitializer(target, arguments, selector);
-  }
-
-  ir.FieldInitializer makeFieldInitializer(FieldElement element,
-                                           ir.Body body) {
-    return new ir.FieldInitializer(element, body);
-  }
-
-  /// Create a [ir.FieldDefinition] for the current [Element] using [_root] as
-  /// the body using [initializer] as the initial value.
-  ir.FieldDefinition makeFieldDefinition(ir.Primitive initializer) {
-    if (initializer == null) {
-      return new ir.FieldDefinition.withoutInitializer(state.currentElement);
-    } else {
-      ir.Body body = makeBody(initializer);
-      return new ir.FieldDefinition(state.currentElement, body);
-    }
-  }
-
-  ir.Body makeBody([ir.Primitive value]) {
-    if (value == null) {
-      _ensureReturn();
-    } else {
-      buildReturn(value);
-    }
-    return new ir.Body(_root, state.returnContinuation);
-  }
-
-  /// Create a [ir.FunctionDefinition] for [element] using [_root] as the body.
+  /// Create a [ir.FunctionDefinition] using [_root] as the body.
   ///
-  /// Parameters must be created before the construction of the body using
-  /// [createFunctionParameter].
-  ir.FunctionDefinition makeFunctionDefinition(
-      List<ConstantExpression> defaults) {
-    FunctionElement element = state.currentElement;
-    if (element.isAbstract || element.isExternal) {
-      assert(invariant(element, _root == null,
-          message: "Non-empty body for abstract method $element: $_root"));
-      assert(invariant(element, state.localConstants.isEmpty,
-          message: "Local constants for abstract method $element: "
-                   "${state.localConstants}"));
-      return new ir.FunctionDefinition.abstract(
-          element, state.functionParameters, defaults);
-    } else {
-      ir.Body body = makeBody();
-      return new ir.FunctionDefinition(
-          element, state.thisParameter, state.functionParameters, body,
-          state.localConstants, defaults);
-    }
-  }
-
-  /// Create a constructor definition without a body, for representing
-  /// external constructors declarations.
-  ir.ConstructorDefinition makeAbstractConstructorDefinition(
-      List<ConstantExpression> defaults) {
-    FunctionElement element = state.currentElement;
-    assert(invariant(element, _root == null,
-        message: "Non-empty body for external constructor $element: $_root"));
-    assert(invariant(element, state.localConstants.isEmpty,
-        message: "Local constants for external constructor $element: "
-                 "${state.localConstants}"));
-    return new ir.ConstructorDefinition.abstract(
-        element, state.functionParameters, defaults);
-  }
-
-  ir.ConstructorDefinition makeConstructorDefinition(
-      List<ConstantExpression> defaults, List<ir.Initializer> initializers) {
-    FunctionElement element = state.currentElement;
-    ir.Body body = makeBody();
-    return new ir.ConstructorDefinition(
-        element, state.thisParameter, state.functionParameters, body, initializers,
-        state.localConstants, defaults);
-  }
-
-  ir.FunctionDefinition makeLazyFieldInitializer() {
-    ir.Body body = makeBody();
-    FieldElement element = state.currentElement;
-    return new ir.FunctionDefinition(element, null, [], body, [], []);
+  /// The protocol for building a function is:
+  /// 1. Call [buildFunctionHeader].
+  /// 2. Call `buildXXX` methods to build the body.
+  /// 3. Call [makeFunctionDefinition] to finish.
+  ir.FunctionDefinition makeFunctionDefinition() {
+    _ensureReturn();
+    return new ir.FunctionDefinition(
+        state.currentElement,
+        state.thisParameter,
+        state.functionParameters,
+        state.returnContinuation,
+        _root);
   }
 
   /// Create a invocation of the [method] on the super class where the call
@@ -1004,6 +918,19 @@
     return _buildInvokeDynamic(receiver, selector, arguments);
   }
 
+  /// Create an if-null expression. This is equivalent to a conditional
+  /// expression whose result is either [value] if [value] is not null, or
+  /// `right` if [value] is null. Only when [value] is null, [buildRight] is
+  /// evaluated to produce the `right` value.
+  ir.Primitive buildIfNull(ir.Primitive value,
+                           ir.Primitive buildRight(IrBuilder builder));
+
+  /// Create a conditional send. This is equivalent to a conditional expression
+  /// that checks if [receiver] is null, if so, it returns null, otherwise it
+  /// evaluates the [buildSend] expression.
+  ir.Primitive buildIfNotNullSend(ir.Primitive receiver,
+                                  ir.Primitive buildSend(IrBuilder builder));
+
   /// Create a dynamic getter invocation on [receiver] where the getter name is
   /// defined by [selector].
   ir.Primitive buildDynamicGet(ir.Primitive receiver, Selector selector) {
@@ -2101,217 +2028,6 @@
   }
 }
 
-/// Shared state between DartIrBuilders within the same method.
-class DartIrBuilderSharedState {
-  /// [MutableVariable]s that should temporarily be treated as registers.
-  final Set<Local> registerizedMutableVariables = new Set<Local>();
-}
-
-/// Dart-specific subclass of [IrBuilder].
-///
-/// Inner functions are represented by a [FunctionDefinition] with the
-/// IR for the inner function nested inside.
-///
-/// Captured variables are translated to ref cells (see [MutableVariable])
-/// using [GetMutableVariable] and [SetMutableVariable].
-class DartIrBuilder extends IrBuilder {
-  final DartIrBuilderSharedState dartState;
-
-  IrBuilder _makeInstance() => new DartIrBuilder._blank(dartState);
-  DartIrBuilder._blank(this.dartState);
-
-  DartIrBuilder(ConstantSystem constantSystem,
-                ExecutableElement currentElement,
-                Set<Local> capturedVariables)
-      : dartState = new DartIrBuilderSharedState() {
-    _init(constantSystem, currentElement);
-    capturedVariables.forEach(makeMutableVariable);
-  }
-
-  @override
-  bool isInMutableVariable(Local local) {
-    return mutableVariables.containsKey(local) &&
-           !dartState.registerizedMutableVariables.contains(local);
-  }
-
-  void _enterScope(ClosureScope scope) {
-    assert(scope == null);
-  }
-
-  void _enterClosureEnvironment(ClosureEnvironment env) {
-    assert(env == null);
-  }
-
-  void _enterForLoopInitializer(ClosureScope scope,
-                                List<LocalElement> loopVariables) {
-    assert(scope == null);
-    for (LocalElement loopVariable in loopVariables) {
-      if (mutableVariables.containsKey(loopVariable)) {
-        // Temporarily keep the loop variable in a primitive.
-        // The loop variable will be added to environment when
-        // [declareLocalVariable] is called.
-        dartState.registerizedMutableVariables.add(loopVariable);
-      }
-    }
-  }
-
-  void _enterForLoopBody(ClosureScope scope,
-                         List<LocalElement> loopVariables) {
-    assert(scope == null);
-    for (LocalElement loopVariable in loopVariables) {
-      if (mutableVariables.containsKey(loopVariable)) {
-        // Move from [Primitive] into [MutableVariable].
-        dartState.registerizedMutableVariables.remove(loopVariable);
-        add(new ir.LetMutable(getMutableVariable(loopVariable),
-                              environment.lookup(loopVariable)));
-      }
-    }
-  }
-
-  void _enterForLoopUpdate(ClosureScope scope,
-                           List<LocalElement> loopVariables) {
-    assert(scope == null);
-    // Move captured loop variables back into the local environment.
-    // The update expression will use the values we put in the environment,
-    // and then the environments for the initializer and update will be
-    // joined at the head of the body.
-    for (LocalElement loopVariable in loopVariables) {
-      if (isInMutableVariable(loopVariable)) {
-        ir.MutableVariable mutableVariable = getMutableVariable(loopVariable);
-        ir.Primitive value =
-            addPrimitive(new ir.GetMutableVariable(mutableVariable));
-        environment.update(loopVariable, value);
-        dartState.registerizedMutableVariables.add(loopVariable);
-      }
-    }
-  }
-
-  void _createFunctionParameter(Local parameterElement) {
-    ir.Parameter parameter = new ir.Parameter(parameterElement);
-    _parameters.add(parameter);
-    if (isInMutableVariable(parameterElement)) {
-      state.functionParameters.add(getMutableVariable(parameterElement));
-    } else {
-      state.functionParameters.add(parameter);
-      environment.extend(parameterElement, parameter);
-    }
-  }
-
-  void _createThisParameter() {
-    void create() {
-      ir.Parameter thisParameter =
-          new ir.Parameter(new ThisParameterLocal(state.currentElement));
-      state.thisParameter = thisParameter;
-      state.enclosingMethodThisParameter = thisParameter;
-    }
-    if (state.currentElement.isLocal) return;
-    if (state.currentElement.isStatic) return;
-    if (state.currentElement.isGenerativeConstructor) {
-      create();
-      return;
-    }
-    if (state.currentElement.isStatic) return;
-    if (state.currentElement.isInstanceMember) {
-      create();
-      return;
-    }
-  }
-
-  void declareLocalVariable(LocalVariableElement variableElement,
-                            {ir.Primitive initialValue}) {
-    assert(isOpen);
-    if (initialValue == null) {
-      initialValue = buildNullConstant();
-    }
-    if (isInMutableVariable(variableElement)) {
-      add(new ir.LetMutable(getMutableVariable(variableElement),
-                            initialValue));
-    } else {
-      initialValue.useElementAsHint(variableElement);
-      environment.extend(variableElement, initialValue);
-    }
-  }
-
-  /// Add [functionElement] to the environment with provided [definition].
-  void declareLocalFunction(LocalFunctionElement functionElement,
-                            ir.FunctionDefinition definition) {
-    assert(isOpen);
-    if (isInMutableVariable(functionElement)) {
-      ir.MutableVariable variable = getMutableVariable(functionElement);
-      add(new ir.DeclareFunction(variable, definition));
-    } else {
-      ir.CreateFunction prim = addPrimitive(new ir.CreateFunction(definition));
-      environment.extend(functionElement, prim);
-      prim.useElementAsHint(functionElement);
-    }
-  }
-
-  /// Create a function expression from [definition].
-  ir.Primitive buildFunctionExpression(ir.FunctionDefinition definition) {
-    return addPrimitive(new ir.CreateFunction(definition));
-  }
-
-  /// Create a read access of [local].
-  @override
-  ir.Primitive _buildLocalGet(LocalElement local) {
-    assert(isOpen);
-    if (isInMutableVariable(local)) {
-      // Do not use [local] as a hint on [result]. The variable should always
-      // be inlined, but the hint prevents it.
-      return addPrimitive(new ir.GetMutableVariable(getMutableVariable(local)));
-    } else {
-      return environment.lookup(local);
-    }
-  }
-
-  /// Create a write access to [local] with the provided [value].
-  @override
-  ir.Primitive buildLocalVariableSet(LocalElement local, ir.Primitive value) {
-    assert(isOpen);
-    if (isInMutableVariable(local)) {
-      add(new ir.SetMutableVariable(getMutableVariable(local), value));
-    } else {
-      value.useElementAsHint(local);
-      environment.update(local, value);
-    }
-    return value;
-  }
-
-  ir.Primitive buildThis() {
-    return state.enclosingMethodThisParameter;
-  }
-
-  @override
-  ir.Primitive buildConstructorInvocation(ConstructorElement element,
-                                          CallStructure callStructure,
-                                          DartType type,
-                                          List<ir.Primitive> arguments) {
-    assert(isOpen);
-    Selector selector =
-        new Selector(SelectorKind.CALL, element.memberName, callStructure);
-    return _continueWithExpression(
-        (k) => new ir.InvokeConstructor(type, element, selector,
-            arguments, k));
-  }
-
-  @override
-  ir.Primitive buildReifyTypeVariable(TypeVariableType variable) {
-    return addPrimitive(new ir.ReifyTypeVar(variable.element));
-  }
-
-  @override
-  ir.Primitive buildTypeOperator(ir.Primitive value,
-                                 DartType type,
-                                 {bool isTypeTest}) {
-    assert(isOpen);
-    assert(isTypeTest != null);
-    ir.Primitive check = _continueWithExpression(
-            (k) => new ir.TypeOperator(value, type,
-                       const <ir.Primitive>[], k, isTypeTest: isTypeTest));
-    return check;
-  }
-}
-
 /// State shared between JsIrBuilders within the same function.
 ///
 /// Note that this is not shared between builders of nested functions.
@@ -2619,11 +2335,11 @@
         arguments.add(value);
       });
       return addPrimitive(new ir.TypeExpression(type, arguments));
-    } else if (type is DynamicType) {
+    } else if (type.treatAsDynamic) {
       return buildNullConstant();
     } else {
       // TypedefType can reach here, and possibly other things.
-      throw 'unimplemented translation of type expression $type';
+      throw 'unimplemented translation of type expression $type (${type.kind})';
     }
   }
 
@@ -2634,23 +2350,26 @@
   /// corresponding type argument (field initializers are evaluated before the
   /// receiver object is created).
   ir.Primitive buildTypeVariableAccess(TypeVariableType variable) {
-    ir.Parameter accessTypeArgumentParameter() {
-      for (int i = 0; i < environment.length; i++) {
-        Local local = environment.index2variable[i];
-        if (local is TypeInformationParameter &&
-            local.variable == variable.element) {
-          return environment.index2value[i];
-        }
-      }
-      throw 'unable to find constructor parameter for type variable $variable.';
+    // If the local exists in the environment, use that.
+    // This is put here when we are inside a constructor or field initializer,
+    // (or possibly a closure inside one of these).
+    Local local = new TypeVariableLocal(variable, state.currentElement);
+    if (environment.contains(local)) {
+      return environment.lookup(local);
     }
 
-    if (jsState.inInitializers) {
-      return accessTypeArgumentParameter();
-    } else {
-      ir.Primitive target = buildThis();
-      return addPrimitive(new ir.ReadTypeVariable(variable, target));
-    }
+    // If the type variable is not in a local, read its value from the
+    // receiver object.
+    ir.Primitive target = buildThis();
+    return addPrimitive(new ir.ReadTypeVariable(variable, target));
+  }
+
+  /// Make the given type variable accessible through the local environment
+  /// with the value of [binding].
+  void declareTypeVariable(TypeVariableType variable, DartType binding) {
+    environment.extend(
+        new TypeVariableLocal(variable, state.currentElement),
+        buildTypeExpression(binding));
   }
 
   @override
@@ -2670,9 +2389,22 @@
                                  {bool isTypeTest}) {
     assert(isOpen);
     assert(isTypeTest != null);
+
+    if (type.isMalformed) {
+      FunctionElement helper = program.throwTypeErrorHelper;
+      ErroneousElement element = type.element;
+      ir.Primitive message = buildStringConstant(element.message);
+      return buildStaticFunctionInvocation(
+          helper,
+          CallStructure.ONE_ARG,
+          <ir.Primitive>[message]);
+    }
+
     if (isTypeTest) {
-      // The TypeOperator node does not allow the Object, dynamic, and Null types,
-      // because the null value satisfies them. These must be handled here.
+      // For type tests, we must treat specially the rare cases where `null`
+      // satisfies the test (which otherwise never satisfies a type test).
+      // This is not an optimization: the TypeOperator assumes that `null`
+      // cannot satisfy the type test.
       if (type.isObject || type.isDynamic) {
         // `x is Object` and `x is dynamic` are always true, even if x is null.
         return buildBooleanConstant(true);
@@ -2682,16 +2414,38 @@
         return addPrimitive(new ir.Identical(value, buildNullConstant()));
       }
     }
-    // Null cannot not satisfy the check. Use a standard subtype check.
     List<ir.Primitive> typeArguments = const <ir.Primitive>[];
     if (type is GenericType && type.typeArguments.isNotEmpty) {
       typeArguments = type.typeArguments.map(buildTypeExpression).toList();
+    } else if (type is TypeVariableType) {
+      typeArguments = <ir.Primitive>[buildTypeVariableAccess(type)];
     }
     ir.Primitive check = _continueWithExpression(
             (k) => new ir.TypeOperator(value,
                        type, typeArguments, k, isTypeTest: isTypeTest));
     return check;
   }
+
+  @override
+  ir.Primitive buildIfNull(ir.Primitive value,
+                           ir.Primitive buildRight(IrBuilder builder)) {
+    ir.Primitive condition = _buildCheckNull(value);
+    return buildConditional(condition, buildRight, (_) => value);
+  }
+
+  @override
+  ir.Primitive buildIfNotNullSend(ir.Primitive receiver,
+                                  ir.Primitive buildSend(IrBuilder builder)) {
+    ir.Primitive condition = _buildCheckNull(receiver);
+    return buildConditional(condition, (_) => receiver, buildSend);
+  }
+
+  /// Creates a type test checking whether [value] is null.
+  ir.Primitive _buildCheckNull(ir.Primitive value) {
+    assert(isOpen);
+    ir.Primitive right = buildNullConstant();
+    return addPrimitive(new ir.Identical(value, right));
+  }
 }
 
 
@@ -2764,12 +2518,3 @@
                    this.stackTraceVariable,
                    this.buildCatchBlock});
 }
-
-/// Synthetic parameter to a JavaScript factory method that takes the type
-/// argument given for the type variable [variable].
-class TypeInformationParameter implements Local {
-  final TypeVariableElement variable;
-  final ExecutableElement executableContext;
-  TypeInformationParameter(this.variable, this.executableContext);
-  String get name => variable.name;
-}
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
index c603337..b311280 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
@@ -40,7 +40,8 @@
  * re-implemented to work directly on the IR.
  */
 class IrBuilderTask extends CompilerTask {
-  final Map<Element, ir.RootNode> nodes = <Element, ir.RootNode>{};
+  final Map<Element, ir.FunctionDefinition> nodes =
+      <Element, ir.FunctionDefinition>{};
   final SourceInformationFactory sourceInformationFactory;
 
   String bailoutMessage = null;
@@ -52,20 +53,16 @@
 
   bool hasIr(Element element) => nodes.containsKey(element.implementation);
 
-  ir.RootNode getIr(ExecutableElement element) {
+  ir.FunctionDefinition getIr(ExecutableElement element) {
     return nodes[element.implementation];
   }
 
-  ir.RootNode buildNode(AstElement element) {
+  ir.FunctionDefinition buildNode(AstElement element) {
     return measure(() => _buildNode(element));
   }
 
-  ir.RootNode _buildNode(AstElement element) {
+  ir.FunctionDefinition _buildNode(AstElement element) {
     bailoutMessage = null;
-    if (!canBuild(element)) {
-      bailoutMessage = 'unsupported element ${element.name}:${element.kind}';
-      return null;
-    }
 
     TreeElements elementsMapping = element.resolvedAst.elements;
     element = element.implementation;
@@ -74,12 +71,9 @@
           sourceInformationFactory.forContext(element);
 
       IrBuilderVisitor builder =
-          compiler.backend is JavaScriptBackend
-          ? new JsIrBuilderVisitor(
-              elementsMapping, compiler, sourceInformationBuilder)
-          : new DartIrBuilderVisitor(
+          new JsIrBuilderVisitor(
               elementsMapping, compiler, sourceInformationBuilder);
-      ir.RootNode irNode = builder.buildExecutable(element);
+      ir.FunctionDefinition irNode = builder.buildExecutable(element);
       if (irNode == null) {
         bailoutMessage = builder.bailoutMessage;
       } else {
@@ -96,31 +90,6 @@
     });
   }
 
-  bool canBuild(Element element) {
-    // If using JavaScript backend, don't try to bail out early.
-    if (compiler.backend is JavaScriptBackend) return true;
-
-    if (element is TypedefElement) return false;
-    if (element is FunctionElement) {
-      // TODO(sigurdm): Support native functions for dart2js.
-      assert(invariant(element, !element.isNative));
-
-      if (element is ConstructorElement) {
-        if (!element.isGenerativeConstructor) {
-          // TODO(kmillikin,sigurdm): Support constructors.
-          return false;
-        }
-        if (element.isSynthesized) {
-          // Do generate CPS for synthetic constructors.
-          return true;
-        }
-      }
-    } else if (element is! FieldElement) {
-      compiler.internalError(element, "Unexpected element type $element");
-    }
-    return compiler.backend.shouldOutput(element);
-  }
-
   bool get inCheckedMode {
     bool result = false;
     assert((result = true));
@@ -191,11 +160,11 @@
   SemanticSendVisitor get sendVisitor => this;
 
   /**
-   * Builds the [ir.RootNode] for an executable element. In case the
+   * Builds the [ir.FunctionDefinition] for an executable element. In case the
    * function uses features that cannot be expressed in the IR, this element
    * returns `null`.
    */
-  ir.RootNode buildExecutable(ExecutableElement element);
+  ir.FunctionDefinition buildExecutable(ExecutableElement element);
 
   ClosureClassMap get closureClassMap;
   ClosureScope getClosureScopeForNode(ast.Node node);
@@ -248,8 +217,8 @@
     return useSelectorType(newSelector, elements.getSelector(node));
   }
 
-  ir.RootNode _makeFunctionBody(FunctionElement element,
-                                ast.FunctionExpression node) {
+  ir.FunctionDefinition _makeFunctionBody(FunctionElement element,
+                                          ast.FunctionExpression node) {
     FunctionSignature signature = element.functionSignature;
     List<ParameterElement> parameters = [];
     signature.orderedForEachParameter(parameters.add);
@@ -258,104 +227,8 @@
                                   closureScope: getClosureScopeForNode(node),
                                   env: getClosureEnvironment());
 
-    List<ConstantExpression> defaults = new List<ConstantExpression>();
-    signature.orderedOptionalParameters.forEach((ParameterElement element) {
-      defaults.add(getConstantForVariable(element));
-    });
-
-    List<ir.Initializer> initializers;
-    if (element.isSynthesized) {
-      assert(element is ConstructorElement);
-      return irBuilder.makeConstructorDefinition(const <ConstantExpression>[],
-          const <ir.Initializer>[]);
-    } else if (element.isGenerativeConstructor) {
-      if (element.isExternal) {
-        return irBuilder.makeAbstractConstructorDefinition(defaults);
-      } else {
-        initializers = buildConstructorInitializers(node, element);
-        visit(node.body);
-        return irBuilder.makeConstructorDefinition(defaults, initializers);
-      }
-    } else {
-      visit(node.body);
-      return irBuilder.makeFunctionDefinition(defaults);
-    }
-  }
-
-  List<ir.Initializer> buildConstructorInitializers(
-      ast.FunctionExpression function, ConstructorElement element) {
-    List<ir.Initializer> result = <ir.Initializer>[];
-    FunctionSignature signature = element.functionSignature;
-
-    void tryAddInitializingFormal(ParameterElement parameterElement) {
-      if (parameterElement.isInitializingFormal) {
-        InitializingFormalElement initializingFormal = parameterElement;
-        withBuilder(irBuilder.makeInitializerBuilder(), () {
-          ir.Primitive value =
-              irBuilder.buildLocalVariableGet(parameterElement);
-          result.add(irBuilder.makeFieldInitializer(
-              initializingFormal.fieldElement,
-              irBuilder.makeBody(value)));
-        });
-      }
-    }
-
-    // TODO(sigurdm): Preserve initializing formals as initializing formals.
-    signature.orderedForEachParameter(tryAddInitializingFormal);
-
-    if (function.initializers == null) return result;
-    bool explicitSuperInitializer = false;
-    for(ast.Node initializer in function.initializers) {
-      if (initializer is ast.SendSet) {
-        // Field initializer.
-        FieldElement field = elements[initializer];
-        withBuilder(irBuilder.makeInitializerBuilder(), () {
-          ir.Primitive value = visit(initializer.arguments.head);
-          ir.Body body = irBuilder.makeBody(value);
-          result.add(irBuilder.makeFieldInitializer(field, body));
-        });
-      } else if (initializer is ast.Send) {
-        // Super or this initializer.
-        if (ast.Initializers.isConstructorRedirect(initializer)) {
-          giveup(initializer, "constructor redirect (this) initializer");
-        }
-        ConstructorElement constructor = elements[initializer].implementation;
-        Selector selector = elements.getSelector(initializer);
-        List<ir.Body> arguments =
-            initializer.arguments.mapToList((ast.Node argument) {
-          return withBuilder(irBuilder.makeInitializerBuilder(), () {
-            ir.Primitive value = visit(argument);
-            return irBuilder.makeBody(value);
-          });
-        });
-        result.add(irBuilder.makeSuperInitializer(constructor,
-                                                  arguments,
-                                                  selector));
-        explicitSuperInitializer = true;
-      } else {
-        compiler.internalError(initializer,
-                               "Unexpected initializer type $initializer");
-      }
-
-    }
-    if (!explicitSuperInitializer) {
-      // No super initializer found. Try to find the default constructor if
-      // the class is not Object.
-      ClassElement enclosingClass = element.enclosingClass;
-      if (!enclosingClass.isObject) {
-        ClassElement superClass = enclosingClass.superclass;
-        FunctionElement target = superClass.lookupDefaultConstructor();
-        if (target == null) {
-          compiler.internalError(superClass,
-              "No default constructor available.");
-        }
-        Selector selector = new Selector.callDefaultConstructor();
-        result.add(irBuilder.makeSuperInitializer(target,
-                                                  <ir.Body>[],
-                                                  selector));
-      }
-    }
-    return result;
+    visit(node.body);
+    return irBuilder.makeFunctionDefinition();
   }
 
   ir.Primitive visit(ast.Node node) => node.accept(this);
@@ -725,6 +598,18 @@
   }
 
   @override
+  ir.Primitive visitIfNotNullDynamicPropertyGet(
+      ast.Send node,
+      ast.Node receiver,
+      Selector selector,
+      _) {
+    ir.Primitive target = visit(receiver);
+    return irBuilder.buildIfNotNullSend(
+        target,
+        nested(() => irBuilder.buildDynamicGet(target, selector)));
+  }
+
+  @override
   ir.Primitive visitDynamicTypeLiteralGet(
       ast.Send node,
       ConstantExpression constant,
@@ -764,7 +649,7 @@
       MethodElement function,
       _) {
     // TODO(karlklose): support foreign functions.
-    if (function.isForeign(compiler.backend)) {
+    if (compiler.backend.isForeign(function)) {
       return giveup(node, 'handleStaticFunctionGet: foreign: $function');
     }
     return irBuilder.buildStaticFunctionGet(function);
@@ -846,7 +731,7 @@
   @override
   ir.Primitive visitIfNull(
       ast.Send node, ast.Node left, ast.Node right, _) {
-    internalError(node, "If-null not yet implemented in cps_ir");
+    return irBuilder.buildIfNull(build(left), subbuild(right));
   }
 
   @override
@@ -1061,6 +946,21 @@
         translateDynamicArguments(arguments, selector.callStructure));
   }
 
+  @override
+  ir.Primitive visitIfNotNullDynamicPropertyInvoke(
+      ast.Send node,
+      ast.Node receiver,
+      ast.NodeList arguments,
+      Selector selector,
+      _) {
+    ir.Primitive target = visit(receiver);
+    return irBuilder.buildIfNotNullSend(
+        target,
+        nested(() => irBuilder.buildDynamicInvocation(
+            target, selector,
+            translateDynamicArguments(arguments, selector.callStructure))));
+  }
+
   ir.Primitive handleLocalInvoke(
       ast.Send node,
       LocalElement element,
@@ -1109,7 +1009,7 @@
       CallStructure callStructure,
       _) {
     // TODO(karlklose): support foreign functions.
-    if (function.isForeign(compiler.backend)) {
+    if (compiler.backend.isForeign(function)) {
       return giveup(node, 'handleStaticFunctionInvoke: foreign: $function');
     }
     return irBuilder.buildStaticFunctionInvocation(function, callStructure,
@@ -1135,7 +1035,7 @@
       ast.NodeList arguments,
       CallStructure callStructure,
       _) {
-    if (getter.isForeign(compiler.backend)) {
+    if (compiler.backend.isForeign(getter)) {
       return giveup(node, 'handleStaticGetterInvoke: foreign: $getter');
     }
     ir.Primitive target = irBuilder.buildStaticGetterGet(getter);
@@ -1251,8 +1151,19 @@
        CompoundRhs rhs,
        void setValue(ir.Primitive value)}) {
     ir.Primitive value = getValue();
+    op.BinaryOperator operator = rhs.operator;
+    if (operator.kind == op.BinaryOperatorKind.IF_NULL) {
+      // Unlike other compound operators if-null conditionally will not do the
+      // assignment operation.
+      return irBuilder.buildIfNull(value, nested(() {
+        ir.Primitive newValue = build(rhs.rhs);
+        setValue(newValue);
+        return newValue;
+      }));
+    }
+
     Selector operatorSelector =
-        new Selector.binaryOperator(rhs.operator.selectorName);
+        new Selector.binaryOperator(operator.selectorName);
     ir.Primitive rhsValue;
     if (rhs.kind == CompoundKind.ASSIGNMENT) {
       rhsValue = visit(rhs.rhs);
@@ -1282,6 +1193,19 @@
   }
 
   @override
+  ir.Primitive visitIfNotNullDynamicPropertySet(
+      ast.SendSet node,
+      ast.Node receiver,
+      Selector selector,
+      ast.Node rhs,
+      _) {
+    ir.Primitive target = visit(receiver);
+    return irBuilder.buildIfNotNullSend(
+        target,
+        nested(() => irBuilder.buildDynamicSet(target, selector, visit(rhs))));
+  }
+
+  @override
   ir.Primitive handleLocalSet(
       ast.SendSet node,
       LocalElement element,
@@ -1357,12 +1281,17 @@
       Selector setterSelector,
       arg) {
     ir.Primitive target = translateReceiver(receiver);
-    return translateCompounds(
-        getValue: () => irBuilder.buildDynamicGet(target, getterSelector),
-        rhs: rhs,
-        setValue: (ir.Primitive result) {
-          irBuilder.buildDynamicSet(target, setterSelector, result);
-        });
+    ir.Primitive helper() {
+      return translateCompounds(
+          getValue: () => irBuilder.buildDynamicGet(target, getterSelector),
+          rhs: rhs,
+          setValue: (ir.Primitive result) {
+            irBuilder.buildDynamicSet(target, setterSelector, result);
+          });
+    }
+    return node.isConditional
+        ? irBuilder.buildIfNotNullSend(target, nested(helper))
+        : helper();
   }
 
   ir.Primitive buildLocalNoSuchSetter(Local local, ir.Primitive value) {
@@ -1923,7 +1852,7 @@
     return buildInstanceNoSuchMethod(selector, args);
   }
 
-  ir.RootNode nullIfGiveup(ir.RootNode action()) {
+  ir.FunctionDefinition nullIfGiveup(ir.FunctionDefinition action()) {
     try {
       return action();
     } catch(e) {
@@ -2110,185 +2039,6 @@
   }
 }
 
-/// IR builder specific to the Dart backend, coupled to the [DartIrBuilder].
-class DartIrBuilderVisitor extends IrBuilderVisitor {
-  /// Promote the type of [irBuilder] to [DartIrBuilder].
-  DartIrBuilder get irBuilder => super.irBuilder;
-
-  DartIrBuilderVisitor(TreeElements elements,
-                       Compiler compiler,
-                       SourceInformationBuilder sourceInformationBuilder)
-      : super(elements, compiler, sourceInformationBuilder);
-
-  DartIrBuilder makeIRBuilder(ExecutableElement element,
-                              Set<Local> capturedVariables) {
-    return new DartIrBuilder(compiler.backend.constantSystem,
-                             element,
-                             capturedVariables);
-  }
-
-  DartCapturedVariables _analyzeCapturedVariables(ExecutableElement element,
-                                                  ast.Node node) {
-    DartCapturedVariables variables = new DartCapturedVariables(elements);
-    if (!element.isSynthesized) {
-      try {
-        variables.analyze(node);
-      } catch (e) {
-        bailoutMessage = variables.bailoutMessage;
-        rethrow;
-      }
-    }
-    return variables;
-  }
-
-  /// Recursively builds the IR for the given nested function.
-  ir.FunctionDefinition makeSubFunction(ast.FunctionExpression node) {
-    FunctionElement element = elements[node];
-    assert(invariant(element, element.isImplementation));
-
-    IrBuilder builder = irBuilder.makeInnerFunctionBuilder(element);
-
-    return withBuilder(builder, () => _makeFunctionBody(element, node));
-  }
-
-  ir.Primitive visitFunctionExpression(ast.FunctionExpression node) {
-    return irBuilder.buildFunctionExpression(makeSubFunction(node));
-  }
-
-  visitFunctionDeclaration(ast.FunctionDeclaration node) {
-    LocalFunctionElement element = elements[node.function];
-    Object inner = makeSubFunction(node.function);
-    irBuilder.declareLocalFunction(element, inner);
-  }
-
-  ClosureClassMap get closureClassMap => null;
-  ClosureScope getClosureScopeForNode(ast.Node node) => null;
-  ClosureEnvironment getClosureEnvironment() => null;
-
-  ir.RootNode buildExecutable(ExecutableElement element) {
-    return nullIfGiveup(() {
-      ir.RootNode root;
-      if (element is FieldElement) {
-        root = buildField(element);
-      } else if (element is FunctionElement || element is ConstructorElement) {
-        root = buildFunction(element);
-      } else {
-        compiler.internalError(element, "Unexpected element type $element");
-      }
-      new CleanupPass().visit(root);
-      return root;
-    });
-  }
-
-  /// Returns a [ir.FieldDefinition] describing the initializer of [element].
-  ir.FieldDefinition buildField(FieldElement element) {
-    assert(invariant(element, element.isImplementation));
-    ast.VariableDefinitions definitions = element.node;
-    ast.Node fieldDefinition = definitions.definitions.nodes.first;
-    if (definitions.modifiers.isConst) {
-      // TODO(sigurdm): Just return const value.
-    }
-    assert(fieldDefinition != null);
-    assert(elements[fieldDefinition] != null);
-
-    DartCapturedVariables variables =
-        _analyzeCapturedVariables(element, fieldDefinition);
-    tryStatements = variables.tryStatements;
-    IrBuilder builder = makeIRBuilder(element, variables.capturedVariables);
-
-    return withBuilder(builder, () {
-      builder.buildFieldInitializerHeader(
-          closureScope: getClosureScopeForNode(fieldDefinition));
-      ir.Primitive initializer;
-      if (fieldDefinition is ast.SendSet) {
-        ast.SendSet sendSet = fieldDefinition;
-        initializer = visit(sendSet.arguments.first);
-      }
-      return builder.makeFieldDefinition(initializer);
-    });
-  }
-
-  ir.RootNode buildFunction(FunctionElement element) {
-    assert(invariant(element, element.isImplementation));
-    ast.FunctionExpression node = element.node;
-    if (element.asyncMarker != AsyncMarker.SYNC) {
-      giveup(null, 'cannot handle async-await');
-    }
-
-    if (!element.isSynthesized) {
-      assert(node != null);
-      assert(elements[node] != null);
-    } else {
-      SynthesizedConstructorElementX constructor = element;
-      if (!constructor.isDefaultConstructor) {
-        giveup(null, 'cannot handle synthetic forwarding constructors');
-      }
-    }
-
-    DartCapturedVariables variables =
-        _analyzeCapturedVariables(element, node);
-    tryStatements = variables.tryStatements;
-    IrBuilder builder = makeIRBuilder(element, variables.capturedVariables);
-
-    return withBuilder(builder, () => _makeFunctionBody(element, node));
-  }
-
-  List<ir.Primitive> normalizeStaticArguments(
-      CallStructure callStructure,
-      FunctionElement target,
-      List<ir.Primitive> arguments) {
-    return arguments;
-  }
-
-  List<ir.Primitive> normalizeDynamicArguments(
-      CallStructure callStructure,
-      List<ir.Primitive> arguments) {
-    return arguments;
-  }
-
-  @override
-  ir.Primitive handleConstructorInvoke(
-      ast.NewExpression node,
-      ConstructorElement constructor,
-      DartType type,
-      ast.NodeList arguments,
-      CallStructure callStructure, _) {
-    List<ir.Primitive> arguments =
-        node.send.arguments.mapToList(visit, growable:false);
-    return irBuilder.buildConstructorInvocation(
-        constructor,
-        callStructure,
-        type,
-        arguments);
-  }
-
-  @override
-  ir.Primitive buildStaticNoSuchMethod(Selector selector,
-                                       List<ir.Primitive> arguments) {
-    return giveup(null, 'Static noSuchMethod');
-  }
-
-  @override
-  ir.Primitive buildInstanceNoSuchMethod(Selector selector,
-                                         List<ir.Primitive> arguments) {
-    return giveup(null, 'Instance noSuchMethod');
-  }
-
-  @override
-  ir.Primitive buildRuntimeError(String message) {
-    return giveup(null, 'Build runtime error: $message');
-  }
-
-  @override
-  ir.Primitive buildAbstractClassInstantiationError(ClassElement element) {
-    return giveup(null, 'Abstract class instantiation: ${element.name}');
-  }
-
-  ir.Primitive buildStaticFieldGet(FieldElement field, SourceInformation src) {
-    return irBuilder.buildStaticFieldLazyGet(field, src);
-  }
-}
-
 /// The [IrBuilder]s view on the information about the program that has been
 /// computed in resolution and and type interence.
 class GlobalProgramInformation {
@@ -2303,6 +2053,8 @@
     return cls.typeVariables.isNotEmpty && _backend.classNeedsRti(cls);
   }
 
+  FunctionElement get throwTypeErrorHelper => _backend.getThrowTypeError();
+
   ClassElement get nullClass => _compiler.nullClass;
 }
 
@@ -2410,9 +2162,9 @@
                             scope.boxedLoopVariables);
   }
 
-  ir.RootNode buildExecutable(ExecutableElement element) {
+  ir.FunctionDefinition buildExecutable(ExecutableElement element) {
     return nullIfGiveup(() {
-      ir.RootNode root;
+      ir.FunctionDefinition root;
       switch (element.kind) {
         case ElementKind.GENERATIVE_CONSTRUCTOR:
           root = buildConstructor(element);
@@ -2458,9 +2210,10 @@
             elements);
     IrBuilder builder = getBuilderFor(element);
     return withBuilder(builder, () {
+      irBuilder.buildFunctionHeader(<Local>[]);
       ir.Primitive initialValue = visit(element.initializer);
       irBuilder.buildReturn(initialValue);
-      return irBuilder.makeLazyFieldInitializer();
+      return irBuilder.makeFunctionDefinition();
     });
   }
 
@@ -2497,10 +2250,11 @@
 
   /// Builds the IR for a given constructor.
   ///
-  /// 1. Evaluates all own or inherited field initializers.
-  /// 2. Creates the object and assigns its fields.
-  /// 3. Calls constructor body and super constructor bodies.
-  /// 4. Returns the created object.
+  /// 1. Computes the type held in all own or "inherited" type variables.
+  /// 2. Evaluates all own or inherited field initializers.
+  /// 3. Creates the object and assigns its fields and runtime type.
+  /// 4. Calls constructor body and super constructor bodies.
+  /// 5. Returns the created object.
   ir.FunctionDefinition buildConstructor(ConstructorElement constructor) {
     // TODO(asgerf): Optimization: If constructor is redirecting, then just
     //               evaluate arguments and call the target constructor.
@@ -2525,8 +2279,11 @@
       if (requiresTypeInformation) {
         firstTypeArgumentParameterIndex = parameters.length;
         classElement.typeVariables.forEach((TypeVariableType variable) {
-          parameters.add(
-              new TypeInformationParameter(variable.element, constructor));
+          parameters.add(new TypeVariableLocal(variable, constructor));
+        });
+      } else {
+        classElement.typeVariables.forEach((TypeVariableType variable) {
+          irBuilder.declareTypeVariable(variable, const DynamicType());
         });
       }
 
@@ -2542,7 +2299,14 @@
         typeInformation = const <ir.Primitive>[];
       }
 
-      // -- Step 1: evaluate field initializers ---
+      // -- Load values for type variables declared on super classes --
+      // Field initializers for super classes can reference these, so they
+      // must be available before evaluating field initializers.
+      // This could be interleaved with field initialization, but we choose do
+      // get it out of the way here to avoid complications with mixins.
+      loadTypeVariablesForSuperClasses(classElement);
+
+      // -- Evaluate field initializers ---
       // Evaluate field initializers in constructor and super constructors.
       irBuilder.enterInitializers();
       List<ConstructorElement> constructorList = <ConstructorElement>[];
@@ -2553,7 +2317,7 @@
       // BoxLocals for captured parameters are also in the environment.
       // The initial value of all fields are now bound in [fieldValues].
 
-      // --- Step 2: create the object ---
+      // --- Create the object ---
       // Get the initial field values in the canonical order.
       List<ir.Primitive> instanceArguments = <ir.Primitive>[];
       classElement.forEachInstanceField((ClassElement c, FieldElement field) {
@@ -2571,7 +2335,7 @@
           typeInformation);
       irBuilder.add(new ir.LetPrim(instance));
 
-      // --- Step 3: call constructor bodies ---
+      // --- Call constructor bodies ---
       for (ConstructorElement target in constructorList) {
         ConstructorBodyElement bodyElement = getConstructorBody(target);
         if (bodyElement == null) continue; // Skip if constructor has no body.
@@ -2585,7 +2349,7 @@
       // --- step 4: return the created object ----
       irBuilder.buildReturn(instance);
 
-      return irBuilder.makeFunctionDefinition([]);
+      return irBuilder.makeFunctionDefinition();
     });
   }
 
@@ -2673,12 +2437,44 @@
     supers.add(constructor);
   }
 
+  /// Loads the type variables for all super classes of [superClass] into the
+  /// IR builder's environment with their corresponding values.
+  ///
+  /// The type variables for [currentClass] must already be in the IR builder's
+  /// environment.
+  ///
+  /// Type variables are stored as [TypeVariableLocal] in the environment.
+  ///
+  /// This ensures that access to type variables mentioned inside the
+  /// constructors and initializers will happen through the local environment
+  /// instead of using 'this'.
+  void loadTypeVariablesForSuperClasses(ClassElement currentClass) {
+    if (currentClass.isObject) return;
+    loadTypeVariablesForType(currentClass.supertype);
+    if (currentClass is MixinApplicationElement) {
+      loadTypeVariablesForType(currentClass.mixinType);
+    }
+  }
+
+  /// Loads all type variables for [type] and all of its super classes into
+  /// the environment. All type variables mentioned in [type] must already
+  /// be in the environment.
+  void loadTypeVariablesForType(InterfaceType type) {
+    ClassElement clazz = type.element;
+    assert(clazz.typeVariables.length == type.typeArguments.length);
+    for (int i = 0; i < clazz.typeVariables.length; ++i) {
+      irBuilder.declareTypeVariable(clazz.typeVariables[i],
+                                    type.typeArguments[i]);
+    }
+    loadTypeVariablesForSuperClasses(clazz);
+  }
+
   /// In preparation of inlining (part of) [target], the [arguments] are moved
   /// into the environment bindings for the corresponding parameters.
   ///
   /// Defaults for optional arguments are evaluated in order to ensure
   /// all parameters are available in the environment.
-  void loadArguments(FunctionElement target,
+  void loadArguments(ConstructorElement target,
                      Selector selector,
                      List<ir.Primitive> arguments) {
     target = target.implementation;
@@ -2837,7 +2633,7 @@
       irBuilder.buildConstructorBodyHeader(getConstructorBodyParameters(body),
                                            getClosureScopeForNode(node));
       visit(node.body);
-      return irBuilder.makeFunctionDefinition([]);
+      return irBuilder.makeFunctionDefinition();
     });
   }
 
@@ -2934,6 +2730,7 @@
     }
     return result;
   }
+
   @override
   ir.Primitive handleConstructorInvoke(
       ast.NewExpression node,
@@ -3035,6 +2832,10 @@
     return expression;
   }
 
+  processFunctionDefinition(ir.FunctionDefinition node) {
+    node.body = replacementFor(node.body);
+  }
+
   processLetPrim(ir.LetPrim node) {
     node.body = replacementFor(node.body);
   }
@@ -3055,10 +2856,6 @@
     node.body = replacementFor(node.body);
   }
 
-  processDeclareFunction(ir.DeclareFunction node) {
-    node.body = replacementFor(node.body);
-  }
-
   processSetField(ir.SetField node) {
     node.body = replacementFor(node.body);
   }
@@ -3070,10 +2867,6 @@
   processContinuation(ir.Continuation node) {
     node.body = replacementFor(node.body);
   }
-
-  processBody(ir.Body node) {
-    node.body = replacementFor(node.body);
-  }
 }
 
 /// Visit a just-deleted subterm and unlink all [Reference]s in it.
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_integrity.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_integrity.dart
index e7a7d14..0d7c066 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_integrity.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_integrity.dart
@@ -26,7 +26,7 @@
 ///
 class CheckCpsIntegrity extends RecursiveVisitor {
 
-  RootNode topLevelNode;
+  FunctionDefinition topLevelNode;
 
   Set<Definition> seenDefinitions = new Set<Definition>();
   Map<Definition, Set<Reference>> seenReferences =
@@ -78,15 +78,6 @@
   }
 
   @override
-  visitBody(Body node) {
-    markAsSeen(node.returnContinuation);
-    if (!node.returnContinuation.isReturnContinuation) {
-      error('Return continuation with a body', node);
-    }
-    doInScope([node.returnContinuation], node, () => visit(node.body));
-  }
-
-  @override
   visitLetPrim(LetPrim node) {
     markAsSeen(node.primitive);
     visit(node.primitive);
@@ -106,24 +97,14 @@
       markAsSeen(node.thisParameter);
     }
     node.parameters.forEach(markAsSeen);
-    if (node.body != null) {
-      doInOptionalScope(node.thisParameter, node,
-          () => doInScope(node.parameters, node, () => visit(node.body)));
+    markAsSeen(node.returnContinuation);
+    if (!node.returnContinuation.isReturnContinuation) {
+      error('Return continuation with a body', node);
     }
-  }
-
-  @override
-  visitConstructorDefinition(ConstructorDefinition node) {
-    if (node.thisParameter != null) {
-      markAsSeen(node.thisParameter);
-    }
-    node.parameters.forEach(markAsSeen);
-    doInScope(node.parameters, node, () {
-      if (node.initializers != null) node.initializers.forEach(visit);
-      if (node.body != null) {
-        doInOptionalScope(node.thisParameter, node, () => visit(node.body));
-      }
-    });
+    doInOptionalScope(node.thisParameter, node,
+        () => doInScope(node.parameters, node,
+            () => doInScope([node.returnContinuation], node,
+                () => visit(node.body))));
   }
 
   doInOptionalScope(Parameter parameter, Node node, action) {
@@ -133,15 +114,6 @@
   }
 
   @override
-  visitDeclareFunction(DeclareFunction node) {
-    markAsSeen(node.variable);
-    doInScope([node.variable], node, () {
-      visit(node.definition);
-      visit(node.body);
-    });
-  }
-
-  @override
   processReference(Reference reference) {
     if (!bindings.containsKey(reference.definition)) {
       error('Referenced out of scope: ${reference.definition}', reference);
@@ -209,7 +181,7 @@
           '$sexpr\n';
   }
 
-  void check(RootNode node) {
+  void check(FunctionDefinition node) {
     topLevelNode = node;
     visit(node);
 
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
index 32c50ef..d052121 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
@@ -1,18 +1,11 @@
 // 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.
-
-// IrNodes are kept in a separate library to have precise control over their
-// dependencies on other parts of the system.
 library dart2js.ir_nodes;
 
 import '../constants/expressions.dart';
 import '../constants/values.dart' as values show ConstantValue;
-import '../dart_types.dart' show DartType, GenericType, TypeVariableType;
-import '../dart2jslib.dart' as dart2js show
-    CURRENT_ELEMENT_SPANNABLE,
-    InternalErrorFunction,
-    invariant;
+import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType;
 import '../elements/elements.dart';
 import '../io/source_information.dart' show SourceInformation;
 import '../universe/universe.dart' show Selector, SelectorKind;
@@ -24,6 +17,16 @@
   accept(Visitor visitor);
 }
 
+/// Expressions can be evaluated, and may diverge, throw, and/or have
+/// side-effects.
+///
+/// Evaluation continues by stepping into a sub-expression, invoking a
+/// continuation, or throwing an exception.
+///
+/// Expressions do not a return value. Expressions that produce values should
+/// invoke a [Continuation] with the result as argument. Alternatively, values
+/// that can be obtained without side-effects, divergence, or throwing
+/// exceptions can be built using a [LetPrim].
 abstract class Expression extends Node {
   Expression plug(Expression expr) => throw 'impossible';
 }
@@ -59,9 +62,11 @@
 /// An expression that cannot throw or diverge and has no side-effects.
 /// All primitives are named using the identity of the [Primitive] object.
 ///
-/// Primitives may allocate objects, this is not considered side-effect here.
+/// Primitives may allocate objects; this is not considered side-effect here.
 ///
 /// Although primitives may not mutate state, they may depend on state.
+///
+/// All primitives except [Parameter] must be bound by a [LetPrim].
 abstract class Primitive extends Definition<Primitive> {
   /// The [VariableElement] or [ParameterElement] from which the primitive
   /// binding originated.
@@ -105,10 +110,12 @@
   }
 }
 
-/// Binding a value (primitive or constant): 'let val x = V in E'.  The bound
-/// value is in scope in the body.
-/// During one-pass construction a LetVal with an empty body is used to
-/// represent the one-hole context 'let val x = V in []'.
+/// Evaluates a primitive and binds it to variable: `let val x = V in E`.
+///
+/// The bound value is in scope in the body.
+///
+/// During one-pass construction a LetPrim with an empty body is used to
+/// represent the one-hole context `let val x = V in []`.
 class LetPrim extends Expression implements InteriorNode {
   final Primitive primitive;
   Expression body;
@@ -133,9 +140,10 @@
 ///
 /// The bound continuations are in scope in the body and the continuation
 /// parameters are in scope in the respective continuation bodies.
+///
 /// During one-pass construction a LetCont whose first continuation has an empty
 /// body is used to represent the one-hole context
-/// 'let cont ... k(v) = [] ... in E'.
+/// `let cont ... k(v) = [] ... in E`.
 class LetCont extends Expression implements InteriorNode {
   List<Continuation> continuations;
   Expression body;
@@ -215,18 +223,17 @@
   void set body(Expression body);
 }
 
-/// Invoke a static function or static getter/setter.
+/// Invoke a static function.
+///
+/// All optional arguments declared by [target] are passed in explicitly, and
+/// occur at the end of [arguments] list, in normalized order.
+///
+/// Discussion:
+/// All information in the [selector] is technically redundant; it will likely
+/// be removed.
 class InvokeStatic extends Expression implements Invoke {
-  /// [FunctionElement] or [FieldElement].
-  final Entity target;
-
-  /**
-   * The selector encodes how the function is invoked: number of positional
-   * arguments, names used in named arguments. This information is required
-   * to build the [StaticCallSiteTypeInformation] for the inference graph.
-   */
+  final FunctionElement target;
   final Selector selector;
-
   final List<Reference<Primitive>> arguments;
   final Reference<Continuation> continuation;
   final SourceInformation sourceInformation;
@@ -237,81 +244,39 @@
                Continuation cont,
                this.sourceInformation)
       : arguments = _referenceList(args),
-        continuation = new Reference<Continuation>(cont) {
-    assert(target is ErroneousElement || selector.name == target.name);
-  }
+        continuation = new Reference<Continuation>(cont);
 
   accept(Visitor visitor) => visitor.visitInvokeStatic(this);
 }
 
-/// A [CallingConvention] codifies how arguments are matched to parameters when
-/// emitting code for a function call.
-class CallingConvention {
-  final String name;
-  const CallingConvention(this.name);
-  /// The normal way of calling a Dart function: Positional arguments are
-  /// matched with (mandatory and optional) positionals parameters from left to
-  /// right and named arguments are matched by name.
-  static const CallingConvention DART = const CallingConvention("Dart call");
-  /// Intercepted calls have an additional first argument that is the actual
-  /// receiver of the call.  See the documentation of [Interceptor] for more
-  /// information.
-  static const CallingConvention JS_INTERCEPTED =
-      const CallingConvention("intercepted JavaScript call");
-}
-
-/// Invoke a method, operator, getter, setter, or index getter/setter.
-/// Converting a method to a function object is treated as a getter invocation.
+/// Invoke a method on an object.
+///
+/// This includes getters, setters, operators, and index getter/setters.
+///
+/// Tearing off a method is treated like a getter invocation (getters and
+/// tear-offs cannot be distinguished at compile-time).
+///
+/// The [selector] records the names of named arguments. The value of named
+/// arguments occur at the end of the [arguments] list, in normalized order.
+///
+/// Discussion:
+/// If the [selector] is a [TypedSelector], the type information contained
+/// there is used by optimization passes. This is likely to change.
 class InvokeMethod extends Expression implements Invoke {
   Reference<Primitive> receiver;
   Selector selector;
-  CallingConvention callingConvention;
   final List<Reference<Primitive>> arguments;
   final Reference<Continuation> continuation;
   final SourceInformation sourceInformation;
 
   InvokeMethod(Primitive receiver,
-               Selector selector,
+               this.selector,
                List<Primitive> arguments,
                Continuation continuation,
-               {SourceInformation sourceInformation})
-      : this.internal(new Reference<Primitive>(receiver),
-                      selector,
-                      _referenceList(arguments),
-                      new Reference<Continuation>(continuation),
-                      sourceInformation);
-
-  InvokeMethod.internal(this.receiver,
-                        this.selector,
-                        this.arguments,
-                        this.continuation,
-                        this.sourceInformation,
-                        [this.callingConvention = CallingConvention.DART]) {
-    assert(isValid);
-  }
-
-  /// Returns whether the arguments match the selector under the given calling
-  /// convention.
-  ///
-  /// This check is designed to be used in an assert, as it also checks that the
-  /// selector, arguments, and calling convention have meaningful values.
-  bool get isValid {
-    if (selector == null || callingConvention == null) return false;
-    if (callingConvention != CallingConvention.DART &&
-        callingConvention != CallingConvention.JS_INTERCEPTED) {
-      return false;
-    }
-    int numberOfArguments =
-        callingConvention == CallingConvention.JS_INTERCEPTED
-            ? arguments.length - 1
-            : arguments.length;
-    return selector.kind == SelectorKind.CALL ||
-           selector.kind == SelectorKind.OPERATOR ||
-           (selector.kind == SelectorKind.GETTER && numberOfArguments == 0) ||
-           (selector.kind == SelectorKind.SETTER && numberOfArguments == 1) ||
-           (selector.kind == SelectorKind.INDEX && numberOfArguments == 1) ||
-           (selector.kind == SelectorKind.INDEX && numberOfArguments == 2);
-  }
+               {this.sourceInformation})
+      : this.receiver = new Reference<Primitive>(receiver),
+        this.arguments = _referenceList(arguments),
+        this.continuation = new Reference<Continuation>(continuation);
 
   accept(Visitor visitor) => visitor.visitInvokeMethod(this);
 }
@@ -333,12 +298,11 @@
 /// TODO(sra): Review. A direct call to a method that is mixed into a native
 /// class will still require an explicit argument.
 ///
-/// When targeting Dart, this instruction is used to represent super calls.
-/// Here, [receiver] must always be a reference to `this`, and [target] must be
-/// a method that is available in the super class.
+/// All optional arguments declared by [target] are passed in explicitly, and
+/// occur at the end of [arguments] list, in normalized order.
 class InvokeMethodDirectly extends Expression implements Invoke {
   Reference<Primitive> receiver;
-  final Element target;
+  final FunctionElement target;
   final Selector selector;
   final List<Reference<Primitive>> arguments;
   final Reference<Continuation> continuation;
@@ -346,69 +310,65 @@
   InvokeMethodDirectly(Primitive receiver,
                        this.target,
                        this.selector,
-                       List<Primitive> args,
-                       Continuation cont)
+                       List<Primitive> arguments,
+                       Continuation continuation)
       : this.receiver = new Reference<Primitive>(receiver),
-          arguments = _referenceList(args),
-          continuation = new Reference<Continuation>(cont) {
-    assert(selector != null);
-    assert(selector.kind == SelectorKind.CALL ||
-           selector.kind == SelectorKind.OPERATOR ||
-           (selector.kind == SelectorKind.GETTER && arguments.isEmpty) ||
-           (selector.kind == SelectorKind.SETTER && arguments.length == 1) ||
-           (selector.kind == SelectorKind.INDEX && arguments.length == 1) ||
-           (selector.kind == SelectorKind.INDEX && arguments.length == 2));
-  }
+        this.arguments = _referenceList(arguments),
+        this.continuation = new Reference<Continuation>(continuation);
 
   accept(Visitor visitor) => visitor.visitInvokeMethodDirectly(this);
 }
 
-/// Non-const call to a constructor. The [target] may be a generative
-/// constructor, factory, or redirecting factory.
+/// Non-const call to a constructor.
+///
+/// The [target] may be a generative constructor (forwarding or normal)
+/// or a non-redirecting factory.
+///
+/// All optional arguments declared by [target] are passed in explicitly, and
+/// occur in the [arguments] list, in normalized order.
+///
+/// Last in the [arguments] list, after the mandatory and optional arguments,
+/// the internal representation of each type argument occurs, unless it could
+/// be determined at build-time that the constructed class has no need for its
+/// runtime type information.
+///
+/// Note that [InvokeConstructor] does it itself allocate an object.
+/// The invoked constructor will do that using [CreateInstance].
 class InvokeConstructor extends Expression implements Invoke {
   final DartType type;
-  final FunctionElement target;
+  final ConstructorElement target;
   final List<Reference<Primitive>> arguments;
   final Reference<Continuation> continuation;
   final Selector selector;
 
-  /// The class being instantiated. This is the same as `target.enclosingClass`
-  /// and `type.element`.
-  ClassElement get targetClass => target.enclosingElement;
-
-  /// True if this is an invocation of a factory constructor.
-  bool get isFactory => target.isFactoryConstructor;
-
   InvokeConstructor(this.type,
                     this.target,
                     this.selector,
                     List<Primitive> args,
                     Continuation cont)
       : arguments = _referenceList(args),
-        continuation = new Reference<Continuation>(cont) {
-    assert(dart2js.invariant(target,
-        target.isErroneous ||
-        type.isDynamic ||
-        type.element == target.enclosingClass.declaration,
-        message: "Constructor invocation target is not a constructor: "
-                 "$target."));
-  }
+        continuation = new Reference<Continuation>(cont);
 
   accept(Visitor visitor) => visitor.visitInvokeConstructor(this);
 }
 
-/// "as" casts and "is" checks.
-// We might want to turn "is"-checks into a [Primitive] as it can never diverge.
-// But then we need to special-case for is-checks with an erroneous .type as
-// these will throw.
+// TODO(asgerf): Make a Primitive for "is" and an Expression for "as".
+
+/// An "as" cast or an "is" check.
 class TypeOperator extends Expression {
   Reference<Primitive> value;
   final DartType type;
-  /// Type arguments to [type]. Since [type] may reference type variables in the
-  /// enclosing class, these are not constant.
+
+  /// If [type] is an [InterfaceType], this holds the internal representation of
+  /// the type arguments to [type]. Since these may reference type variables
+  /// from the enclosing class, they are not constant.
+  ///
+  /// If [type] is a [TypeVariableType], this is a singleton list with
+  /// the internal representation of the type held in that type variable.
+  ///
+  /// Otherwise the list is empty.
   final List<Reference<Primitive>> typeArguments;
   final Reference<Continuation> continuation;
-  // TODO(johnniwinther): Use `Operator` class to encapsule the operator type.
   final bool isTypeTest;
 
   TypeOperator(Primitive value,
@@ -513,30 +473,6 @@
   }
 }
 
-/// Create a potentially recursive function and store it in a [MutableVariable].
-/// The function can access itself using [GetMutableVariable] on [variable].
-/// There must not exist a [SetMutableVariable] to [variable].
-///
-/// This can be seen as a let rec binding:
-///
-///   let rec [variable] = [definition] in [body]
-///
-class DeclareFunction extends Expression
-                      implements InteriorNode, DartSpecificNode {
-  final MutableVariable variable;
-  final FunctionDefinition definition;
-  Expression body;
-
-  DeclareFunction(this.variable, this.definition);
-
-  Expression plug(Expression expr) {
-    assert(body == null);
-    return body = expr;
-  }
-
-  accept(Visitor visitor) => visitor.visitDeclareFunction(this);
-}
-
 /// Invoke a continuation in tail position.
 class InvokeContinuation extends Expression {
   Reference<Continuation> continuation;
@@ -579,6 +515,8 @@
 }
 
 /// Choose between a pair of continuations based on a condition value.
+///
+/// The two continuations must not declare any parameters.
 class Branch extends Expression {
   final Condition condition;
   final Reference<Continuation> trueContinuation;
@@ -591,19 +529,10 @@
   accept(Visitor visitor) => visitor.visitBranch(this);
 }
 
-/// Marker interface for nodes that are only handled in the JavaScript backend.
-///
-/// These nodes are generated by the unsugar step or the [JsIrBuilder] and need
-/// special translation to the Tree IR, which is implemented in JsTreeBuilder.
-abstract class JsSpecificNode implements Node {}
-
-/// Marker interface for nodes that are only handled inthe Dart backend.
-abstract class DartSpecificNode implements Node {}
-
 /// Directly assigns to a field on a given object.
-class SetField extends Expression implements InteriorNode, JsSpecificNode {
+class SetField extends Expression implements InteriorNode {
   final Reference<Primitive> object;
-  Element field;
+  FieldElement field;
   final Reference<Primitive> value;
   Expression body;
 
@@ -620,9 +549,9 @@
 }
 
 /// Directly reads from a field on a given object.
-class GetField extends Primitive implements JsSpecificNode {
+class GetField extends Primitive {
   final Reference<Primitive> object;
-  Element field;
+  FieldElement field;
 
   GetField(Primitive object, this.field)
       : this.object = new Reference<Primitive>(object);
@@ -632,6 +561,7 @@
 
 /// Reads the value of a static field or tears off a static method.
 class GetStatic extends Primitive {
+  /// Can be [FieldElement] or [FunctionElement].
   final Element element;
   final SourceInformation sourceInformation;
 
@@ -642,7 +572,7 @@
 
 /// Sets the value of a static field.
 class SetStatic extends Expression implements InteriorNode {
-  final Element element;
+  final FieldElement element;
   final Reference<Primitive> value;
   Expression body;
   final SourceInformation sourceInformation;
@@ -670,21 +600,21 @@
   final SourceInformation sourceInformation;
 
   GetLazyStatic(this.element,
-                Continuation cont,
+                Continuation continuation,
                 this.sourceInformation)
-      : continuation = new Reference<Continuation>(cont);
+      : continuation = new Reference<Continuation>(continuation);
 
   accept(Visitor visitor) => visitor.visitGetLazyStatic(this);
 }
 
 /// Creates an object for holding boxed variables captured by a closure.
-class CreateBox extends Primitive implements JsSpecificNode {
+class CreateBox extends Primitive {
   accept(Visitor visitor) => visitor.visitCreateBox(this);
 }
 
 /// Creates an instance of a class and initializes its fields and runtime type
 /// information.
-class CreateInstance extends Primitive implements JsSpecificNode {
+class CreateInstance extends Primitive {
   final ClassElement classElement;
 
   /// Initial values for the fields on the class.
@@ -706,7 +636,11 @@
   accept(Visitor visitor) => visitor.visitCreateInstance(this);
 }
 
-class Identical extends Primitive implements JsSpecificNode {
+/// Compare objects for identity.
+///
+/// It is an error pass in a value that does not correspond to a Dart value,
+/// such as an interceptor or a box.
+class Identical extends Primitive {
   final Reference<Primitive> left;
   final Reference<Primitive> right;
   Identical(Primitive left, Primitive right)
@@ -715,7 +649,7 @@
   accept(Visitor visitor) => visitor.visitIdentical(this);
 }
 
-class Interceptor extends Primitive implements JsSpecificNode {
+class Interceptor extends Primitive {
   final Reference<Primitive> input;
   final Set<ClassElement> interceptedClasses;
   Interceptor(Primitive input, this.interceptedClasses)
@@ -724,7 +658,7 @@
 }
 
 /// Create an instance of [Invocation] for use in a call to `noSuchMethod`.
-class CreateInvocationMirror extends Primitive implements JsSpecificNode {
+class CreateInvocationMirror extends Primitive {
   final Selector selector;
   final List<Reference<Primitive>> arguments;
 
@@ -744,21 +678,9 @@
   accept(Visitor visitor) => visitor.visitConstant(this);
 }
 
-/// Reify the given type variable as a [Type].
-/// This depends on the current binding of 'this'.
-class ReifyTypeVar extends Primitive implements DartSpecificNode {
-  final TypeVariableElement typeVariable;
-
-  ReifyTypeVar(this.typeVariable);
-
-  values.ConstantValue get constant => null;
-
-  accept(Visitor visitor) => visitor.visitReifyTypeVar(this);
-}
-
 class LiteralList extends Primitive {
   /// The List type being created; this is not the type argument.
-  final GenericType type;
+  final InterfaceType type;
   final List<Reference<Primitive>> values;
 
   LiteralList(this.type, List<Primitive> values)
@@ -777,7 +699,7 @@
 }
 
 class LiteralMap extends Primitive {
-  final GenericType type;
+  final InterfaceType type;
   final List<LiteralMapEntry> entries;
 
   LiteralMap(this.type, this.entries);
@@ -785,8 +707,17 @@
   accept(Visitor visitor) => visitor.visitLiteralMap(this);
 }
 
-/// Create a non-recursive function.
-class CreateFunction extends Primitive implements DartSpecificNode {
+/// Currently unused.
+///
+/// Nested functions (from Dart code) are translated to classes by closure
+/// conversion, hence they are instantiated with [CreateInstance].
+///
+/// We keep this around for now because it might come in handy when we
+/// handle async/await in the CPS IR.
+///
+/// Instantiates a nested function. [MutableVariable]s are in scope in the
+/// inner function, but primitives are not shared across function boundaries.
+class CreateFunction extends Primitive {
   final FunctionDefinition definition;
 
   CreateFunction(this.definition);
@@ -812,7 +743,7 @@
 
 /// Continuations are normally bound by 'let cont'.  A continuation with one
 /// parameter and no body is used to represent a function's return continuation.
-/// The return continuation is bound by the Function, not by 'let cont'.
+/// The return continuation is bound by the function, not by 'let cont'.
 class Continuation extends Definition<Continuation> implements InteriorNode {
   final List<Parameter> parameters;
   Expression body = null;
@@ -834,39 +765,6 @@
   accept(Visitor visitor) => visitor.visitContinuation(this);
 }
 
-abstract class RootNode extends Node {
-  Element get element;
-
-  /// True if there is no body for this root node.
-  ///
-  /// In some parts of the compiler, empty root nodes are used as placeholders
-  /// for abstract methods, external constructors, fields without initializers,
-  /// etc.
-  bool get isEmpty;
-
-  /// List of parameters, or an empty list if this is a field.
-  /// For fields, this list is immutable.
-  List<Definition> get parameters;
-}
-
-// This is basically a function definition with an empty parameter list and a
-// field element instead of a function element and no const declarations, and
-// never a getter or setter, though that's less important.
-class FieldDefinition extends RootNode implements DartSpecificNode {
-  final FieldElement element;
-  List<Definition> get parameters => const <Definition>[];
-  final Body body;
-
-  FieldDefinition(this.element, this.body);
-
-  FieldDefinition.withoutInitializer(this.element)
-      : this.body = null;
-
-  accept(Visitor visitor) => visitor.visitFieldDefinition(this);
-
-  bool get isEmpty => body == null;
-}
-
 /// Identifies a mutable variable.
 class MutableVariable extends Definition {
   Entity hint;
@@ -876,102 +774,29 @@
   accept(Visitor v) => v.visitMutableVariable(this);
 }
 
-class Body extends InteriorNode {
-  Expression body;
-  final Continuation returnContinuation;
-  Body(this.body, this.returnContinuation);
-  accept(Visitor visitor) => visitor.visitBody(this);
-}
-
-/// A function definition, consisting of parameters and a body.  The parameters
-/// include a distinguished continuation parameter (held by the body).
-class FunctionDefinition extends RootNode {
+/// A function definition, consisting of parameters and a body.
+///
+/// There is an explicit parameter for the `this` argument, and a return
+/// continuation to invoke when returning from the function.
+class FunctionDefinition extends InteriorNode {
   final ExecutableElement element;
   final Parameter thisParameter;
-  /// Mixed list of [Parameter]s and [MutableVariable]s.
-  final List<Definition> parameters;
-  final Body body;
-  final List<ConstDeclaration> localConstants;
-
-  /// Values for optional parameters.
-  final List<ConstantExpression> defaultParameterValues;
+  final List<Parameter> parameters;
+  final Continuation returnContinuation;
+  Expression body;
 
   FunctionDefinition(this.element,
       this.thisParameter,
       this.parameters,
-      this.body,
-      this.localConstants,
-      this.defaultParameterValues);
-
-  FunctionDefinition.abstract(this.element,
-                              this.parameters,
-                              this.defaultParameterValues)
-      : body = null,
-        thisParameter = null,
-        localConstants = const <ConstDeclaration>[];
+      this.returnContinuation,
+      this.body);
 
   accept(Visitor visitor) => visitor.visitFunctionDefinition(this);
-
-  bool get isEmpty => body == null;
-}
-
-abstract class Initializer extends Node implements DartSpecificNode {}
-
-class FieldInitializer extends Initializer {
-  final FieldElement element;
-  final Body body;
-
-  FieldInitializer(this.element, this.body);
-  accept(Visitor visitor) => visitor.visitFieldInitializer(this);
-}
-
-class SuperInitializer extends Initializer {
-  final ConstructorElement target;
-  final List<Body> arguments;
-  final Selector selector;
-  SuperInitializer(this.target, this.arguments, this.selector);
-  accept(Visitor visitor) => visitor.visitSuperInitializer(this);
-}
-
-class ConstructorDefinition extends RootNode implements DartSpecificNode {
-  final ConstructorElement element;
-  final Parameter thisParameter;
-  /// Mixed list of [Parameter]s and [MutableVariable]s.
-  final List<Definition> parameters;
-  final Body body;
-  final List<ConstDeclaration> localConstants;
-  final List<Initializer> initializers;
-
-  /// Values for optional parameters.
-  final List<ConstantExpression> defaultParameterValues;
-
-  ConstructorDefinition(this.element,
-                        this.thisParameter,
-                        this.parameters,
-                        this.body,
-                        this.initializers,
-                        this.localConstants,
-                        this.defaultParameterValues);
-
-  // 'Abstract' here means "has no body" and is used to represent external
-  // constructors.
-  ConstructorDefinition.abstract(
-      this.element,
-      this.parameters,
-      this.defaultParameterValues)
-      : body = null,
-        initializers = null,
-        thisParameter = null,
-        localConstants = const <ConstDeclaration>[];
-
-  accept(Visitor visitor) => visitor.visitConstructorDefinition(this);
-
-  bool get isEmpty => body == null;
 }
 
 /// Converts the internal representation of a type to a Dart object of type
 /// [Type].
-class ReifyRuntimeType extends Primitive implements JsSpecificNode {
+class ReifyRuntimeType extends Primitive {
   /// Reference to the internal representation of a type (as produced, for
   /// example, by [ReadTypeVariable]).
   final Reference<Primitive> value;
@@ -987,7 +812,7 @@
 /// The resulting value is an internal representation (and not neccessarily a
 /// Dart object), and must be reified by [ReifyRuntimeType], if it should be
 /// used as a Dart value.
-class ReadTypeVariable extends Primitive implements JsSpecificNode {
+class ReadTypeVariable extends Primitive {
   final TypeVariableType variable;
   final Reference<Primitive> target;
 
@@ -1006,7 +831,7 @@
 /// treated as 'holes' in the term, which means that it must be ensured at
 /// construction, that duplicate occurences of a type variable in [dartType]
 /// are assigned the same value.
-class TypeExpression extends Primitive implements JsSpecificNode {
+class TypeExpression extends Primitive {
   final DartType dartType;
   final List<Reference<Primitive>> arguments;
 
@@ -1030,14 +855,7 @@
   T visit(Node node);
 
   // Concrete classes.
-  T visitFieldDefinition(FieldDefinition node);
   T visitFunctionDefinition(FunctionDefinition node);
-  T visitConstructorDefinition(ConstructorDefinition node);
-  T visitBody(Body node);
-
-  // Initializers
-  T visitFieldInitializer(FieldInitializer node);
-  T visitSuperInitializer(SuperInitializer node);
 
   // Expressions.
   T visitLetPrim(LetPrim node);
@@ -1055,15 +873,14 @@
   T visitBranch(Branch node);
   T visitTypeOperator(TypeOperator node);
   T visitSetMutableVariable(SetMutableVariable node);
-  T visitDeclareFunction(DeclareFunction node);
   T visitSetStatic(SetStatic node);
   T visitGetLazyStatic(GetLazyStatic node);
+  T visitSetField(SetField node);
 
   // Definitions.
   T visitLiteralList(LiteralList node);
   T visitLiteralMap(LiteralMap node);
   T visitConstant(Constant node);
-  T visitReifyTypeVar(ReifyTypeVar node);
   T visitCreateFunction(CreateFunction node);
   T visitGetMutableVariable(GetMutableVariable node);
   T visitParameter(Parameter node);
@@ -1071,16 +888,6 @@
   T visitMutableVariable(MutableVariable node);
   T visitNonTailThrow(NonTailThrow node);
   T visitGetStatic(GetStatic node);
-
-  // JavaScript specific nodes.
-
-  // Conditions.
-  T visitIsTrue(IsTrue node);
-
-  // Expressions.
-  T visitSetField(SetField node);
-
-  // Definitions.
   T visitIdentical(Identical node);
   T visitInterceptor(Interceptor node);
   T visitCreateInstance(CreateInstance node);
@@ -1090,6 +897,9 @@
   T visitReadTypeVariable(ReadTypeVariable node);
   T visitTypeExpression(TypeExpression node);
   T visitCreateInvocationMirror(CreateInvocationMirror node);
+
+  // Conditions.
+  T visitIsTrue(IsTrue node);
 }
 
 /// Recursively visits the entire CPS term, and calls abstract `process*`
@@ -1101,56 +911,15 @@
 
   processReference(Reference ref) {}
 
-  processBody(Body node) {}
-  visitBody(Body node) {
-    processBody(node);
-    visit(node.returnContinuation);
-    visit(node.body);
-  }
-
-  processFieldDefinition(FieldDefinition node) {}
-  visitFieldDefinition(FieldDefinition node) {
-    processFieldDefinition(node);
-    if (node.body != null) {
-      visit(node.body);
-    }
-  }
-
   processFunctionDefinition(FunctionDefinition node) {}
   visitFunctionDefinition(FunctionDefinition node) {
     processFunctionDefinition(node);
     if (node.thisParameter != null) visit(node.thisParameter);
     node.parameters.forEach(visit);
-    if (node.body != null) {
-      visit(node.body);
-    }
-  }
-
-  processConstructorDefinition(ConstructorDefinition node) {}
-  visitConstructorDefinition(ConstructorDefinition node) {
-    processConstructorDefinition(node);
-    if (node.thisParameter != null) visit(node.thisParameter);
-    node.parameters.forEach(visit);
-    if (node.initializers != null) {
-      node.initializers.forEach(visit);
-    }
-    if (node.body != null) {
-      visit(node.body);
-    }
-  }
-
-  processFieldInitializer(FieldInitializer node) {}
-  visitFieldInitializer(FieldInitializer node) {
-    processFieldInitializer(node);
+    visit(node.returnContinuation);
     visit(node.body);
   }
 
-  processSuperInitializer(SuperInitializer node) {}
-  visitSuperInitializer(SuperInitializer node) {
-    processSuperInitializer(node);
-    node.arguments.forEach(visit);
-  }
-
   // Expressions.
 
   processLetPrim(LetPrim node) {}
@@ -1261,22 +1030,12 @@
     visit(node.body);
   }
 
-  processDeclareFunction(DeclareFunction node) {}
-  visitDeclareFunction(DeclareFunction node) {
-    processDeclareFunction(node);
-    visit(node.variable);
-    visit(node.definition);
-    visit(node.body);
-  }
-
   processGetLazyStatic(GetLazyStatic node) {}
   visitGetLazyStatic(GetLazyStatic node) {
     processGetLazyStatic(node);
     processReference(node.continuation);
   }
 
-  // Definitions.
-
   processLiteralList(LiteralList node) {}
   visitLiteralList(LiteralList node) {
     processLiteralList(node);
@@ -1297,11 +1056,6 @@
     processConstant(node);
   }
 
-  processReifyTypeVar(ReifyTypeVar node) {}
-  visitReifyTypeVar(ReifyTypeVar node) {
-    processReifyTypeVar(node);
-  }
-
   processCreateFunction(CreateFunction node) {}
   visitCreateFunction(CreateFunction node) {
     processCreateFunction(node);
@@ -1331,15 +1085,12 @@
     if (node.body != null) visit(node.body);
   }
 
-  // Conditions.
-
   processIsTrue(IsTrue node) {}
   visitIsTrue(IsTrue node) {
     processIsTrue(node);
     processReference(node.value);
   }
 
-  // JavaScript specific nodes.
   processIdentical(Identical node) {}
   visitIdentical(Identical node) {
     processIdentical(node);
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
index 2d5294b..b4bbcdc 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
@@ -54,68 +54,13 @@
     String name = node.element.name;
     String thisParameter = formatThisParameter(node.thisParameter);
     String parameters = node.parameters.map(visit).join(' ');
-    String body = visit(node.body);
+    namer.setReturnContinuation(node.returnContinuation);
+    String body = indentBlock(() => visit(node.body));
     return '$indentation'
         '(FunctionDefinition $name $thisParameter ($parameters) return\n'
         '$body)';
   }
 
-  String visitFieldDefinition(FieldDefinition node) {
-    String name = node.element.name;
-    if (node.body != null) {
-      String body = visit(node.body);
-      return '$indentation(FieldDefinition $name () return\n'
-             '$body)';
-    } else {
-      return '$indentation(FieldDefinition $name)';
-    }
-  }
-
-  String visitConstructorDefinition(ConstructorDefinition node) {
-    String name = node.element.name;
-    if (name != '') name = '$name ';
-    String thisParameter = formatThisParameter(node.thisParameter);
-    String parameters = node.parameters.map(visit).join(' ');
-    if (node.body != null) {
-      String initializers = indentBlock(() {
-        return indentBlock(() {
-          if (node.initializers.isEmpty) {
-            return '$indentation';
-          } else {
-            return node.initializers.map(visit).join('\n');
-          }
-        });
-      });
-      String body = visit(node.body);
-      return '$indentation'
-          '(ConstructorDefinition $name$thisParameter ($parameters) return'
-          ' (\n$initializers)\n$body)';
-    } else {
-      return '$indentation'
-          '(ConstructorDefinition $name$thisParameter ($parameters) return)';
-    }
-  }
-
-  String visitFieldInitializer(FieldInitializer node) {
-    String name = node.element.name;
-    String body = visit(node.body);
-    return '$indentation(FieldInitializer $name\n$body)';
-  }
-
-  String visitSuperInitializer(SuperInitializer node) {
-    String target = node.target.name;
-    String selector = node.selector.name;
-    String arguments =
-        indentBlock(() =>
-          indentBlock(() => node.arguments.map(visit).join('\n')));
-    return '$indentation(SuperInitializer $target $selector (\n$arguments)';
-  }
-
-  String visitBody(Body node) {
-    namer.setReturnContinuation(node.returnContinuation);
-    return indentBlock(() => visit(node.body));
-  }
-
   String visitLetPrim(LetPrim node) {
     String name = newValueName(node.primitive);
     String value = visit(node.primitive);
@@ -263,10 +208,6 @@
     return '(Constant $value)';
   }
 
-  String visitReifyTypeVar(ReifyTypeVar node) {
-    return '$indentation(ReifyTypeVar ${node.typeVariable.name})';
-  }
-
   String visitCreateFunction(CreateFunction node) {
     String function =
         indentBlock(() => indentBlock(() => visit(node.definition)));
@@ -309,15 +250,6 @@
     return '(LiteralMap ($keys) ($values))';
   }
 
-  String visitDeclareFunction(DeclareFunction node) {
-    String name = visit(node.variable);
-    String function = indentBlock(() => visit(node.definition));
-    String body = indentBlock(() => visit(node.body));
-    return '$indentation(DeclareFunction $name =\n'
-           '$function in\n'
-           '$body)';
-  }
-
   String visitIsTrue(IsTrue node) {
     String value = access(node.value);
     return '(IsTrue $value)';
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart
index 77b757f..74d973e 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart
@@ -5,7 +5,6 @@
 library dart2js.ir_tracer;
 
 import 'dart:async' show EventSink;
-
 import 'cps_ir_nodes.dart' as cps_ir hide Function;
 import '../tracer.dart';
 
@@ -21,8 +20,7 @@
 
   visit(cps_ir.Node node) => node.accept(this);
 
-  void traceGraph(String name, cps_ir.RootNode node) {
-    if (node.isEmpty) return; // Don't bother printing an empty trace.
+  void traceGraph(String name, cps_ir.FunctionDefinition node) {
     tag("cfg", () {
       printProperty("name", name);
 
@@ -43,30 +41,10 @@
   // Temporary field used during tree walk
   Names names;
 
-  visitFieldDefinition(cps_ir.FieldDefinition node) {
-    unexpectedNode(node);
-  }
-
   visitFunctionDefinition(cps_ir.FunctionDefinition node) {
     unexpectedNode(node);
   }
 
-  visitConstructorDefinition(cps_ir.ConstructorDefinition node) {
-    unexpectedNode(node);
-  }
-
-  visitFieldInitializer(cps_ir.FieldInitializer node) {
-    unexpectedNode(node);
-  }
-
-  visitSuperInitializer(cps_ir.SuperInitializer node) {
-    unexpectedNode(node);
-  }
-
-  visitBody(cps_ir.Body node) {
-    unexpectedNode(node);
-  }
-
   // Bodies and initializers are not visited.  They contain continuations which
   // are found by a BlockCollector, then those continuations are processed by
   // this visitor.
@@ -264,13 +242,6 @@
     visit(node.body);
   }
 
-  visitDeclareFunction(cps_ir.DeclareFunction node) {
-    String dummy = names.name(node);
-    String variable = names.name(node.variable);
-    printStmt(dummy, 'DeclareFunction $variable');
-    visit(node.body);
-  }
-
   String formatReference(cps_ir.Reference ref) {
     cps_ir.Definition target = ref.definition;
     if (target is cps_ir.Continuation && target.isReturnContinuation) {
@@ -358,10 +329,6 @@
     return "Interceptor(${formatReference(node.input)})";
   }
 
-  visitReifyTypeVar(cps_ir.ReifyTypeVar node) {
-    return "ReifyTypeVar ${node.typeVariable.name}";
-  }
-
   visitCreateFunction(cps_ir.CreateFunction node) {
     return "CreateFunction ${node.definition.element.name}";
   }
@@ -469,33 +436,12 @@
 
   visit(cps_ir.Node node) => node.accept(this);
 
-  visitFieldDefinition(cps_ir.FieldDefinition node) {
-    visit(node.body);
-  }
-
   visitFunctionDefinition(cps_ir.FunctionDefinition node) {
-    visit(node.body);
-  }
-
-  visitConstructorDefinition(cps_ir.ConstructorDefinition node) {
-    node.initializers.forEach(visit);
-    visit(node.body);
-  }
-
-  visitBody(cps_ir.Body node) {
     currentBlock = new Block(names.name(node), [], node.body);
     entries.add(currentBlock);
     visit(node.body);
   }
 
-  visitFieldInitializer(cps_ir.FieldInitializer node) {
-    visit(node.body);
-  }
-
-  visitSuperInitializer(cps_ir.SuperInitializer node) {
-    node.arguments.forEach(visit);
-  }
-
   visitLetPrim(cps_ir.LetPrim exp) {
     visit(exp.body);
   }
@@ -567,10 +513,6 @@
     addEdgeToContinuation(exp.continuation);
   }
 
-  visitDeclareFunction(cps_ir.DeclareFunction exp) {
-    visit(exp.body);
-  }
-
   visitBranch(cps_ir.Branch exp) {
     cps_ir.Continuation trueTarget = exp.trueContinuation.definition;
     if (!trueTarget.isReturnContinuation) {
@@ -608,9 +550,6 @@
   visitConstant(cps_ir.Constant node) {
     unexpectedNode(node);
   }
-  visitReifyTypeVar(cps_ir.ReifyTypeVar node) {
-    unexpectedNode(node);
-  }
   visitCreateFunction(cps_ir.CreateFunction node) {
     unexpectedNode(node);
   }
diff --git a/pkg/compiler/lib/src/cps_ir/optimizers.dart b/pkg/compiler/lib/src/cps_ir/optimizers.dart
index 8fd3f50..f1007c6 100644
--- a/pkg/compiler/lib/src/cps_ir/optimizers.dart
+++ b/pkg/compiler/lib/src/cps_ir/optimizers.dart
@@ -8,15 +8,13 @@
 
 export 'type_propagation.dart' show TypePropagator, TypeSystem,
                                     UnitTypeSystem, TypeMaskSystem;
-
-part 'redundant_phi.dart';
-part 'shrinking_reductions.dart';
-
+export 'redundant_phi.dart' show RedundantPhiEliminator;
+export 'shrinking_reductions.dart' show ShrinkingReducer, ParentVisitor;
 
 /// An optimization pass over the CPS IR.
 abstract class Pass {
   /// Applies optimizations to root, rewriting it in the process.
-  void rewrite(RootNode root);
+  void rewrite(FunctionDefinition root);
 
   String get passName;
 }
diff --git a/pkg/compiler/lib/src/cps_ir/redundant_phi.dart b/pkg/compiler/lib/src/cps_ir/redundant_phi.dart
index 0fe59ba..1f40c03 100644
--- a/pkg/compiler/lib/src/cps_ir/redundant_phi.dart
+++ b/pkg/compiler/lib/src/cps_ir/redundant_phi.dart
@@ -2,7 +2,10 @@
 // for 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.cps_ir.optimizers;
+library dart2js.cps_ir.redundant_phi_elimination;
+
+import 'cps_ir_nodes.dart';
+import 'optimizers.dart';
 
 /// Eliminate redundant phis from the given [FunctionDefinition].
 ///
@@ -18,9 +21,7 @@
   final Set<Continuation> workSet = new Set<Continuation>();
 
   @override
-  void rewrite(RootNode root) {
-    if (root.isEmpty) return;
-
+  void rewrite(FunctionDefinition root) {
     // Set all parent pointers.
     new ParentVisitor().visit(root);
 
diff --git a/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart b/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart
index 5a9fe92..ea14f3c 100644
--- a/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart
+++ b/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart
@@ -2,7 +2,10 @@
 // for 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.cps_ir.optimizers;
+library dart2js.cps_ir.shrinking_reductions;
+
+import 'cps_ir_nodes.dart';
+import 'optimizers.dart';
 
 /**
  * [ShrinkingReducer] applies shrinking reductions to CPS terms as described
@@ -17,9 +20,7 @@
 
   /// Applies shrinking reductions to root, mutating root in the process.
   @override
-  void rewrite(RootNode root) {
-    if (root.isEmpty) return;
-
+  void rewrite(FunctionDefinition root) {
     _worklist = new Set<_ReductionTask>();
     _RedexVisitor redexVisitor = new _RedexVisitor(_worklist);
 
@@ -494,33 +495,10 @@
       parameter.parent = node;
       if (parameter is Parameter) parameter.parentIndex = index++;
     });
-  }
-
-  processBody(Body node) {
     node.returnContinuation.parent = node;
     node.body.parent = node;
   }
 
-  processConstructorDefinition(ConstructorDefinition node) {
-    node.body.parent = node;
-    int index = 0;
-    node.parameters.forEach((Definition parameter) {
-      parameter.parent = node;
-      if (parameter is Parameter) parameter.parentIndex = index++;
-    });
-    node.initializers.forEach((Initializer i) => i.parent = node);
-  }
-
-  // Expressions.
-
-  processFieldInitializer(FieldInitializer node) {
-    node.body.parent = node;
-  }
-
-  processSuperInitializer(SuperInitializer node) {
-    node.arguments.forEach((Body argument) => argument.parent = node);
-  }
-
   processLetPrim(LetPrim node) {
     node.primitive.parent = node;
     node.body.parent = node;
@@ -596,12 +574,6 @@
     node.value.parent = node;
   }
 
-  processDeclareFunction(DeclareFunction node) {
-    node.variable.parent = node;
-    node.definition.parent = node;
-    node.body.parent = node;
-  }
-
   processThrow(Throw node) {
     node.value.parent = node;
   }
@@ -610,8 +582,6 @@
     node.continuation.parent = node;
   }
 
-  // Definitions.
-
   processLiteralList(LiteralList node) {
     node.values.forEach((Reference ref) => ref.parent = node);
   }
@@ -636,14 +606,10 @@
     });
   }
 
-  // Conditions.
-
   processIsTrue(IsTrue node) {
     node.value.parent = node;
   }
 
-  // JavaScript specific nodes.
-
   processIdentical(Identical node) {
     node.left.parent = node;
     node.right.parent = node;
diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
index 842d460..87f9abe 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -134,9 +134,7 @@
       : _types = <Node, _AbstractValue>{};
 
   @override
-  void rewrite(RootNode root) {
-    if (root.isEmpty) return;
-
+  void rewrite(FunctionDefinition root) {
     // Set all parent pointers.
     new ParentVisitor().visit(root);
 
@@ -178,7 +176,7 @@
                        this.internalError,
                        this.typeSystem);
 
-  void transform(RootNode root) {
+  void transform(FunctionDefinition root) {
     visit(root);
   }
 
@@ -384,7 +382,7 @@
                           this._dartTypes)
       : this.typeSystem = typeSystem;
 
-  void analyze(RootNode root) {
+  void analyze(FunctionDefinition root) {
     reachableNodes.clear();
     defWorkset.clear();
     nodeWorklist.clear();
@@ -453,10 +451,6 @@
   // -------------------------- Visitor overrides ------------------------------
   void visit(Node node) { node.accept(this); }
 
-  void visitFieldDefinition(FieldDefinition node) {
-    setReachable(node.body);
-  }
-
   void visitFunctionDefinition(FunctionDefinition node) {
     if (node.thisParameter != null) {
       setValue(node.thisParameter, nonConstant());
@@ -465,26 +459,6 @@
     setReachable(node.body);
   }
 
-  void visitConstructorDefinition(ConstructorDefinition node) {
-    node.parameters.forEach(visit);
-    node.initializers.forEach(visit);
-    setReachable(node.body);
-  }
-
-  void visitBody(Body node) {
-    setReachable(node.body);
-  }
-
-  void visitFieldInitializer(FieldInitializer node) {
-    setReachable(node.body);
-  }
-
-  void visitSuperInitializer(SuperInitializer node) {
-    node.arguments.forEach(setReachable);
-  }
-
-  // Expressions.
-
   void visitLetPrim(LetPrim node) {
     visit(node.primitive); // No reason to delay visits to primitives.
     setReachable(node.body);
@@ -747,12 +721,6 @@
     setReachable(node.body);
   }
 
-  void visitDeclareFunction(DeclareFunction node) {
-    setReachable(node.definition);
-    setReachable(node.body);
-  }
-
-  // Definitions.
   void visitLiteralList(LiteralList node) {
     // Constant lists are translated into (Constant ListConstant(...)) IR nodes,
     // and thus LiteralList nodes are NonConst.
@@ -770,10 +738,6 @@
     setValue(node, constantValue(value, typeSystem.typeOf(value)));
   }
 
-  void visitReifyTypeVar(ReifyTypeVar node) {
-    setValue(node, nonConstant(typeSystem.typeType));
-  }
-
   void visitCreateFunction(CreateFunction node) {
     setReachable(node.definition);
     ConstantValue constant =
@@ -787,8 +751,8 @@
 
   void visitMutableVariable(MutableVariable node) {
     // [MutableVariable]s are bound either as parameters to
-    // [FunctionDefinition]s, by [LetMutable], or by [DeclareFunction].
-    if (node.parent is RootNode) {
+    // [FunctionDefinition]s, by [LetMutable].
+    if (node.parent is FunctionDefinition) {
       // Just like immutable parameters, the values of mutable parameters are
       // never constant.
       // TODO(karlklose): remove reference to the element model.
@@ -797,9 +761,8 @@
           ? typeSystem.getParameterType(source)
           : typeSystem.dynamicType;
       setValue(node, nonConstant(type));
-    } else if (node.parent is LetMutable || node.parent is DeclareFunction) {
-      // Mutable values bound by LetMutable or DeclareFunction could have
-      // known values.
+    } else if (node.parent is LetMutable) {
+      // Mutable values bound by LetMutable could have known values.
     } else {
       internalError(node.hint, "Unexpected parent of MutableVariable");
     }
@@ -811,7 +774,7 @@
     T type = (source is ParameterElement)
         ? typeSystem.getParameterType(source)
         : typeSystem.dynamicType;
-    if (node.parent is RootNode) {
+    if (node.parent is FunctionDefinition) {
       // Functions may escape and thus their parameters must be non-constant.
       setValue(node, nonConstant(type));
     } else if (node.parent is Continuation) {
@@ -847,15 +810,11 @@
     setValue(returnValue, nonConstant());
   }
 
-  // Conditions.
-
   void visitIsTrue(IsTrue node) {
     Branch branch = node.parent;
     visitBranch(branch);
   }
 
-  // JavaScript specific nodes.
-
   void visitIdentical(Identical node) {
     _AbstractValue<T> leftConst = getValue(node.left.definition);
     _AbstractValue<T> rightConst = getValue(node.right.definition);
@@ -880,6 +839,10 @@
 
   void visitInterceptor(Interceptor node) {
     setReachable(node.input.definition);
+    _AbstractValue<T> value = getValue(node.input.definition);
+    if (!value.isNothing) {
+      setValue(node, nonConstant());
+    }
   }
 
   void visitGetField(GetField node) {
diff --git a/pkg/compiler/lib/src/dart_backend/backend.dart b/pkg/compiler/lib/src/dart_backend/backend.dart
index 90ae82e..78aaeba 100644
--- a/pkg/compiler/lib/src/dart_backend/backend.dart
+++ b/pkg/compiler/lib/src/dart_backend/backend.dart
@@ -129,75 +129,7 @@
     world.registerInvocation(new Selector.call("compareTo", null, 1));
   }
 
-  void codegen(CodegenWorkItem work) { }
-
-  static bool checkTreeIntegrity(tree_ir.RootNode node) {
-    new CheckTreeIntegrity().check(node);
-    return true; // So this can be used from assert().
-  }
-
-  static bool checkCpsIntegrity(cps_ir.RootNode node) {
-    new CheckCpsIntegrity().check(node);
-    return true; // So this can be used from assert().
-  }
-
-  /// Create an [ElementAst] from the CPS IR.
-  static ElementAst createElementAst(
-       ElementAstCreationContext context,
-       Element element,
-       cps_ir.RootNode cpsRoot) {
-    context.traceCompilation(element.name);
-    context.traceGraph('CPS builder', cpsRoot);
-    assert(checkCpsIntegrity(cpsRoot));
-
-    // Transformations on the CPS IR.
-    void applyCpsPass(cps_opt.Pass pass) {
-      pass.rewrite(cpsRoot);
-      context.traceGraph(pass.passName, cpsRoot);
-      assert(checkCpsIntegrity(cpsRoot));
-    }
-
-    // TODO(karlklose): enable type propagation for dart2dart when constant
-    // types are correctly marked as instantiated (Issue 21880).
-    TypePropagator typePropagator = new TypePropagator(
-        context.dartTypes,
-        context.constantSystem,
-        new UnitTypeSystem(),
-        context.internalError);
-    applyCpsPass(typePropagator);
-    applyCpsPass(new RedundantPhiEliminator());
-    applyCpsPass(new ShrinkingReducer());
-
-    tree_builder.Builder builder =
-        new tree_builder.Builder(context.internalError);
-    tree_ir.RootNode treeRoot = builder.build(cpsRoot);
-    assert(treeRoot != null);
-    context.traceGraph('Tree builder', treeRoot);
-    assert(checkTreeIntegrity(treeRoot));
-
-    // Transformations on the Tree IR.
-    void applyTreePass(tree_opt.Pass pass) {
-      pass.rewrite(treeRoot);
-      context.traceGraph(pass.passName, treeRoot);
-      assert(checkTreeIntegrity(treeRoot));
-    }
-
-    applyTreePass(new StatementRewriter(isDartMode: true));
-    applyTreePass(new VariableMerger());
-    applyTreePass(new LoopRewriter());
-    applyTreePass(new LogicalRewriter());
-    applyTreePass(new PullIntoInitializers());
-
-    // Backend-specific transformations.
-    new backend_ast_emitter.UnshadowParameters().unshadow(treeRoot);
-    context.traceGraph('Unshadow parameters', treeRoot);
-
-    TreeElementMapping treeElements = new TreeElementMapping(element);
-    backend_ast.RootNode backendAst = backend_ast_emitter.emit(treeRoot);
-    Node frontend_ast = backend2frontend.emit(treeElements, backendAst);
-    return new ElementAst(frontend_ast, treeElements);
-
-  }
+  WorldImpact codegen(CodegenWorkItem work) => const WorldImpact();
 
   /**
    * Tells whether we should output given element. Corelib classes like
@@ -216,13 +148,8 @@
         new _ElementAstCreationContext(compiler, constantSystem);
 
     ElementAst computeElementAst(AstElement element) {
-      if (!compiler.irBuilder.hasIr(element)) {
-        return new ElementAst(element.resolvedAst.node,
-                              element.resolvedAst.elements);
-      } else {
-        cps_ir.RootNode irNode = compiler.irBuilder.getIr(element);
-        return createElementAst(context, element, irNode);
-      }
+      return new ElementAst(element.resolvedAst.node,
+                            element.resolvedAst.elements);
     }
 
     // TODO(johnniwinther): Remove the need for this method.
@@ -542,9 +469,6 @@
   DartTypes get dartTypes;
   ConstantSystem get constantSystem;
   InternalErrorFunction get internalError;
-
-  void traceCompilation(String name);
-  void traceGraph(String title, var irObject);
 }
 
 class _ElementAstCreationContext implements ElementAstCreationContext {
@@ -553,14 +477,6 @@
 
   _ElementAstCreationContext(this.compiler, this.constantSystem);
 
-  void traceCompilation(String name) {
-    compiler.tracer.traceCompilation(name, null);
-  }
-
-  void traceGraph(String title, var irObject) {
-    compiler.tracer.traceGraph(title, irObject);
-  }
-
   DartTypes get dartTypes => compiler.types;
 
   InternalErrorFunction get internalError => compiler.internalError;
diff --git a/pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart b/pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart
index 5726341..10b056d 100644
--- a/pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart
+++ b/pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart
@@ -4,1024 +4,9 @@
 
 library backend_ast_emitter;
 
-import '../tree_ir/tree_ir_nodes.dart' as tree;
 import 'backend_ast_nodes.dart';
-import '../constants/expressions.dart';
-import '../constants/values.dart';
 import '../dart_types.dart';
 import '../elements/elements.dart';
-import '../elements/modelx.dart' as modelx;
-import '../universe/universe.dart';
-import '../tree/tree.dart' as tree show Modifiers;
-
-/// Translates the dart_tree IR to Dart backend AST.
-RootNode emit(tree.RootNode root) {
-  return new ASTEmitter().emit(root);
-}
-
-// TODO(johnniwinther): Split into function/block state.
-class BuilderContext<T> {
-  /// Builder context for the enclosing function, or null if the current
-  /// function is not a local function.
-  BuilderContext<T> _parent;
-
-  /// Variables to be hoisted at the top of the current function.
-  final List<VariableDeclaration> variables = <VariableDeclaration>[];
-
-  /// Maps variables to their name.
-  final Map<tree.Variable, String> variableNames;
-
-  /// Maps local constants to their name.
-  final Map<VariableElement, String> constantNames =
-      <VariableElement, String>{};
-
-  /// Variables that have had their declaration created.
-  final Set<tree.Variable> declaredVariables = new Set<tree.Variable>();
-
-  /// Variables that are used as catch handler parameters.
-  final Set<tree.Variable> handlerVariables = new Set<tree.Variable>();
-
-  /// Variable names that have already been used. Used to avoid name clashes.
-  final Set<String> usedVariableNames;
-
-  /// Statements emitted by the most recent call to [visitStatement].
-  List<T> _statementBuffer = <T>[];
-
-  /// The element currently being emitted.
-  ExecutableElement currentElement;
-
-  /// Bookkeeping object needed to synthesize a variable declaration.
-  final modelx.VariableList variableList
-      = new modelx.VariableList(tree.Modifiers.EMPTY);
-
-  /// Input to [visitStatement]. Denotes the statement that will execute next
-  /// if the statements produced by [visitStatement] complete normally.
-  /// Set to null if control will fall over the end of the method.
-  tree.Statement fallthrough = null;
-
-  /// Labels that could not be eliminated using fallthrough.
-  final Set<tree.Label> _usedLabels = new Set<tree.Label>();
-
-  final bool inInitializer;
-
-  /// The first dart_tree statement that is not converted to a variable
-  /// initializer.
-  tree.Statement firstStatement;
-
-  BuilderContext() : usedVariableNames = new Set<String>(),
-                     inInitializer = false,
-                     variableNames = <tree.Variable, String>{};
-
-  BuilderContext.inner(BuilderContext<T> parent)
-      : this._parent = parent,
-        usedVariableNames = parent.usedVariableNames,
-        inInitializer = false,
-        variableNames = <tree.Variable, String>{};
-
-  BuilderContext.initializer(BuilderContext<T> parent)
-      : this._parent = parent,
-        usedVariableNames = parent.usedVariableNames,
-        inInitializer = true,
-        variableNames =
-            new Map<tree.Variable, String>.from(parent.variableNames);
-
-  // TODO(johnniwinther): Fully encapsulate handling of parameter, variable
-  // and local function declarations.
-  void addDeclaration(tree.Variable variable, [Expression initializer]) {
-    assert(!declaredVariables.contains(variable));
-    String name = getVariableName(variable);
-    VariableDeclaration decl = new VariableDeclaration(name, initializer);
-    decl.element = variable.element;
-    declaredVariables.add(variable);
-    variables.add(decl);
-  }
-
-  /// Creates an [Identifier] referring to the given variable.
-  Expression makeVariableAccess(tree.Variable variable) {
-    return new Identifier(getVariableName(variable))
-               ..element = variable.element;
-  }
-
-  /// Generates a name for the given variable and synthesizes an element for it,
-  /// if necessary.
-  String getVariableName(tree.Variable variable) {
-    // If the variable belongs to an enclosing function, ask the parent emitter
-    // for the variable name.
-    if (!inInitializer && variable.host != currentElement) {
-      return _parent.getVariableName(variable);
-    }
-
-    // Get the name if we already have one.
-    String name = variableNames[variable];
-    if (name != null) {
-      return name;
-    }
-
-    // Synthesize a variable name that isn't used elsewhere.
-    // The [usedVariableNames] set is shared between nested emitters,
-    // so this also prevents clash with variables in an enclosing/inner scope.
-    // The renaming phase after codegen will further prefix local variables
-    // so they cannot clash with top-level variables or fields.
-    String prefix = variable.element == null ? 'v' : variable.element.name;
-    int counter = 0;
-    name = variable.element == null ? '$prefix$counter' : variable.element.name;
-    while (!usedVariableNames.add(name)) {
-      ++counter;
-      name = '$prefix$counter';
-    }
-    variableNames[variable] = name;
-
-    // Synthesize an element for the variable
-    if (variable.element == null || name != variable.element.name) {
-      // TODO(johnniwinther): Replace by synthetic [Entity].
-      variable.element = new _SyntheticLocalVariableElement(
-          name,
-          currentElement,
-          variableList);
-    }
-    return name;
-  }
-
-  /// Adds declarations for all variables that are still undeclared.
-  void declareRemainingVariables() {
-    // These variables can be referenced from other variable initializers if
-    // they are set by an assignment expression, so we declare variables before
-    // those with initializers.
-    List<VariableDeclaration> declarations = <VariableDeclaration>[];
-    for (tree.Variable variable in variableNames.keys) {
-      if (!declaredVariables.contains(variable)) {
-        String name = getVariableName(variable);
-        VariableDeclaration decl = new VariableDeclaration(name);
-        decl.element = variable.element;
-        declarations.add(decl);
-        declaredVariables.add(variable);
-      }
-    }
-    // Prepend all variables at once to avoid quadratic blowup.
-    variables.insertAll(0, declarations);
-  }
-
-  String getConstantName(VariableElement element) {
-    assert(element.kind == ElementKind.VARIABLE);
-    if (element.enclosingElement != currentElement) {
-      return _parent.getConstantName(element);
-    }
-    String name = constantNames[element];
-    if (name != null) {
-      return name;
-    }
-    String prefix = element.name;
-    int counter = 0;
-    name = element.name;
-    while (!usedVariableNames.add(name)) {
-      ++counter;
-      name = '$prefix$counter';
-    }
-    constantNames[element] = name;
-    return name;
-  }
-
-  List<T> inSubcontext(f(BuilderContext<T> subcontext),
-                       {tree.Statement fallthrough}) {
-    List<T> savedBuffer = this._statementBuffer;
-    tree.Statement savedFallthrough = this.fallthrough;
-    List<T> buffer = this._statementBuffer = <T>[];
-    if (fallthrough != null) {
-      this.fallthrough = fallthrough;
-    }
-    f(this);
-    this.fallthrough = savedFallthrough;
-    this._statementBuffer = savedBuffer;
-    return buffer;
-  }
-
-  /// Removes a trailing "return null" from the current block.
-  void removeTrailingReturn(bool isReturnNull(T statement)) {
-    if (_statementBuffer.isEmpty) return;
-    if (isReturnNull(_statementBuffer.last)) {
-      _statementBuffer.removeLast();
-    }
-  }
-
-  /// Register [label] as used.
-  void useLabel(tree.Label label) {
-    _usedLabels.add(label);
-  }
-
-  /// Remove [label] and return `true` if it was used.
-  bool removeUsedLabel(tree.Label label) {
-    return _usedLabels.remove(label);
-  }
-
-  /// Add [statement] to the current block.
-  void addStatement(T statement) {
-    _statementBuffer.add(statement);
-  }
-
-  /// The statements in the current block.
-  Iterable<T> get statements => _statementBuffer;
-}
-
-/// Translates the dart_tree IR to Dart backend AST.
-/// An instance of this class should only be used once; a fresh emitter
-/// must be created for each function to be emitted.
-class ASTEmitter
-  extends tree.StatementVisitor1<dynamic, BuilderContext<Statement>>
-     with tree.ExpressionVisitor1<Expression, BuilderContext<Statement>>,
-          tree.RootVisitor1<RootNode, BuilderContext<Statement>>,
-          tree.InitializerVisitor1<Initializer, BuilderContext<Statement>> {
-
-  RootNode emit(tree.RootNode node) {
-    return visitRootNode(node, new BuilderContext<Statement>());
-  }
-
-  @override
-  FieldDefinition visitFieldDefinition(tree.FieldDefinition definition,
-                                       BuilderContext<Statement> context) {
-    context.currentElement = definition.element;
-    Expression initializer;
-    if (!definition.isEmpty) {
-      visitStatement(definition.body, context);
-      List<Statement> bodyParts;
-      for (tree.Variable variable in context.variableNames.keys) {
-        if (!context.declaredVariables.contains(variable)) {
-          context.addDeclaration(variable);
-        }
-      }
-      if (context.variables.length > 0) {
-        bodyParts = new List<Statement>();
-        bodyParts.add(new VariableDeclarations(context.variables));
-        bodyParts.addAll(context.statements);
-      } else {
-        bodyParts = context.statements;
-      }
-      initializer = ensureExpression(bodyParts);
-    }
-
-    return new FieldDefinition(definition.element, initializer);
-  }
-
-  /// Returns an expression that will evaluate all of [bodyParts].
-  /// If [bodyParts] is a single [Return] return its value.
-  /// Otherwise wrap the body-parts in an immediately invoked closure.
-  Expression ensureExpression(List<Statement> bodyParts) {
-    if (bodyParts.length == 1) {
-      Statement onlyStatement = bodyParts.single;
-      if (onlyStatement is Return) {
-        return onlyStatement.expression;
-      }
-    }
-    Statement body = new Block(bodyParts);
-    FunctionExpression function =
-        new FunctionExpression(new Parameters([]), body);
-    function.element = null;
-    return new CallFunction(function, []);
-  }
-
-  bool _recognizeTrailingReturn(Statement statement) {
-    if (statement is Return) {
-      Expression expr = statement.expression;
-      if (expr == null || expr is Literal && expr.value.isNull) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  @override
-  FunctionExpression visitConstructorDefinition(
-        tree.ConstructorDefinition definition,
-        BuilderContext<Statement> context) {
-    context.currentElement = definition.element;
-
-    Parameters parameters = emitRootParameters(
-        definition, definition.defaultParameterValues, context);
-
-    // Declare parameters.
-    for (tree.Variable param in definition.parameters) {
-      context.variableNames[param] = param.element.name;
-      context.usedVariableNames.add(param.element.name);
-      context.declaredVariables.add(param);
-    }
-
-    List<Initializer> initializers;
-    Statement body;
-
-    if (!definition.isEmpty) {
-      initializers =
-          definition.initializers.map((tree.Initializer initializer) {
-        return visitInitializer(initializer, context);
-      }).toList();
-
-      context.firstStatement = definition.body;
-      visitStatement(definition.body, context);
-      context.removeTrailingReturn(_recognizeTrailingReturn);
-
-      // Some of the variable declarations have already been added
-      // if their first assignment could be pulled into the initializer.
-      // Add the remaining variable declarations now.
-      context.declareRemainingVariables();
-
-      // Add constant declarations.
-      List<VariableDeclaration> constants = <VariableDeclaration>[];
-      for (ConstDeclaration constDecl in definition.localConstants) {
-        if (!context.constantNames.containsKey(constDecl.element)) {
-          continue; // Discard unused constants declarations.
-        }
-        String name = context.getConstantName(constDecl.element);
-        Expression value =
-            ConstantEmitter.createExpression(constDecl.expression, context);
-        VariableDeclaration decl = new VariableDeclaration(name, value);
-        decl.element = constDecl.element;
-        constants.add(decl);
-      }
-
-      List<Statement> bodyParts = [];
-      if (constants.length > 0) {
-        bodyParts.add(new VariableDeclarations(constants, isConst: true));
-      }
-      if (context.variables.length > 0) {
-        bodyParts.add(new VariableDeclarations(context.variables));
-      }
-      bodyParts.addAll(context.statements);
-      body = new Block(bodyParts);
-    }
-    return new ConstructorDefinition(
-        parameters,
-        body,
-        initializers,
-        context.currentElement.name,
-        definition.element.isConst)..element = context.currentElement;
-  }
-
-  @override
-  FunctionExpression visitFunctionDefinition(
-        tree.FunctionDefinition definition,
-        BuilderContext<Statement> context) {
-    context.currentElement = definition.element;
-
-    Parameters parameters = emitRootParameters(
-        definition, definition.defaultParameterValues, context);
-
-    // Declare parameters.
-    for (tree.Variable param in definition.parameters) {
-      context.variableNames[param] = param.element.name;
-      context.usedVariableNames.add(param.element.name);
-      context.declaredVariables.add(param);
-    }
-
-    Statement body;
-    if (definition.isEmpty) {
-      body = new EmptyStatement();
-    } else {
-      context.firstStatement = definition.body;
-      visitStatement(definition.body, context);
-      context.removeTrailingReturn(_recognizeTrailingReturn);
-
-      // Some of the variable declarations have already been added
-      // if their first assignment could be pulled into the initializer.
-      // Add the remaining variable declarations now.
-      context.declareRemainingVariables();
-
-      // Add constant declarations.
-      List<VariableDeclaration> constants = <VariableDeclaration>[];
-      for (ConstDeclaration constDecl in definition.localConstants) {
-        if (!context.constantNames.containsKey(constDecl.element)) {
-          continue; // Discard unused constants declarations.
-        }
-        String name = context.getConstantName(constDecl.element);
-        Expression value =
-            ConstantEmitter.createExpression(constDecl.expression, context);
-        VariableDeclaration decl = new VariableDeclaration(name, value);
-        decl.element = constDecl.element;
-        constants.add(decl);
-      }
-
-      List<Statement> bodyParts = [];
-      if (constants.length > 0) {
-        bodyParts.add(new VariableDeclarations(constants, isConst: true));
-      }
-      if (context.variables.length > 0) {
-        bodyParts.add(new VariableDeclarations(context.variables));
-      }
-      bodyParts.addAll(context.statements);
-
-      body = new Block(bodyParts);
-    }
-    FunctionType functionType = context.currentElement.type;
-
-    return new FunctionExpression(
-        parameters,
-        body,
-        name: context.currentElement.name,
-        returnType: TypeGenerator.createOptionalType(functionType.returnType),
-        isGetter: context.currentElement.isGetter,
-        isSetter: context.currentElement.isSetter)
-        ..element = context.currentElement;
-  }
-
-  /// Emits parameters that are not nested inside other parameters.
-  /// Root parameters can have default values, while inner parameters cannot.
-  Parameters emitRootParameters(tree.RootNode function,
-                                List<ConstantExpression> defaults,
-                                BuilderContext<Statement> context) {
-    FunctionType functionType = function.element.type;
-    List<Parameter> required = TypeGenerator.createParameters(
-        functionType.parameterTypes,
-        context: context,
-        elements: function.parameters.map((p) => p.element));
-    bool optionalParametersAreNamed = !functionType.namedParameters.isEmpty;
-    List<Parameter> optional = TypeGenerator.createParameters(
-        optionalParametersAreNamed
-            ? functionType.namedParameterTypes
-            : functionType.optionalParameterTypes,
-        context: context,
-        defaultValues: defaults,
-        elements: function.parameters.skip(required.length)
-            .map((p) => p.element));
-    return new Parameters(required, optional, optionalParametersAreNamed);
-  }
-
-  /// True if the two expressions are a reference to the same variable.
-  bool isSameVariable(Receiver e1, Receiver e2) {
-    return e1 is Identifier &&
-           e2 is Identifier &&
-           e1.element is VariableElement &&
-           e1.element == e2.element;
-  }
-
-  Expression makeAssignment(Expression target, Expression value) {
-    // Try to print as compound assignment or increment
-    if (value is BinaryOperator && isCompoundableOperator(value.operator)) {
-      Receiver leftOperand = value.left;
-      Expression rightOperand = value.right;
-      bool valid = false;
-      if (isSameVariable(target, leftOperand)) {
-        valid = true;
-      } else if (target is FieldExpression &&
-                 leftOperand is FieldExpression &&
-                 isSameVariable(target.object, leftOperand.object) &&
-                 target.fieldName == leftOperand.fieldName) {
-        valid = true;
-      } else if (target is IndexExpression &&
-                 leftOperand is IndexExpression &&
-                 isSameVariable(target.object, leftOperand.object) &&
-                 isSameVariable(target.index, leftOperand.index)) {
-        valid = true;
-      }
-      if (valid) {
-        if (rightOperand is Literal && rightOperand.value.isOne &&
-            (value.operator == '+' || value.operator == '-')) {
-          return new Increment.prefix(target, value.operator + value.operator);
-        } else {
-          return new Assignment(target, value.operator + '=', rightOperand);
-        }
-      }
-    }
-    // Fall back to regular assignment
-    return new Assignment(target, '=', value);
-  }
-
-  Block visitInSubContext(tree.Statement statement,
-                          BuilderContext<Statement> context,
-                          {tree.Statement fallthrough}) {
-    return new Block(context.inSubcontext(
-        (BuilderContext<Statement> subcontext) {
-      visitStatement(statement, subcontext);
-    }, fallthrough: fallthrough));
-  }
-
-  void addLabeledStatement(tree.Label label,
-                           Statement statement,
-                           BuilderContext<Statement> context) {
-    if (context.removeUsedLabel(label)) {
-      context.addStatement(new LabeledStatement(label.name, statement));
-    } else {
-      context.addStatement(statement);
-    }
-  }
-
-  @override
-  void visitExpressionStatement(tree.ExpressionStatement stmt,
-                                BuilderContext<Statement> context) {
-    if (stmt.expression is tree.Assign) {
-      emitAssignStatement(stmt.expression, stmt, context);
-      return;
-    }
-    Expression e = visitExpression(stmt.expression, context);
-    context.addStatement(new ExpressionStatement(e));
-    visitStatement(stmt.next, context);
-  }
-
-  @override
-  void visitVariableDeclaration(tree.VariableDeclaration node,
-                                BuilderContext<Statement> context) {
-    Expression value = visitExpression(node.value, context);
-    String name = context.getVariableName(node.variable);
-    VariableDeclaration decl = new VariableDeclaration(name, value)
-                                   ..element = node.variable.element;
-    context.declaredVariables.add(node.variable);
-    context.addStatement(new VariableDeclarations([decl]));
-    visitStatement(node.next, context);
-  }
-
-  @override
-  void visitLabeledStatement(tree.LabeledStatement stmt,
-                             BuilderContext<Statement> context) {
-    Block block = visitInSubContext(stmt.body, context, fallthrough: stmt.next);
-    addLabeledStatement(stmt.label, block, context);
-
-    visitStatement(stmt.next, context);
-  }
-
-  bool isNullLiteral(Expression exp) => exp is Literal && exp.value.isNull;
-
-  void emitAssignStatement(tree.Assign assign,
-                           tree.Statement statement,
-                           BuilderContext<Statement> context) {
-    // Try to emit a local function declaration. This is useful for functions
-    // that may occur in expression context, but could not be inlined anywhere.
-    if (assign.variable.element is FunctionElement &&
-        assign.value is tree.FunctionExpression &&
-        !context.declaredVariables.contains(assign.variable) &&
-        assign.variable.writeCount == 1) {
-      tree.FunctionExpression functionExp = assign.value;
-      FunctionExpression function =
-          makeSubFunction(functionExp.definition, context);
-      FunctionDeclaration decl = new FunctionDeclaration(function);
-      context.addStatement(decl);
-      context.declaredVariables.add(assign.variable);
-
-      visitStatement(statement.next, context);
-      return;
-    }
-
-    Expression definition = visitExpression(assign.value, context);
-    bool isFirstOccurrence = (context.variableNames[assign.variable] == null);
-    bool isDeclaredHere = assign.variable.host == context.currentElement;
-    bool isFirstStatement = context.firstStatement == statement;
-
-    // Try to pull into initializer.
-    if (isFirstStatement && isFirstOccurrence && isDeclaredHere) {
-      if (isNullLiteral(definition)) definition = null;
-      context.addDeclaration(assign.variable, definition);
-      context.firstStatement = statement.next;
-      visitStatement(statement.next, context);
-      return;
-    }
-
-    context.addStatement(new ExpressionStatement(makeAssignment(
-        context.makeVariableAccess(assign.variable),
-        definition)));
-    visitStatement(statement.next, context);
-  }
-
-  @override
-  void visitReturn(tree.Return stmt, BuilderContext<Statement> context) {
-    if (context.currentElement.isGenerativeConstructor &&
-        !context.inInitializer) {
-      assert(() {
-        tree.Expression value = stmt.value;
-        return value is tree.Constant && value.value.isNull;
-      });
-      context.addStatement(new Return(null));
-    } else {
-      Expression inner = visitExpression(stmt.value, context);
-      context.addStatement(new Return(inner));
-    }
-  }
-
-  @override
-  void visitThrow(tree.Throw stmt, BuilderContext<Statement> context) {
-    Expression value = visitExpression(stmt.value, context);
-    context.addStatement(new ExpressionStatement(new Throw(value)));
-  }
-
-  @override
-  void visitRethrow(tree.Rethrow stmt, BuilderContext<Statement> context) {
-    context.addStatement(new Rethrow());
-  }
-
-  @override
-  void visitBreak(tree.Break stmt, BuilderContext<Statement> context) {
-    tree.Statement fall = context.fallthrough;
-    if (stmt.target.binding.next == fall) {
-      // Fall through to break target
-    } else if (fall is tree.Break && fall.target == stmt.target) {
-      // Fall through to equivalent break
-    } else {
-      context.useLabel(stmt.target);
-      context.addStatement(new Break(stmt.target.name));
-    }
-  }
-
-  @override
-  void visitContinue(tree.Continue stmt,
-                     BuilderContext<Statement> context) {
-    tree.Statement fall = context.fallthrough;
-    if (stmt.target.binding == fall) {
-      // Fall through to continue target
-    } else if (fall is tree.Continue && fall.target == stmt.target) {
-      // Fall through to equivalent continue
-    } else {
-      context.useLabel(stmt.target);
-      context.addStatement(new Continue(stmt.target.name));
-    }
-  }
-
-  @override
-  void visitIf(tree.If stmt,
-               BuilderContext<Statement> context) {
-    Expression condition = visitExpression(stmt.condition, context);
-    Block thenBlock = visitInSubContext(stmt.thenStatement, context);
-    Block elseBlock= visitInSubContext(stmt.elseStatement, context);
-    context.addStatement(new If(condition, thenBlock, elseBlock));
-  }
-
-  @override
-  void visitWhileTrue(tree.WhileTrue stmt,
-                      BuilderContext<Statement> context) {
-    Block body = visitInSubContext(stmt.body, context, fallthrough: stmt);
-    Statement statement =
-        new While(new Literal(new TrueConstantValue()), body);
-    addLabeledStatement(stmt.label, statement, context);
-  }
-
-  @override
-  void visitWhileCondition(tree.WhileCondition stmt,
-                           BuilderContext<Statement> context) {
-    Expression condition = visitExpression(stmt.condition, context);
-    Block body = visitInSubContext(stmt.body, context, fallthrough: stmt);
-    Statement statement = new While(condition, body);
-    addLabeledStatement(stmt.label, statement, context);
-
-    visitStatement(stmt.next, context);
-  }
-
-  @override
-  void visitTry(tree.Try stmt,
-                BuilderContext<Statement> context) {
-    Block tryBody = visitInSubContext(stmt.tryBody, context);
-    Block catchBody = visitInSubContext(stmt.catchBody, context);
-    CatchBlock catchBlock;
-    tree.Variable exceptionVariable = stmt.catchParameters[0];
-    context.handlerVariables.add(exceptionVariable);
-    VariableDeclaration exceptionParameter =
-        new VariableDeclaration(context.getVariableName(exceptionVariable));
-    exceptionParameter.element = exceptionVariable.element;
-    stmt.catchParameters.forEach(context.declaredVariables.add);
-    if (stmt.catchParameters.length == 2) {
-      tree.Variable stackTraceVariable = stmt.catchParameters[1];
-      context.handlerVariables.add(stackTraceVariable);
-      VariableDeclaration stackTraceParameter =
-          new VariableDeclaration(context.getVariableName(stackTraceVariable));
-      stackTraceParameter.element = stackTraceVariable.element;
-      catchBlock = new CatchBlock(catchBody,
-          exceptionVar: exceptionParameter,
-          stackVar: stackTraceParameter);
-    } else {
-      assert(stmt.catchParameters.length == 1);
-      catchBlock = new CatchBlock(catchBody,
-          exceptionVar: exceptionParameter);
-    }
-    context.addStatement(new Try(tryBody, <CatchBlock>[catchBlock], null));
-  }
-
-  @override
-  Expression visitConstant(tree.Constant exp,
-                           BuilderContext<Statement> context) {
-    return ConstantEmitter.createExpression(exp.expression, context);
-  }
-
-  @override
-  Expression visitThis(tree.This exp,
-                       BuilderContext<Statement> context) {
-    return new This();
-  }
-
-  @override
-  Expression visitReifyTypeVar(tree.ReifyTypeVar exp,
-                               BuilderContext<Statement> context) {
-    return new ReifyTypeVar(exp.typeVariable.name)
-               ..element = exp.typeVariable;
-  }
-
-  List<Expression> visitExpressions(List<tree.Expression> expressions,
-                                    BuilderContext<Statement> context) {
-    return expressions.map((expression) => visitExpression(expression, context))
-        .toList(growable: false);
-  }
-
-  @override
-  Expression visitLiteralList(tree.LiteralList exp,
-                              BuilderContext<Statement> context) {
-    return new LiteralList(visitExpressions(exp.values, context),
-        typeArgument:
-            TypeGenerator.createOptionalType(exp.type.typeArguments.single));
-  }
-
-  @override
-  Expression visitLiteralMap(tree.LiteralMap exp,
-                             BuilderContext<Statement> context) {
-    List<LiteralMapEntry> entries = new List<LiteralMapEntry>.generate(
-        exp.entries.length,
-        (i) => new LiteralMapEntry(
-            visitExpression(exp.entries[i].key, context),
-            visitExpression(exp.entries[i].value, context)));
-    List<TypeAnnotation> typeArguments = exp.type.treatAsRaw
-        ? null
-        : exp.type.typeArguments.map(TypeGenerator.createType)
-             .toList(growable: false);
-    return new LiteralMap(entries, typeArguments: typeArguments);
-  }
-
-  @override
-  Expression visitTypeOperator(tree.TypeOperator exp,
-                               BuilderContext<Statement> context) {
-    return new TypeOperator(visitExpression(exp.value, context),
-                            exp.operator,
-                            TypeGenerator.createType(exp.type));
-  }
-
-  List<Argument> emitArguments(List<Expression> arguments,
-                               Selector selector) {
-    int positionalArgumentCount = selector.positionalArgumentCount;
-    List<Argument> result = new List<Argument>.generate(positionalArgumentCount,
-        (i) => arguments[i]);
-    for (int i = 0; i < selector.namedArgumentCount; ++i) {
-      result.add(new NamedArgument(selector.namedArguments[i],
-          arguments[positionalArgumentCount + i]));
-    }
-    return result;
-  }
-
-  List<Expression> visitArgumentList(List<tree.Expression> arguments,
-                                     BuilderContext context) {
-    return arguments
-        .map((tree.Expression argument) => visitExpression(argument, context))
-        .toList();
-  }
-
-  @override
-  Expression visitInvokeStatic(tree.InvokeStatic exp,
-                               BuilderContext<Statement> context) {
-    switch (exp.selector.kind) {
-      case SelectorKind.GETTER:
-        return new Identifier(exp.target.name)..element = exp.target;
-
-      case SelectorKind.SETTER:
-        return new Assignment(
-            new Identifier(exp.target.name)..element = exp.target,
-            '=',
-            visitExpression(exp.arguments[0], context));
-
-      case SelectorKind.CALL:
-        return new CallStatic(
-            null, exp.target.name,
-            emitArguments(visitArgumentList(exp.arguments, context),
-                          exp.selector))
-            ..element = exp.target;
-
-      default:
-        throw "Unexpected selector kind: ${exp.selector.kind}";
-    }
-  }
-
-  Expression emitMethodCall(tree.Invoke exp, Receiver receiver,
-                            BuilderContext<Statement> context) {
-    List<Argument> args =
-        emitArguments(visitArgumentList(exp.arguments, context), exp.selector);
-    switch (exp.selector.kind) {
-      case SelectorKind.CALL:
-        if (exp.selector.name == "call") {
-          return new CallFunction(receiver, args);
-        }
-        return new CallMethod(receiver, exp.selector.name, args);
-
-      case SelectorKind.OPERATOR:
-        if (args.length == 0) {
-          String name = exp.selector.name;
-          if (name == 'unary-') {
-            name = '-';
-          }
-          return new UnaryOperator(name, receiver);
-        }
-        return new BinaryOperator(receiver, exp.selector.name, args[0]);
-
-      case SelectorKind.GETTER:
-        return new FieldExpression(receiver, exp.selector.name);
-
-      case SelectorKind.SETTER:
-        return makeAssignment(
-            new FieldExpression(receiver, exp.selector.name),
-            args[0]);
-
-      case SelectorKind.INDEX:
-        Expression e = new IndexExpression(receiver, args[0]);
-        if (args.length == 2) {
-          e = makeAssignment(e, args[1]);
-        }
-        return e;
-
-      default:
-        throw "Unexpected selector in InvokeMethod: ${exp.selector.kind}";
-    }
-  }
-
-  @override
-  Expression visitInvokeMethod(tree.InvokeMethod exp,
-                               BuilderContext<Statement> context) {
-    Expression receiver = visitExpression(exp.receiver, context);
-    return emitMethodCall(exp, receiver, context);
-  }
-
-  @override
-  Expression visitInvokeMethodDirectly(tree.InvokeMethodDirectly exp,
-                                       BuilderContext<Statement> context) {
-    // When targeting Dart, InvokeMethodDirectly is only used for super calls.
-    // The receiver is known to be `this`, and the target method is a method
-    // on the super class. So we just translate it as a method call with the
-    // super receiver.
-    return emitMethodCall(exp, new SuperReceiver(), context);
-  }
-
-  @override
-  Expression visitInvokeConstructor(tree.InvokeConstructor exp,
-                                    BuilderContext<Statement> context) {
-    List<Argument> args =
-        emitArguments(visitArgumentList(exp.arguments, context), exp.selector);
-    FunctionElement constructor = exp.target;
-    String name = constructor.name.isEmpty ? null : constructor.name;
-    return new CallNew(TypeGenerator.createType(exp.type),
-                       args,
-                       constructorName: name,
-                       isConst: exp.constant != null)
-               ..constructor = constructor
-               ..dartType = exp.type;
-  }
-
-  @override
-  Expression visitConcatenateStrings(tree.ConcatenateStrings exp,
-                                     BuilderContext<Statement> context) {
-    return new StringConcat(visitExpressions(exp.arguments, context));
-  }
-
-  @override
-  Expression visitConditional(tree.Conditional exp,
-                              BuilderContext<Statement> context) {
-    return new Conditional(
-        visitExpression(exp.condition, context),
-        visitExpression(exp.thenExpression, context),
-        visitExpression(exp.elseExpression, context));
-  }
-
-  @override
-  Expression visitLogicalOperator(tree.LogicalOperator exp,
-                                  BuilderContext<Statement> context) {
-    return new BinaryOperator(visitExpression(exp.left, context),
-                              exp.operator,
-                              visitExpression(exp.right, context));
-  }
-
-  @override
-  Expression visitNot(tree.Not exp,
-                      BuilderContext<Statement> context) {
-    return new UnaryOperator('!', visitExpression(exp.operand, context));
-  }
-
-  @override
-  Expression visitVariableUse(tree.VariableUse exp,
-                              BuilderContext<Statement> context) {
-    return context.makeVariableAccess(exp.variable);
-  }
-
-  @override
-  Expression visitAssign(tree.Assign node, BuilderContext<Statement> context) {
-    // This is called only when an assignment occurs in expression context.
-    return makeAssignment(
-        context.makeVariableAccess(node.variable),
-        visitExpression(node.value, context));
-  }
-
-  FunctionExpression makeSubFunction(tree.FunctionDefinition function,
-                                     BuilderContext<Statement> context) {
-    return visitFunctionDefinition(function,
-        new BuilderContext<Statement>.inner(context));
-  }
-
-  @override
-  Expression visitFunctionExpression(tree.FunctionExpression exp,
-                                     BuilderContext<Statement> context) {
-    return makeSubFunction(exp.definition, context)..name = null;
-  }
-
-  @override
-  void visitFunctionDeclaration(tree.FunctionDeclaration node,
-                                BuilderContext<Statement> context) {
-    assert(context.variableNames[node.variable] == null);
-    String name = context.getVariableName(node.variable);
-    FunctionExpression inner = makeSubFunction(node.definition, context);
-    inner.name = name;
-    FunctionDeclaration decl = new FunctionDeclaration(inner);
-    context.declaredVariables.add(node.variable);
-    context.addStatement(decl);
-    visitStatement(node.next, context);
-  }
-
-  List<Statement> buildInInitializerContext(tree.Statement root,
-                                            BuilderContext context) {
-    BuilderContext inner = new BuilderContext<Statement>.initializer(context);
-    inner.currentElement = context.currentElement;
-    inner.firstStatement = root;
-    visitStatement(root, inner);
-    List<Statement> bodyParts;
-    for (tree.Variable variable in inner.variableNames.keys) {
-      if (!context.declaredVariables.contains(variable) &&
-          !inner.declaredVariables.contains(variable)) {
-        inner.addDeclaration(variable);
-      }
-    }
-    if (inner.variables.length > 0) {
-      bodyParts = new List<Statement>();
-      bodyParts.add(new VariableDeclarations(inner.variables));
-      bodyParts.addAll(inner.statements);
-    } else {
-      bodyParts = inner.statements;
-    }
-    return bodyParts;
-  }
-
-  @override
-  Initializer visitFieldInitializer(tree.FieldInitializer node,
-                                   BuilderContext<Statement> context) {
-    return new FieldInitializer(node.element,
-        ensureExpression(buildInInitializerContext(node.body, context)));
-  }
-
-  @override
-  Initializer visitSuperInitializer(tree.SuperInitializer node,
-                                   BuilderContext<Statement> context) {
-    List<Argument> arguments = node.arguments.map((tree.Statement argument) {
-      return ensureExpression(buildInInitializerContext(argument, context));
-    }).toList();
-    return new SuperInitializer(node.target,
-                                emitArguments(arguments, node.selector));
-  }
-
-  @override
-  Expression visitGetStatic(tree.GetStatic node,
-                            BuilderContext<Statement> context) {
-    return new Identifier(node.element.name)..element = node.element;
-  }
-
-  @override
-  Expression visitSetStatic(tree.SetStatic node,
-                            BuilderContext<Statement> context) {
-    Expression target =
-        new Identifier(node.element.name)..element = node.element;
-    Expression value = visitExpression(node.value, context);
-    return makeAssignment(target, value);
-  }
-
-  @override
-  Expression visitTypeExpression(tree.TypeExpression node, arg) {
-    throw '$node not supported by dart backend';
-  }
-
-  @override
-  visitGetField(tree.GetField node, arg) => errorUnsupportedNode(node);
-
-  @override
-  visitSetField(tree.SetField node, arg) => errorUnsupportedNode(node);
-
-  @override
-  visitCreateBox(tree.CreateBox node, arg) => errorUnsupportedNode(node);
-
-  @override
-  visitCreateInstance(tree.CreateInstance node, arg) {
-    return errorUnsupportedNode(node);
-  }
-
-  @override
-  visitCreateInvocationMirror(tree.CreateInvocationMirror node, arg) {
-    return errorUnsupportedNode(node);
-  }
-
-  @override
-  Expression visitReadTypeVariable(tree.ReadTypeVariable node, arg) {
-    return errorUnsupportedNode(node);
-  }
-
-  @override
-  Expression visitReifyRuntimeType(tree.ReifyRuntimeType node, arg) {
-    return errorUnsupportedNode(node);
-  }
-
-  errorUnsupportedNode(tree.JsSpecificNode node) {
-    throw '$node not supported by dart backend';
-  }
-
-}
 
 class TypeGenerator {
 
@@ -1029,10 +14,8 @@
   static int pseudoNameCounter = 0;
 
   static Parameter emitParameter(DartType type,
-                                 BuilderContext<Statement> context,
                                  {String name,
-                                  Element element,
-                                  ConstantExpression defaultValue}) {
+                                  Element element}) {
     if (name == null && element != null) {
       name = element.name;
     }
@@ -1051,10 +34,6 @@
       parameter = new Parameter(name, type: typeAnnotation);
     }
     parameter.element = element;
-    if (defaultValue != null && !defaultValue.value.isNull) {
-      parameter.defaultValue =
-          ConstantEmitter.createExpression(defaultValue, context);
-    }
     return parameter;
   }
 
@@ -1076,20 +55,15 @@
 
   static List<Parameter> createParameters(
       Iterable<DartType> parameterTypes,
-      {BuilderContext<Statement> context,
-       Iterable<String> names: const <String>[],
-       Iterable<ConstantExpression> defaultValues: const <ConstantExpression>[],
+      {Iterable<String> names: const <String>[],
        Iterable<Element> elements: const <Element>[]}) {
     Iterator<String> name = names.iterator;
-    Iterator<ConstantExpression> defaultValue = defaultValues.iterator;
     Iterator<Element> element = elements.iterator;
     return parameterTypes.map((DartType type) {
       name.moveNext();
-      defaultValue.moveNext();
       element.moveNext();
-      return emitParameter(type, context,
+      return emitParameter(type,
                            name: name.current,
-                           defaultValue: defaultValue.current,
                            element: element.current);
     }).toList();
   }
@@ -1129,323 +103,4 @@
       throw "Unsupported type annotation: $type";
     }
   }
-
-}
-
-
-class ConstantEmitter
-    extends ConstantExpressionVisitor<Expression, BuilderContext<Statement>> {
-  const ConstantEmitter();
-
-  /// Creates the [Expression] for the constant [exp].
-  static Expression createExpression(ConstantExpression exp,
-                                     BuilderContext<Statement> context) {
-    return const ConstantEmitter().visit(exp, context);
-  }
-
-  Expression handlePrimitiveConstant(PrimitiveConstantValue value) {
-    // Num constants may be negative, while literals must be non-negative:
-    // Literals are non-negative in the specification, and a negated literal
-    // parses as a call to unary `-`. The AST unparser assumes literals are
-    // non-negative and relies on this to avoid incorrectly generating `--`,
-    // the predecrement operator.
-    // Translate such constants into their positive value wrapped by
-    // the unary minus operator.
-    if (value.isNum) {
-      NumConstantValue numConstant = value;
-      if (numConstant.primitiveValue.isNegative) {
-        return negatedLiteral(numConstant);
-      }
-    }
-    return new Literal(value);
-  }
-
-  List<Expression> visitExpressions(List<ConstantExpression> expressions,
-                                    BuilderContext<Statement> context) {
-    return expressions.map((expression) => visit(expression, context))
-        .toList(growable: false);
-  }
-
-  @override
-  Expression visitBool(BoolConstantExpression exp,
-                       BuilderContext<Statement> context) {
-    return handlePrimitiveConstant(exp.value);
-  }
-
-  @override
-  Expression visitInt(IntConstantExpression exp,
-                      BuilderContext<Statement> context) {
-    return handlePrimitiveConstant(exp.value);
-  }
-
-  @override
-  Expression visitDouble(DoubleConstantExpression exp,
-                         BuilderContext<Statement> context) {
-    return handlePrimitiveConstant(exp.value);
-  }
-
-  @override
-  Expression visitString(StringConstantExpression exp,
-                         BuilderContext<Statement> context) {
-    return handlePrimitiveConstant(exp.value);
-  }
-
-  @override
-  Expression visitNull(NullConstantExpression exp,
-                       BuilderContext<Statement> context) {
-    return handlePrimitiveConstant(exp.value);
-  }
-
-  /// Given a negative num constant, returns the corresponding positive
-  /// literal wrapped by a unary minus operator.
-  Expression negatedLiteral(NumConstantValue constant) {
-    assert(constant.primitiveValue.isNegative);
-    NumConstantValue positiveConstant;
-    if (constant.isInt) {
-      positiveConstant = new IntConstantValue(-constant.primitiveValue);
-    } else if (constant.isDouble) {
-      positiveConstant = new DoubleConstantValue(-constant.primitiveValue);
-    } else {
-      throw "Unexpected type of NumConstant: $constant";
-    }
-    return new UnaryOperator('-', new Literal(positiveConstant));
-  }
-
-  @override
-  Expression visitList(ListConstantExpression exp,
-                       BuilderContext<Statement> context) {
-    return new LiteralList(
-        visitExpressions(exp.values, context),
-        isConst: true,
-        typeArgument:
-            TypeGenerator.createOptionalType(exp.type.typeArguments.single));
-  }
-
-  @override
-  Expression visitMap(MapConstantExpression exp,
-                      BuilderContext<Statement> context) {
-    List<LiteralMapEntry> entries = new List<LiteralMapEntry>.generate(
-        exp.values.length,
-        (i) => new LiteralMapEntry(visit(exp.keys[i], context),
-                                   visit(exp.values[i], context)));
-    List<TypeAnnotation> typeArguments = exp.type.treatAsRaw
-        ? null
-        : exp.type.typeArguments.map(TypeGenerator.createType).toList();
-    return new LiteralMap(entries, isConst: true, typeArguments: typeArguments);
-  }
-
-  @override
-  Expression visitConstructed(ConstructedConstantExpression exp,
-                              BuilderContext<Statement> context) {
-    int positionalArgumentCount = exp.callStructure.positionalArgumentCount;
-    List<Argument> args = new List<Argument>.generate(
-        positionalArgumentCount,
-        (i) => visit(exp.arguments[i], context));
-    for (int i = 0; i < exp.callStructure.namedArgumentCount; ++i) {
-      args.add(new NamedArgument(exp.callStructure.namedArguments[i],
-          visit(exp.arguments[positionalArgumentCount + i], context)));
-    }
-
-    FunctionElement constructor = exp.target;
-    String name = constructor.name.isEmpty ? null : constructor.name;
-    return new CallNew(TypeGenerator.createType(exp.type),
-                       args,
-                       constructorName: name,
-                       isConst: true)
-               ..constructor = constructor
-               ..dartType = exp.type;
-  }
-
-  @override
-  Expression visitConcatenate(ConcatenateConstantExpression exp,
-                              BuilderContext<Statement> context) {
-
-    return new StringConcat(visitExpressions(exp.expressions, context));
-  }
-
-  @override
-  Expression visitSymbol(SymbolConstantExpression exp,
-                         BuilderContext<Statement> context) {
-    return new LiteralSymbol(exp.name);
-  }
-
-  @override
-  Expression visitType(TypeConstantExpression exp,
-                       BuilderContext<Statement> context) {
-    DartType type = exp.type;
-    return new LiteralType(type.name)
-               ..type = type;
-  }
-
-  @override
-  Expression visitVariable(VariableConstantExpression exp,
-                           BuilderContext<Statement> context) {
-    Element element = exp.element;
-    if (element.kind != ElementKind.VARIABLE) {
-      return new Identifier(element.name)..element = element;
-    }
-    String name = context.getConstantName(element);
-    return new Identifier(name)
-               ..element = element;
-  }
-
-  @override
-  Expression visitFunction(FunctionConstantExpression exp,
-                           BuilderContext<Statement> context) {
-    return new Identifier(exp.element.name)
-               ..element = exp.element;
-  }
-
-  @override
-  Expression visitBinary(BinaryConstantExpression exp,
-                         BuilderContext<Statement> context) {
-    return handlePrimitiveConstant(exp.value);
-  }
-
-  @override
-  Expression visitIdentical(IdenticalConstantExpression exp,
-                            BuilderContext<Statement> context) {
-    return handlePrimitiveConstant(exp.value);
-  }
-
-  @override
-  Expression visitConditional(ConditionalConstantExpression exp,
-                              BuilderContext<Statement> context) {
-    if (exp.condition.value.isTrue) {
-      return exp.trueExp.accept(this);
-    } else {
-      return exp.falseExp.accept(this);
-    }
-  }
-
-  @override
-  Expression visitUnary(UnaryConstantExpression exp,
-                        BuilderContext<Statement> context) {
-    return handlePrimitiveConstant(exp.value);
-  }
-
-  @override
-  Expression visitNamed(NamedArgumentReference exp,
-                        BuilderContext<Statement> context) {
-    throw new UnsupportedError("ConstantEmitter.visitNamed");
-  }
-
-  @override
-  Expression visitPositional(PositionalArgumentReference exp,
-                             BuilderContext<Statement> context) {
-    throw new UnsupportedError("ConstantEmitter.visitPositional");
-  }
-
-  @override
-  Expression visitBoolFromEnvironment(
-      BoolFromEnvironmentConstantExpression exp,
-      BuilderContext<Statement> context) {
-    return handlePrimitiveConstant(exp.value);
-  }
-
-  @override
-  Expression visitIntFromEnvironment(
-      IntFromEnvironmentConstantExpression exp,
-      BuilderContext<Statement> context) {
-    return handlePrimitiveConstant(exp.value);
-  }
-
-  @override
-  Expression visitStringFromEnvironment(
-      StringFromEnvironmentConstantExpression exp,
-      BuilderContext<Statement> context) {
-    return handlePrimitiveConstant(exp.value);
-  }
-
-  @override
-  Expression visitDeferred(DeferredConstantExpression exp,
-                           BuilderContext<Statement> context) {
-    return exp.expression.accept(this);
-  }
-}
-
-/// Moves function parameters into a separate variable if one of its uses is
-/// shadowed by an inner function parameter.
-/// This artifact is necessary because function parameters cannot be renamed.
-class UnshadowParameters extends tree.RecursiveVisitor {
-
-  /// Maps parameter names to their bindings.
-  Map<String, tree.Variable> environment = <String, tree.Variable>{};
-
-  /// Parameters that are currently shadowed by another parameter.
-  Set<tree.Variable> shadowedParameters = new Set<tree.Variable>();
-
-  /// Parameters that are used in a context where it is shadowed.
-  Set<tree.Variable> hasShadowedUse = new Set<tree.Variable>();
-
-  void unshadow(tree.RootNode definition) {
-    if (definition.isEmpty) return;
-    unshadowFunction(definition);
-  }
-
-  void unshadowFunction(tree.RootNode definition) {
-    var oldShadow = shadowedParameters;
-    var oldEnvironment = environment;
-    environment = new Map<String, tree.Variable>.from(environment);
-    shadowedParameters = new Set<tree.Variable>.from(shadowedParameters);
-    for (tree.Variable param in definition.parameters) {
-      tree.Variable oldVariable = environment[param.element.name];
-      if (oldVariable != null) {
-        shadowedParameters.add(oldVariable);
-      }
-      environment[param.element.name] = param;
-    }
-    definition.forEachBody(visitStatement);
-    environment = oldEnvironment;
-    shadowedParameters = oldShadow;
-
-    for (int i=0; i<definition.parameters.length; i++) {
-      tree.Variable param = definition.parameters[i];
-      if (hasShadowedUse.remove(param)) {
-        tree.Variable newParam = new tree.Variable(definition.element,
-            param.element);
-        definition.parameters[i] = newParam;
-        definition.replaceEachBody((tree.Statement body) {
-          return tree.Assign.makeStatement(
-              param,
-              new tree.VariableUse(newParam),
-              body);
-        });
-        newParam.writeCount = 1; // Being a parameter counts as a write.
-        param.writeCount--; // Not a parameter anymore.
-      }
-    }
-  }
-
-  @override
-  void visitInnerFunction(tree.FunctionDefinition definition) {
-    unshadowFunction(definition);
-  }
-
-  @override
-  visitVariable(tree.Variable variable) {
-    if (shadowedParameters.contains(variable)) {
-      hasShadowedUse.add(variable);
-    }
-  }
-
-}
-
-// TODO(johnniwinther): Remove this when the dart `backend_ast` does not need
-// [Element] for entities.
-class _SyntheticLocalVariableElement extends modelx.VariableElementX
-    implements LocalVariableElement {
-
-  _SyntheticLocalVariableElement(String name,
-                                 ExecutableElement enclosingElement,
-                                 modelx.VariableList variables)
-      : super(name, ElementKind.VARIABLE, enclosingElement, variables, null);
-
-  ExecutableElement get executableContext => enclosingElement;
-
-  ExecutableElement get memberContext => executableContext.memberContext;
-
-  bool get isLocal => true;
-
-  LibraryElement get implementationLibrary => enclosingElement.library;
 }
diff --git a/pkg/compiler/lib/src/dart_backend/backend_ast_nodes.dart b/pkg/compiler/lib/src/dart_backend/backend_ast_nodes.dart
index a4d445f..d4e86e6 100644
--- a/pkg/compiler/lib/src/dart_backend/backend_ast_nodes.dart
+++ b/pkg/compiler/lib/src/dart_backend/backend_ast_nodes.dart
@@ -747,7 +747,7 @@
   }
 
   void writeOperator(String operator) {
-    write(" "); // TODO(sigurdm,kmillikin): Minimize use of whitespace.
+    write(" ");
     write(operator);
     write(" ");
   }
@@ -787,7 +787,6 @@
   /// Abusing terminology slightly, the function accepts a [Receiver] which
   /// may also be the [SuperReceiver] object.
   void writeExp(Receiver e, int minPrecedence, {beginStmt:false}) {
-    // TODO(kmillikin,sigurdm): it might be faster to use a Visitor.
     void withPrecedence(int actual, void action()) {
       if (actual < minPrecedence) {
         write("(");
@@ -820,7 +819,6 @@
           write(e.name);
         }
         writeParameters(e.parameters);
-        // TODO(sigurdm,kmillikin): Print {} for "return null;"
         if (stmt is Return) {
           write('=> ');
           writeExp(stmt.expression, EXPRESSION);
@@ -863,8 +861,6 @@
           write(v.toString());
         }
       } else {
-        // TODO(sigurdm): Use [ConstExp] to generate valid code for any
-        // constant.
         write(e.value.unparse());
       }
     } else if (e is LiteralList) {
@@ -1310,7 +1306,6 @@
   /// A list of string quotings that the printer may use to quote strings.
   // Ignore multiline quotings for now. Would need to make sure that no
   // newline (potentially prefixed by whitespace) follows the quoting.
-  // TODO(sigurdm,kmillikin): Include multiline quotation schemes.
   static const _QUOTINGS = const <tree.StringQuoting>[
       const tree.StringQuoting(characters.$DQ, raw: false, leftQuoteLength: 1),
       const tree.StringQuoting(characters.$DQ, raw: true, leftQuoteLength: 1),
@@ -1319,7 +1314,6 @@
   ];
 
   static StringLiteralOutput analyzeStringLiteral(Expression node) {
-    // TODO(sigurdm,kmillikin): This might be a bit too expensive. Benchmark.
     // Flatten the StringConcat tree.
     List parts = []; // Expression or int (char node)
     void collectParts(Expression e) {
diff --git a/pkg/compiler/lib/src/dart_backend/dart_backend.dart b/pkg/compiler/lib/src/dart_backend/dart_backend.dart
index 790daa0..d8221ad 100644
--- a/pkg/compiler/lib/src/dart_backend/dart_backend.dart
+++ b/pkg/compiler/lib/src/dart_backend/dart_backend.dart
@@ -11,23 +11,11 @@
 import '../library_loader.dart' show LoadedLibraries;
 import '../dart_types.dart';
 import '../tree/tree.dart';
-import '../cps_ir/cps_ir_nodes.dart' as cps_ir;
-import '../cps_ir/cps_ir_nodes_sexpr.dart';
 import '../compile_time_constants.dart';
 import '../constants/constant_system.dart';
 import '../constants/expressions.dart';
-import '../cps_ir/optimizers.dart';
-import '../cps_ir/optimizers.dart' as cps_opt;
-import '../tree_ir/tree_ir_builder.dart' as tree_builder;
-import '../tree_ir/tree_ir_nodes.dart' as tree_ir;
 import '../util/util.dart';
 import '../mirror_renamer/mirror_renamer.dart';
-import '../tree_ir/optimization/optimization.dart';
-import '../tree_ir/optimization/optimization.dart' as tree_opt;
-import '../tree_ir/tree_ir_integrity.dart';
-import '../cps_ir/cps_ir_integrity.dart';
-import 'backend_ast_emitter.dart' as backend_ast_emitter;
-import 'backend_ast_nodes.dart' as backend_ast;
 import 'backend_ast_to_frontend_ast.dart' as backend2frontend;
 import '../../compiler.dart' show CompilerOutputProvider;
 
diff --git a/pkg/compiler/lib/src/elements/common.dart b/pkg/compiler/lib/src/elements/common.dart
new file mode 100644
index 0000000..7c3f944
--- /dev/null
+++ b/pkg/compiler/lib/src/elements/common.dart
@@ -0,0 +1,473 @@
+// 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.

+

+/// Mixins that implement convenience methods on [Element] subclasses.

+

+library elements.common;

+

+import '../dart2jslib.dart' show Compiler, isPrivateName;

+import '../dart_types.dart' show DartType, InterfaceType, FunctionType;

+import '../universe/universe.dart' show Selector;

+import '../util/util.dart' show Link;

+

+import 'elements.dart';

+

+abstract class ElementCommon implements Element {

+  @override

+  bool get isLibrary => kind == ElementKind.LIBRARY;

+

+  @override

+  bool get isCompilationUnit => kind == ElementKind.COMPILATION_UNIT;

+

+  @override

+  bool get isPrefix => kind == ElementKind.PREFIX;

+

+  @override

+  bool get isClass => kind == ElementKind.CLASS;

+

+  @override

+  bool get isTypeVariable => kind == ElementKind.TYPE_VARIABLE;

+

+  @override

+  bool get isTypedef => kind == ElementKind.TYPEDEF;

+

+  @override

+  bool get isFunction => kind == ElementKind.FUNCTION;

+

+  @override

+  bool get isAccessor => isGetter || isSetter;

+

+  @override

+  bool get isGetter => kind == ElementKind.GETTER;

+

+  @override

+  bool get isSetter => kind == ElementKind.SETTER;

+

+  @override

+  bool get isConstructor => isGenerativeConstructor ||  isFactoryConstructor;

+

+  @override

+  bool get isGenerativeConstructor =>

+      kind == ElementKind.GENERATIVE_CONSTRUCTOR;

+

+  @override

+  bool get isGenerativeConstructorBody =>

+      kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY;

+

+  @override

+  bool get isVariable => kind == ElementKind.VARIABLE;

+

+  @override

+  bool get isField => kind == ElementKind.FIELD;

+

+  @override

+  bool get isAbstractField => kind == ElementKind.ABSTRACT_FIELD;

+

+  @override

+  bool get isParameter => kind == ElementKind.PARAMETER;

+

+  @override

+  bool get isInitializingFormal => kind == ElementKind.INITIALIZING_FORMAL;

+

+  @override

+  bool get isErroneous => kind == ElementKind.ERROR;

+

+  @override

+  bool get isAmbiguous => kind == ElementKind.AMBIGUOUS;

+

+  @override

+  bool get isWarnOnUse => kind == ElementKind.WARN_ON_USE;

+

+  @override

+  bool get impliesType => (kind.category & ElementCategory.IMPLIES_TYPE) != 0;

+

+  @override

+  Element get declaration => this;

+

+  @override

+  Element get implementation => this;

+

+  @override

+  bool get isDeclaration => true;

+

+  @override

+  bool get isPatched => false;

+

+  @override

+  bool get isPatch => false;

+

+  @override

+  bool get isImplementation => true;

+

+  @override

+  bool get isInjected => !isPatch && implementationLibrary.isPatch;

+

+  @override

+  Element get patch {

+    throw new UnsupportedError('patch is not supported on $this');

+  }

+

+  @override

+  Element get origin {

+    throw new UnsupportedError('origin is not supported on $this');

+  }

+}

+

+abstract class LibraryElementCommon implements LibraryElement {

+  @override

+  bool get isDartCore => canonicalUri == Compiler.DART_CORE;

+

+  @override

+  bool get isPlatformLibrary => canonicalUri.scheme == 'dart';

+

+  @override

+  bool get isPackageLibrary => canonicalUri.scheme == 'package';

+

+  @override

+  bool get isInternalLibrary =>

+      isPlatformLibrary && canonicalUri.path.startsWith('_');

+}

+

+abstract class ClassElementCommon implements ClassElement {

+

+  @override

+  Link<DartType> get allSupertypes => allSupertypesAndSelf.supertypes;

+

+  @override

+  int get hierarchyDepth => allSupertypesAndSelf.maxDepth;

+

+  @override

+  InterfaceType asInstanceOf(ClassElement cls) {

+    if (cls == this) return thisType;

+    return allSupertypesAndSelf.asInstanceOf(cls);

+  }

+

+  @override

+  ConstructorElement lookupConstructor(String name) {

+    Element result = localLookup(name);

+    return result != null && result.isConstructor ? result : null;

+  }

+

+

+  /**

+   * Find the first member in the class chain with the given [memberName].

+   *

+   * This method is NOT to be used for resolving

+   * unqualified sends because it does not implement the scoping

+   * rules, where library scope comes before superclass scope.

+   *

+   * When called on the implementation element both members declared in the

+   * origin and the patch class are returned.

+   */

+  Element lookupByName(Name memberName) {

+    return internalLookupByName(memberName, isSuperLookup: false);

+  }

+

+  Element lookupSuperByName(Name memberName) {

+    return internalLookupByName(memberName, isSuperLookup: true);

+  }

+

+  Element internalLookupByName(Name memberName, {bool isSuperLookup}) {

+    String name = memberName.text;

+    bool isPrivate = memberName.isPrivate;

+    LibraryElement library = memberName.library;

+    for (ClassElement current = isSuperLookup ? superclass : this;

+         current != null;

+         current = current.superclass) {

+      Element member = current.lookupLocalMember(name);

+      if (member == null && current.isPatched) {

+        // Doing lookups on selectors is done after resolution, so it

+        // is safe to look in the patch class.

+        member = current.patch.lookupLocalMember(name);

+      }

+      if (member == null) continue;

+      // Private members from a different library are not visible.

+      if (isPrivate && !identical(library, member.library)) continue;

+      // Static members are not inherited.

+      if (member.isStatic && !identical(this, current)) continue;

+      // If we find an abstract field we have to make sure that it has

+      // the getter or setter part we're actually looking

+      // for. Otherwise, we continue up the superclass chain.

+      if (member.isAbstractField) {

+        AbstractFieldElement field = member;

+        FunctionElement getter = field.getter;

+        FunctionElement setter = field.setter;

+        if (memberName.isSetter) {

+          // Abstract members can be defined in a super class.

+          if (setter != null && !setter.isAbstract) {

+            return setter;

+          }

+        } else {

+          if (getter != null && !getter.isAbstract) {

+            return getter;

+          }

+        }

+      // Abstract members can be defined in a super class.

+      } else if (!member.isAbstract) {

+        return member;

+      }

+    }

+    return null;

+  }

+

+  /**

+   * Find the first member in the class chain with the given

+   * [memberName]. This method is NOT to be used for resolving

+   * unqualified sends because it does not implement the scoping

+   * rules, where library scope comes before superclass scope.

+   */

+  @override

+  Element lookupMember(String memberName) {

+    Element localMember = lookupLocalMember(memberName);

+    return localMember == null ? lookupSuperMember(memberName) : localMember;

+  }

+

+  @override

+  Link<Element> get constructors {

+    // TODO(ajohnsen): See if we can avoid this method at some point.

+    Link<Element> result = const Link<Element>();

+    // TODO(johnniwinther): Should we include injected constructors?

+    forEachMember((_, Element member) {

+      if (member.isConstructor) result = result.prepend(member);

+    });

+    return result;

+  }

+

+  /**

+   * Lookup super members for the class. This will ignore constructors.

+   */

+  @override

+  Element lookupSuperMember(String memberName) {

+    return lookupSuperMemberInLibrary(memberName, library);

+  }

+

+  /**

+   * Lookup super members for the class that is accessible in [library].

+   * This will ignore constructors.

+   */

+  @override

+  Element lookupSuperMemberInLibrary(String memberName,

+                                     LibraryElement library) {

+    bool isPrivate = isPrivateName(memberName);

+    for (ClassElement s = superclass; s != null; s = s.superclass) {

+      // Private members from a different library are not visible.

+      if (isPrivate && !identical(library, s.library)) continue;

+      Element e = s.lookupLocalMember(memberName);

+      if (e == null) continue;

+      // Static members are not inherited.

+      if (e.isStatic) continue;

+      return e;

+    }

+    return null;

+  }

+

+  /**

+   * Lookup local members in the class. This will ignore constructors.

+   */

+  @override

+  Element lookupLocalMember(String memberName) {

+    var result = localLookup(memberName);

+    if (result != null && result.isConstructor) return null;

+    return result;

+  }

+

+  /**

+   * Runs through all members of this class.

+   *

+   * The enclosing class is passed to the callback. This is useful when

+   * [includeSuperAndInjectedMembers] is [:true:].

+   *

+   * When called on an implementation element both the members in the origin

+   * and patch class are included.

+   */

+  // TODO(johnniwinther): Clean up lookup to get rid of the include predicates.

+  @override

+  void forEachMember(void f(ClassElement enclosingClass, Element member),

+                     {includeBackendMembers: false,

+                      includeSuperAndInjectedMembers: false}) {

+    bool includeInjectedMembers = includeSuperAndInjectedMembers || isPatch;

+    ClassElement classElement = declaration;

+    do {

+      // Iterate through the members in textual order, which requires

+      // to reverse the data structure [localMembers] we created.

+      // Textual order may be important for certain operations, for

+      // example when emitting the initializers of fields.

+      classElement.forEachLocalMember((e) => f(classElement, e));

+      if (includeBackendMembers) {

+        classElement.forEachBackendMember((e) => f(classElement, e));

+      }

+      if (includeInjectedMembers) {

+        if (classElement.patch != null) {

+          classElement.patch.forEachLocalMember((e) {

+            if (!e.isPatch) f(classElement, e);

+          });

+        }

+      }

+      classElement = includeSuperAndInjectedMembers

+          ? classElement.superclass

+          : null;

+    } while (classElement != null);

+  }

+

+  /**

+   * Runs through all instance-field members of this class.

+   *

+   * The enclosing class is passed to the callback. This is useful when

+   * [includeSuperAndInjectedMembers] is [:true:].

+   *

+   * When called on the implementation element both the fields declared in the

+   * origin and in the patch are included.

+   */

+  @override

+  void forEachInstanceField(void f(ClassElement enclosingClass,

+                                   FieldElement field),

+                            {bool includeSuperAndInjectedMembers: false}) {

+    // Filters so that [f] is only invoked with instance fields.

+    void fieldFilter(ClassElement enclosingClass, Element member) {

+      if (member.isInstanceMember && member.kind == ElementKind.FIELD) {

+        f(enclosingClass, member);

+      }

+    }

+

+    forEachMember(fieldFilter,

+        includeSuperAndInjectedMembers: includeSuperAndInjectedMembers);

+  }

+

+  /// Similar to [forEachInstanceField] but visits static fields.

+  @override

+  void forEachStaticField(void f(ClassElement enclosingClass, Element field)) {

+    // Filters so that [f] is only invoked with static fields.

+    void fieldFilter(ClassElement enclosingClass, Element member) {

+      if (!member.isInstanceMember && member.kind == ElementKind.FIELD) {

+        f(enclosingClass, member);

+      }

+    }

+

+    forEachMember(fieldFilter);

+  }

+

+  /**

+   * Returns true if the [fieldMember] shadows another field.  The given

+   * [fieldMember] must be a member of this class, i.e. if there is a field of

+   * the same name in the superclass chain.

+   *

+   * This method also works if the [fieldMember] is private.

+   */

+  @override

+  bool hasFieldShadowedBy(Element fieldMember) {

+    assert(fieldMember.isField);

+    String fieldName = fieldMember.name;

+    bool isPrivate = isPrivateName(fieldName);

+    LibraryElement memberLibrary = fieldMember.library;

+    ClassElement lookupClass = this.superclass;

+    while (lookupClass != null) {

+      Element foundMember = lookupClass.lookupLocalMember(fieldName);

+      if (foundMember != null) {

+        if (foundMember.isField) {

+          if (!isPrivate || memberLibrary == foundMember.library) {

+            // Private fields can only be shadowed by a field declared in the

+            // same library.

+            return true;

+          }

+        }

+      }

+      lookupClass = lookupClass.superclass;

+    }

+    return false;

+  }

+

+  @override

+  bool implementsInterface(ClassElement intrface) {

+    for (DartType implementedInterfaceType in allSupertypes) {

+      ClassElement implementedInterface = implementedInterfaceType.element;

+      if (identical(implementedInterface, intrface)) {

+        return true;

+      }

+    }

+    return false;

+  }

+

+  /**

+   * Returns true if [this] is a subclass of [cls].

+   *

+   * This method is not to be used for checking type hierarchy and

+   * assignments, because it does not take parameterized types into

+   * account.

+   */

+  bool isSubclassOf(ClassElement cls) {

+    // Use [declaration] for both [this] and [cls], because

+    // declaration classes hold the superclass hierarchy.

+    cls = cls.declaration;

+    for (ClassElement s = declaration; s != null; s = s.superclass) {

+      if (identical(s, cls)) return true;

+    }

+    return false;

+  }

+

+  FunctionType get callType {

+    MemberSignature member =

+        lookupInterfaceMember(const PublicName(Compiler.CALL_OPERATOR_NAME));

+    return member != null && member.isMethod ? member.type : null;

+  }

+}

+

+abstract class FunctionSignatureCommon implements FunctionSignature {

+  void forEachRequiredParameter(void function(Element parameter)) {

+    requiredParameters.forEach(function);

+  }

+

+  void forEachOptionalParameter(void function(Element parameter)) {

+    optionalParameters.forEach(function);

+  }

+

+  Element get firstOptionalParameter => optionalParameters.first;

+

+  void forEachParameter(void function(Element parameter)) {

+    forEachRequiredParameter(function);

+    forEachOptionalParameter(function);

+  }

+

+  void orderedForEachParameter(void function(Element parameter)) {

+    forEachRequiredParameter(function);

+    orderedOptionalParameters.forEach(function);

+  }

+

+  int get parameterCount => requiredParameterCount + optionalParameterCount;

+

+  /**

+   * Check whether a function with this signature can be used instead of a

+   * function with signature [signature] without causing a `noSuchMethod`

+   * exception/call.

+   */

+  bool isCompatibleWith(FunctionSignature signature) {

+    if (optionalParametersAreNamed) {

+      if (!signature.optionalParametersAreNamed) {

+        return requiredParameterCount == signature.parameterCount;

+      }

+      // If both signatures have named parameters, then they must have

+      // the same number of required parameters, and the names in

+      // [signature] must all be in [:this:].

+      if (requiredParameterCount != signature.requiredParameterCount) {

+        return false;

+      }

+      Set<String> names = optionalParameters.map(

+          (Element element) => element.name).toSet();

+      for (Element namedParameter in signature.optionalParameters) {

+        if (!names.contains(namedParameter.name)) {

+          return false;

+        }

+      }

+    } else {

+      if (signature.optionalParametersAreNamed) return false;

+      // There must be at least as many arguments as in the other signature, but

+      // this signature must not have more required parameters.  Having more

+      // optional parameters is not a problem, they simply are never provided

+      // by call sites of a call to a method with the other signature.

+      int otherTotalCount = signature.parameterCount;

+      return requiredParameterCount <= otherTotalCount

+          && parameterCount >= otherTotalCount;

+    }

+    return true;

+  }

+}

diff --git a/pkg/compiler/lib/src/elements/elements.dart b/pkg/compiler/lib/src/elements/elements.dart
index 4a820e0..c2e809f 100644
--- a/pkg/compiler/lib/src/elements/elements.dart
+++ b/pkg/compiler/lib/src/elements/elements.dart
@@ -20,6 +20,7 @@
                                  Script,
                                  FunctionType,
                                  Selector,
+                                 SourceSpan,
                                  Constant,
                                  Compiler,
                                  Backend,
@@ -199,23 +200,23 @@
   @deprecated DartType computeType(Compiler compiler);
 
   /// `true` if this element is a library.
-  bool get isLibrary => kind == ElementKind.LIBRARY;
+  bool get isLibrary;
 
   /// `true` if this element is a compilation unit.
-  bool get isCompilationUnit => kind == ElementKind.COMPILATION_UNIT;
+  bool get isCompilationUnit;
 
   /// `true` if this element is defines the scope of prefix used by one or
   /// more import declarations.
-  bool get isPrefix => kind == ElementKind.PREFIX;
+  bool get isPrefix;
 
   /// `true` if this element is a class declaration or a mixin application.
-  bool get isClass => kind == ElementKind.CLASS;
+  bool get isClass;
 
   /// `true` if this element is a type variable declaration.
-  bool get isTypeVariable => kind == ElementKind.TYPE_VARIABLE;
+  bool get isTypeVariable;
 
   /// `true` if this element is a typedef declaration.
-  bool get isTypedef => kind == ElementKind.TYPEDEF;
+  bool get isTypedef;
 
   /// `true` if this element is a top level function, static or instance
   /// method, local function or closure defined by a function expression.
@@ -226,48 +227,46 @@
   /// See also [isConstructor], [isGenerativeConstructor], and
   /// [isFactoryConstructor] for constructor properties, and [isAccessor],
   /// [isGetter] and [isSetter] for getter/setter properties.
-  bool get isFunction => kind == ElementKind.FUNCTION;
+  bool get isFunction;
 
   /// `true` if this element is an operator method.
   bool get isOperator;
 
   /// `true` if this element is an accessor, that is either an explicit
   /// getter or an explicit setter.
-  bool get isAccessor => isGetter || isSetter;
+  bool get isAccessor;
 
   /// `true` if this element is an explicit getter method.
-  bool get isGetter => kind == ElementKind.GETTER;
+  bool get isGetter;
 
   /// `true` if this element is an explicit setter method.
-  bool get isSetter => kind == ElementKind.SETTER;
+  bool get isSetter;
 
   /// `true` if this element is a generative or factory constructor.
-  bool get isConstructor => isGenerativeConstructor ||  isFactoryConstructor;
+  bool get isConstructor;
 
   /// `true` if this element is a generative constructor, potentially
   /// redirecting.
-  bool get isGenerativeConstructor =>
-      kind == ElementKind.GENERATIVE_CONSTRUCTOR;
+  bool get isGenerativeConstructor;
 
   /// `true` if this element is the body of a generative constructor.
   ///
   /// This is a synthetic element kind used only be the JavaScript backend.
-  bool get isGenerativeConstructorBody =>
-      kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY;
+  bool get isGenerativeConstructorBody;
 
   /// `true` if this element is a factory constructor,
   /// potentially redirecting.
   bool get isFactoryConstructor;
 
   /// `true` if this element is a local variable.
-  bool get isVariable => kind == ElementKind.VARIABLE;
+  bool get isVariable;
 
   /// `true` if this element is a top level variable, static or instance field.
-  bool get isField => kind == ElementKind.FIELD;
+  bool get isField;
 
   /// `true` if this element is the abstract field implicitly defined by an
   /// explicit getter and/or setter.
-  bool get isAbstractField => kind == ElementKind.ABSTRACT_FIELD;
+  bool get isAbstractField;
 
   /// `true` if this element is formal parameter either from a constructor,
   /// method, or typedef declaration or from an inlined function typed
@@ -275,25 +274,25 @@
   ///
   /// This property is `false` if this element is an initializing formal.
   /// See [isInitializingFormal].
-  bool get isParameter => kind == ElementKind.PARAMETER;
+  bool get isParameter;
 
   /// `true` if this element is an initializing formal of constructor, that
   /// is a formal of the form `this.foo`.
-  bool get isInitializingFormal => kind == ElementKind.INITIALIZING_FORMAL;
+  bool get isInitializingFormal;
 
   /// `true` if this element represents a resolution error.
-  bool get isErroneous => kind == ElementKind.ERROR;
+  bool get isErroneous;
 
   /// `true` if this element represents an ambiguous name.
   ///
   /// Ambiguous names occur when two imports/exports contain different entities
   /// by the same name. If an ambiguous name is resolved an warning or error
   /// is produced.
-  bool get isAmbiguous => kind == ElementKind.AMBIGUOUS;
+  bool get isAmbiguous;
 
   /// `true` if this element represents an entity whose access causes one or
   /// more warnings.
-  bool get isWarnOnUse => kind == ElementKind.WARN_ON_USE;
+  bool get isWarnOnUse;
 
   bool get isClosure;
 
@@ -340,8 +339,12 @@
 
   bool get impliesType;
 
+  // TODO(johnniwinther): Remove this.
   Token get position;
 
+  /// The position of the declaration of this element, if available.
+  SourceSpan get sourcePosition;
+
   CompilationUnitElement get compilationUnit;
   LibraryElement get library;
   LibraryElement get implementationLibrary;
@@ -409,7 +412,6 @@
   String get fixedBackendName;
 
   bool get isAbstract;
-  bool isForeign(Backend backend);
 
   Scope buildScope();
 
@@ -525,7 +527,7 @@
   static bool isNativeOrExtendsNative(ClassElement element) {
     if (element == null) return false;
     if (element.isNative) return true;
-    assert(element.resolutionState == STATE_DONE);
+    assert(element.isResolved);
     return isNativeOrExtendsNative(element.superclass);
   }
 
@@ -903,6 +905,9 @@
   Element findExported(String elementName);
   void forEachExport(f(Element element));
 
+  /// Calls [f] for each [Element] imported into this library.
+  void forEachImport(f(Element element));
+
   /// Returns the imports that import element into this library.
   Link<Import> getImportsFor(Element element);
 
@@ -1325,15 +1330,11 @@
 
   bool get isResolved;
 
-  int get resolutionState;
-
   void ensureResolved(Compiler compiler);
 }
 
 abstract class ClassElement extends TypeDeclarationElement
     implements ScopeContainerElement {
-  int get id;
-
   /// The length of the longest inheritance path from [:Object:].
   int get hierarchyDepth;
 
@@ -1364,7 +1365,6 @@
   ClassElement get declaration;
   ClassElement get implementation;
 
-  int get supertypeLoadState;
   String get nativeTagInfo;
 
   /// `true` if this class is an enum declaration.
@@ -1396,9 +1396,6 @@
   /// Returns `true` if the class hierarchy for this class contains errors.
   bool get hasIncompleteHierarchy;
 
-  void addMember(Element element, DiagnosticListener listener);
-  void addToScope(Element element, DiagnosticListener listener);
-
   void addBackendMember(Element element);
   void reverseBackendMembers();
 
@@ -1429,8 +1426,6 @@
 
   void forEachBackendMember(void f(Element member));
 
-  List<DartType> computeTypeParameters(Compiler compiler);
-
   /// Looks up the member [name] in this class.
   Member lookupClassMember(Name name);
 
diff --git a/pkg/compiler/lib/src/elements/modelx.dart b/pkg/compiler/lib/src/elements/modelx.dart
index e5e4f39..964cb74 100644
--- a/pkg/compiler/lib/src/elements/modelx.dart
+++ b/pkg/compiler/lib/src/elements/modelx.dart
@@ -4,6 +4,7 @@
 
 library elements.modelx;
 
+import 'common.dart';
 import 'elements.dart';
 import '../constants/expressions.dart';
 import '../constants/constructors.dart';
@@ -25,6 +26,7 @@
     MessageKind,
     Script,
     Selector,
+    SourceSpan,
     TypeVariableType,
     TypedefType,
     invariant,
@@ -44,7 +46,7 @@
 abstract class DeclarationSite {
 }
 
-abstract class ElementX extends Element {
+abstract class ElementX extends Element with ElementCommon {
   static int elementHashCode = 0;
 
   final String name;
@@ -94,29 +96,6 @@
   bool get isFinal => modifiers.isFinal;
   bool get isStatic => modifiers.isStatic;
   bool get isOperator => Elements.isOperatorName(name);
-  bool get impliesType => (kind.category & ElementCategory.IMPLIES_TYPE) != 0;
-
-  bool get isPatched => false;
-
-  bool get isPatch => false;
-
-  bool get isImplementation => true;
-
-  bool get isDeclaration => true;
-
-  bool get isInjected => !isPatch && implementationLibrary.isPatch;
-
-  Element get implementation => this;
-
-  Element get declaration => this;
-
-  Element get patch {
-    throw new UnsupportedError('patch is not supported on $this');
-  }
-
-  Element get origin {
-    throw new UnsupportedError('origin is not supported on $this');
-  }
 
   bool get isSynthesized => false;
 
@@ -140,6 +119,13 @@
 
   Token get position => null;
 
+  SourceSpan get sourcePosition {
+    if (position == null) return null;
+    Uri uri = compilationUnit.script.readableUri;
+    return new SourceSpan(
+        uri, position.charOffset, position.charOffset + position.charCount);
+  }
+
   Token findMyName(Token token) {
     return findNameToken(token, isConstructor, name, enclosingElement.name);
   }
@@ -251,7 +237,6 @@
   FunctionElement asFunctionElement() => null;
 
   bool get isAbstract => modifiers.isAbstract;
-  bool isForeign(Backend backend) => backend.isForeign(this);
 
   void diagnose(Element context, DiagnosticListener listener) {}
 
@@ -857,7 +842,10 @@
 }
 
 class LibraryElementX
-    extends ElementX with AnalyzableElementX, PatchMixin<LibraryElementX>
+    extends ElementX
+    with LibraryElementCommon,
+         AnalyzableElementX,
+         PatchMixin<LibraryElementX>
     implements LibraryElement {
   final Uri canonicalUri;
 
@@ -903,8 +891,6 @@
     }
   }
 
-  bool get isDartCore => canonicalUri == Compiler.DART_CORE;
-
   Link<MetadataAnnotation> get metadata {
     return (libraryTag == null) ? super.metadata : libraryTag.metadata;
   }
@@ -1048,6 +1034,11 @@
 
   Link<Import> getImportsFor(Element element) => importers.getImports(element);
 
+  @override
+  void forEachImport(f(Element element)) {
+    importScope.importScope.values.forEach(f);
+  }
+
   void forEachLocalMember(f(Element element)) {
     if (isPatch) {
       // Patch libraries traverse both origin and injected members.
@@ -1104,13 +1095,6 @@
 
   Scope buildScope() => new LibraryScope(this);
 
-  bool get isPlatformLibrary => canonicalUri.scheme == 'dart';
-
-  bool get isPackageLibrary => canonicalUri.scheme == 'package';
-
-  bool get isInternalLibrary =>
-      isPlatformLibrary && canonicalUri.path.startsWith('_');
-
   String toString() {
     if (origin != null) {
       return 'patch library(${canonicalUri})';
@@ -1273,12 +1257,21 @@
   ConstantExpression _constant;
 
   ConstantExpression get constant {
+    if (isPatch) {
+      ConstantVariableMixin originVariable = origin;
+      return originVariable.constant;
+    }
     assert(invariant(this, _constant != null,
         message: "Constant has not been computed for $this."));
     return _constant;
   }
 
   void set constant(ConstantExpression value) {
+    if (isPatch) {
+      ConstantVariableMixin originVariable = origin;
+      originVariable.constant = value;
+      return null;
+    }
     assert(invariant(this, _constant == null || _constant == value,
         message: "Constant has already been computed for $this."));
     _constant = value;
@@ -1591,7 +1584,8 @@
 /// to ensure that default values on parameters are computed once (on the
 /// origin parameter) but can be found through both the origin and the patch.
 abstract class ParameterElementX extends FormalElementX
-    with PatchMixin<ParameterElement>, ConstantVariableMixin
+    with PatchMixin<ParameterElement>,
+         ConstantVariableMixin
     implements ParameterElement {
   final Expression initializer;
   final bool isOptional;
@@ -1617,6 +1611,15 @@
   }
 
   bool get isLocal => true;
+
+  String toString() {
+    if (isPatched) {
+      return 'origin ${super.toString()}';
+    } else if (isPatch) {
+      return 'patch ${super.toString()}';
+    }
+    return super.toString();
+  }
 }
 
 class LocalParameterElementX extends ParameterElementX
@@ -1747,7 +1750,8 @@
 // TODO(johnniwinther): [FunctionSignature] should be merged with
 // [FunctionType].
 // TODO(karlklose): all these lists should have element type [FormalElement].
-class FunctionSignatureX implements FunctionSignature {
+class FunctionSignatureX extends FunctionSignatureCommon
+    implements FunctionSignature {
   final List<Element> requiredParameters;
   final List<Element> optionalParameters;
   final int requiredParameterCount;
@@ -1766,64 +1770,6 @@
                       this.type})
       : optionalParameters = optionalParameters,
         hasOptionalParameters = !optionalParameters.isEmpty;
-
-  void forEachRequiredParameter(void function(Element parameter)) {
-    requiredParameters.forEach(function);
-  }
-
-  void forEachOptionalParameter(void function(Element parameter)) {
-    optionalParameters.forEach(function);
-  }
-
-  Element get firstOptionalParameter => optionalParameters.first;
-
-  void forEachParameter(void function(Element parameter)) {
-    forEachRequiredParameter(function);
-    forEachOptionalParameter(function);
-  }
-
-  void orderedForEachParameter(void function(Element parameter)) {
-    forEachRequiredParameter(function);
-    orderedOptionalParameters.forEach(function);
-  }
-
-  int get parameterCount => requiredParameterCount + optionalParameterCount;
-
-  /**
-   * Check whether a function with this signature can be used instead of a
-   * function with signature [signature] without causing a `noSuchMethod`
-   * exception/call.
-   */
-  bool isCompatibleWith(FunctionSignature signature) {
-    if (optionalParametersAreNamed) {
-      if (!signature.optionalParametersAreNamed) {
-        return requiredParameterCount == signature.parameterCount;
-      }
-      // If both signatures have named parameters, then they must have
-      // the same number of required parameters, and the names in
-      // [signature] must all be in [:this:].
-      if (requiredParameterCount != signature.requiredParameterCount) {
-        return false;
-      }
-      Set<String> names = optionalParameters.map(
-          (Element element) => element.name).toSet();
-      for (Element namedParameter in signature.optionalParameters) {
-        if (!names.contains(namedParameter.name)) {
-          return false;
-        }
-      }
-    } else {
-      if (signature.optionalParametersAreNamed) return false;
-      // There must be at least as many arguments as in the other signature, but
-      // this signature must not have more required parameters.  Having more
-      // optional parameters is not a problem, they simply are never provided
-      // by call sites of a call to a method with the other signature.
-      int otherTotalCount = signature.parameterCount;
-      return requiredParameterCount <= otherTotalCount
-          && parameterCount >= otherTotalCount;
-    }
-    return true;
-  }
 }
 
 abstract class BaseFunctionElementX
@@ -2110,8 +2056,6 @@
 
   bool get isClassMember => false;
 
-  bool isForeign(Backend backend) => true;
-
   bool get isSynthesized => true;
 
   bool get isDeferredLoaderGetter => true;
@@ -2332,11 +2276,14 @@
   }
 
   bool get isResolved => resolutionState == STATE_DONE;
+
+  int get resolutionState;
 }
 
 abstract class BaseClassElementX extends ElementX
     with AstElementMixin,
          AnalyzableElementX,
+         ClassElementCommon,
          TypeDeclarationElementX<InterfaceType>,
          PatchMixin<ClassElement>,
          ClassMemberMixin
@@ -2357,10 +2304,6 @@
 
   OrderedTypeSet allSupertypesAndSelf;
 
-  Link<DartType> get allSupertypes => allSupertypesAndSelf.supertypes;
-
-  int get hierarchyDepth => allSupertypesAndSelf.maxDepth;
-
   BaseClassElementX(String name,
                     Element enclosing,
                     this.id,
@@ -2396,17 +2339,13 @@
     }
   }
 
+  @override
   InterfaceType createType(List<DartType> typeArguments) {
     return new InterfaceType(this, typeArguments);
   }
 
   List<DartType> computeTypeParameters(Compiler compiler);
 
-  InterfaceType asInstanceOf(ClassElement cls) {
-    if (cls == this) return thisType;
-    return allSupertypesAndSelf.asInstanceOf(cls);
-  }
-
   bool get isObject {
     assert(invariant(this, isResolved,
         message: "isObject has not been computed for $this."));
@@ -2431,15 +2370,6 @@
     backendMembers = backendMembers.reverse();
   }
 
-  /**
-   * Lookup local members in the class. This will ignore constructors.
-   */
-  Element lookupLocalMember(String memberName) {
-    var result = localLookup(memberName);
-    if (result != null && result.isConstructor) return null;
-    return result;
-  }
-
   /// Lookup a synthetic element created by the backend.
   Element lookupBackendMember(String memberName) {
     for (Element element in backendMembers) {
@@ -2449,132 +2379,6 @@
     }
     return null;
   }
-  /**
-   * Lookup super members for the class. This will ignore constructors.
-   */
-  Element lookupSuperMember(String memberName) {
-    return lookupSuperMemberInLibrary(memberName, library);
-  }
-
-  /**
-   * Lookup super members for the class that is accessible in [library].
-   * This will ignore constructors.
-   */
-  Element lookupSuperMemberInLibrary(String memberName,
-                                     LibraryElement library) {
-    bool isPrivate = isPrivateName(memberName);
-    for (ClassElement s = superclass; s != null; s = s.superclass) {
-      // Private members from a different library are not visible.
-      if (isPrivate && !identical(library, s.library)) continue;
-      Element e = s.lookupLocalMember(memberName);
-      if (e == null) continue;
-      // Static members are not inherited.
-      if (e.isStatic) continue;
-      return e;
-    }
-    return null;
-  }
-
-  /**
-   * Find the first member in the class chain with the given [memberName].
-   *
-   * This method is NOT to be used for resolving
-   * unqualified sends because it does not implement the scoping
-   * rules, where library scope comes before superclass scope.
-   *
-   * When called on the implementation element both members declared in the
-   * origin and the patch class are returned.
-   */
-  Element lookupByName(Name memberName) {
-    return internalLookupByName(memberName, isSuperLookup: false);
-  }
-
-  Element lookupSuperByName(Name memberName) {
-    return internalLookupByName(memberName, isSuperLookup: true);
-  }
-
-  Element internalLookupByName(Name memberName, {bool isSuperLookup}) {
-    String name = memberName.text;
-    bool isPrivate = memberName.isPrivate;
-    LibraryElement library = memberName.library;
-    for (ClassElement current = isSuperLookup ? superclass : this;
-         current != null;
-         current = current.superclass) {
-      Element member = current.lookupLocalMember(name);
-      if (member == null && current.isPatched) {
-        // Doing lookups on selectors is done after resolution, so it
-        // is safe to look in the patch class.
-        member = current.patch.lookupLocalMember(name);
-      }
-      if (member == null) continue;
-      // Private members from a different library are not visible.
-      if (isPrivate && !identical(library, member.library)) continue;
-      // Static members are not inherited.
-      if (member.isStatic && !identical(this, current)) continue;
-      // If we find an abstract field we have to make sure that it has
-      // the getter or setter part we're actually looking
-      // for. Otherwise, we continue up the superclass chain.
-      if (member.isAbstractField) {
-        AbstractFieldElement field = member;
-        FunctionElement getter = field.getter;
-        FunctionElement setter = field.setter;
-        if (memberName.isSetter) {
-          // Abstract members can be defined in a super class.
-          if (setter != null && !setter.isAbstract) {
-            return setter;
-          }
-        } else {
-          if (getter != null && !getter.isAbstract) {
-            return getter;
-          }
-        }
-      // Abstract members can be defined in a super class.
-      } else if (!member.isAbstract) {
-        return member;
-      }
-    }
-    return null;
-  }
-
-  /**
-   * Find the first member in the class chain with the given
-   * [memberName]. This method is NOT to be used for resolving
-   * unqualified sends because it does not implement the scoping
-   * rules, where library scope comes before superclass scope.
-   */
-  Element lookupMember(String memberName) {
-    Element localMember = lookupLocalMember(memberName);
-    return localMember == null ? lookupSuperMember(memberName) : localMember;
-  }
-
-  /**
-   * Returns true if the [fieldMember] shadows another field.  The given
-   * [fieldMember] must be a member of this class, i.e. if there is a field of
-   * the same name in the superclass chain.
-   *
-   * This method also works if the [fieldMember] is private.
-   */
-  bool hasFieldShadowedBy(Element fieldMember) {
-    assert(fieldMember.isField);
-    String fieldName = fieldMember.name;
-    bool isPrivate = isPrivateName(fieldName);
-    LibraryElement memberLibrary = fieldMember.library;
-    ClassElement lookupClass = this.superclass;
-    while (lookupClass != null) {
-      Element foundMember = lookupClass.lookupLocalMember(fieldName);
-      if (foundMember != null) {
-        if (foundMember.isField) {
-          if (!isPrivate || memberLibrary == foundMember.library) {
-            // Private fields can only be shadowed by a field declared in the
-            // same library.
-            return true;
-          }
-        }
-      }
-      lookupClass = lookupClass.superclass;
-    }
-    return false;
-  }
 
   ConstructorElement lookupDefaultConstructor() {
     ConstructorElement constructor = lookupConstructor("");
@@ -2589,21 +2393,6 @@
     return null;
   }
 
-  ConstructorElement lookupConstructor(String name) {
-    Element result = localLookup(name);
-    return result != null && result.isConstructor ? result : null;
-  }
-
-  Link<Element> get constructors {
-    // TODO(ajohnsen): See if we can avoid this method at some point.
-    Link<Element> result = const Link<Element>();
-    // TODO(johnniwinther): Should we include injected constructors?
-    forEachMember((_, Element member) {
-      if (member.isConstructor) result = result.prepend(member);
-    });
-    return result;
-  }
-
   /**
    * Returns the super class, if any.
    *
@@ -2614,78 +2403,6 @@
     return supertype == null ? null : supertype.element;
   }
 
-  /**
-   * Runs through all members of this class.
-   *
-   * The enclosing class is passed to the callback. This is useful when
-   * [includeSuperAndInjectedMembers] is [:true:].
-   *
-   * When called on an implementation element both the members in the origin
-   * and patch class are included.
-   */
-  // TODO(johnniwinther): Clean up lookup to get rid of the include predicates.
-  void forEachMember(void f(ClassElement enclosingClass, Element member),
-                     {includeBackendMembers: false,
-                      includeSuperAndInjectedMembers: false}) {
-    bool includeInjectedMembers = includeSuperAndInjectedMembers || isPatch;
-    ClassElement classElement = declaration;
-    do {
-      // Iterate through the members in textual order, which requires
-      // to reverse the data structure [localMembers] we created.
-      // Textual order may be important for certain operations, for
-      // example when emitting the initializers of fields.
-      classElement.forEachLocalMember((e) => f(classElement, e));
-      if (includeBackendMembers) {
-        classElement.forEachBackendMember((e) => f(classElement, e));
-      }
-      if (includeInjectedMembers) {
-        if (classElement.patch != null) {
-          classElement.patch.forEachLocalMember((e) {
-            if (!e.isPatch) f(classElement, e);
-          });
-        }
-      }
-      classElement = includeSuperAndInjectedMembers
-          ? classElement.superclass
-          : null;
-    } while (classElement != null);
-  }
-
-  /**
-   * Runs through all instance-field members of this class.
-   *
-   * The enclosing class is passed to the callback. This is useful when
-   * [includeSuperAndInjectedMembers] is [:true:].
-   *
-   * When called on the implementation element both the fields declared in the
-   * origin and in the patch are included.
-   */
-  void forEachInstanceField(void f(ClassElement enclosingClass,
-                                   FieldElement field),
-                            {bool includeSuperAndInjectedMembers: false}) {
-    // Filters so that [f] is only invoked with instance fields.
-    void fieldFilter(ClassElement enclosingClass, Element member) {
-      if (member.isInstanceMember && member.kind == ElementKind.FIELD) {
-        f(enclosingClass, member);
-      }
-    }
-
-    forEachMember(fieldFilter,
-        includeSuperAndInjectedMembers: includeSuperAndInjectedMembers);
-  }
-
-  /// Similar to [forEachInstanceField] but visits static fields.
-  void forEachStaticField(void f(ClassElement enclosingClass, Element field)) {
-    // Filters so that [f] is only invoked with static fields.
-    void fieldFilter(ClassElement enclosingClass, Element member) {
-      if (!member.isInstanceMember && member.kind == ElementKind.FIELD) {
-        f(enclosingClass, member);
-      }
-    }
-
-    forEachMember(fieldFilter);
-  }
-
   void forEachBackendMember(void f(Element member)) {
     backendMembers.forEach(f);
   }
@@ -2694,33 +2411,6 @@
     return asInstanceOf(compiler.functionClass) != null || callType != null;
   }
 
-  bool implementsInterface(ClassElement intrface) {
-    for (DartType implementedInterfaceType in allSupertypes) {
-      ClassElement implementedInterface = implementedInterfaceType.element;
-      if (identical(implementedInterface, intrface)) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  /**
-   * Returns true if [this] is a subclass of [cls].
-   *
-   * This method is not to be used for checking type hierarchy and
-   * assignments, because it does not take parameterized types into
-   * account.
-   */
-  bool isSubclassOf(ClassElement cls) {
-    // Use [declaration] for both [this] and [cls], because
-    // declaration classes hold the superclass hierarchy.
-    cls = cls.declaration;
-    for (ClassElement s = declaration; s != null; s = s.superclass) {
-      if (identical(s, cls)) return true;
-    }
-    return false;
-  }
-
   bool get isNative => nativeTagInfo != null;
 
   void setNative(String name) {
@@ -2734,12 +2424,6 @@
     nativeTagInfo = name;
   }
 
-  FunctionType get callType {
-    MemberSignature member =
-        lookupInterfaceMember(const PublicName(Compiler.CALL_OPERATOR_NAME));
-    return member != null && member.isMethod ? member.type : null;
-  }
-
   // TODO(johnniwinther): Remove these when issue 18630 is fixed.
   ClassElement get patch => super.patch;
   ClassElement get origin => super.origin;
diff --git a/pkg/compiler/lib/src/enqueue.dart b/pkg/compiler/lib/src/enqueue.dart
index ebbef36..186025c 100644
--- a/pkg/compiler/lib/src/enqueue.dart
+++ b/pkg/compiler/lib/src/enqueue.dart
@@ -32,6 +32,27 @@
   }
 }
 
+class WorldImpact {
+  const WorldImpact();
+
+  Iterable<Selector> get dynamicInvocations => const <Selector>[];
+  Iterable<Selector> get dynamicGetters => const <Selector>[];
+  Iterable<Selector> get dynamicSetters => const <Selector>[];
+
+  // TODO(johnniwinther): Split this into more precise subsets.
+  Iterable<Element> get staticUses => const <Element>[];
+
+  // TODO(johnniwinther): Replace this by called constructors with type
+  // arguments.
+  Iterable<InterfaceType> get instantiatedTypes => const <InterfaceType>[];
+
+  // TODO(johnniwinther): Collect checked types for checked mode separately to
+  // support serialization.
+  Iterable<DartType> get checkedTypes => const <DartType>[];
+
+  Iterable<MethodElement> get closurizedFunctions => const <MethodElement>[];
+}
+
 abstract class Enqueuer {
   final String name;
   final Compiler compiler; // TODO(ahe): Remove this dependency.
@@ -84,6 +105,20 @@
    */
   bool internalAddToWorkList(Element element);
 
+  /// Apply the [worldImpact] of processing [element] to this enqueuer.
+  void applyImpact(Element element, WorldImpact worldImpact) {
+    // TODO(johnniwinther): Optimize the application of the world impact.
+    worldImpact.dynamicInvocations.forEach(registerDynamicInvocation);
+    worldImpact.dynamicGetters.forEach(registerDynamicGetter);
+    worldImpact.dynamicSetters.forEach(registerDynamicSetter);
+    worldImpact.staticUses.forEach(registerStaticUse);
+    // TODO(johnniwinther): Register [worldImpact.instantiatedTypes] when it
+    // doesn't require a [Registry].
+    worldImpact.checkedTypes.forEach(registerIsCheck);
+    worldImpact.closurizedFunctions.forEach(registerGetOfStaticFunction);
+  }
+
+  // TODO(johnniwinther): Remove the need for passing the [registry].
   void registerInstantiatedType(InterfaceType type, Registry registry,
                                 {bool mirrorUsage: false}) {
     task.measure(() {
@@ -96,12 +131,6 @@
     });
   }
 
-  void registerInstantiatedClass(ClassElement cls, Registry registry,
-                                 {bool mirrorUsage: false}) {
-    cls.ensureResolved(compiler);
-    registerInstantiatedType(cls.rawType, registry, mirrorUsage: mirrorUsage);
-  }
-
   bool checkNoEnqueuedInvokedInstanceMethods() {
     return filter.checkNoEnqueuedInvokedInstanceMethods(this);
   }
@@ -350,7 +379,8 @@
     if (includeClass) {
       logEnqueueReflectiveAction(cls, "register");
       ClassElement decl = cls.declaration;
-      registerInstantiatedClass(decl, compiler.mirrorDependencies,
+      decl.ensureResolved(compiler);
+      registerInstantiatedType(decl.rawType, compiler.mirrorDependencies,
           mirrorUsage: true);
     }
     // If the class is never instantiated, we know nothing of it can possibly
@@ -380,7 +410,8 @@
     for (ClassElement cls in classes) {
       if (compiler.backend.referencedFromMirrorSystem(cls)) {
         logEnqueueReflectiveAction(cls);
-        registerInstantiatedClass(cls, compiler.mirrorDependencies,
+        cls.ensureResolved(compiler);
+        registerInstantiatedType(cls.rawType, compiler.mirrorDependencies,
             mirrorUsage: true);
       }
     }
@@ -564,7 +595,7 @@
     universe.fieldSetters.add(element);
   }
 
-  void registerIsCheck(DartType type, Registry registry) {
+  void registerIsCheck(DartType type) {
     type = universe.registerIsCheck(type, compiler);
     // Even in checked mode, type annotations for return type and argument
     // types do not imply type checks, so there should never be a check
@@ -836,7 +867,7 @@
 
   bool internalAddToWorkList(Element element) {
     // Don't generate code for foreign elements.
-    if (element.isForeign(compiler.backend)) return false;
+    if (compiler.backend.isForeign(element)) return false;
 
     // Codegen inlines field initializers. It only needs to generate
     // code for checked setters.
diff --git a/pkg/compiler/lib/src/inferrer/closure_tracer.dart b/pkg/compiler/lib/src/inferrer/closure_tracer.dart
index 9ac5813..844c76a 100644
--- a/pkg/compiler/lib/src/inferrer/closure_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/closure_tracer.dart
@@ -57,7 +57,7 @@
   visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) {
     super.visitStaticCallSiteTypeInformation(info);
     Element called = info.calledElement;
-    if (called.isForeign(compiler.backend)) {
+    if (compiler.backend.isForeign(called)) {
       String name = called.name;
       if (name == 'JS' || name == 'DART_CLOSURE_TO_JS') {
         bailout('Used in JS ${info.call}');
diff --git a/pkg/compiler/lib/src/inferrer/list_tracer.dart b/pkg/compiler/lib/src/inferrer/list_tracer.dart
index 357893d..b3e8ab3 100644
--- a/pkg/compiler/lib/src/inferrer/list_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/list_tracer.dart
@@ -161,7 +161,7 @@
   visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) {
     super.visitStaticCallSiteTypeInformation(info);
     Element called = info.calledElement;
-    if (called.isForeign(compiler.backend) && called.name == 'JS') {
+    if (compiler.backend.isForeign(called) && called.name == 'JS') {
       bailout('Used in JS ${info.call}');
     }
   }
diff --git a/pkg/compiler/lib/src/inferrer/map_tracer.dart b/pkg/compiler/lib/src/inferrer/map_tracer.dart
index 67c5c11..eecd7d8 100644
--- a/pkg/compiler/lib/src/inferrer/map_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/map_tracer.dart
@@ -61,7 +61,7 @@
   visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info) {
     super.visitStaticCallSiteTypeInformation(info);
     Element called = info.calledElement;
-    if (called.isForeign(compiler.backend) && called.name == 'JS') {
+    if (compiler.backend.isForeign(called) && called.name == 'JS') {
       bailout('Used in JS ${info.call}');
     }
   }
diff --git a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart b/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
index 00ad240..6012f86 100644
--- a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
+++ b/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
@@ -1328,6 +1328,14 @@
   }
 
   @override
+  T visitSuperSetterGet(
+      ast.Send node,
+      MethodElement setter,
+      _) {
+    return handleErroneousSuperSend(node);
+  }
+
+  @override
   T visitUnresolvedSuperInvoke(
       ast.Send node,
       Element element,
@@ -1529,7 +1537,7 @@
         element = constructor.effectiveTarget.implementation;
       }
     }
-    if (element.isForeign(compiler.backend)) {
+    if (compiler.backend.isForeign(element)) {
       return handleForeignSend(node, element);
     }
     Selector selector = elements.getSelector(node);
@@ -1590,7 +1598,7 @@
 
   /// Handle invocation of a top level or static [function].
   T handleStaticFunctionInvoke(ast.Send node, MethodElement function) {
-    if (function.isForeign(compiler.backend)) {
+    if (compiler.backend.isForeign(function)) {
       return handleForeignSend(node, function);
     }
     ArgumentsTypes arguments = analyzeArguments(node.arguments);
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index 3bc8c0f..0101ab0 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -1181,15 +1181,17 @@
   }
 
   void registerBoundClosure(Enqueuer enqueuer) {
-    enqueuer.registerInstantiatedClass(
-        boundClosureClass,
+    boundClosureClass.ensureResolved(compiler);
+    enqueuer.registerInstantiatedType(
+        boundClosureClass.rawType,
         // Precise dependency is not important here.
         compiler.globalDependencies);
   }
 
   void registerGetOfStaticFunction(Enqueuer enqueuer) {
-    enqueuer.registerInstantiatedClass(closureClass,
-                                       compiler.globalDependencies);
+    closureClass.ensureResolved(compiler);
+    enqueuer.registerInstantiatedType(
+        closureClass.rawType, compiler.globalDependencies);
   }
 
   void registerComputeSignature(Enqueuer enqueuer, Registry registry) {
@@ -1371,28 +1373,31 @@
   /// Register instantiation of [cls] in [enqueuer].
   ///
   /// This method calls [registerBackendUse].
-  void enqueueClass(Enqueuer enqueuer, Element cls, Registry registry) {
+  void enqueueClass(Enqueuer enqueuer, ClassElement cls, Registry registry) {
     if (cls == null) return;
     registerBackendUse(cls);
     helpersUsed.add(cls.declaration);
     if (cls.declaration != cls.implementation) {
       helpersUsed.add(cls.implementation);
     }
-    enqueuer.registerInstantiatedClass(cls, registry);
+    cls.ensureResolved(compiler);
+    enqueuer.registerInstantiatedType(cls.rawType, registry);
   }
 
-  void codegen(CodegenWorkItem work) {
+  WorldImpact codegen(CodegenWorkItem work) {
     Element element = work.element;
     if (compiler.elementHasCompileTimeError(element)) {
       generatedCode[element] = jsAst.js(
           "function () { throw new Error('Compile time error in $element') }");
-      return;
+      return const WorldImpact();
     }
     var kind = element.kind;
-    if (kind == ElementKind.TYPEDEF) return;
+    if (kind == ElementKind.TYPEDEF) {
+      return const WorldImpact();
+    }
     if (element.isConstructor && element.enclosingClass == jsNullClass) {
       // Work around a problem compiling JSNull's constructor.
-      return;
+      return const WorldImpact();
     }
     if (kind.category == ElementCategory.VARIABLE) {
       ConstantExpression initialValue =
@@ -1403,7 +1408,9 @@
         // We don't need to generate code for static or top-level
         // variables. For instance variables, we may need to generate
         // the checked setter.
-        if (Elements.isStaticOrTopLevel(element)) return;
+        if (Elements.isStaticOrTopLevel(element)) {
+          return const WorldImpact();
+        }
       } else {
         // If the constant-handler was not able to produce a result we have to
         // go through the builder (below) to generate the lazy initializer for
@@ -1413,6 +1420,7 @@
       }
     }
     generatedCode[element] = functionCompiler.compile(work);
+    return const WorldImpact();
   }
 
   native.NativeEnqueuer nativeResolutionEnqueuer(Enqueuer world) {
@@ -2637,13 +2645,18 @@
       enqueue(enqueuer, getCompleterConstructor(), registry);
       enqueue(enqueuer, getStreamIteratorConstructor(), registry);
     } else if (element.asyncMarker == AsyncMarker.SYNC_STAR) {
-      enqueuer.registerInstantiatedClass(getSyncStarIterable(), registry);
+      ClassElement clsSyncStarIterable = getSyncStarIterable();
+      clsSyncStarIterable.ensureResolved(compiler);
+      enqueuer.registerInstantiatedType(clsSyncStarIterable.rawType, registry);
       enqueue(enqueuer, getSyncStarIterableConstructor(), registry);
       enqueue(enqueuer, getEndOfIteration(), registry);
       enqueue(enqueuer, getYieldStar(), registry);
       enqueue(enqueuer, getSyncStarUncaughtError(), registry);
     } else if (element.asyncMarker == AsyncMarker.ASYNC_STAR) {
-      enqueuer.registerInstantiatedClass(getASyncStarController(), registry);
+      ClassElement clsASyncStarController = getASyncStarController();
+      clsASyncStarController.ensureResolved(compiler);
+      enqueuer.registerInstantiatedType(
+          clsASyncStarController.rawType, registry);
       enqueue(enqueuer, getAsyncStarHelper(), registry);
       enqueue(enqueuer, getStreamOfController(), registry);
       enqueue(enqueuer, getYieldSingle(), registry);
diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
index c133788..ed8c803 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -383,7 +383,14 @@
 
       return buildStaticHelperInvocation(
           glue.getCheckSubtype(),
-          [value, isT, typeArgumentArray, asT]);
+          <js.Expression>[value, isT, typeArgumentArray, asT]);
+    } else if (type is TypeVariableType) {
+      glue.registerIsCheck(type, registry);
+      // The only type argument is the type held in the type variable.
+      js.Expression typeValue = typeArguments.single;
+      return buildStaticHelperInvocation(
+          glue.getCheckSubtypeOfRuntime(),
+          <js.Expression>[value, typeValue]);
     }
     return giveup(node, 'type check unimplemented for $type.');
   }
@@ -676,29 +683,9 @@
     return glue.generateTypeRepresentation(node.dartType, arguments);
   }
 
-  // Dart-specific IR nodes
-
-  @override
-  visitReifyTypeVar(tree_ir.ReifyTypeVar node) {
-    return errorUnsupportedNode(node);
-  }
-
-  @override
   visitFunctionExpression(tree_ir.FunctionExpression node) {
-    return errorUnsupportedNode(node);
-  }
-
-  @override
-  visitFunctionDeclaration(tree_ir.FunctionDeclaration node) {
-    return errorUnsupportedNode(node);
-  }
-
-  @override
-  visitVariableDeclaration(tree_ir.VariableDeclaration node) {
-    return errorUnsupportedNode(node);
-  }
-
-  errorUnsupportedNode(tree_ir.DartSpecificNode node) {
-    throw "Unsupported node in JS backend: $node";
+    // FunctionExpressions are currently unused.
+    // We might need them if we want to emit raw JS nested functions.
+    throw 'FunctionExpressions should not be used';
   }
 }
diff --git a/pkg/compiler/lib/src/js_backend/codegen/glue.dart b/pkg/compiler/lib/src/js_backend/codegen/glue.dart
index cb87354..50fea4f 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/glue.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/glue.dart
@@ -171,10 +171,16 @@
     return _backend.getSetRuntimeTypeInfo();
   }
 
+  /// checkSubtype(value, $isT, typeArgs, $asT)
   FunctionElement getCheckSubtype() {
     return _backend.getCheckSubtype();
   }
 
+  /// checkSubtypeOfRuntime(value, runtimeType)
+  FunctionElement getCheckSubtypeOfRuntime() {
+    return _backend.getCheckSubtypeOfRuntimeType();
+  }
+
   js.Expression getRuntimeTypeName(ClassElement cls) {
     return js.string(_namer.runtimeTypeName(cls));
   }
@@ -204,7 +210,7 @@
   }
 
   void registerIsCheck(DartType type, Registry registry) {
-    _enqueuer.registerIsCheck(type, registry);
+    _enqueuer.registerIsCheck(type);
     _backend.registerIsCheckForCodegen(type, _enqueuer, registry);
   }
 
diff --git a/pkg/compiler/lib/src/js_backend/codegen/task.dart b/pkg/compiler/lib/src/js_backend/codegen/task.dart
index ab69b01..0540d4c 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/task.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/task.dart
@@ -153,7 +153,7 @@
     }
   }
 
-  static bool checkCpsIntegrity(cps.RootNode node) {
+  static bool checkCpsIntegrity(cps.FunctionDefinition node) {
     new CheckCpsIntegrity().check(node);
     return true; // So this can be used from assert().
   }
@@ -189,7 +189,7 @@
     return treeNode;
   }
 
-  static bool checkTreeIntegrity(tree_ir.RootNode node) {
+  static bool checkTreeIntegrity(tree_ir.FunctionDefinition node) {
     new CheckTreeIntegrity().check(node);
     return true; // So this can be used from assert().
   }
diff --git a/pkg/compiler/lib/src/js_backend/codegen/unsugar.dart b/pkg/compiler/lib/src/js_backend/codegen/unsugar.dart
index 24aec5a..9ce842f 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/unsugar.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/unsugar.dart
@@ -2,8 +2,7 @@
 
 import '../../cps_ir/cps_ir_nodes.dart';
 
-// TODO(karlklose): share the [ParentVisitor].
-import '../../cps_ir/optimizers.dart';
+import '../../cps_ir/optimizers.dart' show ParentVisitor;
 import '../../constants/expressions.dart';
 import '../../constants/values.dart';
 import '../../elements/elements.dart' show
@@ -124,14 +123,14 @@
     //       body;
     //
     Continuation originalBody = new Continuation(<Parameter>[]);
-    originalBody.body = function.body.body;
+    originalBody.body = function.body;
 
     Continuation returnFalse = new Continuation(<Parameter>[]);
     Primitive falsePrimitive = falseConstant;
     returnFalse.body =
         new LetPrim(falsePrimitive,
             new InvokeContinuation(
-                function.body.returnContinuation, <Primitive>[falsePrimitive]));
+                function.returnContinuation, <Primitive>[falsePrimitive]));
 
     Primitive nullPrimitive = nullConstant;
     Primitive test = new Identical(function.parameters.single, nullPrimitive);
@@ -144,7 +143,7 @@
                         new IsTrue(test),
                         returnFalse,
                         originalBody))));
-    function.body.body = newBody;
+    function.body = newBody;
   }
 
   /// Insert a static call to [function] at the point of [node] with result
@@ -257,8 +256,6 @@
     }
 
     node.arguments.insert(0, node.receiver);
-    node.callingConvention = CallingConvention.JS_INTERCEPTED;
-    assert(node.isValid);
     node.receiver = new Reference<Primitive>(newReceiver);
   }
 
diff --git a/pkg/compiler/lib/src/js_backend/constant_emitter.dart b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
index f01f0d0..b113d24 100644
--- a/pkg/compiler/lib/src/js_backend/constant_emitter.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
@@ -270,7 +270,7 @@
   @override
   jsAst.Expression visitConstructed(ConstructedConstantValue constant, [_]) {
     Element element = constant.type.element;
-    if (element.isForeign(backend)
+    if (backend.isForeign(element)
         && element.name == 'JS_CONST') {
       StringConstantValue str = constant.fields.values.single;
       String value = str.primitiveValue.slowToString();
diff --git a/pkg/compiler/lib/src/native/enqueue.dart b/pkg/compiler/lib/src/native/enqueue.dart
index 1f09444..51041d5 100644
--- a/pkg/compiler/lib/src/native/enqueue.dart
+++ b/pkg/compiler/lib/src/native/enqueue.dart
@@ -370,7 +370,9 @@
     registeredClasses.add(classElement);
 
     // TODO(ahe): Is this really a global dependency?
-    world.registerInstantiatedClass(classElement, compiler.globalDependencies);
+    classElement.ensureResolved(compiler);
+    world.registerInstantiatedType(
+        classElement.rawType, compiler.globalDependencies);
 
     // Also parse the node to know all its methods because otherwise it will
     // only be parsed if there is a call to one of its constructors.
@@ -523,27 +525,30 @@
       matchedTypeConstraints.add(type);
       if (type is SpecialType) {
         if (type == SpecialType.JsObject) {
-          world.registerInstantiatedClass(compiler.objectClass, registry);
+          world.registerInstantiatedType(
+              compiler.coreTypes.objectType, registry);
         }
         continue;
       }
       if (type is InterfaceType) {
         if (type.element == compiler.intClass) {
-          world.registerInstantiatedClass(compiler.intClass, registry);
+          world.registerInstantiatedType(type, registry);
         } else if (type.element == compiler.doubleClass) {
-          world.registerInstantiatedClass(compiler.doubleClass, registry);
+          world.registerInstantiatedType(type, registry);
         } else if (type.element == compiler.numClass) {
-          world.registerInstantiatedClass(compiler.doubleClass, registry);
-          world.registerInstantiatedClass(compiler.intClass, registry);
+          world.registerInstantiatedType(
+              compiler.coreTypes.doubleType, registry);
+          world.registerInstantiatedType(
+              compiler.coreTypes.intType, registry);
         } else if (type.element == compiler.stringClass) {
-          world.registerInstantiatedClass(compiler.stringClass, registry);
+          world.registerInstantiatedType(type, registry);
         } else if (type.element == compiler.nullClass) {
-          world.registerInstantiatedClass(compiler.nullClass, registry);
+          world.registerInstantiatedType(type, registry);
         } else if (type.element == compiler.boolClass) {
-          world.registerInstantiatedClass(compiler.boolClass, registry);
+          world.registerInstantiatedType(type, registry);
         } else if (compiler.types.isSubtype(
                       type, backend.listImplementation.rawType)) {
-          world.registerInstantiatedClass(type.element, registry);
+          world.registerInstantiatedType(type, registry);
         }
       }
       assert(type is DartType);
diff --git a/pkg/compiler/lib/src/resolution/constructors.dart b/pkg/compiler/lib/src/resolution/constructors.dart
index 28d5a3b..27f7ed2 100644
--- a/pkg/compiler/lib/src/resolution/constructors.dart
+++ b/pkg/compiler/lib/src/resolution/constructors.dart
@@ -141,7 +141,7 @@
     ClassElement superClass = classElement.superclass;
     if (classElement != visitor.compiler.objectClass) {
       assert(superClass != null);
-      assert(superClass.resolutionState == STATE_DONE);
+      assert(superClass.isResolved);
 
       final bool isSuperCall = true;
       ClassElement lookupTarget = getSuperOrThisLookupTarget(constructor,
@@ -192,8 +192,10 @@
         visitor.compiler.reportError(diagnosticNode, kind);
       } else if (caller.isConst
                  && !lookedupConstructor.isConst) {
-        visitor.compiler.reportError(
-            diagnosticNode, MessageKind.CONST_CALLS_NON_CONST);
+        MessageKind kind = isImplicitSuperCall
+                           ? MessageKind.CONST_CALLS_NON_CONST_FOR_IMPLICIT
+                           : MessageKind.CONST_CALLS_NON_CONST;
+        visitor.compiler.reportError(diagnosticNode, kind);
       }
     }
   }
diff --git a/pkg/compiler/lib/src/resolution/members.dart b/pkg/compiler/lib/src/resolution/members.dart
index 0ea0739..8d05b11 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -187,6 +187,44 @@
     return new ErroneousElementX(kind, arguments, name, enclosingElement);
   }
 
+  /// Report a warning or error on an unresolved access in non-instance context.
+  ///
+  /// The [ErroneousElement] corresponding to the message is returned.
+  ErroneousElement reportCannotResolve(Node node, String name) {
+    assert(invariant(node, !inInstanceContext,
+        message: "ResolverVisitor.reportCannotResolve must not be called in "
+                 "instance context."));
+
+    // We report an error within initializers because `this` is implicitly
+    // accessed when unqualified identifiers are not resolved.  For
+    // details, see section 16.14.3 of the spec (2nd edition):
+    //   An unqualified invocation `i` of the form `id(a1, ...)`
+    //   ...
+    //   If `i` does not occur inside a top level or static function, `i`
+    //   is equivalent to `this.id(a1 , ...)`.
+    bool inInitializer =
+        enclosingElement.isGenerativeConstructor ||
+        (enclosingElement.isInstanceMember && enclosingElement.isField);
+    MessageKind kind;
+    Map arguments = {'name': name};
+    if (inInitializer) {
+      kind = MessageKind.CANNOT_RESOLVE_IN_INITIALIZER;
+    } else if (name == 'await') {
+      var functionName = enclosingElement.name;
+      if (functionName == '') {
+        kind = MessageKind.CANNOT_RESOLVE_AWAIT_IN_CLOSURE;
+      } else {
+        kind = MessageKind.CANNOT_RESOLVE_AWAIT;
+        arguments['functionName'] = functionName;
+      }
+    } else {
+      kind = MessageKind.CANNOT_RESOLVE;
+    }
+    registry.registerThrowNoSuchMethod();
+    return reportAndCreateErroneousElement(
+        node, name, kind, arguments, isError: inInitializer);
+  }
+
   ResolutionResult visitIdentifier(Identifier node) {
     if (node.isThis()) {
       if (!inInstanceContext) {
@@ -211,36 +249,10 @@
         // Set the type to be `dynamic` to mark that this is a type literal.
         registry.setType(node, const DynamicType());
       }
-      element = reportLookupErrorIfAny(element, node, node.source);
+      element = reportLookupErrorIfAny(element, node, name);
       if (element == null) {
         if (!inInstanceContext) {
-          // We report an error within initializers because `this` is implicitly
-          // accessed when unqualified identifiers are not resolved.  For
-          // details, see section 16.14.3 of the spec (2nd edition):
-          //   An unqualified invocation `i` of the form `id(a1, ...)`
-          //   ...
-          //   If `i` does not occur inside a top level or static function, `i`
-          //   is equivalent to `this.id(a1 , ...)`.
-          bool inInitializer = enclosingElement.isGenerativeConstructor ||
-              (enclosingElement.isInstanceMember && enclosingElement.isField);
-          MessageKind kind;
-          Map arguments = {'name': name};
-          if (inInitializer) {
-            kind = MessageKind.CANNOT_RESOLVE_IN_INITIALIZER;
-          } else if (name == 'await') {
-            var functionName = enclosingElement.name;
-            if (functionName == '') {
-              kind = MessageKind.CANNOT_RESOLVE_AWAIT_IN_CLOSURE;
-            } else {
-              kind = MessageKind.CANNOT_RESOLVE_AWAIT;
-              arguments['functionName'] = functionName;
-            }
-          } else {
-            kind = MessageKind.CANNOT_RESOLVE;
-          }
-          element = reportAndCreateErroneousElement(node, name, kind,
-              arguments, isError: inInitializer);
-          registry.registerThrowNoSuchMethod();
+          element = reportCannotResolve(node, name);
         }
       } else if (element.isErroneous) {
         // Use the erroneous element.
@@ -485,21 +497,7 @@
       // If this send is of the form "assert(expr);", then
       // this is an assertion.
       if (selector.isAssert) {
-        SendStructure sendStructure = const AssertStructure();
-        if (selector.argumentCount != 1) {
-          error(node.selector,
-                MessageKind.WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT,
-                {'argumentCount': selector.argumentCount});
-          sendStructure = const InvalidAssertStructure();
-        } else if (selector.namedArgumentCount != 0) {
-          error(node.selector,
-                MessageKind.ASSERT_IS_GIVEN_NAMED_ARGUMENTS,
-                {'argumentCount': selector.namedArgumentCount});
-          sendStructure = const InvalidAssertStructure();
-        }
-        registry.registerAssert(node);
-        registry.registerSendStructure(node, sendStructure);
-        return const AssertResult();
+        internalError(node, "Unexpected assert: $node");
       }
 
       return node.selector.accept(this);
@@ -709,17 +707,20 @@
     return selector;
   }
 
-  void resolveArguments(NodeList list) {
-    if (list == null) return;
+  CallStructure resolveArguments(NodeList list) {
+    if (list == null) return null;
     bool oldSendIsMemberAccess = sendIsMemberAccess;
     sendIsMemberAccess = false;
     Map<String, Node> seenNamedArguments = new Map<String, Node>();
+    int argumentCount = 0;
+    List<String> namedArguments = <String>[];
     for (Link<Node> link = list.nodes; !link.isEmpty; link = link.tail) {
       Expression argument = link.head;
       visit(argument);
       NamedArgument namedArgument = argument.asNamedArgument();
       if (namedArgument != null) {
         String source = namedArgument.name.source;
+        namedArguments.add(source);
         if (seenNamedArguments.containsKey(source)) {
           reportDuplicateDefinition(
               source,
@@ -731,8 +732,10 @@
       } else if (!seenNamedArguments.isEmpty) {
         error(argument, MessageKind.INVALID_ARGUMENT_AFTER_NAMED);
       }
+      argumentCount++;
     }
     sendIsMemberAccess = oldSendIsMemberAccess;
+    return new CallStructure(argumentCount, namedArguments);
   }
 
   void registerTypeLiteralAccess(Send node, Element target) {
@@ -770,9 +773,14 @@
   }
 
   /// Check that access to `super` is currently allowed.
-  bool checkSuperAccess(Node node) {
+  bool checkSuperAccess(Send node) {
     if (!inInstanceContext) {
-      compiler.reportError(node, MessageKind.NO_SUPER_AVAILABLE);
+      compiler.reportError(node, MessageKind.NO_SUPER_IN_STATIC);
+      return false;
+    }
+    if (node.isConditional) {
+      // `super?.foo` is not allowed.
+      compiler.reportError(node, MessageKind.INVALID_USE_OF_SUPER);
       return false;
     }
     if (currentClass.supertype == null) {
@@ -786,6 +794,15 @@
     return true;
   }
 
+  /// Check that access to `this` is currently allowed.
+  bool checkThisAccess(Send node) {
+    if (!inInstanceContext) {
+      compiler.reportError(node, MessageKind.NO_THIS_AVAILABLE);
+      return false;
+    }
+    return true;
+  }
+
   /// Compute the [AccessSemantics] corresponding to a super access of [target].
   AccessSemantics computeSuperAccess(Spannable node, Element target) {
     if (target.isErroneous) {
@@ -803,6 +820,22 @@
     }
   }
 
+  /// Compute the [AccessSemantics] for accessing the name of [selector] on the
+  /// super class.
+  ///
+  /// If no matching super member is found and error is reported and
+  /// `noSuchMethod` on `super` is registered. Furthermore, if [alternateName]
+  /// is provided, the [AccessSemantics] corresponding to the alternate name is
+  /// returned. For instance, the access of a super setter for an unresolved
+  /// getter:
+  ///
+  ///     class Super {
+  ///       set name(_) {}
+  ///     }
+  ///     class Sub extends Super {
+  ///       foo => super.name; // Access to the setter.
+  ///     }
+  ///
   AccessSemantics computeSuperSemantics(Spannable node,
                                         Selector selector,
                                         {Name alternateName}) {
@@ -830,6 +863,8 @@
     return computeSuperAccess(node, target);
   }
 
+  /// Resolve [node] as subexpression that is _not_ the prefix of a member
+  /// access. For instance `a` in `a + b`, as opposed to `a` in `a.b`.
   ResolutionResult visitExpression(Node node) {
     bool oldSendIsMemberAccess = sendIsMemberAccess;
     sendIsMemberAccess = false;
@@ -838,6 +873,7 @@
     return result;
   }
 
+  /// Handle a type test expression, like `a is T` and `a is! T`.
   ResolutionResult handleIs(Send node) {
     Node expression = node.receiver;
     visitExpression(expression);
@@ -864,6 +900,7 @@
     return null;
   }
 
+  /// Handle a type cast expression, like `a as T`.
   ResolutionResult handleAs(Send node) {
     Node expression = node.receiver;
     visitExpression(expression);
@@ -875,6 +912,8 @@
     return null;
   }
 
+  /// Handle the unary expression of an unresolved unary operator [text], like
+  /// the no longer supported `+a`.
   ResolutionResult handleUnresolvedUnary(Send node, String text) {
     Node expression = node.receiver;
     if (node.isSuperCall) {
@@ -887,6 +926,8 @@
     return null;
   }
 
+  /// Handle the unary expression of a user definable unary [operator], like
+  /// `-a`, and `-super`.
   ResolutionResult handleUserDefinableUnary(Send node, UnaryOperator operator) {
     Node expression = node.receiver;
     Selector selector = operator.selector;
@@ -921,6 +962,7 @@
     return null;
   }
 
+  /// Handle a not expression, like `!a`.
   ResolutionResult handleNot(Send node, UnaryOperator operator) {
     assert(invariant(node, operator.kind == UnaryOperatorKind.NOT));
 
@@ -931,6 +973,7 @@
     return null;
   }
 
+  /// Handle a logical and expression, like `a && b`.
   ResolutionResult handleLogicalAnd(Send node) {
     Node left = node.receiver;
     Node right = node.arguments.head;
@@ -940,6 +983,7 @@
     return null;
   }
 
+  /// Handle a logical or expression, like `a || b`.
   ResolutionResult handleLogicalOr(Send node) {
     Node left = node.receiver;
     Node right = node.arguments.head;
@@ -949,6 +993,7 @@
     return null;
   }
 
+  /// Handle an if-null expression, like `a ?? b`.
   ResolutionResult handleIfNull(Send node) {
     Node left = node.receiver;
     Node right = node.arguments.head;
@@ -958,6 +1003,8 @@
     return null;
   }
 
+  /// Handle the binary expression of an unresolved binary operator [text], like
+  /// the no longer supported `a === b`.
   ResolutionResult handleUnresolvedBinary(Send node, String text) {
     Node left = node.receiver;
     Node right = node.arguments.head;
@@ -971,6 +1018,8 @@
     return null;
   }
 
+  /// Handle the binary expression of a user definable binary [operator], like
+  /// `a + b`, `super + b`, `a == b` and `a != b`.
   ResolutionResult handleUserDefinableBinary(Send node,
                                              BinaryOperator operator) {
     Node left = node.receiver;
@@ -997,7 +1046,6 @@
         // TODO(johnniwinther): Remove this when all information goes through
         // the [SendStructure].
         registry.useElement(node, semantics.element);
-
       }
     } else {
       visitExpression(left);
@@ -1048,65 +1096,333 @@
     return null;
   }
 
-  ResolutionResult visitSend(Send node) {
-    if (node.isOperator) {
-      String operatorText = node.selector.asOperator().source;
-      if (operatorText == 'is') {
-        return handleIs(node);
-      } else if (operatorText  == 'as') {
-        return handleAs(node);
-      } else if (node.arguments.isEmpty) {
-        UnaryOperator operator = UnaryOperator.parse(operatorText);
-        if (operator == null) {
-          return handleUnresolvedUnary(node, operatorText);
-        } else {
-          switch (operator.kind) {
-            case UnaryOperatorKind.NOT:
-              return handleNot(node, operator);
-            case UnaryOperatorKind.COMPLEMENT:
-            case UnaryOperatorKind.NEGATE:
-              assert(invariant(node, operator.isUserDefinable,
-                  message: "Unexpected unary operator '${operator}'."));
-              return handleUserDefinableUnary(node, operator);
-          }
-          return handleUserDefinableUnary(node, operator);
+  /// Handle an invocation of an expression, like `(){}()` or `(foo)()`.
+  ResolutionResult handleExpressionInvoke(Send node) {
+    assert(invariant(node, node.isCall,
+        message: "Unexpected expression: $node"));
+    Node expression = node.selector;
+    visitExpression(expression);
+    CallStructure callStructure = resolveArguments(node.argumentsNode);
+    Selector selector = callStructure.callSelector;
+    // TODO(johnniwinther): Remove this when all information goes through the
+    // [SendStructure].
+    registry.setSelector(node, selector);
+    registry.registerDynamicInvocation(selector);
+    registry.registerSendStructure(node,
+        new InvokeStructure(new AccessSemantics.expression(), selector));
+    return null;
+  }
+
+  /// Handle a, possibly invalid, assertion, like `assert(cond)` or `assert()`.
+  ResolutionResult handleAssert(Send node) {
+    assert(invariant(node, node.isCall,
+        message: "Unexpected assert: $node"));
+    // If this send is of the form "assert(expr);", then
+    // this is an assertion.
+
+    CallStructure callStructure = resolveArguments(node.argumentsNode);
+    SendStructure sendStructure = const AssertStructure();
+    if (callStructure.argumentCount != 1) {
+      compiler.reportError(
+          node.selector,
+          MessageKind.WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT,
+          {'argumentCount': callStructure.argumentCount});
+      sendStructure = const InvalidAssertStructure();
+    } else if (callStructure.namedArgumentCount != 0) {
+      compiler.reportError(
+          node.selector,
+          MessageKind.ASSERT_IS_GIVEN_NAMED_ARGUMENTS,
+          {'argumentCount': callStructure.namedArgumentCount});
+      sendStructure = const InvalidAssertStructure();
+    }
+    registry.registerAssert(node);
+    registry.registerSendStructure(node, sendStructure);
+    return const AssertResult();
+  }
+
+  /// Handle access of a property of [name] on `this`, like `this.name` and
+  /// `this.name()`, or `name` and `name()` in instance context.
+  ResolutionResult handleThisPropertyAccess(Send node, Name name) {
+    AccessSemantics accessSemantics = new AccessSemantics.thisProperty();
+    SendStructure sendStructure;
+    Selector selector;
+    if (node.isCall) {
+      CallStructure callStructure = resolveArguments(node.argumentsNode);
+      selector = new Selector(SelectorKind.CALL, name, callStructure);
+      registry.registerDynamicInvocation(selector);
+      sendStructure = new InvokeStructure(accessSemantics, selector);
+    } else {
+      assert(invariant(node, node.isPropertyAccess));
+      selector = new Selector(
+          SelectorKind.GETTER, name, CallStructure.NO_ARGS);
+      registry.registerDynamicGetter(selector);
+      sendStructure = new GetStructure(accessSemantics, selector);
+    }
+    registry.registerSendStructure(node, sendStructure);
+    // TODO(johnniwinther): Remove this when all information goes through
+    // the [SendStructure].
+    registry.setSelector(node, selector);
+    return null;
+  }
+
+  /// Handle access on `this`, like `this()` and `this` when it is parsed as a
+  /// [Send] node.
+  ResolutionResult handleThisAccess(Send node) {
+    AccessSemantics accessSemantics = new AccessSemantics.thisAccess();
+    if (node.isCall) {
+      CallStructure callStructure = resolveArguments(node.argumentsNode);
+      Selector selector = callStructure.callSelector;
+      // TODO(johnniwinther): Handle invalid this access as an
+      // [AccessSemantics].
+      if (checkThisAccess(node)) {
+        registry.registerDynamicInvocation(selector);
+        registry.registerSendStructure(node,
+            new InvokeStructure(accessSemantics, selector));
+      }
+      // TODO(johnniwinther): Remove this when all information goes through
+      // the [SendStructure].
+      registry.setSelector(node, selector);
+    } else {
+      // TODO(johnniwinther): Handle get of `this` when it is a [Send] node.
+      internalError(node, "Unexpected node '$node'.");
+    }
+    return null;
+  }
+
+  /// Handle access of a super property, like `super.foo` and `super.foo()`.
+  ResolutionResult handleSuperPropertyAccess(Send node, Name name) {
+    Element target;
+    Selector selector;
+    CallStructure callStructure = CallStructure.NO_ARGS;
+    if (node.isCall) {
+      callStructure = resolveArguments(node.argumentsNode);
+      selector = new Selector(SelectorKind.CALL, name, callStructure);
+    } else {
+      selector = new Selector(SelectorKind.GETTER, name, callStructure);
+    }
+    if (checkSuperAccess(node)) {
+      AccessSemantics semantics = computeSuperSemantics(
+          node, selector, alternateName: name.setter);
+      if (node.isCall) {
+        bool isIncompatibleInvoke = false;
+        switch (semantics.kind) {
+          case AccessKind.SUPER_METHOD:
+            MethodElementX superMethod = semantics.element;
+            superMethod.computeSignature(compiler);
+            if (!callStructure.signatureApplies(superMethod)) {
+              registry.registerThrowNoSuchMethod();
+              registry.registerDynamicInvocation(selector);
+              registry.registerSuperNoSuchMethod();
+              isIncompatibleInvoke = true;
+            } else {
+              registry.registerStaticInvocation(semantics.element);
+            }
+            break;
+          case AccessKind.SUPER_FIELD:
+          case AccessKind.SUPER_GETTER:
+            registry.registerStaticUse(semantics.element);
+            selector = callStructure.callSelector;
+            registry.registerDynamicInvocation(selector);
+            break;
+          case AccessKind.SUPER_SETTER:
+          case AccessKind.UNRESOLVED_SUPER:
+            // NoSuchMethod registered in [computeSuperSemantics].
+            break;
+          default:
+            internalError(node, "Unexpected super property access $semantics.");
+            break;
         }
+        registry.registerSendStructure(node,
+            isIncompatibleInvoke
+                ? new IncompatibleInvokeStructure(semantics, selector)
+                : new InvokeStructure(semantics, selector));
       } else {
-        BinaryOperator operator = BinaryOperator.parse(operatorText);
-        if (operator == null) {
-          return handleUnresolvedBinary(node, operatorText);
-        } else {
-          switch (operator.kind) {
-            case BinaryOperatorKind.LOGICAL_AND:
-              return handleLogicalAnd(node);
-            case BinaryOperatorKind.LOGICAL_OR:
-              return handleLogicalOr(node);
-            case BinaryOperatorKind.IF_NULL:
-              return handleIfNull(node);
-            case BinaryOperatorKind.EQ:
-            case BinaryOperatorKind.NOT_EQ:
-            case BinaryOperatorKind.INDEX:
-            case BinaryOperatorKind.ADD:
-            case BinaryOperatorKind.SUB:
-            case BinaryOperatorKind.MUL:
-            case BinaryOperatorKind.DIV:
-            case BinaryOperatorKind.IDIV:
-            case BinaryOperatorKind.MOD:
-            case BinaryOperatorKind.SHL:
-            case BinaryOperatorKind.SHR:
-            case BinaryOperatorKind.GTEQ:
-            case BinaryOperatorKind.GT:
-            case BinaryOperatorKind.LTEQ:
-            case BinaryOperatorKind.LT:
-            case BinaryOperatorKind.AND:
-            case BinaryOperatorKind.OR:
-            case BinaryOperatorKind.XOR:
-              return handleUserDefinableBinary(node, operator);
-          }
+        switch (semantics.kind) {
+          case AccessKind.SUPER_METHOD:
+            // TODO(johnniwinther): Method this should be registered as a
+            // closurization.
+            registry.registerStaticUse(semantics.element);
+            break;
+          case AccessKind.SUPER_FIELD:
+          case AccessKind.SUPER_GETTER:
+            registry.registerStaticUse(semantics.element);
+            break;
+          case AccessKind.SUPER_SETTER:
+          case AccessKind.UNRESOLVED_SUPER:
+            // NoSuchMethod registered in [computeSuperSemantics].
+            break;
+          default:
+            internalError(node, "Unexpected super property access $semantics.");
+            break;
+        }
+        registry.registerSendStructure(node,
+            new GetStructure(semantics, selector));
+      }
+      target = semantics.element;
+    }
+
+    // TODO(johnniwinther): Remove these when all information goes through
+    // the [SendStructure].
+    registry.useElement(node, target);
+    registry.setSelector(node, selector);
+    return null;
+  }
+
+  /// Handle a [Send] whose selector is an [Operator], like `a && b`, `a is T`,
+  /// `a + b`, and `~a`.
+  ResolutionResult handleOperatorSend(Send node) {
+    String operatorText = node.selector.asOperator().source;
+    if (operatorText == 'is') {
+      return handleIs(node);
+    } else if (operatorText  == 'as') {
+      return handleAs(node);
+    } else if (node.arguments.isEmpty) {
+      UnaryOperator operator = UnaryOperator.parse(operatorText);
+      if (operator == null) {
+        return handleUnresolvedUnary(node, operatorText);
+      } else {
+        switch (operator.kind) {
+          case UnaryOperatorKind.NOT:
+            return handleNot(node, operator);
+          case UnaryOperatorKind.COMPLEMENT:
+          case UnaryOperatorKind.NEGATE:
+            assert(invariant(node, operator.isUserDefinable,
+                message: "Unexpected unary operator '${operator}'."));
+            return handleUserDefinableUnary(node, operator);
+        }
+        return handleUserDefinableUnary(node, operator);
+      }
+    } else {
+      BinaryOperator operator = BinaryOperator.parse(operatorText);
+      if (operator == null) {
+        return handleUnresolvedBinary(node, operatorText);
+      } else {
+        switch (operator.kind) {
+          case BinaryOperatorKind.LOGICAL_AND:
+            return handleLogicalAnd(node);
+          case BinaryOperatorKind.LOGICAL_OR:
+            return handleLogicalOr(node);
+          case BinaryOperatorKind.IF_NULL:
+            return handleIfNull(node);
+          case BinaryOperatorKind.EQ:
+          case BinaryOperatorKind.NOT_EQ:
+          case BinaryOperatorKind.INDEX:
+          case BinaryOperatorKind.ADD:
+          case BinaryOperatorKind.SUB:
+          case BinaryOperatorKind.MUL:
+          case BinaryOperatorKind.DIV:
+          case BinaryOperatorKind.IDIV:
+          case BinaryOperatorKind.MOD:
+          case BinaryOperatorKind.SHL:
+          case BinaryOperatorKind.SHR:
+          case BinaryOperatorKind.GTEQ:
+          case BinaryOperatorKind.GT:
+          case BinaryOperatorKind.LTEQ:
+          case BinaryOperatorKind.LT:
+          case BinaryOperatorKind.AND:
+          case BinaryOperatorKind.OR:
+          case BinaryOperatorKind.XOR:
+            return handleUserDefinableBinary(node, operator);
         }
       }
     }
+  }
 
+  /// Handle a qualified [Send], that is where the receiver is non-null, like
+  /// `a.b`, `a.b()`, `this.a()` and `super.a()`.
+  ResolutionResult handleQualifiedSend(Send node) {
+    Identifier selector = node.selector.asIdentifier();
+    Name name = new Name(selector.source, enclosingElement.library);
+    if (node.isSuperCall) {
+      return handleSuperPropertyAccess(node, name);
+    } else if (node.receiver.isThis()) {
+      if (checkThisAccess(node)) {
+        return handleThisPropertyAccess(node, name);
+      }
+      // TODO(johnniwinther): Handle invalid this access as an
+      // [AccessSemantics].
+      return null;
+    }
+    // TODO(johnniwinther): Handle remaining qualified sends.
+    return oldVisitSend(node);
+  }
+
+  /// Handle access unresolved access to [name] in a non-instance context.
+  ResolutionResult handleUnresolvedAccess(
+        Send node, Name name, Element element) {
+    // TODO(johnniwinther): Support unresolved top level access as an
+    // [AccessSemantics].
+    AccessSemantics accessSemantics = new StaticAccess.unresolved(element);
+    SendStructure sendStructure;
+    Selector selector;
+    if (node.isCall) {
+      CallStructure callStructure = resolveArguments(node.argumentsNode);
+      selector = new Selector(SelectorKind.CALL, name, callStructure);
+      registry.registerDynamicInvocation(selector);
+      sendStructure = new InvokeStructure(accessSemantics, selector);
+    } else {
+      assert(invariant(node, node.isPropertyAccess));
+      selector = new Selector(
+          SelectorKind.GETTER, name, CallStructure.NO_ARGS);
+      registry.registerDynamicGetter(selector);
+      sendStructure = new GetStructure(accessSemantics, selector);
+    }
+    // TODO(johnniwinther): Remove this when all information goes through
+    // the [SendStructure].
+    registry.setSelector(node, selector);
+    registry.useElement(node, element);
+    registry.registerSendStructure(node, sendStructure);
+    return null;
+  }
+
+  /// Handle an unqualified [Send], that is where the `node.receiver` is null,
+  /// like `a`, `a()`, `this()`, `assert()`, and `(){}()`.
+  ResolutionResult handleUnqualifiedSend(Send node) {
+    Identifier selector = node.selector.asIdentifier();
+    if (selector == null) {
+      // `(){}()` and `(foo)()`.
+      return handleExpressionInvoke(node);
+    }
+    String text = selector.source;
+    if (text == 'assert') {
+      // `assert()`.
+      return handleAssert(node);
+    } else if (text == 'this') {
+      // `this()`.
+      return handleThisAccess(node);
+    } else if (text == 'dynamic') {
+      // `dynamic` || `dynamic()`.
+      // TODO(johnniwinther): Handle dynamic type literal access.
+      return oldVisitSend(node);
+    }
+    // `name` or `name()`
+    Name name = new Name(text, enclosingElement.library);
+    Element element = lookupInScope(compiler, node, scope, text);
+    if (element == null) {
+      if (inInstanceContext) {
+        // Implicitly `this.name`.
+        return handleThisPropertyAccess(node, name);
+      } else {
+        // Create [ErroneousElement] for unresolved access.
+        ErroneousElement error = reportCannotResolve(node, text);
+        return handleUnresolvedAccess(node, name, error);
+      }
+    }
+    return oldVisitSend(node);
+  }
+
+  ResolutionResult visitSend(Send node) {
+    if (node.isOperator) {
+      return handleOperatorSend(node);
+    } else if (node.receiver != null) {
+      return handleQualifiedSend(node);
+    } else {
+      return handleUnqualifiedSend(node);
+    }
+    return oldVisitSend(node);
+  }
+
+  ResolutionResult oldVisitSend(Send node) {
     bool oldSendIsMemberAccess = sendIsMemberAccess;
     sendIsMemberAccess = node.isPropertyAccess || node.isCall;
 
@@ -1190,17 +1506,12 @@
         if (!selector.applies(target, compiler.world)) {
           registry.registerThrowNoSuchMethod();
           if (node.isSuperCall) {
-            // Similar to what we do when we can't find super via selector
-            // in [resolveSend] above, we still need to register the invocation,
-            // because we might call [:super.noSuchMethod:] which calls
-            // [JSInvocationMirror._invokeOn].
-            registry.registerDynamicInvocation(selector);
-            registry.registerSuperNoSuchMethod();
+            internalError(node, "Unexpected super call $node");
           }
         }
       }
 
-      if (target != null && target.isForeign(compiler.backend)) {
+      if (target != null && compiler.backend.isForeign(target)) {
         if (selector.name == 'JS') {
           registry.registerJsCall(node, this);
         } else if (selector.name == 'JS_EMBEDDED_GLOBAL') {
@@ -1229,8 +1540,7 @@
 
   /// Callback for native enqueuer to parse a type.  Returns [:null:] on error.
   DartType resolveTypeFromString(Node node, String typeName) {
-    Element element = lookupInScope(compiler, node,
-                                    scope, typeName);
+    Element element = lookupInScope(compiler, node, scope, typeName);
     if (element == null) return null;
     if (element is! ClassElement) return null;
     ClassElement cls = element;
diff --git a/pkg/compiler/lib/src/resolution/operators.dart b/pkg/compiler/lib/src/resolution/operators.dart
index 594e0a0..4b9ec51 100644
--- a/pkg/compiler/lib/src/resolution/operators.dart
+++ b/pkg/compiler/lib/src/resolution/operators.dart
@@ -170,7 +170,7 @@
 
   /// The if-null ?? operator.
   static const BinaryOperator IF_NULL =
-      const _LogicalOperator(BinaryOperatorKind.IF_NULL, '??');
+      const _IfNullOperator(BinaryOperatorKind.IF_NULL, '??');
 
   static BinaryOperator parse(String value) {
     switch (value) {
@@ -221,6 +221,16 @@
   String get selectorName => null;
 }
 
+/// The operators ?? is not user definable.
+class _IfNullOperator extends BinaryOperator {
+  const _IfNullOperator(BinaryOperatorKind kind, String name)
+      : super._(kind, name);
+
+  bool get isUserDefinable => false;
+
+  String get selectorName => '??';
+}
+
 enum AssignmentOperatorKind {
   ASSIGN,
   IF_NULL,
diff --git a/pkg/compiler/lib/src/resolution/registry.dart b/pkg/compiler/lib/src/resolution/registry.dart
index 70209b2..7d24835 100644
--- a/pkg/compiler/lib/src/resolution/registry.dart
+++ b/pkg/compiler/lib/src/resolution/registry.dart
@@ -8,14 +8,177 @@
 /// related information in a [TreeElements] mapping and registers calls with
 /// [Backend], [World] and [Enqueuer].
 // TODO(johnniwinther): Split this into an interface and implementation class.
-class ResolutionRegistry extends Registry {
+
+class EagerRegistry implements Registry {
   final Compiler compiler;
   final TreeElementMapping mapping;
 
+  EagerRegistry(this.compiler, this.mapping);
+
+  ResolutionEnqueuer get world => compiler.enqueuer.resolution;
+
+  @override
+  bool get isForResolution => true;
+
+  @override
+  Iterable<Element> get otherDependencies => mapping.otherDependencies;
+
+  @override
+  void registerDependency(Element element) {
+    mapping.registerDependency(element);
+  }
+
+  @override
+  void registerDynamicGetter(Selector selector) {
+    world.registerDynamicGetter(selector);
+  }
+
+  @override
+  void registerDynamicInvocation(Selector selector) {
+    world.registerDynamicInvocation(selector);
+  }
+
+  @override
+  void registerDynamicSetter(Selector selector) {
+    world.registerDynamicSetter(selector);
+  }
+
+  @override
+  void registerGetOfStaticFunction(FunctionElement element) {
+    world.registerGetOfStaticFunction(element);
+  }
+
+  @override
+  void registerInstantiation(InterfaceType type) {
+    // TODO(johnniwinther): Remove the need for passing `this`.
+    world.registerInstantiatedType(type, this);
+  }
+
+  @override
+  void registerStaticInvocation(Element element) {
+    registerDependency(element);
+    world.registerStaticUse(element);
+  }
+}
+
+class ResolutionWorldImpact implements WorldImpact {
+  final Registry registry;
+  Setlet<Selector> _dynamicInvocations;
+  Setlet<Selector> _dynamicGetters;
+  Setlet<Selector> _dynamicSetters;
+  Setlet<InterfaceType> _instantiatedTypes;
+  Setlet<Element> _staticUses;
+  Setlet<DartType> _checkedTypes;
+  Setlet<MethodElement> _closurizedFunctions;
+
+  ResolutionWorldImpact(Compiler compiler, TreeElementMapping mapping)
+      : this.registry = new EagerRegistry(compiler, mapping);
+
+  void registerDynamicGetter(Selector selector) {
+    if (_dynamicGetters == null) {
+      _dynamicGetters = new Setlet<Selector>();
+    }
+    _dynamicGetters.add(selector);
+  }
+
+  @override
+  Iterable<Selector> get dynamicGetters {
+    return _dynamicGetters != null ? _dynamicGetters : const <Selector>[];
+  }
+
+  void registerDynamicInvocation(Selector selector) {
+    if (_dynamicInvocations == null) {
+      _dynamicInvocations = new Setlet<Selector>();
+    }
+    _dynamicInvocations.add(selector);
+  }
+
+  @override
+  Iterable<Selector> get dynamicInvocations {
+    return _dynamicInvocations != null
+        ? _dynamicInvocations : const <Selector>[];
+  }
+
+  void registerDynamicSetter(Selector selector) {
+    if (_dynamicSetters == null) {
+      _dynamicSetters = new Setlet<Selector>();
+    }
+    _dynamicSetters.add(selector);
+  }
+
+  @override
+  Iterable<Selector> get dynamicSetters {
+    return _dynamicSetters != null ? _dynamicSetters : const <Selector>[];
+  }
+
+  void registerInstantiatedType(InterfaceType type) {
+    // TODO(johnniwinther): Enable this when registration doesn't require a
+    // [Registry].
+    throw new UnsupportedError(
+        'Lazy registration of instantiated not supported.');
+    if (_instantiatedTypes == null) {
+      _instantiatedTypes = new Setlet<InterfaceType>();
+    }
+    _instantiatedTypes.add(type);
+  }
+
+  @override
+  Iterable<InterfaceType> get instantiatedTypes {
+    return _instantiatedTypes != null
+        ? _instantiatedTypes : const <InterfaceType>[];
+  }
+
+  void registerStaticUse(Element element) {
+    if (_staticUses == null) {
+      _staticUses = new Setlet<Element>();
+    }
+    _staticUses.add(element);
+  }
+
+  @override
+  Iterable<Element> get staticUses {
+    return _staticUses != null ? _staticUses : const <Element>[];
+  }
+
+  void registerCheckedType(DartType type) {
+    if (_checkedTypes == null) {
+      _checkedTypes = new Setlet<DartType>();
+    }
+    _checkedTypes.add(type);
+  }
+
+  @override
+  Iterable<DartType> get checkedTypes {
+    return _checkedTypes != null
+        ? _checkedTypes : const <DartType>[];
+  }
+
+  void registerClosurizedFunction(MethodElement element) {
+    if (_closurizedFunctions == null) {
+      _closurizedFunctions = new Setlet<MethodElement>();
+    }
+    _closurizedFunctions.add(element);
+  }
+
+  @override
+  Iterable<MethodElement> get closurizedFunctions {
+    return _closurizedFunctions != null
+        ? _closurizedFunctions : const <MethodElement>[];
+  }
+}
+
+class ResolutionRegistry implements Registry {
+  final Compiler compiler;
+  final TreeElementMapping mapping;
+  final ResolutionWorldImpact worldImpact;
+
   ResolutionRegistry(Compiler compiler, Element element)
       : this.internal(compiler, _ensureTreeElements(element));
 
-  ResolutionRegistry.internal(this.compiler, this.mapping);
+  ResolutionRegistry.internal(Compiler compiler, TreeElementMapping mapping)
+      : this.compiler = compiler,
+        this.mapping = mapping,
+        this.worldImpact = new ResolutionWorldImpact(compiler, mapping);
 
   bool get isForResolution => true;
 
@@ -190,15 +353,19 @@
   //////////////////////////////////////////////////////////////////////////////
 
   void registerStaticUse(Element element) {
-    world.registerStaticUse(element);
+    worldImpact.registerStaticUse(element);
   }
 
   void registerImplicitSuperCall(FunctionElement superConstructor) {
     universe.registerImplicitSuperCall(this, superConstructor);
   }
 
+  // TODO(johnniwinther): Remove this.
+  // Use [registerInstantiatedType] of `rawType` instead.
+  @deprecated
   void registerInstantiatedClass(ClassElement element) {
-    world.registerInstantiatedClass(element, this);
+    element.ensureResolved(compiler);
+    registerInstantiatedType(element.rawType);
   }
 
   void registerLazyField() {
@@ -223,7 +390,7 @@
   }
 
   void registerIsCheck(DartType type) {
-    world.registerIsCheck(type, this);
+    worldImpact.registerCheckedType(type);
     backend.resolutionCallbacks.onIsCheck(type, this);
   }
 
@@ -241,7 +408,7 @@
   }
 
   void registerDynamicInvocation(Selector selector) {
-    world.registerDynamicInvocation(selector);
+    worldImpact.registerDynamicInvocation(selector);
   }
 
   void registerSuperNoSuchMethod() {
@@ -259,7 +426,7 @@
   void registerTypeLiteral(Send node, DartType type) {
     mapping.setType(node, type);
     backend.resolutionCallbacks.onTypeLiteral(type, this);
-    world.registerInstantiatedClass(compiler.typeClass, this);
+    world.registerInstantiatedType(compiler.coreTypes.typeType, this);
   }
 
   void registerMapLiteral(Node node, DartType type, bool isConstant) {
@@ -286,15 +453,15 @@
   }
 
   void registerGetOfStaticFunction(FunctionElement element) {
-    world.registerGetOfStaticFunction(element);
+    worldImpact.registerClosurizedFunction(element);
   }
 
   void registerDynamicGetter(Selector selector) {
-    world.registerDynamicGetter(selector);
+    worldImpact.registerDynamicGetter(selector);
   }
 
   void registerDynamicSetter(Selector selector) {
-    world.registerDynamicSetter(selector);
+    worldImpact.registerDynamicSetter(selector);
   }
 
   void registerConstSymbol(String name) {
@@ -362,7 +529,7 @@
 
   void registerStaticInvocation(Element element) {
     if (element == null) return;
-    world.addToWorkList(element);
+    registerStaticUse(element);
     registerDependency(element);
   }
 
diff --git a/pkg/compiler/lib/src/resolution/resolution.dart b/pkg/compiler/lib/src/resolution/resolution.dart
index 2073cac..5cb7b3b 100644
--- a/pkg/compiler/lib/src/resolution/resolution.dart
+++ b/pkg/compiler/lib/src/resolution/resolution.dart
@@ -47,7 +47,7 @@
 
 import '../ordered_typeset.dart' show OrderedTypeSet, OrderedTypeSetBuilder;
 import '../util/util.dart';
-import '../universe/universe.dart' show CallStructure;
+import '../universe/universe.dart' show CallStructure, SelectorKind;
 
 import 'access_semantics.dart';
 import 'class_members.dart' show MembersCreator;
diff --git a/pkg/compiler/lib/src/resolution/resolution_common.dart b/pkg/compiler/lib/src/resolution/resolution_common.dart
index 6f257f4..d13b5f3 100644
--- a/pkg/compiler/lib/src/resolution/resolution_common.dart
+++ b/pkg/compiler/lib/src/resolution/resolution_common.dart
@@ -11,11 +11,11 @@
 
   String get name => 'Resolver';
 
-  TreeElements resolve(Element element) {
+  WorldImpact resolve(Element element) {
     return measure(() {
       if (Elements.isErroneous(element)) return null;
 
-      processMetadata([result]) {
+      WorldImpact processMetadata([WorldImpact result]) {
         for (MetadataAnnotation metadata in element.metadata) {
           metadata.ensureResolved(compiler);
         }
@@ -36,7 +36,7 @@
       if (element.isClass) {
         ClassElement cls = element;
         cls.ensureResolved(compiler);
-        return processMetadata();
+        return processMetadata(const WorldImpact());
       } else if (element.isTypedef) {
         TypedefElement typdef = element;
         return processMetadata(resolveTypedef(typdef));
@@ -69,7 +69,7 @@
 
   static void processAsyncMarker(Compiler compiler,
                                  BaseFunctionElementX element,
-                                 Registry registry) {
+                                 ResolutionRegistry registry) {
     FunctionExpression functionExpression = element.node;
     AsyncModifier asyncModifier = functionExpression.asyncModifier;
     if (asyncModifier != null) {
@@ -126,7 +126,7 @@
     return false;
   }
 
-  TreeElements resolveMethodElementImplementation(
+  WorldImpact resolveMethodElementImplementation(
       FunctionElement element, FunctionExpression tree) {
     return compiler.withCurrentElement(element, () {
       if (element.isExternal && tree.hasBody()) {
@@ -194,12 +194,12 @@
         error(tree, MessageKind.NO_SUCH_METHOD_IN_NATIVE);
       }
 
-      return resolutionTree;
+      return registry.worldImpact;
     });
 
   }
 
-  TreeElements resolveMethodElement(FunctionElementX element) {
+  WorldImpact resolveMethodElement(FunctionElementX element) {
     assert(invariant(element, element.isDeclaration));
     return compiler.withCurrentElement(element, () {
       if (compiler.enqueuer.resolution.hasBeenResolved(element)) {
@@ -208,7 +208,7 @@
         assert(invariant(element, element.isConstructor,
             message: 'Non-constructor element $element '
                      'has already been analyzed.'));
-        return element.resolvedAst.elements;
+        return const WorldImpact();
       }
       if (element.isSynthesized) {
         if (element.isGenerativeConstructor) {
@@ -224,10 +224,11 @@
             registry.registerStaticUse(target);
             registry.registerImplicitSuperCall(target);
           }
-          return registry.mapping;
+          return registry.worldImpact;
         } else {
           assert(element.isDeferredLoaderGetter || element.isErroneous);
-          return _ensureTreeElements(element);
+          _ensureTreeElements(element);
+          return const WorldImpact();
         }
       } else {
         element.parseNode(compiler);
@@ -254,7 +255,7 @@
         useEnclosingScope: useEnclosingScope);
   }
 
-  TreeElements resolveField(FieldElementX element) {
+  WorldImpact resolveField(FieldElementX element) {
     VariableDefinitions tree = element.parseNode(compiler);
     if(element.modifiers.isStatic && element.isTopLevel) {
       error(element.modifiers.getStatic(),
@@ -307,7 +308,7 @@
     // Perform various checks as side effect of "computing" the type.
     element.computeType(compiler);
 
-    return registry.mapping;
+    return registry.worldImpact;
   }
 
   DartType resolveTypeAnnotation(Element element, TypeAnnotation annotation) {
@@ -886,8 +887,8 @@
     });
   }
 
-  TreeElements resolveTypedef(TypedefElementX element) {
-    if (element.isResolved) return element.treeElements;
+  WorldImpact resolveTypedef(TypedefElementX element) {
+    if (element.isResolved) return const WorldImpact();
     compiler.world.allTypedefs.add(element);
     return _resolveTypeDeclaration(element, () {
       ResolutionRegistry registry = new ResolutionRegistry(compiler, element);
@@ -901,7 +902,7 @@
             new TypedefResolverVisitor(compiler, element, registry);
           visitor.visit(node);
           element.resolutionState = STATE_DONE;
-          return registry.mapping;
+          return registry.worldImpact;
         });
       });
     });
diff --git a/pkg/compiler/lib/src/resolution/semantic_visitor.dart b/pkg/compiler/lib/src/resolution/semantic_visitor.dart
index f90db1c..3cc1c22 100644
--- a/pkg/compiler/lib/src/resolution/semantic_visitor.dart
+++ b/pkg/compiler/lib/src/resolution/semantic_visitor.dart
@@ -91,16 +91,10 @@
     }
   }
 
-  visitInitializers(NodeList initializers, A arg) {
-    if (initializers != null) {
-      for (Node node in initializers) {
-        InitializerStructure structure = computeInitializerStructure(node);
-        if (structure == null) {
-          internalError(node, 'No structure for $node');
-        } else {
-          structure.dispatch(declVisitor, node, arg);
-        }
-      }
+  visitInitializers(FunctionExpression function, A arg) {
+    InitializersStructure initializers = computeInitializersStructure(function);
+    for (InitializerStructure structure in initializers.initializers) {
+      structure.dispatch(declVisitor, arg);
     }
   }
 
@@ -4009,8 +4003,8 @@
   /// Apply this visitor to the [parameters].
   applyParameters(NodeList parameters, A arg);
 
-  /// Apply this visitor to the constructor [initializers].
-  applyInitializers(NodeList initializers, A arg);
+  /// Apply this visitor to the initializers of [constructor].
+  applyInitializers(FunctionExpression constructor, A arg);
 
   /// A declaration of a top level [getter].
   ///
@@ -4395,6 +4389,8 @@
   ///       C(a) : this.a = a, super();
   ///     }
   ///
+  // TODO(johnniwinther): Replace [initializers] with a structure like
+  // [InitializersStructure] when computed in resolution.
   R visitGenerativeConstructorDeclaration(
       FunctionExpression node,
       ConstructorElement constructor,
@@ -4412,6 +4408,8 @@
   ///       C._();
   ///     }
   ///
+  // TODO(johnniwinther): Replace [initializers] with a single
+  // [ThisConstructorInvokeStructure] when computed in resolution.
   R visitRedirectingGenerativeConstructorDeclaration(
       FunctionExpression node,
       ConstructorElement constructor,
@@ -4499,7 +4497,24 @@
       ConstructorElement superConstructor,
       InterfaceType type,
       NodeList arguments,
-      Selector selector,
+      CallStructure callStructure,
+      A arg);
+
+  /// An implicit super constructor invocation of [superConstructor] from
+  /// generative constructor initializers.
+  ///
+  /// For instance `super(42)` in
+  ///     class B {
+  ///       B();
+  ///     }
+  ///     class C extends B {
+  ///       C(); // Implicit super call of B().
+  ///     }
+  ///
+  R visitImplicitSuperConstructorInvoke(
+      FunctionExpression node,
+      ConstructorElement superConstructor,
+      InterfaceType type,
       A arg);
 
   /// An super constructor invocation of an unresolved with [arguments] as
@@ -4533,7 +4548,7 @@
       Send node,
       ConstructorElement thisConstructor,
       NodeList arguments,
-      Selector selector,
+      CallStructure callStructure,
       A arg);
 
   /// An this constructor invocation of an unresolved constructor with
diff --git a/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart b/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart
index 69665d7..af43415 100644
--- a/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart
+++ b/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart
@@ -3117,7 +3117,7 @@
 abstract class InitializerBulkMixin<R, A>
     implements SemanticDeclarationVisitor<R, A>, BulkHandle<R, A> {
 
-  R bulkHandleInitializer(Send node, A arg) {
+  R bulkHandleInitializer(Node node, A arg) {
     return bulkHandleNode(
         node, "Initializer `#` unhandled.", arg);
   }
@@ -3166,7 +3166,16 @@
       ConstructorElement superConstructor,
       InterfaceType type,
       NodeList arguments,
-      Selector selector,
+      CallStructure callStructure,
+      A arg) {
+    return bulkHandleInitializer(node, arg);
+  }
+
+  @override
+  R visitImplicitSuperConstructorInvoke(
+      FunctionExpression node,
+      ConstructorElement superConstructor,
+      InterfaceType type,
       A arg) {
     return bulkHandleInitializer(node, arg);
   }
@@ -3176,7 +3185,7 @@
       Send node,
       ConstructorElement thisConstructor,
       NodeList arguments,
-      Selector selector,
+      CallStructure callStructure,
       A arg) {
     return bulkHandleInitializer(node, arg);
   }
@@ -3435,7 +3444,7 @@
   }
 
   @override
-  applyInitializers(NodeList initializers, A arg) {
+  applyInitializers(FunctionExpression constructor, A arg) {
     throw new UnimplementedError(
         "BulkDeclVisitor.applyInitializers unimplemented");
   }
@@ -6041,7 +6050,7 @@
   }
 
   @override
-  applyInitializers(NodeList initializers, A arg) {
+  applyInitializers(FunctionExpression constructor, A arg) {
     throw new UnimplementedError(
         "TraversalMixin.applyInitializers unimplemented");
   }
@@ -6105,7 +6114,7 @@
       Node body,
       A arg) {
     applyParameters(parameters, arg);
-    applyInitializers(initializers, arg);
+    applyInitializers(node, arg);
     apply(body, arg);
     return null;
   }
@@ -6154,7 +6163,7 @@
       NodeList initializers,
       A arg) {
     applyParameters(parameters, arg);
-    applyInitializers(initializers, arg);
+    applyInitializers(node, arg);
     return null;
   }
 
@@ -6176,18 +6185,27 @@
       ConstructorElement superConstructor,
       InterfaceType type,
       NodeList arguments,
-      Selector selector,
+      CallStructure callStructure,
       A arg) {
     apply(arguments, arg);
     return null;
   }
 
   @override
+  R visitImplicitSuperConstructorInvoke(
+      FunctionExpression node,
+      ConstructorElement superConstructor,
+      InterfaceType type,
+      A arg) {
+    return null;
+  }
+
+  @override
   R visitThisConstructorInvoke(
       Send node,
       ConstructorElement thisConstructor,
       NodeList arguments,
-      Selector selector,
+      CallStructure callStructure,
       A arg) {
     apply(arguments, arg);
     return null;
@@ -6483,8 +6501,8 @@
   }
 
   @override
-  applyInitializers(NodeList initializers, A arg) {
-    visitInitializers(initializers, arg);
+  applyInitializers(FunctionExpression constructor, A arg) {
+    visitInitializers(constructor, arg);
   }
 
   @override
diff --git a/pkg/compiler/lib/src/resolution/send_resolver.dart b/pkg/compiler/lib/src/resolution/send_resolver.dart
index a706f1c..5910234 100644
--- a/pkg/compiler/lib/src/resolution/send_resolver.dart
+++ b/pkg/compiler/lib/src/resolution/send_resolver.dart
@@ -269,33 +269,17 @@
     if (node.isOperator) {
       String operatorText = node.selector.asOperator().source;
       if (node.arguments.isEmpty) {
-        unaryOperator = UnaryOperator.parse(operatorText);
-        if (unaryOperator != null) {
-          switch (unaryOperator.kind) {
-            case UnaryOperatorKind.NOT:
-              kind = SendStructureKind.NOT;
-              break;
-            default:
-              kind = SendStructureKind.UNARY;
-              break;
-          }
-        } else {
-          return const InvalidUnaryStructure();
-        }
+        return internalError(node, "Unexpected unary $operatorText.");
       } else {
         binaryOperator = BinaryOperator.parse(operatorText);
         if (binaryOperator != null) {
           switch (binaryOperator.kind) {
             case BinaryOperatorKind.EQ:
               kind = SendStructureKind.EQ;
-              break;
+              return internalError(node, "Unexpected binary $kind.");
             case BinaryOperatorKind.NOT_EQ:
-              if (node.isSuperCall) {
-                // `super != foo` is a compile-time error.
-                return const InvalidBinaryStructure();
-              }
               kind = SendStructureKind.NOT_EQ;
-              break;
+              return internalError(node, "Unexpected binary $kind.");
             case BinaryOperatorKind.INDEX:
               if (node.isPrefix) {
                 kind = SendStructureKind.INDEX_PREFIX;
@@ -304,6 +288,7 @@
               } else if (node.arguments.tail.isEmpty) {
                 // a[b]
                 kind = SendStructureKind.INDEX;
+                return internalError(node, "Unexpected binary $kind.");
               } else {
                 if (kind == SendStructureKind.COMPOUND) {
                   // a[b] += c
@@ -316,10 +301,11 @@
               break;
             default:
               kind = SendStructureKind.BINARY;
-              break;
+              return internalError(node, "Unexpected binary $kind.");
           }
         } else {
-          return const InvalidBinaryStructure();
+          return internalError(
+              node, "Unexpected invalid binary $operatorText.");
         }
       }
     }
@@ -854,18 +840,48 @@
     }
   }
 
+  InitializersStructure computeInitializersStructure(FunctionExpression node) {
+    List<InitializerStructure> initializers = <InitializerStructure>[];
+    NodeList list = node.initializers;
+    bool constructorInvocationSeen = false;
+    if (list != null) {
+      for (Node initializer in list) {
+        InitializerStructure structure =
+            computeInitializerStructure(initializer);
+        if (structure.isConstructorInvoke) {
+          constructorInvocationSeen = true;
+        }
+        initializers.add(structure);
+      }
+    }
+    if (!constructorInvocationSeen) {
+      ConstructorElement currentConstructor = elements[node];
+      ClassElement currentClass = currentConstructor.enclosingClass;
+      InterfaceType supertype = currentClass.supertype;
+      if (supertype != null) {
+        ClassElement superclass = supertype.element;
+        ConstructorElement superConstructor =
+            superclass.lookupDefaultConstructor();
+        initializers.add(new ImplicitSuperConstructorInvokeStructure(
+            node, superConstructor, supertype));
+      }
+    }
+    return new InitializersStructure(initializers);
+  }
+
   InitializerStructure computeInitializerStructure(Send node) {
     Element element = elements[node];
     if (node.asSendSet() != null) {
-      return new FieldInitializerStructure(element);
+      return new FieldInitializerStructure(node, element);
     } else if (Initializers.isConstructorRedirect(node)) {
       return new ThisConstructorInvokeStructure(
-          element, elements.getSelector(node));
+          node, element, elements.getSelector(node).callStructure);
     } else if (Initializers.isSuperConstructorCall(node)) {
       return new SuperConstructorInvokeStructure(
+          node,
           element,
           elements.analyzedElement.enclosingClass.supertype,
-          elements.getSelector(node));
+          elements.getSelector(node).callStructure);
     }
     return internalError(node, "Unhandled initializer.");
   }
diff --git a/pkg/compiler/lib/src/resolution/send_structure.dart b/pkg/compiler/lib/src/resolution/send_structure.dart
index bae22a9..b5d0f71 100644
--- a/pkg/compiler/lib/src/resolution/send_structure.dart
+++ b/pkg/compiler/lib/src/resolution/send_structure.dart
@@ -2537,46 +2537,76 @@
   }
 }
 
-abstract class InitializerStructure<R, A> {
-  R dispatch(SemanticDeclarationVisitor<R, A> visitor, Send node, A arg);
+class InitializersStructure<R, A> {
+  final List<InitializerStructure<R, A>> initializers;
 
-  bool get isSuperConstructorInvoke => false;
+  InitializersStructure(this.initializers);
+}
+
+abstract class InitializerStructure<R, A> {
+  R dispatch(SemanticDeclarationVisitor<R, A> visitor, A arg);
+
+  bool get isConstructorInvoke => false;
 }
 
 class FieldInitializerStructure<R, A> extends InitializerStructure<R, A> {
+  final Send node;
   final FieldElement field;
 
-  FieldInitializerStructure(this.field);
+  FieldInitializerStructure(this.node, this.field);
 
-  R dispatch(SemanticDeclarationVisitor<R, A> visitor, Send node, A arg) {
+  R dispatch(SemanticDeclarationVisitor<R, A> visitor, A arg) {
     return visitor.visitFieldInitializer(
         node, field, node.arguments.single, arg);
   }
 }
 
 class SuperConstructorInvokeStructure<R, A> extends InitializerStructure<R, A> {
+  final Send node;
   final ConstructorElement constructor;
   final InterfaceType type;
-  final Selector selector;
+  final CallStructure callStructure;
 
-  SuperConstructorInvokeStructure(this.constructor, this.type, this.selector);
+  SuperConstructorInvokeStructure(
+      this.node, this.constructor, this.type, this.callStructure);
 
-  R dispatch(SemanticDeclarationVisitor<R, A> visitor, Send node, A arg) {
+  R dispatch(SemanticDeclarationVisitor<R, A> visitor, A arg) {
     return visitor.visitSuperConstructorInvoke(
-        node, constructor, type, node.argumentsNode, selector, arg);
+        node, constructor, type, node.argumentsNode, callStructure, arg);
   }
 
-  bool get isSuperConstructorInvoke => true;
+  bool get isConstructorInvoke => true;
+}
+
+class ImplicitSuperConstructorInvokeStructure<R, A>
+    extends InitializerStructure<R, A> {
+  final FunctionExpression node;
+  final ConstructorElement constructor;
+  final InterfaceType type;
+
+  ImplicitSuperConstructorInvokeStructure(
+      this.node, this.constructor, this.type);
+
+  R dispatch(SemanticDeclarationVisitor<R, A> visitor, A arg) {
+    return visitor.visitImplicitSuperConstructorInvoke(
+        node, constructor, type, arg);
+  }
+
+  bool get isConstructorInvoke => true;
 }
 
 class ThisConstructorInvokeStructure<R, A> extends InitializerStructure<R, A> {
+  final Send node;
   final ConstructorElement constructor;
-  final Selector selector;
+  final CallStructure callStructure;
 
-  ThisConstructorInvokeStructure(this.constructor, this.selector);
+  ThisConstructorInvokeStructure(
+      this.node, this.constructor, this.callStructure);
 
-  R dispatch(SemanticDeclarationVisitor<R, A> visitor, Send node, A arg) {
+  R dispatch(SemanticDeclarationVisitor<R, A> visitor, A arg) {
     return visitor.visitThisConstructorInvoke(
-        node, constructor, node.argumentsNode, selector, arg);
+        node, constructor, node.argumentsNode, callStructure, arg);
   }
+
+  bool get isConstructorInvoke => true;
 }
diff --git a/pkg/compiler/lib/src/resolved_visitor.dart b/pkg/compiler/lib/src/resolved_visitor.dart
index d75834b..6828a79 100644
--- a/pkg/compiler/lib/src/resolved_visitor.dart
+++ b/pkg/compiler/lib/src/resolved_visitor.dart
@@ -239,7 +239,8 @@
   bool checkResolvedKind(Node node,
                          ResolvedKind oldKind,
                          ResolvedKind newKind) {
-    return invariant(node, oldKind == newKind, message: '$oldKind != $newKind');
+    return invariant(node, oldKind == newKind,
+        message: 'old=$oldKind != new=$newKind');
   }
 
   ResolvedKind computeResolvedKindFromStructure(
@@ -436,7 +437,7 @@
       Send node,
       FunctionElement setter,
       ResolvedKindVisitor<R> visitor) {
-    return visitor.visitGetterSend(node);
+    return visitor.visitSuperSend(node);
   }
 
   @override
@@ -495,6 +496,14 @@
   }
 
   @override
+  R visitUnresolvedSuperGet(
+      Send node,
+      Element element,
+      ResolvedKindVisitor<R> visitor) {
+    return visitor.visitSuperSend(node);
+  }
+
+  @override
   R visitUnresolvedInvoke(
       Send node,
       Element element,
diff --git a/pkg/compiler/lib/src/scanner/class_element_parser.dart b/pkg/compiler/lib/src/scanner/class_element_parser.dart
index 0f49ad2..67fe480 100644
--- a/pkg/compiler/lib/src/scanner/class_element_parser.dart
+++ b/pkg/compiler/lib/src/scanner/class_element_parser.dart
@@ -101,10 +101,10 @@
 }
 
 class MemberListener extends NodeListener {
-  final ClassElement enclosingClass;
+  final ClassElementX enclosingClass;
 
   MemberListener(DiagnosticListener listener,
-                 ClassElement enclosingElement)
+                 ClassElementX enclosingElement)
       : this.enclosingClass = enclosingElement,
         super(listener, enclosingElement.compilationUnit);
 
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index 310a5c7..331c750 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -1873,7 +1873,7 @@
       // by the effective target.
       if (!callee.isRedirectingGenerative) {
         inlinedFrom(callee, () {
-          buildFieldInitializers(callee.enclosingElement.implementation,
+          buildFieldInitializers(callee.enclosingClass.implementation,
                                fieldValues);
         });
       }
@@ -2005,7 +2005,7 @@
       ClassElement superClass = enclosingClass.superclass;
       if (!enclosingClass.isObject) {
         assert(superClass != null);
-        assert(superClass.resolutionState == STATE_DONE);
+        assert(superClass.isResolved);
         // TODO(johnniwinther): Should we find injected constructors as well?
         FunctionElement target = superClass.lookupDefaultConstructor();
         if (target == null) {
@@ -4476,6 +4476,14 @@
   }
 
   @override
+  void visitSuperSetterGet(
+      ast.Send node,
+      MethodElement setter,
+      _) {
+    handleUnresolvedSuperInvoke(node);
+  }
+
+  @override
   void visitUnresolvedSuperInvoke(
       ast.Send node,
       Element element,
@@ -5135,7 +5143,7 @@
       ast.NodeList arguments,
       CallStructure callStructure,
       _) {
-    if (function.isForeign(backend)) {
+    if (backend.isForeign(function)) {
       handleForeignSend(node, function);
     } else {
       generateStaticFunctionInvoke(node, function, callStructure);
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index 9463de1..c59b1a3 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -1285,7 +1285,9 @@
 
   visitTruncatingDivide(HTruncatingDivide node) {
     assert(node.isUInt31(compiler));
-    assert(node.left.isUInt32(compiler));
+    // TODO(karlklose): Enable this assertion again when type propagation is
+    // fixed. Issue 23555.
+//    assert(node.left.isUInt32(compiler));
     assert(node.right.isPositiveInteger(compiler));
     use(node.left);
     js.Expression jsLeft = pop();
diff --git a/pkg/compiler/lib/src/ssa/types_propagation.dart b/pkg/compiler/lib/src/ssa/types_propagation.dart
index 0aa5f0f..71abe6c 100644
--- a/pkg/compiler/lib/src/ssa/types_propagation.dart
+++ b/pkg/compiler/lib/src/ssa/types_propagation.dart
@@ -343,10 +343,10 @@
     }
 
     HInstruction receiver = instruction.getDartReceiver(compiler);
-    Selector selector = instruction.selector;
-    TypeMask receiverType = selector is TypedSelector
-        ? selector.mask.intersection(receiver.instructionType, classWorld)
-        : receiver.instructionType;
+    TypeMask receiverType = receiver.instructionType;
+    Selector selector =
+        new TypedSelector(receiverType, instruction.selector, classWorld);
+    instruction.selector = selector;
 
     // Try to specialize the receiver after this call.
     if (receiver.dominatedUsers(instruction).length != 1
diff --git a/pkg/compiler/lib/src/tracer.dart b/pkg/compiler/lib/src/tracer.dart
index 8491860..32327c3 100644
--- a/pkg/compiler/lib/src/tracer.dart
+++ b/pkg/compiler/lib/src/tracer.dart
@@ -57,10 +57,10 @@
     if (irObject is ssa.HGraph) {
       new HTracer(output, compiler, context).traceGraph(name, irObject);
     }
-    else if (irObject is cps_ir.RootNode) {
+    else if (irObject is cps_ir.FunctionDefinition) {
       new IRTracer(output).traceGraph(name, irObject);
     }
-    else if (irObject is tree_ir.RootNode) {
+    else if (irObject is tree_ir.FunctionDefinition) {
       new TreeTracer(output).traceGraph(name, irObject);
     }
   }
diff --git a/pkg/compiler/lib/src/tree_ir/optimization/logical_rewriter.dart b/pkg/compiler/lib/src/tree_ir/optimization/logical_rewriter.dart
index 941b22c..4bef70a 100644
--- a/pkg/compiler/lib/src/tree_ir/optimization/logical_rewriter.dart
+++ b/pkg/compiler/lib/src/tree_ir/optimization/logical_rewriter.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 tree_ir.optimization;
+library tree_ir.optimization.logical_rewriter;
+
+import '../tree_ir_nodes.dart';
+import 'optimization.dart' show Pass;
+import '../../constants/values.dart' as values;
+
+// TODO(asgerf): Update this class to use JS semantics for && and ||.
 
 /// Rewrites logical expressions to be more compact in the Tree IR.
 ///
@@ -59,8 +65,8 @@
   String get passName => 'Logical rewriter';
 
   @override
-  void rewrite(RootNode node) {
-    node.replaceEachBody(visitStatement);
+  void rewrite(FunctionDefinition node) {
+    node.body = visitStatement(node.body);
   }
 
   /// Statement to be executed next by natural fallthrough. Although fallthrough
diff --git a/pkg/compiler/lib/src/tree_ir/optimization/loop_rewriter.dart b/pkg/compiler/lib/src/tree_ir/optimization/loop_rewriter.dart
index 0129c0d..8287bac 100644
--- a/pkg/compiler/lib/src/tree_ir/optimization/loop_rewriter.dart
+++ b/pkg/compiler/lib/src/tree_ir/optimization/loop_rewriter.dart
@@ -2,7 +2,10 @@
 // for 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 tree_ir.optimization;
+library tree_ir.optimization.loop_rewriter;
+
+import 'optimization.dart' show Pass;
+import '../tree_ir_nodes.dart';
 
 /// Rewrites [WhileTrue] statements.
 ///
@@ -57,8 +60,8 @@
 
   Set<Label> usedContinueLabels = new Set<Label>();
 
-  void rewrite(RootNode root) {
-    root.replaceEachBody(visitStatement);
+  void rewrite(FunctionDefinition root) {
+    root.body = visitStatement(root.body);
   }
 
   @override
diff --git a/pkg/compiler/lib/src/tree_ir/optimization/optimization.dart b/pkg/compiler/lib/src/tree_ir/optimization/optimization.dart
index e57bdc9..130e5e3 100644
--- a/pkg/compiler/lib/src/tree_ir/optimization/optimization.dart
+++ b/pkg/compiler/lib/src/tree_ir/optimization/optimization.dart
@@ -1,20 +1,17 @@
 library tree_ir.optimization;
 
 import '../tree_ir_nodes.dart';
-import '../../constants/values.dart' as values;
-import 'variable_merger.dart';
 
+export 'statement_rewriter.dart' show StatementRewriter;
 export 'variable_merger.dart' show VariableMerger;
+export 'loop_rewriter.dart' show LoopRewriter;
+export 'logical_rewriter.dart' show LogicalRewriter;
 export 'pull_into_initializers.dart' show PullIntoInitializers;
 
-part 'logical_rewriter.dart';
-part 'loop_rewriter.dart';
-part 'statement_rewriter.dart';
-
 /// An optimization pass over the Tree IR.
 abstract class Pass {
   /// Applies optimizations to root, rewriting it in the process.
-  void rewrite(RootNode root);
+  void rewrite(FunctionDefinition root);
 
   String get passName;
 }
diff --git a/pkg/compiler/lib/src/tree_ir/optimization/pull_into_initializers.dart b/pkg/compiler/lib/src/tree_ir/optimization/pull_into_initializers.dart
index e68c488..a19aeba 100644
--- a/pkg/compiler/lib/src/tree_ir/optimization/pull_into_initializers.dart
+++ b/pkg/compiler/lib/src/tree_ir/optimization/pull_into_initializers.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.
 
+library tree_ir.optimization.pull_into_initializers;
+
 import 'optimization.dart' show Pass;
 import '../tree_ir_nodes.dart';
 
@@ -46,17 +48,10 @@
 /// [PullIntoInitializers] cannot pull `y` into an initializer because
 /// the impure expressions `foo()` and `bar()` would then be swapped.
 ///
-class PullIntoInitializers implements Pass {
+class PullIntoInitializers extends ExpressionVisitor<Expression>
+                           implements Pass {
   String get passName => 'Pull into initializers';
 
-  void rewrite(RootNode node) {
-    node.replaceEachBody((Statement body) {
-      return new BodyRewriter().rewriteBody(node.parameters, body);
-    });
-  }
-}
-
-class BodyRewriter extends ExpressionVisitor<Expression> {
   Set<Variable> assignedVariables = new Set<Variable>();
 
   /// The fragment between [first] and [last] holds the statements
@@ -98,8 +93,9 @@
     return visitExpression(node);
   }
 
-  Statement rewriteBody(List<Variable> parameters, Statement body) {
-    assignedVariables.addAll(parameters);
+  void rewrite(FunctionDefinition node) {
+    Statement body = node.body;
+    assignedVariables.addAll(node.parameters);
 
     // [body] represents the first statement after the initializer block.
     // Repeatedly pull assignment statements into the initializer block.
@@ -134,7 +130,8 @@
 
     append(body);
     assert(first != null); // Because we just appended the body.
-    return first;
+
+    node.body = first;
   }
 
   void destroyVariableUse(VariableUse node) {
@@ -255,7 +252,7 @@
   }
 
   void visitInnerFunction(FunctionDefinition node) {
-    node.body = new BodyRewriter().rewriteBody(node.parameters, node.body);
+    new PullIntoInitializers().rewrite(node);
   }
 
   Expression visitFunctionExpression(FunctionExpression node) {
@@ -315,10 +312,6 @@
     return node;
   }
 
-  Expression visitReifyTypeVar(ReifyTypeVar node) {
-    return node;
-  }
-
   Expression visitNot(Not node) {
     node.operand = visitExpression(node.operand);
     return node;
diff --git a/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart b/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart
index f845e43..1f5fea0 100644
--- a/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart
+++ b/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart
@@ -2,7 +2,10 @@
 // for 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 tree_ir.optimization;
+library tree_ir.optimization.statement_rewriter;
+
+import 'optimization.dart' show Pass;
+import '../tree_ir_nodes.dart';
 
 /**
  * Performs the following transformations on the tree:
@@ -109,8 +112,8 @@
   String get passName => 'Statement rewriter';
 
   @override
-  void rewrite(RootNode node) {
-    node.replaceEachBody(visitStatement);
+  void rewrite(FunctionDefinition node) {
+    node.body = visitStatement(node.body);
   }
 
   /// True if targeting Dart.
@@ -269,7 +272,6 @@
     // and/or if it is better handled at the CPS level.
     return exp is Constant ||
            exp is This ||
-           exp is ReifyTypeVar ||
            exp is CreateInvocationMirror ||
            exp is InvokeStatic && exp.isEffectivelyConstant ||
            exp is VariableUse && constantEnvironment.containsKey(exp.variable);
@@ -331,18 +333,6 @@
     return node;
   }
 
-  Statement visitVariableDeclaration(VariableDeclaration node) {
-    if (isEffectivelyConstant(node.value)) {
-      node.next = visitStatement(node.next);
-    } else {
-      inEmptyEnvironment(() {
-        node.next = visitStatement(node.next);
-      });
-    }
-    node.value = visitExpression(node.value);
-    return node;
-  }
-
   /// Process nodes right-to-left, the opposite of evaluation order in the case
   /// of argument lists..
   void _rewriteList(List<Node> nodes) {
@@ -422,12 +412,6 @@
     return node;
   }
 
-  Statement visitFunctionDeclaration(FunctionDeclaration node) {
-    new StatementRewriter.nested(this).rewrite(node.definition);
-    node.next = visitStatement(node.next);
-    return node;
-  }
-
   Statement visitReturn(Return node) {
     node.value = visitExpression(node.value);
     return node;
@@ -553,10 +537,6 @@
     return node;
   }
 
-  Expression visitReifyTypeVar(ReifyTypeVar node) {
-    return node;
-  }
-
   Expression visitLiteralList(LiteralList node) {
     _rewriteList(node.values);
     return node;
diff --git a/pkg/compiler/lib/src/tree_ir/optimization/variable_merger.dart b/pkg/compiler/lib/src/tree_ir/optimization/variable_merger.dart
index 79bf831..141e646 100644
--- a/pkg/compiler/lib/src/tree_ir/optimization/variable_merger.dart
+++ b/pkg/compiler/lib/src/tree_ir/optimization/variable_merger.dart
@@ -15,9 +15,9 @@
 class VariableMerger extends RecursiveVisitor implements Pass {
   String get passName => 'Variable merger';
 
-  void rewrite(RootNode node) {
+  void rewrite(FunctionDefinition node) {
     rewriteFunction(node);
-    node.forEachBody(visitStatement);
+    visitStatement(node.body);
   }
 
   @override
@@ -27,15 +27,13 @@
 
   /// Rewrites the given function.
   /// This is called for the outermost function and inner functions.
-  void rewriteFunction(RootNode node) {
-    node.forEachBody((Statement body) {
-      BlockGraphBuilder builder = new BlockGraphBuilder();
-      builder.build(node.parameters, body);
-      _computeLiveness(builder.blocks);
-      Map<Variable, Variable> subst =
-          _computeRegisterAllocation(builder.blocks, node.parameters);
-      new SubstituteVariables(subst).apply(node);
-    });
+  void rewriteFunction(FunctionDefinition node) {
+    BlockGraphBuilder builder = new BlockGraphBuilder();
+    builder.build(node);
+    _computeLiveness(builder.blocks);
+    Map<Variable, Variable> subst =
+        _computeRegisterAllocation(builder.blocks, node.parameters);
+    new SubstituteVariables(subst).apply(node);
   }
 }
 
@@ -108,10 +106,10 @@
   /// them from the control-flow graph entirely.
   Set<Variable> _ignoredVariables = new Set<Variable>();
 
-  void build(List<Variable> parameters, Statement body) {
+  void build(FunctionDefinition node) {
     _currentBlock = newBlock();
-    parameters.forEach(write);
-    visitStatement(body);
+    node.parameters.forEach(write);
+    visitStatement(node.body);
   }
 
   @override
@@ -164,11 +162,6 @@
     read(node.variable);
   }
 
-  visitVariableDeclaration(VariableDeclaration node) {
-    assert(node.variable.isCaptured);
-    visitStatement(node.next);
-  }
-
   visitAssign(Assign node) {
     visitExpression(node.value);
     write(node.variable);
@@ -243,12 +236,6 @@
     branchFrom(afterCondition);
     visitExpression(node.right);
   }
-
-  visitFunctionDeclaration(FunctionDeclaration node) {
-    // The function variable is final, hence cannot be merged.
-    ignoreVariable(node.variable);
-    visitStatement(node.next);
-  }
 }
 
 /// Computes liveness information of the given control-flow graph.
@@ -492,11 +479,11 @@
     return w;
   }
 
-  void apply(RootNode node) {
+  void apply(FunctionDefinition node) {
     for (int i = 0; i < node.parameters.length; ++i) {
       node.parameters[i] = replaceWrite(node.parameters[i]);
     }
-    node.replaceEachBody(visitStatement);
+    node.body = visitStatement(node.body);
   }
 
   @override
@@ -535,15 +522,4 @@
     }
     return node;
   }
-
-  Statement visitVariableDeclaration(VariableDeclaration node) {
-    // VariableDeclaration is only used for captured variables, which are never
-    // merged, so this is not strictly necessary. But it's nicer if this class
-    // works for arbitrary substitution maps.
-    node.variable = replaceWrite(node.variable);
-    node.value = visitExpression(node.value);
-    node.next = visitStatement(node.next);
-    return node;
-  }
-
 }
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
index 980aefb..19c8a12 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
@@ -119,35 +119,6 @@
     return new VariableUse(getVariable(reference.definition));
   }
 
-  RootNode build(cps_ir.RootNode node) {
-    // TODO(asgerf): Don't have build AND buildXXX as public API.
-    if (node is cps_ir.FieldDefinition) {
-      return buildField(node);
-    } else if (node is cps_ir.ConstructorDefinition) {
-      return buildConstructor(node);
-    } else {
-      assert(dart2js.invariant(
-          CURRENT_ELEMENT_SPANNABLE,
-          node is cps_ir.FunctionDefinition,
-          message: 'expected FunctionDefinition or FieldDefinition, '
-            ' found $node'));
-      return buildFunction(node);
-    }
-  }
-
-  FieldDefinition buildField(cps_ir.FieldDefinition node) {
-    Statement body;
-    if (!node.isEmpty) {
-      currentElement = node.element;
-      returnContinuation = node.body.returnContinuation;
-
-      phiTempVar = new Variable(node.element, null);
-
-      body = visit(node.body);
-    }
-    return new FieldDefinition(node.element, body);
-  }
-
   Variable addFunctionParameter(cps_ir.Definition variable) {
     if (variable is cps_ir.Parameter) {
       return getVariable(variable);
@@ -167,34 +138,10 @@
     }
     List<Variable> parameters =
         node.parameters.map(addFunctionParameter).toList();
-    Statement body;
-    if (!node.isEmpty) {
-      returnContinuation = node.body.returnContinuation;
-      phiTempVar = new Variable(node.element, null);
-      body = visit(node.body);
-    }
-
-    return new FunctionDefinition(node.element, parameters,
-        body, node.localConstants, node.defaultParameterValues);
-  }
-
-  ConstructorDefinition buildConstructor(cps_ir.ConstructorDefinition node) {
-    currentElement = node.element;
-    thisParameter = node.thisParameter;
-    List<Variable> parameters =
-        node.parameters.map(addFunctionParameter).toList();
-    List<Initializer> initializers;
-    Statement body;
-    if (!node.isEmpty) {
-      initializers = node.initializers.map(visit).toList();
-      returnContinuation = node.body.returnContinuation;
-
-      phiTempVar = new Variable(node.element, null);
-      body = visit(node.body);
-    }
-
-    return new ConstructorDefinition(node.element, parameters,
-        body, initializers, node.localConstants, node.defaultParameterValues);
+    returnContinuation = node.returnContinuation;
+    phiTempVar = new Variable(node.element, null);
+    Statement body = visit(node.body);
+    return new FunctionDefinition(node.element, parameters, body);
   }
 
   /// Returns a list of variables corresponding to the arguments to a method
@@ -334,29 +281,9 @@
 
   // Executable definitions are not visited directly.  They have 'build'
   // functions as entry points.
-  visitFieldDefinition(cps_ir.FieldDefinition node) {
-    return unexpectedNode(node);
-  }
   visitFunctionDefinition(cps_ir.FunctionDefinition node) {
     return unexpectedNode(node);
   }
-  visitConstructorDefinition(cps_ir.ConstructorDefinition node) {
-    return unexpectedNode(node);
-  }
-
-  Initializer visitFieldInitializer(cps_ir.FieldInitializer node) {
-    returnContinuation = node.body.returnContinuation;
-    return new FieldInitializer(node.element, visit(node.body.body));
-  }
-
-  Initializer visitSuperInitializer(cps_ir.SuperInitializer node) {
-    List<Statement> arguments =
-        node.arguments.map((cps_ir.Body argument) {
-      returnContinuation = argument.returnContinuation;
-      return visit(argument.body);
-    }).toList();
-    return new SuperInitializer(node.target, node.selector, arguments);
-  }
 
   Statement visitLetPrim(cps_ir.LetPrim node) {
     Variable variable = getVariable(node.primitive);
@@ -364,20 +291,8 @@
     // Don't translate unused primitives.
     if (variable == null) return visit(node.body);
 
-    Node definition = visit(node.primitive);
-
-    // visitPrimitive returns a Statement without successor if it cannot occur
-    // in expression context (currently only the case for FunctionDeclarations).
-    if (definition is Statement) {
-      definition.next = visit(node.body);
-      return definition;
-    } else {
-      return Assign.makeStatement(variable, definition, visit(node.body));
-    }
-  }
-
-  Statement visitBody(cps_ir.Body node) {
-    return visit(node.body);
+    Expression value = visit(node.primitive);
+    return Assign.makeStatement(variable, value, visit(node.body));
   }
 
   Statement visitLetCont(cps_ir.LetCont node) {
@@ -486,11 +401,6 @@
     Variable variable = addMutableVariable(node.variable);
     Expression value = getVariableUse(node.value);
     Statement body = visit(node.body);
-    // If the variable was captured by an inner function in the body, this
-    // must be declared here so we assign to a fresh copy of the variable.
-    if (variable.isCaptured) {
-      return new VariableDeclaration(variable, value, body);
-    }
     return Assign.makeStatement(variable, value, body);
   }
 
@@ -504,12 +414,6 @@
     return Assign.makeStatement(variable, value, visit(node.body));
   }
 
-  Statement visitDeclareFunction(cps_ir.DeclareFunction node) {
-    Variable variable = addMutableVariable(node.variable);
-    FunctionDefinition function = makeSubFunction(node.definition);
-    return new FunctionDeclaration(variable, function, visit(node.body));
-  }
-
   Statement visitTypeOperator(cps_ir.TypeOperator node) {
     Expression value = getVariableUse(node.value);
     List<Expression> typeArgs = translateArguments(node.typeArguments);
@@ -589,10 +493,6 @@
     return new Constant(node.expression);
   }
 
-  Expression visitReifyTypeVar(cps_ir.ReifyTypeVar node) {
-    return new ReifyTypeVar(node.typeVariable);
-  }
-
   Expression visitLiteralList(cps_ir.LiteralList node) {
     return new LiteralList(
             node.type,
@@ -614,17 +514,11 @@
     return createInnerBuilder().buildFunction(function);
   }
 
-  Node visitCreateFunction(cps_ir.CreateFunction node) {
+  Expression visitCreateFunction(cps_ir.CreateFunction node) {
     FunctionDefinition def = makeSubFunction(node.definition);
     FunctionType type = node.definition.element.type;
     bool hasReturnType = !type.returnType.treatAsDynamic;
-    if (hasReturnType) {
-      // This function cannot occur in expression context.
-      // The successor will be filled in by visitLetPrim.
-      return new FunctionDeclaration(getVariable(node), def, null);
-    } else {
-      return new FunctionExpression(def);
-    }
+    return new FunctionExpression(def);
   }
 
   visitParameter(cps_ir.Parameter node) {
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_integrity.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_integrity.dart
index 20225c9..5afd2da 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_integrity.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_integrity.dart
@@ -16,7 +16,7 @@
 /// - Variables must not have more than one declaration.
 ///
 class CheckTreeIntegrity extends RecursiveVisitor {
-  RootNode topLevelNode;
+  FunctionDefinition topLevelNode;
 
   Map<Variable, int> varReads = <Variable, int>{};
   Map<Variable, int> varWrites = <Variable, int>{};
@@ -65,13 +65,6 @@
     read(node.variable);
   }
 
-  visitVariableDeclaration(VariableDeclaration node) {
-    visitExpression(node.value);
-    declare(node.variable);
-    visitStatement(node.next);
-    undeclare(node.variable);
-  }
-
   visitAssign(Assign node) {
     visitExpression(node.value);
     write(node.variable);
@@ -84,16 +77,6 @@
     node.catchParameters.forEach(undeclare);
   }
 
-  visitFunctionDeclaration(FunctionDeclaration node) {
-    declare(node.variable);
-    checkBody(node.definition);
-    visitStatement(node.next);
-    undeclare(node.variable);
-    if (varWrites[node.variable] > 1) {
-      error('Assignment to function declaration ${node.variable}');
-    }
-  }
-
   visitJumpTargetBody(JumpTarget target) {
     Label label = target.label;
     if (label2declaration.containsKey(label)) {
@@ -149,9 +132,9 @@
     checkBody(node);
   }
 
-  void checkBody(RootNode node) {
+  void checkBody(FunctionDefinition node) {
     node.parameters.forEach(declare);
-    node.forEachBody(visitStatement);
+    visitStatement(node.body);
     node.parameters.forEach(undeclare);
   }
 
@@ -159,7 +142,7 @@
     throw 'Tree IR integrity violation in ${topLevelNode.element}:\n$message';
   }
 
-  void check(RootNode node) {
+  void check(FunctionDefinition node) {
     topLevelNode = node;
     checkBody(node);
 
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
index fe216b1..d200e405 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
@@ -6,10 +6,9 @@
 
 import '../constants/expressions.dart';
 import '../constants/values.dart' as values;
-import '../dart_types.dart' show DartType, GenericType, InterfaceType, TypeVariableType;
+import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType;
 import '../elements/elements.dart';
 import '../io/source_information.dart' show SourceInformation;
-import '../universe/universe.dart';
 import '../universe/universe.dart' show Selector;
 
 // The Tree language is the target of translation out of the CPS-based IR.
@@ -288,19 +287,8 @@
   accept1(ExpressionVisitor1 visitor, arg) => visitor.visitThis(this, arg);
 }
 
-class ReifyTypeVar extends Expression implements DartSpecificNode {
-  TypeVariableElement typeVariable;
-
-  ReifyTypeVar(this.typeVariable);
-
-  accept(ExpressionVisitor visitor) => visitor.visitReifyTypeVar(this);
-  accept1(ExpressionVisitor1 visitor, arg) {
-    return visitor.visitReifyTypeVar(this, arg);
-  }
-}
-
 class LiteralList extends Expression {
-  final GenericType type;
+  final InterfaceType type;
   final List<Expression> values;
 
   LiteralList(this.type, this.values);
@@ -319,7 +307,7 @@
 }
 
 class LiteralMap extends Expression {
-  final GenericType type;
+  final InterfaceType type;
   final List<LiteralMapEntry> entries;
 
   LiteralMap(this.type, this.entries);
@@ -390,7 +378,10 @@
   accept1(ExpressionVisitor1 visitor, arg) => visitor.visitNot(this, arg);
 }
 
-class FunctionExpression extends Expression implements DartSpecificNode {
+/// Currently unused.
+///
+/// See CreateFunction in the cps_ir_nodes.dart.
+class FunctionExpression extends Expression {
   final FunctionDefinition definition;
 
   FunctionExpression(this.definition);
@@ -401,26 +392,6 @@
   }
 }
 
-/// Declares a local function.
-/// Used for functions that may not occur in expression context due to
-/// being recursive or having a return type.
-/// The [variable] must not occur as the left-hand side of an [Assign] or
-/// any other [FunctionDeclaration].
-class FunctionDeclaration extends Statement implements DartSpecificNode {
-  Variable variable;
-  final FunctionDefinition definition;
-  Statement next;
-
-  FunctionDeclaration(this.variable, this.definition, this.next) {
-    ++variable.writeCount;
-  }
-
-  accept(StatementVisitor visitor) => visitor.visitFunctionDeclaration(this);
-  accept1(StatementVisitor1 visitor, arg) {
-    return visitor.visitFunctionDeclaration(this, arg);
-  }
-}
-
 /// A [LabeledStatement] or [WhileTrue] or [WhileCondition].
 abstract class JumpTarget extends Statement {
   Label get label;
@@ -539,28 +510,6 @@
   accept1(StatementVisitor1 visitor, arg) => visitor.visitContinue(this, arg);
 }
 
-/// Declares a captured [variable] with an initial [value].
-///
-/// All uses of the variable must be inside the [next] statement.
-class VariableDeclaration extends Statement implements DartSpecificNode {
-  Variable variable;
-  Expression value;
-  Statement next;
-
-  VariableDeclaration(this.variable, this.value, this.next) {
-    assert(variable.isCaptured); // Because otherwise no declaration is needed.
-    ++variable.writeCount;
-  }
-
-  accept(StatementVisitor visitor) {
-    return visitor.visitVariableDeclaration(this);
-  }
-
-  accept1(StatementVisitor1 visitor, arg) {
-    return visitor.visitVariableDeclaration(this, arg);
-  }
-}
-
 /**
  * A return exit from the function.
  *
@@ -663,183 +612,25 @@
   }
 }
 
-abstract class RootNode extends Node {
-  ExecutableElement get element;
-  List<Variable> get parameters;
-
-  /// True if there is no body for this root node.
-  ///
-  /// In some parts of the compiler, empty root nodes are used as placeholders
-  /// for abstract methods, external constructors, fields without initializers,
-  /// etc.
-  bool get isEmpty;
-
-  void forEachBody(void action(Statement node));
-  void replaceEachBody(Statement transform(Statement node));
-
-  accept(RootVisitor v);
-  accept1(RootVisitor1 v, arg);
-}
-
-class FieldDefinition extends RootNode implements DartSpecificNode {
-  final FieldElement element;
-  // The `body` of a field is its initializer.
-  Statement body;
-  List<Variable> get parameters => const <Variable>[];
-
-  FieldDefinition(this.element, this.body);
-
-  bool get isEmpty => body == null;
-
-  accept(RootVisitor v) => v.visitFieldDefinition(this);
-  accept1(RootVisitor1 v, arg) => v.visitFieldDefinition(this, arg);
-
-  void forEachBody(void action(Statement node)) {
-    if (isEmpty) return;
-    action(body);
-  }
-
-  void replaceEachBody(Statement transform(Statement node)) {
-    if (isEmpty) return;
-    body = transform(body);
-  }
-}
-
-class FunctionDefinition extends RootNode {
+class FunctionDefinition extends Node {
   final ExecutableElement element;
   final List<Variable> parameters;
   Statement body;
-  final List<ConstDeclaration> localConstants;
-  final List<ConstantExpression> defaultParameterValues;
 
   /// Creates a function definition and updates `writeCount` for [parameters].
-  FunctionDefinition(this.element, this.parameters, this.body,
-      this.localConstants, this.defaultParameterValues) {
+  FunctionDefinition(this.element, this.parameters, this.body) {
     for (Variable param in parameters) {
       param.writeCount++; // Being a parameter counts as a write.
     }
   }
-
-  bool get isEmpty => body == null;
-
-  accept(RootVisitor v) => v.visitFunctionDefinition(this);
-  accept1(RootVisitor1 v, arg) => v.visitFunctionDefinition(this, arg);
-
-  void forEachBody(void action(Statement node)) {
-    if (isEmpty) return;
-    action(body);
-  }
-
-  void replaceEachBody(Statement transform(Statement node)) {
-    if (isEmpty) return;
-    body = transform(body);
-  }
 }
 
-abstract class Initializer implements DartSpecificNode {
-  accept(InitializerVisitor v);
-  accept1(InitializerVisitor1 v, arg);
-
-  void forEachBody(void action(Statement node));
-  void replaceEachBody(Statement transform(Statement node));
-}
-
-class FieldInitializer extends Initializer {
-  final FieldElement element;
-  Statement body;
-  bool processed = false;
-
-  FieldInitializer(this.element, this.body);
-
-  accept(InitializerVisitor visitor) => visitor.visitFieldInitializer(this);
-  accept1(InitializerVisitor1 visitor, arg) {
-    return visitor.visitFieldInitializer(this, arg);
-  }
-
-  void forEachBody(void action(Statement node)) {
-    action(body);
-  }
-
-  void replaceEachBody(Statement transform(Statement node)) {
-    body = transform(body);
-  }
-}
-
-class SuperInitializer extends Initializer {
-  final ConstructorElement target;
-  final Selector selector;
-  final List<Statement> arguments;
-  bool processed = false;
-
-  SuperInitializer(this.target, this.selector, this.arguments);
-  accept(InitializerVisitor visitor) => visitor.visitSuperInitializer(this);
-  accept1(InitializerVisitor1 visitor, arg) {
-    return visitor.visitSuperInitializer(this, arg);
-  }
-
-  void forEachBody(void action(Statement node)) {
-    arguments.forEach(action);
-  }
-
-  void replaceEachBody(Statement transform(Statement node)) {
-    for (int i = 0; i < arguments.length; i++) {
-      arguments[i] = transform(arguments[i]);
-    }
-  }
-}
-
-class ConstructorDefinition extends RootNode
-                            implements DartSpecificNode {
-  final ConstructorElement element;
-  final List<Variable> parameters;
-  Statement body;
-  final List<ConstDeclaration> localConstants;
-  final List<ConstantExpression> defaultParameterValues;
-  final List<Initializer> initializers;
-
-  ConstructorDefinition(this.element,
-                        this.parameters,
-                        this.body,
-                        this.initializers,
-                        this.localConstants,
-                        this.defaultParameterValues) {
-    for (Variable param in parameters) {
-      param.writeCount++; // Being a parameter counts as a write.
-    }
-  }
-
-  bool get isEmpty => body == null;
-
-  accept(RootVisitor v) => v.visitConstructorDefinition(this);
-  accept1(RootVisitor1 v, arg) => v.visitConstructorDefinition(this, arg);
-
-  void forEachBody(void action(Statement node)) {
-    if (isEmpty) return;
-    for (Initializer init in initializers) {
-      init.forEachBody(action);
-    }
-    action(body);
-  }
-
-  void replaceEachBody(Statement transform(Statement node)) {
-    if (isEmpty) return;
-    for (Initializer init in initializers) {
-      init.replaceEachBody(transform);
-    }
-    body = transform(body);
-  }
-}
-
-abstract class JsSpecificNode implements Node {}
-
-abstract class DartSpecificNode implements Node {}
-
-class CreateBox extends Expression implements JsSpecificNode {
+class CreateBox extends Expression {
   accept(ExpressionVisitor visitor) => visitor.visitCreateBox(this);
   accept1(ExpressionVisitor1 visitor, arg) => visitor.visitCreateBox(this, arg);
 }
 
-class CreateInstance extends Expression implements JsSpecificNode {
+class CreateInstance extends Expression {
   ClassElement classElement;
   List<Expression> arguments;
   List<Expression> typeInformation;
@@ -852,7 +643,7 @@
   }
 }
 
-class GetField extends Expression implements JsSpecificNode {
+class GetField extends Expression {
   Expression object;
   Element field;
 
@@ -862,7 +653,7 @@
   accept1(ExpressionVisitor1 visitor, arg) => visitor.visitGetField(this, arg);
 }
 
-class SetField extends Expression implements JsSpecificNode {
+class SetField extends Expression {
   Expression object;
   Element field;
   Expression value;
@@ -896,7 +687,7 @@
   accept1(ExpressionVisitor1 visitor, arg) => visitor.visitSetStatic(this, arg);
 }
 
-class ReifyRuntimeType extends Expression implements JsSpecificNode {
+class ReifyRuntimeType extends Expression {
   Expression value;
 
   ReifyRuntimeType(this.value);
@@ -910,7 +701,7 @@
   }
 }
 
-class ReadTypeVariable extends Expression implements JsSpecificNode {
+class ReadTypeVariable extends Expression {
   final TypeVariableType variable;
   Expression target;
 
@@ -925,7 +716,7 @@
   }
 }
 
-class CreateInvocationMirror extends Expression implements JsSpecificNode {
+class CreateInvocationMirror extends Expression {
   final Selector selector;
   final List<Expression> arguments;
 
@@ -969,7 +760,6 @@
   E visitConcatenateStrings(ConcatenateStrings node);
   E visitConstant(Constant node);
   E visitThis(This node);
-  E visitReifyTypeVar(ReifyTypeVar node);
   E visitConditional(Conditional node);
   E visitLogicalOperator(LogicalOperator node);
   E visitNot(Not node);
@@ -1000,7 +790,6 @@
   E visitConcatenateStrings(ConcatenateStrings node, A arg);
   E visitConstant(Constant node, A arg);
   E visitThis(This node, A arg);
-  E visitReifyTypeVar(ReifyTypeVar node, A arg);
   E visitConditional(Conditional node, A arg);
   E visitLogicalOperator(LogicalOperator node, A arg);
   E visitNot(Not node, A arg);
@@ -1031,8 +820,6 @@
   S visitIf(If node);
   S visitWhileTrue(WhileTrue node);
   S visitWhileCondition(WhileCondition node);
-  S visitFunctionDeclaration(FunctionDeclaration node);
-  S visitVariableDeclaration(VariableDeclaration node);
   S visitExpressionStatement(ExpressionStatement node);
   S visitTry(Try node);
 }
@@ -1048,39 +835,10 @@
   S visitIf(If node, A arg);
   S visitWhileTrue(WhileTrue node, A arg);
   S visitWhileCondition(WhileCondition node, A arg);
-  S visitFunctionDeclaration(FunctionDeclaration node, A arg);
-  S visitVariableDeclaration(VariableDeclaration node, A arg);
   S visitExpressionStatement(ExpressionStatement node, A arg);
   S visitTry(Try node, A arg);
 }
 
-abstract class RootVisitor<T> {
-  T visitRootNode(RootNode node) => node.accept(this);
-  T visitFunctionDefinition(FunctionDefinition node);
-  T visitConstructorDefinition(ConstructorDefinition node);
-  T visitFieldDefinition(FieldDefinition node);
-}
-
-abstract class RootVisitor1<T, A> {
-  T visitRootNode(RootNode node, A arg) => node.accept1(this, arg);
-  T visitFunctionDefinition(FunctionDefinition node, A arg);
-  T visitConstructorDefinition(ConstructorDefinition node, A arg);
-  T visitFieldDefinition(FieldDefinition node, A arg);
-}
-
-abstract class InitializerVisitor<T> {
-  T visitInitializer(Initializer node) => node.accept(this);
-  T visitFieldInitializer(FieldInitializer node);
-  T visitSuperInitializer(SuperInitializer node);
-}
-
-
-abstract class InitializerVisitor1<T, A> {
-  T visitInitializer(Initializer node, A arg) => node.accept1(this, arg);
-  T visitFieldInitializer(FieldInitializer node, A arg);
-  T visitSuperInitializer(SuperInitializer node, A arg);
-}
-
 abstract class RecursiveVisitor implements StatementVisitor, ExpressionVisitor {
   visitExpression(Expression e) => e.accept(this);
   visitStatement(Statement s) => s.accept(this);
@@ -1093,11 +851,6 @@
     visitVariable(node.variable);
   }
 
-  visitVariableDeclaration(VariableDeclaration node) {
-    visitVariable(node.variable);
-    visitStatement(node.next);
-  }
-
   visitAssign(Assign node) {
     visitVariable(node.variable);
     visitExpression(node.value);
@@ -1129,8 +882,6 @@
 
   visitThis(This node) {}
 
-  visitReifyTypeVar(ReifyTypeVar node) {}
-
   visitConditional(Conditional node) {
     visitExpression(node.condition);
     visitExpression(node.thenExpression);
@@ -1201,11 +952,6 @@
     visitStatement(node.next);
   }
 
-  visitFunctionDeclaration(FunctionDeclaration node) {
-    visitInnerFunction(node.definition);
-    visitStatement(node.next);
-  }
-
   visitExpressionStatement(ExpressionStatement node) {
     visitExpression(node.expression);
     visitStatement(node.next);
@@ -1276,11 +1022,6 @@
 
   visitVariableUse(VariableUse node) => node;
 
-  visitVariableDeclaration(VariableDeclaration node) {
-    node.next = visitStatement(node.next);
-    return node;
-  }
-
   visitAssign(Assign node) {
     node.value = visitExpression(node.value);
     return node;
@@ -1317,8 +1058,6 @@
 
   visitThis(This node) => node;
 
-  visitReifyTypeVar(ReifyTypeVar node) => node;
-
   visitConditional(Conditional node) {
     node.condition = visitExpression(node.condition);
     node.thenExpression = visitExpression(node.thenExpression);
@@ -1402,12 +1141,6 @@
     return node;
   }
 
-  visitFunctionDeclaration(FunctionDeclaration node) {
-    visitInnerFunction(node.definition);
-    node.next = visitStatement(node.next);
-    return node;
-  }
-
   visitExpressionStatement(ExpressionStatement node) {
     node.expression = visitExpression(node.expression);
     node.next = visitStatement(node.next);
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart
index e9e8865..acf3133 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart
@@ -61,11 +61,9 @@
     blocks.add(block);
   }
 
-  void collect(RootNode node) {
-    node.forEachBody((Statement body) {
-      _addBlock(new Block()..isEntryPoint = true);
-      visitStatement(body);
-    });
+  void collect(FunctionDefinition node) {
+    _addBlock(new Block()..isEntryPoint = true);
+    visitStatement(node.body);
   }
 
   visitLabeledStatement(LabeledStatement node) {
@@ -170,16 +168,6 @@
     _addStatement(node);
     visitStatement(node.next);
   }
-
-  visitFunctionDeclaration(FunctionDeclaration node) {
-    _addStatement(node);
-    visitStatement(node.next);
-  }
-
-  visitVariableDeclaration(VariableDeclaration node) {
-    _addStatement(node);
-    visitStatement(node.next);
-  }
 }
 
 class TreeTracer extends TracerUtil with StatementVisitor {
@@ -194,25 +182,18 @@
   BlockCollector collector;
   int statementCounter;
 
-  void traceGraph(String name, RootNode node) {
-    if (node.isEmpty) return;
+  void traceGraph(String name, FunctionDefinition node) {
     parameters = node.parameters;
     tag("cfg", () {
       printProperty("name", name);
-      printRootNode(node);
+      names = new Names();
+      statementCounter = 0;
+      collector = new BlockCollector();
+      collector.collect(node);
       collector.blocks.forEach(printBlock);
     });
   }
 
-  void printRootNode(RootNode node) {
-    collector = new BlockCollector();
-    names = new Names();
-    statementCounter = 0;
-    collector = new BlockCollector();
-    collector.collect(node);
-    collector.blocks.forEach(printBlock);
-  }
-
   void printBlock(Block block) {
     tag("block", () {
       printProperty("name", block.name);
@@ -319,16 +300,6 @@
     printStatement(null, expr(node.expression));
   }
 
-  visitFunctionDeclaration(FunctionDeclaration node) {
-    printStatement(null, 'function ${node.definition.element.name}');
-  }
-
-  visitVariableDeclaration(VariableDeclaration node) {
-    String variable = names.varName(node.variable);
-    String value = expr(node.value);
-    printStatement(null, 'declare $variable = $value');
-  }
-
   visitSetField(SetField node) {
     String object = expr(node.object);
     String field = node.field.name;
@@ -425,10 +396,6 @@
     return "this";
   }
 
-  String visitReifyTypeVar(ReifyTypeVar node) {
-    return "typevar [${node.typeVariable.name}]";
-  }
-
   static bool usesInfixNotation(Expression node) {
     return node is Conditional ||
            node is LogicalOperator ||
@@ -473,14 +440,6 @@
     return "function ${node.definition.element.name}";
   }
 
-  String visitFieldInitializer(FieldInitializer node) {
-    throw "$node should not be visited by $this";
-  }
-
-  String visitSuperInitializer(SuperInitializer node) {
-    throw "$node should not be visited by $this";
-  }
-
   String visitGetField(GetField node) {
     String object = visitExpression(node.object);
     String field = node.field.name;
diff --git a/pkg/compiler/lib/src/typechecker.dart b/pkg/compiler/lib/src/typechecker.dart
index 71686c9a..4811e3f 100644
--- a/pkg/compiler/lib/src/typechecker.dart
+++ b/pkg/compiler/lib/src/typechecker.dart
@@ -8,19 +8,18 @@
   TypeCheckerTask(Compiler compiler) : super(compiler);
   String get name => "Type checker";
 
-  void check(TreeElements elements) {
-    AstElement element = elements.analyzedElement;
+  void check(AstElement element) {
+    if (element.isClass) return;
     if (element.isTypedef) return;
-
+    ResolvedAst resolvedAst = element.resolvedAst;
     compiler.withCurrentElement(element, () {
       measure(() {
-        Node tree = element.node;
-        TypeCheckerVisitor visitor =
-            new TypeCheckerVisitor(compiler, elements, compiler.types);
+        TypeCheckerVisitor visitor = new TypeCheckerVisitor(
+            compiler, resolvedAst.elements, compiler.types);
         if (element.isField) {
           visitor.analyzingInitializer = true;
         }
-        tree.accept(visitor);
+        resolvedAst.node.accept(visitor);
       });
     });
   }
diff --git a/pkg/compiler/lib/src/types/type_mask.dart b/pkg/compiler/lib/src/types/type_mask.dart
index a6ac402..753faf2 100644
--- a/pkg/compiler/lib/src/types/type_mask.dart
+++ b/pkg/compiler/lib/src/types/type_mask.dart
@@ -54,7 +54,8 @@
 
   factory TypeMask.nonNullExact(ClassElement base, ClassWorld classWorld) {
     assert(invariant(base, classWorld.isInstantiated(base),
-        message: "Cannot create extact type mask for uninstantiated class"));
+        message: "Cannot create extact type mask for "
+                 "uninstantiated class $base."));
     return new FlatTypeMask.nonNullExact(base);
   }
 
diff --git a/pkg/compiler/lib/src/use_unused_api.dart b/pkg/compiler/lib/src/use_unused_api.dart
index dd46337..d1359e6 100644
--- a/pkg/compiler/lib/src/use_unused_api.dart
+++ b/pkg/compiler/lib/src/use_unused_api.dart
@@ -68,7 +68,7 @@
   useSsa(null);
   useIo(null, null);
   usedByTests();
-  useElements(null, null, null, null, null);
+  useElements();
   useIr(null, null);
   useCompiler(null);
   useTypes();
@@ -245,17 +245,19 @@
 }
 
 useElements(
-    elements.ClassElement e,
-    elements.Name n,
-    modelx.FieldElementX f,
-    PartialClassElement pce,
-    PartialFunctionElement pfe) {
+    [elements.ClassElement e,
+     elements.Name n,
+     modelx.FieldElementX f,
+     PartialClassElement pce,
+     PartialFunctionElement pfe,
+     elements.LibraryElement l]) {
   e.lookupClassMember(null);
   e.lookupInterfaceMember(null);
   n.isAccessibleFrom(null);
   f.reuseElement();
   pce.copyWithEnclosing(null);
   pfe.copyWithEnclosing(null);
+  l.forEachImport(null);
 }
 
 useIr(ir_builder.IrBuilderTask task,
@@ -301,17 +303,12 @@
   new semantic_visitor.BulkDeclarationVisitor().apply(null, null);
 }
 
-class DummyTreeVisitor extends tree_ir.RootVisitor
-                          with tree_ir.InitializerVisitor {
-  visitFunctionDefinition(tree_ir.FunctionDefinition node) {}
-  visitConstructorDefinition(tree_ir.ConstructorDefinition node) {}
-  visitFieldDefinition(tree_ir.FieldDefinition node) {}
-
-  visitFieldInitializer(tree_ir.FieldInitializer node) {}
-  visitSuperInitializer(tree_ir.SuperInitializer node) {}
+class TreeVisitor1 extends tree_ir.ExpressionVisitor1
+                      with tree_ir.StatementVisitor1 {
+  noSuchMethod(inv) {}
 }
 
 useTreeVisitors() {
-  new DummyTreeVisitor().visitRootNode(null);
-  new DummyTreeVisitor().visitInitializer(null);
+  new TreeVisitor1().visitExpression(null, null);
+  new TreeVisitor1().visitStatement(null, null);
 }
diff --git a/pkg/compiler/lib/src/warnings.dart b/pkg/compiler/lib/src/warnings.dart
index d7f1403..7af9562 100644
--- a/pkg/compiler/lib/src/warnings.dart
+++ b/pkg/compiler/lib/src/warnings.dart
@@ -167,8 +167,8 @@
   static const MessageKind NO_INSTANCE_AVAILABLE = const MessageKind(
       "'#{name}' is only available in instance methods.");
 
-  static const MessageKind NO_SUPER_AVAILABLE = const MessageKind(
-      "'super' is only available in instance methods.");
+  static const MessageKind NO_THIS_AVAILABLE = const MessageKind(
+      "'this' is only available in instance methods.");
 
   static const MessageKind PRIVATE_ACCESS = const MessageKind(
       "'#{name}' is declared private within library "
@@ -481,6 +481,22 @@
   static const MessageKind CONST_CALLS_NON_CONST = const MessageKind(
       "'const' constructor cannot call a non-const constructor.");
 
+  static const MessageKind CONST_CALLS_NON_CONST_FOR_IMPLICIT =
+      const MessageKind(
+          "'const' constructor cannot call a non-const constructor. "
+          "This constructor has an implicit call to a "
+          "super non-const constructor.",
+          howToFix: "Try making the super constructor const.",
+          examples: const ["""
+class C {
+  C(); // missing const
+}
+class D extends C {
+  final d;
+  const D(this.d);
+}
+main() => new D(0);"""]);
+
   static const MessageKind CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS =
       const MessageKind(
           "Can't declare constructor 'const' on class #{className} "
diff --git a/pkg/compiler/lib/src/world.dart b/pkg/compiler/lib/src/world.dart
index 2cf1b8f..99b4493 100644
--- a/pkg/compiler/lib/src/world.dart
+++ b/pkg/compiler/lib/src/world.dart
@@ -341,7 +341,7 @@
 
   // Used by selectors.
   bool isForeign(Element element) {
-    return element.isForeign(compiler.backend);
+    return compiler.backend.isForeign(element);
   }
 
   Set<ClassElement> typesImplementedBySubclassesOf(ClassElement cls) {
diff --git a/pkg/pkg.gyp b/pkg/pkg.gyp
index eed2aac..4afbb19 100644
--- a/pkg/pkg.gyp
+++ b/pkg/pkg.gyp
@@ -30,6 +30,9 @@
             '--timestamp_file=<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
             '<(PRODUCT_DIR)/packages',
             '<@(_inputs)',
+            # Pub imports dart2js as compiler_unsupported so it can work outside
+            # the SDK. Map that to the compiler package.
+            'compiler/lib:compiler_unsupported'
           ],
         },
       ],
diff --git a/runtime/bin/bin.gypi b/runtime/bin/bin.gypi
index 18f5aec..51437ef 100644
--- a/runtime/bin/bin.gypi
+++ b/runtime/bin/bin.gypi
@@ -373,6 +373,7 @@
       ],
       'defines': [
         'DART_SHARED_LIB',
+        'DART_NO_SNAPSHOT',
       ],
     },
     {
diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc
index d3091f6..db698a3 100644
--- a/runtime/bin/eventhandler_win.cc
+++ b/runtime/bin/eventhandler_win.cc
@@ -562,9 +562,12 @@
     accepted_count_--;
   }
 
-  if (!IsClosing()) {
-    if (!IssueAccept()) {
-      HandleError(this);
+  if (pending_accept_count_ < 5) {
+    // We have less than 5 pending accepts, queue another.
+    if (!IsClosing()) {
+      if (!IssueAccept()) {
+        HandleError(this);
+      }
     }
   }
 
diff --git a/runtime/lib/array_patch.dart b/runtime/lib/array_patch.dart
index e422e30..109938b 100644
--- a/runtime/lib/array_patch.dart
+++ b/runtime/lib/array_patch.dart
@@ -33,7 +33,7 @@
   }
 
   /* patch */ factory List.from(Iterable elements, { bool growable: true }) {
-    if (elements is EfficientLengthIterable) {
+    if (elements is EfficientLength) {
       int length = elements.length;
       var list = growable ? new _GrowableList<E>(length) : new _List<E>(length);
       int i = 0;
diff --git a/runtime/lib/collection_patch.dart b/runtime/lib/collection_patch.dart
index be2a2dd..ccb4190 100644
--- a/runtime/lib/collection_patch.dart
+++ b/runtime/lib/collection_patch.dart
@@ -432,8 +432,8 @@
   _HashMapEntry(this.key, this.value, this.hashCode, this.next);
 }
 
-abstract class _HashMapIterable<E> extends Iterable<E>
-                                   implements EfficientLengthIterable<E> {
+abstract class _HashMapIterable<E> extends IterableBase<E>
+                                   implements EfficientLength {
   final HashMap _map;
   _HashMapIterable(this._map);
   int get length => _map.length;
@@ -835,8 +835,8 @@
   }
 }
 
-class _LinkedHashMapKeyIterable<K> extends Iterable<K>
-                                   implements EfficientLengthIterable<K> {
+class _LinkedHashMapKeyIterable<K> extends IterableBase<K>
+                                   implements EfficientLength {
   LinkedHashMap<K, dynamic> _map;
   _LinkedHashMapKeyIterable(this._map);
   Iterator<K> get iterator => new _LinkedHashMapKeyIterator<K>(_map);
@@ -847,8 +847,8 @@
   Set<K> toSet() => _map._newKeySet()..addAll(this);
 }
 
-class _LinkedHashMapValueIterable<V> extends Iterable<V>
-                                     implements EfficientLengthIterable<V> {
+class _LinkedHashMapValueIterable<V> extends IterableBase<V>
+                                     implements EfficientLength {
   LinkedHashMap<dynamic, V> _map;
   _LinkedHashMapValueIterable(this._map);
   Iterator<V> get iterator => new _LinkedHashMapValueIterator<V>(_map);
@@ -916,11 +916,7 @@
     if (isValidKey == null) {
       if (hashCode == null) {
         if (equals == null) {
-          if (_useInternalCached) {
-            return new _InternalLinkedHashMap<K, V>();
-          } else {
-            return new _CompactLinkedHashMap<K, V>();
-          }
+          return new _InternalLinkedHashMap<K, V>();
         }
         hashCode = _defaultHashCode;
       } else {
@@ -945,9 +941,6 @@
 
   /* patch */ factory LinkedHashMap.identity() =
       _CompactLinkedIdentityHashMap<K, V>;
-
-  static final bool _useInternalCached = _useInternal;
-  static bool get _useInternal native "LinkedHashMap_useInternal";
 }
 
 patch class LinkedHashSet<E> {
diff --git a/runtime/lib/collection_sources.gypi b/runtime/lib/collection_sources.gypi
index 4cb695b..0e1e21e 100644
--- a/runtime/lib/collection_sources.gypi
+++ b/runtime/lib/collection_sources.gypi
@@ -7,6 +7,5 @@
     'collection_patch.dart',
     'compact_hash.dart',
     'linked_hash_map.cc',
-    'linked_hash_map.dart',
   ],
 }
diff --git a/runtime/lib/compact_hash.dart b/runtime/lib/compact_hash.dart
index 9375fa8..22af0a2 100644
--- a/runtime/lib/compact_hash.dart
+++ b/runtime/lib/compact_hash.dart
@@ -6,34 +6,68 @@
 import 'dart:_internal' as internal;
 
 // Hash table with open addressing that separates the index from keys/values.
-abstract class _HashBase {
+
+abstract class _HashFieldBase {
   // Each occupied entry in _index is a fixed-size integer that encodes a pair:
   //   [ hash pattern for key | index of entry in _data ]
   // The hash pattern is based on hashCode, but is guaranteed to be non-zero.
   // The length of _index is always a power of two, and there is always at
   // least one unoccupied entry.
-  Uint32List _index;
-
-  // The number of bits used for each component is determined by table size.
-  // The length of _index is twice the number of entries in _data, and both
-  // are doubled when _data is full. Thus, _index will have a max load factor
-  // of 1/2, which enables one more bit to be used for the hash.
-  // TODO(koda): Consider growing _data by factor sqrt(2), twice as often.
-  static const int _INITIAL_INDEX_BITS = 3;
-  static const int _INITIAL_INDEX_SIZE = 1 << (_INITIAL_INDEX_BITS + 1);
-
-  // Unused and deleted entries are marked by 0 and 1, respectively.
-  static const int _UNUSED_PAIR = 0;
-  static const int _DELETED_PAIR = 1;
+  Uint32List _index = new Uint32List(_HashBase._INITIAL_INDEX_SIZE);
 
   // Cached in-place mask for the hash pattern component. On 32-bit, the top
   // bits are wasted to avoid Mint allocation.
   // TODO(koda): Reclaim the bits by making the compiler treat hash patterns
   // as unsigned words.
   int _hashMask = internal.is64Bit ?
-      (1 << (32 - _INITIAL_INDEX_BITS)) - 1 :
-      (1 << (30 - _INITIAL_INDEX_BITS)) - 1;
+      (1 << (32 - _HashBase._INITIAL_INDEX_BITS)) - 1 :
+      (1 << (30 - _HashBase._INITIAL_INDEX_BITS)) - 1;
 
+  // Fixed-length list of keys (set) or key/value at even/odd indices (map).
+  List _data = new List(_HashBase._INITIAL_INDEX_SIZE);
+
+  // Length of _data that is used (i.e., keys + values for a map).
+  int _usedData = 0;
+
+  // Number of deleted keys.
+  int _deletedKeys = 0;
+}
+
+// Base class for VM-internal classes; keep in sync with _HashFieldBase.
+abstract class _HashVMBase {
+  Uint32List get _index native "LinkedHashMap_getIndex";
+  void set _index(Uint32List value) native "LinkedHashMap_setIndex";
+
+  int get _hashMask native "LinkedHashMap_getHashMask";
+  void set _hashMask(int value) native "LinkedHashMap_setHashMask";
+
+  List get _data native "LinkedHashMap_getData";
+  void set _data(List value) native "LinkedHashMap_setData";
+
+  int get _usedData native "LinkedHashMap_getUsedData";
+  void set _usedData(int value) native "LinkedHashMap_setUsedData";
+
+  int get _deletedKeys native "LinkedHashMap_getDeletedKeys";
+  void set _deletedKeys(int value) native "LinkedHashMap_setDeletedKeys";
+}
+
+// This mixin can be applied to _HashFieldBase or _HashVMBase (for
+// normal and VM-internalized classes, respectivley), which provide the
+// actual fields/accessors that this mixin assumes.
+// TODO(koda): Consider moving field comments to _HashFieldBase.
+abstract class _HashBase {
+  // The number of bits used for each component is determined by table size.
+  // The length of _index is twice the number of entries in _data, and both
+  // are doubled when _data is full. Thus, _index will have a max load factor
+  // of 1/2, which enables one more bit to be used for the hash.
+  // TODO(koda): Consider growing _data by factor sqrt(2), twice as often. 
+  static const int _INITIAL_INDEX_BITS = 3;
+  static const int _INITIAL_INDEX_SIZE = 1 << (_INITIAL_INDEX_BITS + 1);
+  
+  // Unused and deleted entries are marked by 0 and 1, respectively.
+  static const int _UNUSED_PAIR = 0;
+  static const int _DELETED_PAIR = 1;
+  
   static int _hashPattern(int fullHash, int hashMask, int size) {
     final int maskedHash = fullHash & hashMask;
     // TODO(koda): Consider keeping bit length and use left shift.
@@ -47,14 +81,7 @@
     return ((i << 1) + i) & sizeMask;
   }
   static int _nextProbe(int i, int sizeMask) => (i + 1) & sizeMask;
-
-  // Fixed-length list of keys (set) or key/value at even/odd indices (map).
-  List _data;
-  // Length of _data that is used (i.e., keys + values for a map).
-  int _usedData = 0;
-  // Number of deleted keys.
-  int _deletedKeys = 0;
-
+  
   // A self-loop is used to mark a deleted key or value.
   static bool _isDeleted(List data, Object keyOrValue) =>
       identical(keyOrValue, data);
@@ -79,22 +106,19 @@
   bool _equals(e1, e2) => identical(e1, e2);
 }
 
-// Map with iteration in insertion order (hence "Linked"). New keys are simply
-// appended to _data.
-class _CompactLinkedHashMap<K, V>
-    extends MapBase<K, V> with _HashBase, _OperatorEqualsAndHashCode
+// VM-internalized implementation of a default-constructed LinkedHashMap.
+class _InternalLinkedHashMap<K, V> extends _HashVMBase
+    with MapMixin<K, V>, _LinkedHashMapMixin<K, V>, _HashBase,
+         _OperatorEqualsAndHashCode
     implements LinkedHashMap<K, V> {
+  factory _InternalLinkedHashMap() native "LinkedHashMap_allocate";
+}
 
-  _CompactLinkedHashMap() {
-    assert(_HashBase._UNUSED_PAIR == 0);
-    _index = new Uint32List(_HashBase._INITIAL_INDEX_SIZE);
-    _data = new List(_HashBase._INITIAL_INDEX_SIZE);
-  }
-
+class _LinkedHashMapMixin<K, V> {  
   int get length => (_usedData >> 1) - _deletedKeys;
   bool get isEmpty => length == 0;
   bool get isNotEmpty => !isEmpty;
-
+  
   void _rehash() {
     if ((_deletedKeys << 2) > _usedData) {
       // TODO(koda): Consider shrinking.
@@ -105,7 +129,7 @@
       _init(_index.length << 1, _hashMask >> 1, _data, _usedData);
     }
   }
-
+  
   void clear() {
     if (!isEmpty) {
       _init(_index.length, _hashMask);
@@ -131,7 +155,7 @@
       }
     }
   }
-
+  
   void _insert(K key, V value, int hashPattern, int i) {
     if (_usedData == _data.length) {
       _rehash();
@@ -145,7 +169,7 @@
       _data[_usedData++] = value;
     }
   }
-
+  
   // If key is present, returns the index of the value in _data, else returns
   // the negated insertion point in _index.
   int _findValueOrInsertPoint(K key, int fullHash, int hashPattern, int size) {
@@ -173,7 +197,7 @@
     }
     return firstDeleted >= 0 ? -firstDeleted : -i;
   }
-
+  
   void operator[]=(K key, V value) {
     final int size = _index.length;
     final int sizeMask = size - 1;
@@ -187,7 +211,7 @@
       _insert(key, value, hashPattern, i);
     }
   }
-
+  
   V putIfAbsent(K key, V ifAbsent()) {
     final int size = _index.length;
     final int sizeMask = size - 1;
@@ -210,7 +234,7 @@
     }
     return value;
   }
-
+  
   V remove(Object key) {
     final int size = _index.length;
     final int sizeMask = size - 1;
@@ -239,7 +263,7 @@
     }
     return null;
   }
-
+  
   // If key is absent, return _data (which is never a value).
   Object _getValueOrData(Object key) {
     final int size = _index.length;
@@ -264,14 +288,14 @@
     }
     return _data;
   }
-
+  
   bool containsKey(Object key) => !identical(_data, _getValueOrData(key));
-
+  
   V operator[](Object key) {
     var v = _getValueOrData(key);
     return identical(_data, v) ? null : v;
   }
-
+  
   bool containsValue(Object value) {
     for (var v in values) {
       // Spec. says this should always use "==", also for identity maps, etc.
@@ -297,12 +321,15 @@
       new _CompactIterable<V>(this, _data, _usedData, -1, 2);
 }
 
-class _CompactLinkedIdentityHashMap<K, V>
-    extends _CompactLinkedHashMap<K, V> with _IdenticalAndIdentityHashCode {
+class _CompactLinkedIdentityHashMap<K, V> extends _HashFieldBase
+    with MapMixin<K, V>, _LinkedHashMapMixin<K, V>, _HashBase,
+         _IdenticalAndIdentityHashCode
+    implements LinkedHashMap<K, V> {
 }
 
-class _CompactLinkedCustomHashMap<K, V>
-    extends _CompactLinkedHashMap<K, V> {
+class _CompactLinkedCustomHashMap<K, V> extends _HashFieldBase
+    with MapMixin<K, V>, _LinkedHashMapMixin<K, V>, _HashBase
+    implements LinkedHashMap<K, V> {
   final _equality;
   final _hasher;
   final _validKey;
@@ -369,8 +396,8 @@
 }
 
 // Set implementation, analogous to _CompactLinkedHashMap.
-class _CompactLinkedHashSet<E>
-    extends SetBase<E> with _HashBase, _OperatorEqualsAndHashCode
+class _CompactLinkedHashSet<E> extends _HashFieldBase
+    with _HashBase, _OperatorEqualsAndHashCode, SetMixin<E>
     implements LinkedHashSet<E> {
 
   _CompactLinkedHashSet() {
diff --git a/runtime/lib/growable_array.dart b/runtime/lib/growable_array.dart
index 482e9c0..bd79837 100644
--- a/runtime/lib/growable_array.dart
+++ b/runtime/lib/growable_array.dart
@@ -157,7 +157,7 @@
         (cid == ClassID.cidArray) ||
         (cid == ClassID.cidGrowableObjectArray) ||
         (cid == ClassID.cidImmutableArray);
-    if (isVMList || (iterable is EfficientLengthIterable)) {
+    if (isVMList || (iterable is EfficientLength)) {
       var cap = _capacity;
       // Pregrow if we know iterable.length.
       var iterLen = iterable.length;
diff --git a/runtime/lib/immutable_map.dart b/runtime/lib/immutable_map.dart
index b4fcbcf..2377c8c 100644
--- a/runtime/lib/immutable_map.dart
+++ b/runtime/lib/immutable_map.dart
@@ -84,8 +84,8 @@
   }
 }
 
-class _ImmutableMapKeyIterable<E> extends Iterable<E>
-                                  implements EfficientLengthIterable<E> {
+class _ImmutableMapKeyIterable<E> extends IterableBase<E>
+                                  implements EfficientLength {
   final ImmutableMap _map;
   _ImmutableMapKeyIterable(this._map);
 
@@ -96,8 +96,8 @@
   int get length => _map.length;
 }
 
-class _ImmutableMapValueIterable<E> extends Iterable<E>
-                                    implements EfficientLengthIterable<E> {
+class _ImmutableMapValueIterable<E> extends IterableBase<E>
+                                    implements EfficientLength {
   final ImmutableMap _map;
   _ImmutableMapValueIterable(this._map);
 
diff --git a/runtime/lib/linked_hash_map.cc b/runtime/lib/linked_hash_map.cc
index b69910a..9511841 100644
--- a/runtime/lib/linked_hash_map.cc
+++ b/runtime/lib/linked_hash_map.cc
@@ -13,85 +13,98 @@
 
 namespace dart {
 
-DEFINE_FLAG(bool, use_internal_hash_map, false, "Use internal hash map.");
-
-
 DEFINE_NATIVE_ENTRY(LinkedHashMap_allocate, 1) {
   const TypeArguments& type_arguments =
       TypeArguments::CheckedHandle(arguments->NativeArgAt(0));
   const LinkedHashMap& map =
-    LinkedHashMap::Handle(LinkedHashMap::New());
+    LinkedHashMap::Handle(LinkedHashMap::NewDefault());
   map.SetTypeArguments(type_arguments);
   return map.raw();
 }
 
 
-DEFINE_NATIVE_ENTRY(LinkedHashMap_getLength, 1) {
+DEFINE_NATIVE_ENTRY(LinkedHashMap_getIndex, 1) {
   const LinkedHashMap& map =
       LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0));
-  return Smi::New(map.Length());
+  return map.index();
 }
 
 
-DEFINE_NATIVE_ENTRY(LinkedHashMap_lookUp, 2) {
+DEFINE_NATIVE_ENTRY(LinkedHashMap_setIndex, 2) {
   const LinkedHashMap& map =
       LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0));
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, key, arguments->NativeArgAt(1));
-  return map.LookUp(key);
-}
-
-
-DEFINE_NATIVE_ENTRY(LinkedHashMap_containsKey, 2) {
-  const LinkedHashMap& map =
-      LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0));
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, key, arguments->NativeArgAt(1));
-  return Bool::Get(map.Contains(key)).raw();
-}
-
-
-DEFINE_NATIVE_ENTRY(LinkedHashMap_insertOrUpdate, 3) {
-  LinkedHashMap& map =
-      LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0));
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, key, arguments->NativeArgAt(1));
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(2));
-  map.InsertOrUpdate(key, value);
+  const TypedData& index =
+      TypedData::CheckedHandle(arguments->NativeArgAt(1));
+  map.SetIndex(index);
   return Object::null();
 }
 
 
-DEFINE_NATIVE_ENTRY(LinkedHashMap_remove, 2) {
+DEFINE_NATIVE_ENTRY(LinkedHashMap_getData, 1) {
   const LinkedHashMap& map =
       LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0));
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, key, arguments->NativeArgAt(1));
-  return map.Remove(key);
+  return map.data();
 }
 
 
-DEFINE_NATIVE_ENTRY(LinkedHashMap_clear, 1) {
+DEFINE_NATIVE_ENTRY(LinkedHashMap_setData, 2) {
   const LinkedHashMap& map =
       LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0));
-  map.Clear();
+  const Array& data =
+      Array::CheckedHandle(arguments->NativeArgAt(1));
+  map.SetData(data);
   return Object::null();
 }
 
 
-DEFINE_NATIVE_ENTRY(LinkedHashMap_toArray, 1) {
+DEFINE_NATIVE_ENTRY(LinkedHashMap_getHashMask, 1) {
   const LinkedHashMap& map =
       LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0));
-  return map.ToArray();
+  return map.hash_mask();
 }
 
 
-DEFINE_NATIVE_ENTRY(LinkedHashMap_getModMark, 2) {
+DEFINE_NATIVE_ENTRY(LinkedHashMap_setHashMask, 2) {
   const LinkedHashMap& map =
       LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0));
-  GET_NON_NULL_NATIVE_ARGUMENT(Bool, create, arguments->NativeArgAt(1));
-  return map.GetModificationMark(create.value());
+  const Smi& hashMask =
+      Smi::CheckedHandle(arguments->NativeArgAt(1));
+  map.SetHashMask(hashMask.Value());
+  return Object::null();
 }
 
 
-DEFINE_NATIVE_ENTRY(LinkedHashMap_useInternal, 0) {
-  return Bool::Get(FLAG_use_internal_hash_map).raw();
+DEFINE_NATIVE_ENTRY(LinkedHashMap_getDeletedKeys, 1) {
+  const LinkedHashMap& map =
+      LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0));
+  return map.deleted_keys();
+}
+
+
+DEFINE_NATIVE_ENTRY(LinkedHashMap_setDeletedKeys, 2) {
+  const LinkedHashMap& map =
+      LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0));
+  const Smi& deletedKeys =
+      Smi::CheckedHandle(arguments->NativeArgAt(1));
+  map.SetDeletedKeys(deletedKeys.Value());
+  return Object::null();
+}
+
+
+DEFINE_NATIVE_ENTRY(LinkedHashMap_getUsedData, 1) {
+  const LinkedHashMap& map =
+      LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0));
+  return map.used_data();
+}
+
+
+DEFINE_NATIVE_ENTRY(LinkedHashMap_setUsedData, 2) {
+  const LinkedHashMap& map =
+      LinkedHashMap::CheckedHandle(arguments->NativeArgAt(0));
+  const Smi& usedData =
+      Smi::CheckedHandle(arguments->NativeArgAt(1));
+  map.SetUsedData(usedData.Value());
+  return Object::null();
 }
 
 }  // namespace dart
diff --git a/runtime/lib/linked_hash_map.dart b/runtime/lib/linked_hash_map.dart
deleted file mode 100644
index 54dc897..0000000
--- a/runtime/lib/linked_hash_map.dart
+++ /dev/null
@@ -1,118 +0,0 @@
-// 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.
-
-// VM-internalized implementation of a default-constructed LinkedHashMap.
-// Currently calls the runtime for most operations.
-class _InternalLinkedHashMap<K, V> implements HashMap<K, V>,
-                                              LinkedHashMap<K, V> {
-  factory _InternalLinkedHashMap() native "LinkedHashMap_allocate";
-  int get length native "LinkedHashMap_getLength";
-  V operator [](K key) native "LinkedHashMap_lookUp";
-  void operator []=(K key, V value) native "LinkedHashMap_insertOrUpdate";
-  V remove(K key) native "LinkedHashMap_remove";
-  void clear() native "LinkedHashMap_clear";
-  bool containsKey(K key) native "LinkedHashMap_containsKey";
-
-  bool get isEmpty => length == 0;
-  bool get isNotEmpty => !isEmpty;
-
-  List _toArray() native "LinkedHashMap_toArray";
-
-  // "Modificaton marks" are tokens used to detect concurrent modification.
-  // Considering only modifications (M) and iterator creation (I) events, e.g.:
-  //   M, M, M, I, I, M, I, M, M, I, I, I, M ...
-  // a new mark is allocated at the start of each run of I's and cleared from
-  // the map at the start of each run of M's. Iterators' moveNext check whether
-  // the map's mark was changed or cleared since the iterator was created.
-  // TODO(koda): Consider a counter instead.
-  Object _getModMark(bool create) native "LinkedHashMap_getModMark";
-
-  void addAll(Map<K, V> other) {
-    other.forEach((K key, V value) {
-      this[key] = value;
-    });
-  }
-
-  V putIfAbsent(K key, Function ifAbsent) {
-    if (containsKey(key)) {
-      return this[key];
-    } else {
-      V value = ifAbsent();
-      this[key] = value;
-      return value;
-    }
-  }
-
-  bool containsValue(V value) {
-    for (V v in values) {
-      if (v == value) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  void forEach(Function f) {
-    for (K key in keys) {
-      f(key, this[key]);
-    }
-  }
-
-  // The even-indexed entries of toArray are the keys.
-  Iterable<K> get keys =>
-      new _ListStepIterable<K>(this, _getModMark(true), _toArray(), -2, 2);
-
-  // The odd-indexed entries of toArray are the values.
-  Iterable<V> get values =>
-      new _ListStepIterable<V>(this, _getModMark(true), _toArray(), -1, 2);
-
-  String toString() => Maps.mapToString(this);
-}
-
-// Iterates over a list from a given offset and step size.
-class _ListStepIterable<E> extends IterableBase<E> {
-  _InternalLinkedHashMap _map;
-  Object _modMark;
-  List _list;
-  int _offset;
-  int _step;
-
-  _ListStepIterable(this._map, this._modMark,
-                    this._list, this._offset, this._step);
-
-  Iterator<E> get iterator =>
-      new _ListStepIterator(_map, _modMark, _list, _offset, _step);
-
-  // TODO(koda): Should this check for concurrent modification?
-  int get length => _map.length;
-  bool get isEmpty => length == 0;
-  bool get isNotEmpty => !isEmpty;
-}
-
-class _ListStepIterator<E> implements Iterator<E> {
-  _InternalLinkedHashMap _map;
-  Object _modMark;
-  List _list;
-  int _offset;
-  int _step;
-
-  _ListStepIterator(this._map, this._modMark,
-                    this._list, this._offset, this._step);
-
-  bool moveNext() {
-    if (_map._getModMark(false) != _modMark) {
-      throw new ConcurrentModificationError(_map);
-    }
-    _offset += _step;
-    return _offset < _list.length;
-  }
-
-  E get current {
-    if (_offset < 0 || _offset >= _list.length) {
-      return null;
-    }
-    return _list[_offset];
-  }
-}
-
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index 63e05d0..d90f69c 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -18,7 +18,7 @@
 
 namespace dart {
 
-#define PROPOGATE_IF_MALFOMRED(type)                                           \
+#define PROPAGATE_IF_MALFORMED(type)                                           \
   if (type.IsMalformed()) {                                                    \
     Exceptions::PropagateError(Error::Handle(type.error()));                   \
   }                                                                            \
@@ -210,7 +210,7 @@
   for (intptr_t i = 0; i < args.Length(); i++) {
     type ^= args.TypeAt(i);
     ASSERT(type.IsTypeParameter());
-    PROPOGATE_IF_MALFOMRED(type);
+    PROPAGATE_IF_MALFORMED(type);
     ASSERT(type.IsFinalized());
     name ^= type.name();
     result.SetAt(2 * i, name);
@@ -516,7 +516,8 @@
     return CreateTypeMirror(ref_type);
   }
   ASSERT(type.IsFinalized());
-  PROPOGATE_IF_MALFOMRED(type);
+  PROPAGATE_IF_MALFORMED(type);
+  ASSERT(type.IsCanonical() || type.IsTypeParameter() || type.IsBoundedType());
 
   if (type.HasResolvedTypeClass()) {
     const Class& cls = Class::Handle(type.type_class());
@@ -762,7 +763,8 @@
 static RawAbstractType* InstantiateType(const AbstractType& type,
                                         const AbstractType& instantiator) {
   ASSERT(type.IsFinalized());
-  PROPOGATE_IF_MALFOMRED(type);
+  PROPAGATE_IF_MALFORMED(type);
+  ASSERT(type.IsCanonical() || type.IsTypeParameter() || type.IsBoundedType());
 
   if (type.IsInstantiated() || instantiator.IsNull()) {
     return type.Canonicalize();
@@ -770,7 +772,7 @@
 
   ASSERT(!instantiator.IsNull());
   ASSERT(instantiator.IsFinalized());
-  PROPOGATE_IF_MALFOMRED(instantiator);
+  PROPAGATE_IF_MALFORMED(instantiator);
 
   const TypeArguments& type_args =
       TypeArguments::Handle(instantiator.arguments());
@@ -816,7 +818,7 @@
 
 DEFINE_NATIVE_ENTRY(Mirrors_makeLocalClassMirror, 1) {
   GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
-  PROPOGATE_IF_MALFOMRED(type);
+  PROPAGATE_IF_MALFORMED(type);
   ASSERT(type.IsFinalized());
   ASSERT(type.HasResolvedTypeClass());
   const Class& cls = Class::Handle(type.type_class());
@@ -941,7 +943,7 @@
 
 DEFINE_NATIVE_ENTRY(ClassMirror_supertype, 1) {
   GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
-  PROPOGATE_IF_MALFOMRED(type);
+  PROPAGATE_IF_MALFORMED(type);
   ASSERT(type.IsFinalized());
   if (!type.HasResolvedTypeClass()) {
     Exceptions::ThrowArgumentError(type);
@@ -956,7 +958,7 @@
 
 DEFINE_NATIVE_ENTRY(ClassMirror_supertype_instantiated, 1) {
   GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
-  PROPOGATE_IF_MALFOMRED(type);
+  PROPAGATE_IF_MALFORMED(type);
   ASSERT(type.IsFinalized());
   if (!type.HasResolvedTypeClass()) {
     Exceptions::ThrowArgumentError(type);
@@ -970,7 +972,7 @@
 
 DEFINE_NATIVE_ENTRY(ClassMirror_interfaces, 1) {
   GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
-  PROPOGATE_IF_MALFOMRED(type);
+  PROPAGATE_IF_MALFORMED(type);
   ASSERT(type.IsFinalized());
   if (!type.HasResolvedTypeClass()) {
     Exceptions::ThrowArgumentError(type);
@@ -987,7 +989,7 @@
 
 DEFINE_NATIVE_ENTRY(ClassMirror_interfaces_instantiated, 1) {
   GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
-  PROPOGATE_IF_MALFOMRED(type);
+  PROPAGATE_IF_MALFORMED(type);
   ASSERT(type.IsFinalized());
   if (!type.HasResolvedTypeClass()) {
     Exceptions::ThrowArgumentError(type);
@@ -1015,7 +1017,7 @@
 
 DEFINE_NATIVE_ENTRY(ClassMirror_mixin, 1) {
   GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
-  PROPOGATE_IF_MALFOMRED(type);
+  PROPAGATE_IF_MALFORMED(type);
   ASSERT(type.IsFinalized());
   if (!type.HasResolvedTypeClass()) {
     Exceptions::ThrowArgumentError(type);
@@ -1033,7 +1035,7 @@
   GET_NON_NULL_NATIVE_ARGUMENT(AbstractType,
                                instantiator,
                                arguments->NativeArgAt(1));
-  PROPOGATE_IF_MALFOMRED(type);
+  PROPAGATE_IF_MALFORMED(type);
   ASSERT(type.IsFinalized());
   if (!type.HasResolvedTypeClass()) {
     Exceptions::ThrowArgumentError(type);
diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart
index 4547fa5..11db8fe 100644
--- a/runtime/lib/string_patch.dart
+++ b/runtime/lib/string_patch.dart
@@ -157,7 +157,7 @@
   static String _createStringFromIterable(Iterable<int> charCodes,
                                           int start, int end) {
     // Treat charCodes as Iterable.
-    if (charCodes is EfficientLengthIterable) {
+    if (charCodes is EfficientLength) {
       int length = charCodes.length;
       end = RangeError.checkValidRange(start, end, length);
       List charCodeList = new List.from(charCodes.take(end).skip(start),
diff --git a/runtime/lib/typed_data.dart b/runtime/lib/typed_data.dart
index a6d5dfd..f70781a 100644
--- a/runtime/lib/typed_data.dart
+++ b/runtime/lib/typed_data.dart
@@ -487,14 +487,9 @@
 
   void setRange(int start, int end, Iterable from, [int skipCount = 0]) {
     // Check ranges.
-    if ((start < 0) || (start > length)) {
-      throw _newRangeError(start, length + 1);
-    }
-    if ((end < 0) || (end > length)) {
-      throw _newRangeError(end, length + 1);
-    }
-    if (start > end) {
-      throw _newRangeError(start, end + 1);
+    if (0 > start || start > end || end > length) {
+      RangeError.checkValidRange(start, end, length);  // Always throws.
+      assert(false);
     }
     if (skipCount < 0) {
       throw new ArgumentError(skipCount);
@@ -942,14 +937,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getInt8(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setInt8(index, _toInt8(value));
   }
@@ -983,14 +978,14 @@
   // Methods implementing List interface.
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getUint8(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setUint8(index, _toUint8(value));
   }
@@ -1023,14 +1018,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getUint8(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setUint8(index, _toClampedUint8(value));
   }
@@ -1065,14 +1060,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedInt16(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedInt16(index, _toInt16(value));
   }
@@ -1125,14 +1120,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedUint16(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedUint16(index, _toUint16(value));
   }
@@ -1185,14 +1180,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedInt32(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedInt32(index, _toInt32(value));
   }
@@ -1235,14 +1230,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedUint32(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedUint32(index, _toUint32(value));
   }
@@ -1285,14 +1280,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedInt64(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedInt64(index, _toInt64(value));
   }
@@ -1335,14 +1330,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedUint64(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedUint64(index, _toUint64(value));
   }
@@ -1385,14 +1380,14 @@
 
   double operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedFloat32(index);
   }
 
   void operator[]=(int index, double value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedFloat32(index, value);
   }
@@ -1435,14 +1430,14 @@
 
   double operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedFloat64(index);
   }
 
   void operator[]=(int index, double value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedFloat64(index, value);
   }
@@ -1483,14 +1478,14 @@
 
   Float32x4 operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedFloat32x4(index);
   }
 
   void operator[]=(int index, Float32x4 value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedFloat32x4(index, value);
   }
@@ -1531,14 +1526,14 @@
 
   Int32x4 operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedInt32x4(index);
   }
 
   void operator[]=(int index, Int32x4 value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedInt32x4(index, value);
   }
@@ -1579,14 +1574,14 @@
 
   Float64x2 operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedFloat64x2(index);
   }
 
   void operator[]=(int index, Float64x2 value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedFloat64x2(index, value);
   }
@@ -1628,14 +1623,14 @@
   // Method(s) implementing the List interface.
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getInt8(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setInt8(index, value);
   }
@@ -1671,14 +1666,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getUint8(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setUint8(index, _toUint8(value));
   }
@@ -1713,14 +1708,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getUint8(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setUint8(index, _toClampedUint8(value));
   }
@@ -1756,14 +1751,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedInt16(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedInt16(index, _toInt16(value));
   }
@@ -1807,14 +1802,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedUint16(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedUint16(index, _toUint16(value));
   }
@@ -1858,14 +1853,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedInt32(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedInt32(index, _toInt32(value));
   }
@@ -1909,14 +1904,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedUint32(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedUint32(index, _toUint32(value));
   }
@@ -1960,14 +1955,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedInt64(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedInt64(index, _toInt64(value));
   }
@@ -2011,14 +2006,14 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedUint64(index);
   }
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedUint64(index, _toUint64(value));
   }
@@ -2062,14 +2057,14 @@
 
   double operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedFloat32(index);
   }
 
   void operator[]=(int index, double value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedFloat32(index, value);
   }
@@ -2113,14 +2108,14 @@
 
   double operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedFloat64(index);
   }
 
   void operator[]=(int index, double value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedFloat64(index, value);
   }
@@ -2164,14 +2159,14 @@
 
   Float32x4 operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedFloat32x4(index);
   }
 
   void operator[]=(int index, Float32x4 value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedFloat32x4(index, value);
   }
@@ -2215,14 +2210,14 @@
 
   Int32x4 operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedInt32x4(index);
   }
 
   void operator[]=(int index, Int32x4 value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedInt32x4(index, value);
   }
@@ -2266,14 +2261,14 @@
 
   Float64x2 operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _getIndexedFloat64x2(index);
   }
 
   void operator[]=(int index, Float64x2 value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _setIndexedFloat64x2(index, value);
   }
@@ -2594,7 +2589,7 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _typedData._getInt8(offsetInBytes +
                                (index * Int8List.BYTES_PER_ELEMENT));
@@ -2602,7 +2597,7 @@
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _typedData._setInt8(offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT),
                         _toInt8(value));
@@ -2641,7 +2636,7 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _typedData._getUint8(offsetInBytes +
                                 (index * Uint8List.BYTES_PER_ELEMENT));
@@ -2649,7 +2644,7 @@
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT),
                          _toUint8(value));
@@ -2689,7 +2684,7 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _typedData._getUint8(offsetInBytes +
                                 (index * Uint8List.BYTES_PER_ELEMENT));
@@ -2697,7 +2692,7 @@
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT),
                          _toClampedUint8(value));
@@ -2737,7 +2732,7 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _typedData._getInt16(offsetInBytes +
                                 (index * Int16List.BYTES_PER_ELEMENT));
@@ -2745,7 +2740,7 @@
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _typedData._setInt16(offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT),
                          _toInt16(value));
@@ -2795,7 +2790,7 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _typedData._getUint16(offsetInBytes +
                                  (index * Uint16List.BYTES_PER_ELEMENT));
@@ -2803,7 +2798,7 @@
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _typedData._setUint16(offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT),
                           _toUint16(value));
@@ -2852,7 +2847,7 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _typedData._getInt32(offsetInBytes +
                                 (index * Int32List.BYTES_PER_ELEMENT));
@@ -2860,7 +2855,7 @@
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _typedData._setInt32(offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT),
                          _toInt32(value));
@@ -2900,7 +2895,7 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _typedData._getUint32(offsetInBytes +
                                  (index * Uint32List.BYTES_PER_ELEMENT));
@@ -2908,7 +2903,7 @@
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _typedData._setUint32(offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT),
                           _toUint32(value));
@@ -2948,7 +2943,7 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _typedData._getInt64(offsetInBytes +
                                 (index * Int64List.BYTES_PER_ELEMENT));
@@ -2956,7 +2951,7 @@
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _typedData._setInt64(offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT),
                          _toInt64(value));
@@ -2996,7 +2991,7 @@
 
   int operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _typedData._getUint64(offsetInBytes +
                                  (index * Uint64List.BYTES_PER_ELEMENT));
@@ -3004,7 +2999,7 @@
 
   void operator[]=(int index, int value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _typedData._setUint64(offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT),
                           _toUint64(value));
@@ -3044,7 +3039,7 @@
 
   double operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _typedData._getFloat32(offsetInBytes +
                                   (index * Float32List.BYTES_PER_ELEMENT));
@@ -3052,7 +3047,7 @@
 
   void operator[]=(int index, double value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _typedData._setFloat32(offsetInBytes +
                            (index * Float32List.BYTES_PER_ELEMENT), value);
@@ -3092,7 +3087,7 @@
 
   double operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _typedData._getFloat64(offsetInBytes +
                                   (index * Float64List.BYTES_PER_ELEMENT));
@@ -3100,7 +3095,7 @@
 
   void operator[]=(int index, double value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _typedData._setFloat64(offsetInBytes +
                           (index * Float64List.BYTES_PER_ELEMENT), value);
@@ -3140,7 +3135,7 @@
 
   Float32x4 operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _typedData._getFloat32x4(offsetInBytes +
                                   (index * Float32x4List.BYTES_PER_ELEMENT));
@@ -3148,7 +3143,7 @@
 
   void operator[]=(int index, Float32x4 value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _typedData._setFloat32x4(offsetInBytes +
                              (index * Float32x4List.BYTES_PER_ELEMENT), value);
@@ -3188,7 +3183,7 @@
 
   Int32x4 operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _typedData._getInt32x4(offsetInBytes +
                                    (index * Int32x4List.BYTES_PER_ELEMENT));
@@ -3196,7 +3191,7 @@
 
   void operator[]=(int index, Int32x4 value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _typedData._setInt32x4(offsetInBytes +
                             (index * Int32x4List.BYTES_PER_ELEMENT), value);
@@ -3236,7 +3231,7 @@
 
   Float64x2 operator[](int index) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     return _typedData._getFloat64x2(offsetInBytes +
                                     (index * Float64x2List.BYTES_PER_ELEMENT));
@@ -3244,7 +3239,7 @@
 
   void operator[]=(int index, Float64x2 value) {
     if (index < 0 || index >= length) {
-      throw _newRangeError(index, length);
+      throw new RangeError.index(index, this, "index");
     }
     _typedData._setFloat64x2(offsetInBytes +
                              (index * Float64x2List.BYTES_PER_ELEMENT), value);
@@ -3297,33 +3292,33 @@
 
   int getInt8(int byteOffset) {
     if (byteOffset < 0 || byteOffset >= length) {
-      throw _newRangeError(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 _newRangeError(byteOffset, length);
+      throw new RangeError.index(byteOffset, this, "byteOffset");
     }
     _typedData._setInt8(_offset + byteOffset, value);
   }
 
   int getUint8(int byteOffset) {
     if (byteOffset < 0 || byteOffset >= length) {
-      throw _newRangeError(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 _newRangeError(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 _newRangeError(byteOffset + 1, length);
+      throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
     }
     var result = _typedData._getInt16(_offset + byteOffset);
     if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -3335,7 +3330,7 @@
                 int value,
                 [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 1 >= length) {
-      throw _newRangeError(byteOffset + 1, length);
+      throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
     }
     _typedData._setInt16(_offset + byteOffset,
         identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value));
@@ -3343,7 +3338,7 @@
 
   int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 1 >= length) {
-      throw _newRangeError(byteOffset + 1, length);
+      throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
     }
     var result = _typedData._getUint16(_offset + byteOffset);
     if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -3355,7 +3350,7 @@
                  int value,
                  [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 1 >= length) {
-      throw _newRangeError(byteOffset + 1, length);
+      throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
     }
     _typedData._setUint16(_offset + byteOffset,
         identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value));
@@ -3363,7 +3358,7 @@
 
   int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw _newRangeError(byteOffset + 3, length);
+      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
     }
     var result = _typedData._getInt32(_offset + byteOffset);
     if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -3375,7 +3370,7 @@
                 int value,
                 [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw _newRangeError(byteOffset + 3, length);
+      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
     }
     _typedData._setInt32(_offset + byteOffset,
         identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value));
@@ -3383,7 +3378,7 @@
 
   int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw _newRangeError(byteOffset + 3, length);
+      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
     }
     var result = _typedData._getUint32(_offset + byteOffset);
     if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -3395,7 +3390,7 @@
                  int value,
                  [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw _newRangeError(byteOffset + 3, length);
+      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
     }
     _typedData._setUint32(_offset + byteOffset,
         identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value));
@@ -3403,7 +3398,7 @@
 
   int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 7 >= length) {
-      throw _newRangeError(byteOffset + 7, length);
+      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
     }
     var result = _typedData._getInt64(_offset + byteOffset);
     if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -3415,7 +3410,7 @@
                 int value,
                 [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 7 >= length) {
-      throw _newRangeError(byteOffset + 7, length);
+      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
     }
     _typedData._setInt64(_offset + byteOffset,
         identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value));
@@ -3423,7 +3418,7 @@
 
   int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 7 >= length) {
-      throw _newRangeError(byteOffset + 7, length);
+      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
     }
     var result = _typedData._getUint64(_offset + byteOffset);
     if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -3435,7 +3430,7 @@
                  int value,
                  [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 7 >= length) {
-      throw _newRangeError(byteOffset + 7, length);
+      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
     }
     _typedData._setUint64(_offset + byteOffset,
         identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value));
@@ -3444,7 +3439,7 @@
   double getFloat32(int byteOffset,
                     [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw _newRangeError(byteOffset + 3, length);
+      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
     }
     if (identical(endian, Endianness.HOST_ENDIAN)) {
       return _typedData._getFloat32(_offset + byteOffset);
@@ -3456,7 +3451,7 @@
                   double value,
                   [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw _newRangeError(byteOffset + 3, length);
+      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
     }
     if (identical(endian, Endianness.HOST_ENDIAN)) {
       _typedData._setFloat32(_offset + byteOffset, value);
@@ -3469,7 +3464,7 @@
   double getFloat64(int byteOffset,
                     [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 7 >= length) {
-      throw _newRangeError(byteOffset + 7, length);
+      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
     }
     if (identical(endian, Endianness.HOST_ENDIAN)) {
       return _typedData._getFloat64(_offset + byteOffset);
@@ -3481,7 +3476,7 @@
                   double value,
                   [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 7 >= length) {
-      throw _newRangeError(byteOffset + 7, length);
+      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
     }
     if (identical(endian, Endianness.HOST_ENDIAN)) {
       _typedData._setFloat64(_offset + byteOffset, value);
@@ -3494,7 +3489,7 @@
   Float32x4 getFloat32x4(int byteOffset,
                          [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw _newRangeError(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);
@@ -3503,7 +3498,7 @@
                     Float32x4 value,
                     [Endianness endian = Endianness.BIG_ENDIAN]) {
     if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw _newRangeError(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);
@@ -3621,9 +3616,3 @@
   }
   return object;
 }
-
-
-_newRangeError(int index, int length) {
-  String message = "$index must be in the range [0..$length)";
-  return new RangeError(message);
-}
diff --git a/runtime/observatory/lib/object_graph.dart b/runtime/observatory/lib/object_graph.dart
index a616043..0035580 100644
--- a/runtime/observatory/lib/object_graph.dart
+++ b/runtime/observatory/lib/object_graph.dart
@@ -58,6 +58,8 @@
 
   ObjectVertex._(this._id, this._graph);
 
+  bool get isRoot => _id == 1;
+
   bool operator ==(other) => _id == other._id && _graph == other._graph;
   int get hashCode => _id;
 
@@ -186,7 +188,7 @@
 
     var result = _mostRetained;
     if (classId != null) {
-      result = result.where((u) => u.classId == classId);
+      result = result.where((u) => u.vmCid == classId);
     }
     if (limit != null) {
       result = result.take(limit);
@@ -254,8 +256,8 @@
     while (stream.pendingBytes > 0) {
       positions[id] = stream.position;
       var addr = stream.readUnsigned();
-      var shallowSize = stream.readUnsigned();
-      var cid = stream.readUnsigned();
+      stream.readUnsigned(); // shallowSize
+      stream.readUnsigned(); // cid
       addrToId[addr] = id;
 
       var succAddr = stream.readUnsigned();
@@ -409,8 +411,7 @@
   // Keith D. Cooper, Timothy J. Harvey, and Ken Kennedy
   void _buildDominators() {
     var N = _N;
-    var E = _E;
-    var addrToId = _addrToId;
+
     var postOrder = _postOrderOrdinals;
     var postOrderIndex = _postOrderIndices;
     var firstPreds = _firstPreds;
@@ -486,7 +487,6 @@
 
   void _calculateRetainedSizes() {
     var N = _N;
-    var E = _E;
 
     var size = 0;
     var positions = _positions;
diff --git a/runtime/observatory/lib/service_common.dart b/runtime/observatory/lib/service_common.dart
index 50774c4..790efe1 100644
--- a/runtime/observatory/lib/service_common.dart
+++ b/runtime/observatory/lib/service_common.dart
@@ -76,9 +76,7 @@
 }
 
 /// A [CommonWebSocketVM] communicates with a Dart VM over a CommonWebSocket.
-/// The Dart VM can be embedded in Chromium or standalone. In the case of
-/// Chromium, we make the service requests via the Chrome Remote Debugging
-/// Protocol.
+/// The Dart VM can be embedded in Chromium or standalone.
 abstract class CommonWebSocketVM extends VM {
   final Completer _connected = new Completer();
   final Completer _disconnected = new Completer<String>();
diff --git a/runtime/observatory/lib/src/app/application.dart b/runtime/observatory/lib/src/app/application.dart
index ef8d574..8c8e00e 100644
--- a/runtime/observatory/lib/src/app/application.dart
+++ b/runtime/observatory/lib/src/app/application.dart
@@ -85,7 +85,7 @@
   }
 
   void _onEvent(ServiceEvent event) {
-    switch(event.eventType) {
+    switch(event.kind) {
       case ServiceEvent.kIsolateStart:
       case ServiceEvent.kIsolateUpdate:
       case ServiceEvent.kGraph:
@@ -209,7 +209,7 @@
     notifications.removeWhere((notification) {
         var event = notification.event;
         return (event != null &&
-                event.eventType == ServiceEvent.kConnectionClosed);
+                event.kind == ServiceEvent.kConnectionClosed);
       });
   }
 
diff --git a/runtime/observatory/lib/src/elements/class_view.dart b/runtime/observatory/lib/src/elements/class_view.dart
index 25cb6cb..a7cdf07 100644
--- a/runtime/observatory/lib/src/elements/class_view.dart
+++ b/runtime/observatory/lib/src/elements/class_view.dart
@@ -44,11 +44,18 @@
     });
   }
 
+  void attached() {
+    library.variables.forEach((variable) => variable.reload());
+  }
+
   Future refresh() {
     instances = null;
     retainedBytes = null;
     mostRetained = null;
-    return cls.reload();
+    var loads = [];
+    loads.add(cls.reload());
+    cls.variables.forEach((variable) => loads.add(variable.reload()));
+    return Future.wait(loads);
   }
 
   Future refreshCoverage() {
diff --git a/runtime/observatory/lib/src/elements/class_view.html b/runtime/observatory/lib/src/elements/class_view.html
index b7c113e..dc4121e 100644
--- a/runtime/observatory/lib/src/elements/class_view.html
+++ b/runtime/observatory/lib/src/elements/class_view.html
@@ -99,6 +99,12 @@
     <hr>
 
     <div class="content">
+      <eval-box callback="{{ evaluate }}"></eval-box>
+    </div>
+
+    <hr>
+
+    <div class="content">
       <template if="{{ cls.fields.isNotEmpty }}">
         fields ({{ cls.fields.length }})
         <curly-block expand="{{ cls.fields.length <= 8 }}">
@@ -109,8 +115,8 @@
                   <field-ref ref="{{ field }}"></field-ref>
                 </div>
                 <div class="memberValue">
-                  <template if="{{ field.value != null }}">
-                    <any-service-ref ref="{{ field.value }}"></any-service-ref>
+                  <template if="{{ field.staticValue != null }}">
+                    <any-service-ref ref="{{ field.staticValue }}"></any-service-ref>
                   </template>
                 </div>
               </div>
@@ -199,10 +205,9 @@
         </template>
     </div>
 
+    <hr>
+
     <div class="content-centered-big">
-      <hr>
-      <eval-box callback="{{ evaluate }}"></eval-box>
-      <hr>
       <script-inset script="{{ cls.script }}"
                     startPos="{{ cls.tokenPos }}"
                     endPos="{{ cls.endTokenPos }}">
diff --git a/runtime/observatory/lib/src/elements/cpu_profile.dart b/runtime/observatory/lib/src/elements/cpu_profile.dart
index 3fc31a2..ed7651b 100644
--- a/runtime/observatory/lib/src/elements/cpu_profile.dart
+++ b/runtime/observatory/lib/src/elements/cpu_profile.dart
@@ -545,7 +545,7 @@
       bool handled = false;
       if (e is ServerRpcException) {
         ServerRpcException se = e;
-        if (se.code == ServerRpcException.kProfilingDisabled) {
+        if (se.code == ServerRpcException.kFeatureDisabled) {
           state = 'Disabled';
           handled = true;
         }
@@ -876,7 +876,7 @@
       bool handled = false;
       if (e is ServerRpcException) {
         ServerRpcException se = e;
-        if (se.code == ServerRpcException.kProfilingDisabled) {
+        if (se.code == ServerRpcException.kFeatureDisabled) {
           state = 'Disabled';
           handled = true;
         }
diff --git a/runtime/observatory/lib/src/elements/debugger.dart b/runtime/observatory/lib/src/elements/debugger.dart
index c9be5ec..9fc8df5 100644
--- a/runtime/observatory/lib/src/elements/debugger.dart
+++ b/runtime/observatory/lib/src/elements/debugger.dart
@@ -288,11 +288,11 @@
   Future run(List<String> args) {
     if (debugger.isolatePaused()) {
       var event = debugger.isolate.pauseEvent;
-      if (event.eventType == ServiceEvent.kPauseStart) {
+      if (event.kind == ServiceEvent.kPauseStart) {
         debugger.console.print("Type 'continue' to start the isolate");
         return new Future.value(null);
       }
-      if (event.eventType == ServiceEvent.kPauseExit) {
+      if (event.kind == ServiceEvent.kPauseExit) {
         debugger.console.print("Type 'continue' to exit the isolate");
         return new Future.value(null);
       }
@@ -320,11 +320,11 @@
   Future run(List<String> args) {
     if (debugger.isolatePaused()) {
       var event = debugger.isolate.pauseEvent;
-      if (event.eventType == ServiceEvent.kPauseStart) {
+      if (event.kind == ServiceEvent.kPauseStart) {
         debugger.console.print("Type 'continue' to start the isolate");
         return new Future.value(null);
       }
-      if (event.eventType == ServiceEvent.kPauseExit) {
+      if (event.kind == ServiceEvent.kPauseExit) {
         debugger.console.print("Type 'continue' to exit the isolate");
         return new Future.value(null);
       }
@@ -381,7 +381,7 @@
         try {
           await debugger.isolate.addBreakpointAtEntry(loc.function);
         } on ServerRpcException catch(e) {
-          if (e.code == ServerRpcException.kNoBreakAtFunction) {
+          if (e.code == ServerRpcException.kCannotAddBreakpoint) {
             debugger.console.print('Unable to set breakpoint at ${loc}');
           } else {
             rethrow;
@@ -398,7 +398,7 @@
         try {
           await debugger.isolate.addBreakpoint(loc.script, loc.line);
         } on ServerRpcException catch(e) {
-          if (e.code == ServerRpcException.kNoBreakAtLine) {
+          if (e.code == ServerRpcException.kCannotAddBreakpoint) {
             debugger.console.print('Unable to set breakpoint at ${loc}');
           } else {
             rethrow;
@@ -932,7 +932,7 @@
     // debugger, this could introduce a race.
     return (isolate != null &&
             isolate.pauseEvent != null &&
-            isolate.pauseEvent.eventType != ServiceEvent.kResume);
+            isolate.pauseEvent.kind != ServiceEvent.kResume);
   }
 
   void warnOutOfDate() {
@@ -974,10 +974,10 @@
   }
 
   void _reportPause(ServiceEvent event) {
-    if (event.eventType == ServiceEvent.kPauseStart) {
+    if (event.kind == ServiceEvent.kPauseStart) {
       console.print(
           "Paused at isolate start (type 'continue' to start the isolate')");
-    } else if (event.eventType == ServiceEvent.kPauseExit) {
+    } else if (event.kind == ServiceEvent.kPauseExit) {
       console.print(
           "Paused at isolate exit (type 'continue' to exit the isolate')");
     }
@@ -1005,7 +1005,7 @@
   Future _reportBreakpointEvent(ServiceEvent event) {
     var bpt = event.breakpoint;
     var verb = null;
-    switch (event.eventType) {
+    switch (event.kind) {
       case ServiceEvent.kBreakpointAdded:
         verb = 'added';
         break;
@@ -1035,7 +1035,7 @@
   }
 
   void _onEvent(ServiceEvent event) {
-    switch(event.eventType) {
+    switch(event.kind) {
       case ServiceEvent.kIsolateStart:
         {
           var iso = event.owner;
@@ -1230,7 +1230,7 @@
     DebuggerFrameElement frameElement = new Element.tag('debugger-frame');
     frameElement.frame = frameInfo;
 
-    if (frameInfo['depth'] == currentFrame) {
+    if (frameInfo['index'] == currentFrame) {
       frameElement.setCurrent(true);
     } else {
       frameElement.setCurrent(false);
@@ -1347,7 +1347,7 @@
     List frameElements = $['frameList'].children;
     for (var frameElement in frameElements) {
       var dbgFrameElement = frameElement.children[0];
-      if (dbgFrameElement.frame['depth'] == currentFrame) {
+      if (dbgFrameElement.frame['index'] == currentFrame) {
         dbgFrameElement.setCurrent(true);
       } else {
         dbgFrameElement.setCurrent(false);
@@ -1429,7 +1429,7 @@
 
   void updateFrame(ObservableMap newFrame) {
     assert(matchFrame(newFrame));
-    frame['depth'] = newFrame['depth'];
+    frame['index'] = newFrame['index'];
     frame['tokenPos'] = newFrame['tokenPos'];
     frame['vars'] = newFrame['vars'];
   }
@@ -1503,7 +1503,7 @@
   void updateMessage(ServiceMap newMessage) {
     bool messageChanged =
         (message['messageObjectId'] != newMessage['messageObjectId']);
-    message['depth'] = newMessage['depth'];
+    message['index'] = newMessage['index'];
     message['handlerFunction'] = newMessage['handlerFunction'];
     message['messageObjectId'] = newMessage['messageObjectId'];
     if (messageChanged) {
diff --git a/runtime/observatory/lib/src/elements/debugger.html b/runtime/observatory/lib/src/elements/debugger.html
index 5394bc7..e324955 100644
--- a/runtime/observatory/lib/src/elements/debugger.html
+++ b/runtime/observatory/lib/src/elements/debugger.html
@@ -241,7 +241,7 @@
       <a on-click="{{ toggleExpand }}">
         <div class="frameSummary">
           <div class="frameSummaryText">
-            <div class="frameId"><b>frame {{ frame['depth'] }}</b></div>
+            <div class="frameId"><b>frame {{ frame['index'] }}</b></div>
             <function-ref ref="{{ frame['function'] }}"></function-ref>
             ( <script-ref ref="{{ frame['script'] }}"
                           pos="{{ frame['tokenPos'] }}">
@@ -355,7 +355,7 @@
       <a on-click="{{ toggleExpand }}">
         <div class="messageSummary">
           <div class="messageSummaryText">
-            <div class="messageId"><b>message {{ message['depth'] }}</b></div>
+            <div class="messageId"><b>message {{ message['index'] }}</b></div>
             <function-ref ref="{{ message['handlerFunction'] }}"></function-ref>
             ( <script-ref ref="{{ message['handlerScript'] }}"
                           pos="{{ message['handlerTokenPos'] }}">
diff --git a/runtime/observatory/lib/src/elements/error_ref.html b/runtime/observatory/lib/src/elements/error_ref.html
index ae047c7..57de134 100644
--- a/runtime/observatory/lib/src/elements/error_ref.html
+++ b/runtime/observatory/lib/src/elements/error_ref.html
@@ -18,9 +18,9 @@
       }
     </style>
     <span>
-      <pre class="errorBox">{{ ref.kind }}: {{ ref.message }}</pre>
+      <pre class="errorBox">{{ ref.message }}</pre>
     </span>
   </template>
 </polymer-element>
 
-<script type="application/dart" src="error_ref.dart"></script>
\ No newline at end of file
+<script type="application/dart" src="error_ref.dart"></script>
diff --git a/runtime/observatory/lib/src/elements/field_view.html b/runtime/observatory/lib/src/elements/field_view.html
index a3812b1..ecb9b93 100644
--- a/runtime/observatory/lib/src/elements/field_view.html
+++ b/runtime/observatory/lib/src/elements/field_view.html
@@ -73,11 +73,11 @@
             </div>
           </div>
         </template>
-        <template if="{{ field.value != null }}">
+        <template if="{{ field.staticValue != null }}">
           <div class="memberItem">
             <div class="memberName">static value</div>
             <div class="memberValue">
-              <any-service-ref ref="{{ field.value }}"></any-service-ref>
+              <any-service-ref ref="{{ field.staticValue }}"></any-service-ref>
             </div>
           </div>
         </template>
diff --git a/runtime/observatory/lib/src/elements/heap_profile.dart b/runtime/observatory/lib/src/elements/heap_profile.dart
index 01c3608..243be472 100644
--- a/runtime/observatory/lib/src/elements/heap_profile.dart
+++ b/runtime/observatory/lib/src/elements/heap_profile.dart
@@ -108,7 +108,7 @@
   bool refreshAutoQueued = false;
 
   void _onEvent(ServiceEvent event) {
-    if (autoRefresh && event.eventType == 'GC') {
+    if (autoRefresh && event.kind == 'GC') {
       if (!refreshAutoPending) {
         refreshAuto();
       } else {
diff --git a/runtime/observatory/lib/src/elements/heap_snapshot.dart b/runtime/observatory/lib/src/elements/heap_snapshot.dart
index 4285692..53b8a52 100644
--- a/runtime/observatory/lib/src/elements/heap_snapshot.dart
+++ b/runtime/observatory/lib/src/elements/heap_snapshot.dart
@@ -7,12 +7,10 @@
 import 'dart:async';
 import 'dart:html';
 import 'observatory_element.dart';
-import 'heap_profile.dart';
 import 'package:observatory/app.dart';
 import 'package:observatory/service.dart';
 import 'package:observatory/elements.dart';
 import 'package:observatory/object_graph.dart';
-import 'package:logging/logging.dart';
 import 'package:polymer/polymer.dart';
 
 class DominatorTreeRow extends TableTreeRow {
diff --git a/runtime/observatory/lib/src/elements/instance_ref.html b/runtime/observatory/lib/src/elements/instance_ref.html
index 6b1ee82..0a60ee9 100644
--- a/runtime/observatory/lib/src/elements/instance_ref.html
+++ b/runtime/observatory/lib/src/elements/instance_ref.html
@@ -42,7 +42,8 @@
         </a>
       </template>
 
-      <template if="{{ ref.isPlainInstance }}">
+      <!-- TODO(rmacnak): Specialized view for maps. -->
+      <template if="{{ ref.isPlainInstance || ref.isMap }}">
         <a on-click="{{ goto }}" _href="{{ url }}"><em>{{ ref.clazz.name }}</em></a>
         <curly-block callback="{{ expander() }}">
           <div class="memberList">
diff --git a/runtime/observatory/lib/src/elements/instance_view.html b/runtime/observatory/lib/src/elements/instance_view.html
index 517cc2d..2745e9b 100644
--- a/runtime/observatory/lib/src/elements/instance_view.html
+++ b/runtime/observatory/lib/src/elements/instance_view.html
@@ -88,8 +88,6 @@
                 </function-ref>
               </div>
             </div>
-          </template>
-          <template if="{{ instance.isClosure }}">
             <div class="memberItem">
               <div class="memberName">closure context</div>
               <div class="memberValue">
@@ -128,9 +126,15 @@
       <hr>
 
       <div class="content">
+        <eval-box callback="{{ evaluate }}"></eval-box>
+      </div>
+
+      <hr>
+
+      <div class="content">
         <template if="{{ instance.nativeFields.isNotEmpty }}">
           native fields ({{ instance.nativeFields.length }})
-          <curly-block expand="{{ instance.nativeFields.length <= 8 }}">
+          <curly-block expand="{{ instance.nativeFields.length <= 100 }}">
             <div class="memberList">
               <template repeat="{{ field in instance.nativeFields }}">
                 <div class="memberItem">
@@ -144,7 +148,7 @@
 
         <template if="{{ instance.fields.isNotEmpty }}">
           fields ({{ instance.fields.length }})
-          <curly-block expand="{{ instance.fields.length <= 8 }}">
+          <curly-block expand="{{ instance.fields.length <= 100 }}">
             <div class="memberList">
               <template repeat="{{ field in instance.fields }}">
                 <div class="memberItem">
@@ -177,11 +181,6 @@
         </template>
       </div>
 
-      <hr>
-
-      <div class="content">
-        <eval-box callback="{{ evaluate }}"></eval-box>
-      </div>
     </template>
     <view-footer></view-footer>
   </template>
diff --git a/runtime/observatory/lib/src/elements/isolate_summary.html b/runtime/observatory/lib/src/elements/isolate_summary.html
index 54817b1..618b42e 100644
--- a/runtime/observatory/lib/src/elements/isolate_summary.html
+++ b/runtime/observatory/lib/src/elements/isolate_summary.html
@@ -65,21 +65,21 @@
 <polymer-element name="isolate-location" extends="observatory-element">
   <template>
     <template if="{{ isolate.pauseEvent != null }}">
-      <template if="{{ isolate.pauseEvent.eventType == 'PauseStart' }}">
+      <template if="{{ isolate.pauseEvent.kind == 'PauseStart' }}">
         at isolate start
       </template>
 
-      <template if="{{ isolate.pauseEvent.eventType == 'PauseExit' }}">
+      <template if="{{ isolate.pauseEvent.kind == 'PauseExit' }}">
         at isolate exit
       </template>
 
-      <template if="{{ isolate.pauseEvent.eventType == 'PauseInterrupted' ||
-                       isolate.pauseEvent.eventType == 'PauseBreakpoint' ||
-                       isolate.pauseEvent.eventType == 'PauseException' }}">
+      <template if="{{ isolate.pauseEvent.kind == 'PauseInterrupted' ||
+                       isolate.pauseEvent.kind == 'PauseBreakpoint' ||
+                       isolate.pauseEvent.kind == 'PauseException' }}">
         <template if="{{ isolate.pauseEvent.breakpoint != null }}">
           by breakpoint
         </template>
-        <template if="{{ isolate.pauseEvent.eventType == 'PauseException' }}">
+        <template if="{{ isolate.pauseEvent.kind == 'PauseException' }}">
           by exception
         </template>
         at
diff --git a/runtime/observatory/lib/src/elements/isolate_view.html b/runtime/observatory/lib/src/elements/isolate_view.html
index cb44f71..b9f5e811 100644
--- a/runtime/observatory/lib/src/elements/isolate_view.html
+++ b/runtime/observatory/lib/src/elements/isolate_view.html
@@ -53,10 +53,12 @@
 
     <template if="{{ isolate.topFrame != null }}">
       <br>
-      <script-inset script="{{ isolate.topFrame['script'] }}"
-                    currentPos="{{ isolate.topFrame['tokenPos'] }}"
-                    height="200px">
-      </script-inset>
+      <div class="content-centered-big">
+         <script-inset script="{{ isolate.topFrame['script'] }}"
+                       currentPos="{{ isolate.topFrame['tokenPos'] }}"
+                       height="200px">
+         </script-inset>
+      </div>
     </template>
 
     <div class="flex-row">
diff --git a/runtime/observatory/lib/src/elements/library_view.dart b/runtime/observatory/lib/src/elements/library_view.dart
index 55f05bf..6b43ae3 100644
--- a/runtime/observatory/lib/src/elements/library_view.dart
+++ b/runtime/observatory/lib/src/elements/library_view.dart
@@ -20,8 +20,15 @@
     return library.evaluate(expression);
   }
 
+  void attached() {
+    library.variables.forEach((variable) => variable.reload());
+  }
+
   Future refresh() {
-    return library.reload();
+    var loads = [];
+    loads.add(library.reload());
+    library.variables.forEach((variable) => loads.add(variable.reload()));
+    return Future.wait(loads);
   }
 
   Future refreshCoverage() {
diff --git a/runtime/observatory/lib/src/elements/library_view.html b/runtime/observatory/lib/src/elements/library_view.html
index 65db44c..e28ebad 100644
--- a/runtime/observatory/lib/src/elements/library_view.html
+++ b/runtime/observatory/lib/src/elements/library_view.html
@@ -46,14 +46,20 @@
     <hr>
 
     <div class="content">
-      <template if="{{ library.imports.isNotEmpty }}">
-        imports ({{ library.imports.length }})
-        <curly-block expand="{{ library.imports.length <= 8 }}">
+      <eval-box callback="{{ evaluate }}"></eval-box>
+    </div>
+
+    <hr>
+
+    <div class="content">
+      <template if="{{ library.dependencies.isNotEmpty }}">
+        dependencies ({{ library.dependencies.length }})
+        <curly-block expand="{{ library.dependencies.length <= 8 }}">
           <div class="memberList">
-            <template repeat="{{ imp in library.imports }}">
+            <template repeat="{{ dep in library.dependencies }}">
               <div class="memberItem">
                 <div class="memberValue">
-                  <library-ref ref="{{ imp }}"></library-ref>
+                  <library-ref ref="{{ dep.target }}"></library-ref>
                 </div>
               </div>
             </template>
@@ -104,8 +110,8 @@
                   <field-ref ref="{{ field }}"></field-ref>
                 </div>
                 <div class="memberValue">
-                  <template if="{{ field.value != null }}">
-                    <any-service-ref ref="{{ field.value }}"></any-service-ref>
+                  <template if="{{ field.staticValue != null }}">
+                    <any-service-ref ref="{{ field.staticValue }}"></any-service-ref>
                   </template>
                 </div>
               </div>
@@ -132,11 +138,6 @@
       </template>
     </div>
 
-    <hr>
-
-    <div class="content">
-      <eval-box callback="{{ evaluate }}"></eval-box>
-    </div>
     <view-footer></view-footer>
  </template>
 </polymer-element>
diff --git a/runtime/observatory/lib/src/elements/nav_bar.html b/runtime/observatory/lib/src/elements/nav_bar.html
index 5d1c904..c2e379f 100644
--- a/runtime/observatory/lib/src/elements/nav_bar.html
+++ b/runtime/observatory/lib/src/elements/nav_bar.html
@@ -322,16 +322,16 @@
           <a class="link" on-click="{{ goto }}"
              _href="{{ gotoLink('/inspect', event.isolate) }}">{{ event.isolate.name }}</a>
           is paused
-          <template if="{{ event.eventType == 'PauseStart' }}">
+          <template if="{{ event.kind == 'PauseStart' }}">
             at isolate start
           </template>
-          <template if="{{ event.eventType == 'PauseExit' }}">
+          <template if="{{ event.kind == 'PauseExit' }}">
             at isolate exit
           </template>
           <template if="{{ event.breakpoint != null }}">
             at breakpoint {{ event.breakpoint.number }}
           </template>
-          <template if="{{ event.eventType == 'PauseException' }}">
+          <template if="{{ event.kind == 'PauseException' }}">
             due to exception
           </template>
 
@@ -342,7 +342,7 @@
           <a class="boxclose" on-click="{{ closeItem }}">&times;</a>
         </div>
       </template>
-      <template if="{{ event.eventType == 'ConnectionClosed' }}">
+      <template if="{{ event.kind == 'ConnectionClosed' }}">
         <div class="item">
           Disconnected from VM: {{ event.reason }}
           <br><br>
@@ -351,7 +351,7 @@
           <a class="boxclose" on-click="{{ closeItem }}">&times;</a>
         </div>
       </template>
-      <template if="{{ event.eventType == 'Inspect' }}">
+      <template if="{{ event.kind == 'Inspect' }}">
         <div class="item">
           Inspect <any-service-ref ref="{{ event.inspectee }}"></any-service-ref>
           <br><br>
diff --git a/runtime/observatory/lib/src/elements/script_inset.dart b/runtime/observatory/lib/src/elements/script_inset.dart
index f5a9edd..d35c86e 100644
--- a/runtime/observatory/lib/src/elements/script_inset.dart
+++ b/runtime/observatory/lib/src/elements/script_inset.dart
@@ -230,10 +230,12 @@
       details.append(r);
 
       if (field.isStatic) {
-        r = row();
-        r.append(cell("Value"));
-        r.append(cell(serviceRef(field.value)));
-        details.append(r);
+        if (field.loaded) {
+          r = row();
+          r.append(cell("Value"));
+          r.append(cell(serviceRef(field.staticValue)));
+          details.append(r);
+        }
       } else {
         r = row();
         r.append(cell("Nullable"));
@@ -657,7 +659,7 @@
           .catchError((e, st) {
             if (e is! ServerRpcException ||
                 (e as ServerRpcException).code !=
-                ServerRpcException.kNoBreakAtLine) {
+                ServerRpcException.kCannotAddBreakpoint) {
               app.handleException(e, st);
             }})
           .whenComplete(() {
diff --git a/runtime/observatory/lib/src/elements/service_ref.dart b/runtime/observatory/lib/src/elements/service_ref.dart
index e238141..ba00201 100644
--- a/runtime/observatory/lib/src/elements/service_ref.dart
+++ b/runtime/observatory/lib/src/elements/service_ref.dart
@@ -102,17 +102,15 @@
         ServiceRefElement element = new Element.tag('script-ref');
         element.ref = ref;
         return element;
+      case 'Instance':
+      case 'Sentinel':
+        ServiceRefElement element = new Element.tag('instance-ref');
+        element.ref = ref;
+        return element;
       default:
-        if (ref.isInstance ||
-            ref.isSentinel) {  // TODO(rmacnak): Separate this out.
-          ServiceRefElement element = new Element.tag('instance-ref');
-          element.ref = ref;
-          return element;
-        } else {
-          SpanElement element = new Element.tag('span');
-          element.text = "<<Unknown service ref: $ref>>";
-          return element;
-        }
+        SpanElement element = new Element.tag('span');
+        element.text = "<<Unknown service ref: $ref>>";
+        return element;
     }
   }
 
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index d2c9703..1e744a3 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -20,10 +20,9 @@
   static const kMethodNotFound = -32601;
   static const kInvalidParams  = -32602;
   static const kInternalError  = -32603;
-  static const kVMMustBePaused    = 100;
-  static const kNoBreakAtLine     = 101;
-  static const kNoBreakAtFunction = 102;
-  static const kProfilingDisabled = 200;
+  static const kFeatureDisabled   = 100;
+  static const kVMMustBePaused    = 101;
+  static const kCannotAddBreakpoint = 102;
 
   int code;
   Map data;
@@ -101,58 +100,25 @@
   @reflectable String get vmType => _vmType;
   String _vmType;
 
-  static bool _isInstanceType(String type) {
-    switch (type) {
-      case 'BoundedType':
-      case 'Instance':
-      case 'List':
-      case 'String':
-      case 'Type':
-      case 'TypeParameter':
-      case 'TypeRef':
-      case 'bool':
-      case 'double':
-      case 'int':
-      case 'null':
-        return true;
-      default:
-        return false;
-    }
-  }
-
-  static bool _isTypeType(String type) {
-    switch (type) {
-      case 'BoundedType':
-      case 'Type':
-      case 'TypeParameter':
-      case 'TypeRef':
-        return true;
-      default:
-        return false;
-    }
-  }
-
-  bool get isAbstractType => _isTypeType(type);
-  bool get isBool => type == 'bool';
   bool get isContext => type == 'Context';
-  bool get isDouble => type == 'double';
   bool get isError => type == 'Error';
-  bool get isInstance => _isInstanceType(type);
-  bool get isInt => type == 'int';
-  bool get isList => type == 'List';
-  bool get isNull => type == 'null';
+  bool get isInstance => type == 'Instance';
   bool get isSentinel => type == 'Sentinel';
-  bool get isString => type == 'String';
   bool get isMessage => type == 'Message';
 
   // Kinds of Instance.
-  bool get isMirrorReference => vmType == 'MirrorReference';
-  bool get isWeakProperty => vmType == 'WeakProperty';
+  bool get isAbstractType => false;
+  bool get isNull => false;
+  bool get isBool => false;
+  bool get isDouble => false;
+  bool get isString => false;
+  bool get isInt => false;
+  bool get isList => false;
+  bool get isMap => false;
+  bool get isMirrorReference => false;
+  bool get isWeakProperty => false;
   bool get isClosure => false;
-  bool get isPlainInstance {
-    return (type == 'Instance' &&
-            !isMirrorReference && !isWeakProperty && !isClosure);
-  }
+  bool get isPlainInstance => false;
 
   /// Has this object been fully loaded?
   bool get loaded => _loaded;
@@ -184,7 +150,7 @@
     }
     assert(_isServiceMap(map));
     var type = _stripRef(map['type']);
-    var vmType = map['_vmType'] != null ? _stripRef(map['_vmType']) : type;
+    var vmType = map['_vmType'] != null ? map['_vmType'] : type;
     var obj = null;
     assert(type != 'VM');
     switch (type) {
@@ -234,7 +200,7 @@
             break;
         }
         break;
-      case 'ServiceEvent':
+      case 'Event':
         obj = new ServiceEvent._empty(owner);
         break;
       case 'Script':
@@ -243,11 +209,11 @@
       case 'Socket':
         obj = new Socket._empty(owner);
         break;
+      case 'Instance':
+      case 'Sentinel':  // TODO(rmacnak): Separate this out.
+        obj = new Instance._empty(owner);
+        break;
       default:
-        if (_isInstanceType(type) ||
-            type == 'Sentinel') {  // TODO(rmacnak): Separate this out.
-          obj = new Instance._empty(owner);
-        }
         break;
     }
     if (obj == null) {
@@ -441,9 +407,9 @@
     if (data != null) {
       map['_data'] = data;
     }
-    if (map['type'] != 'ServiceEvent') {
+    if (map['type'] != 'Event') {
       Logger.root.severe(
-          "Expected 'ServiceEvent' but found '${map['type']}'");
+          "Expected 'Event' but found '${map['type']}'");
       return;
     }
 
@@ -455,7 +421,7 @@
       // getFromMap creates the Isolate if it hasn't been seen already.
       var isolate = getFromMap(map['isolate']);
       var event = new ServiceObject._fromMap(isolate, map);
-      if (event.eventType == ServiceEvent.kIsolateExit) {
+      if (event.kind == ServiceEvent.kIsolateExit) {
         _removeIsolate(isolate.id);
       }
       isolate._onEvent(event);
@@ -560,7 +526,6 @@
   }
 
   Future<ObservableMap> _fetchDirect() {
-    print("FETCH DIRECT VM");
     return invokeRpcNoUpgrade('getVM', {});
   }
 
@@ -788,11 +753,16 @@
 
   List<Future<ServiceObject>> getMostRetained({int classId, int limit}) {
     var result = [];
-    for (var v in graph.getMostRetained(classId: classId, limit: limit)) {
-      var address = v.addressForWordSize(isolate.vm.architectureBits ~/ 8);
-      result.add(isolate.getObjectByAddress(address.toRadixString(16)).then((obj) {
-        obj.retainedSize = v.retainedSize;
-        return new Future(() => obj);
+    for (ObjectVertex v in graph.getMostRetained(classId: classId,
+                                                 limit: limit)) {
+      result.add(isolate.getObjectByAddress(v.address.toRadixString(16))
+                        .then((ServiceObject obj) {
+        if (obj is Instance) {
+          // TODO(rmacnak): size/retainedSize are properties of all heap
+          // objects, not just Instances.
+          obj.retainedSize = v.retainedSize;
+        }
+        return obj;
       }));
     }
     return result;
@@ -813,7 +783,7 @@
   void _updateRunState() {
     topFrame = (pauseEvent != null ? pauseEvent.topFrame : null);
     paused = (pauseEvent != null &&
-              pauseEvent.eventType != ServiceEvent.kResume);
+              pauseEvent.kind != ServiceEvent.kResume);
     running = (!paused && topFrame != null);
     idle = (!paused && topFrame == null);
     notifyPropertyChange(#topFrame, 0, 1);
@@ -1132,7 +1102,7 @@
   }
 
   void _onEvent(ServiceEvent event) {
-    switch(event.eventType) {
+    switch(event.kind) {
       case ServiceEvent.kIsolateStart:
       case ServiceEvent.kIsolateExit:
       case ServiceEvent.kInspect:
@@ -1193,7 +1163,7 @@
       }
       return bpt;
     } on ServerRpcException catch(e) {
-      if (e.code == ServerRpcException.kNoBreakAtLine) {
+      if (e.code == ServerRpcException.kCannotAddBreakpoint) {
         // Unable to set a breakpoint at the desired line.
         script.getLine(line).possibleBpt = false;
       }
@@ -1225,15 +1195,15 @@
   }
 
   Future stepInto() {
-    return invokeRpc('resume', {'step': 'into'});
+    return invokeRpc('resume', {'step': 'Into'});
   }
 
   Future stepOver() {
-    return invokeRpc('resume', {'step': 'over'});
+    return invokeRpc('resume', {'step': 'Over'});
   }
 
   Future stepOut() {
-    return invokeRpc('resume', {'step': 'out'});
+    return invokeRpc('resume', {'step': 'Out'});
   }
 
   Future setName(String newName) {
@@ -1253,10 +1223,10 @@
     return invokeRpc('evaluate', params);
   }
 
-  Future<ServiceObject> evalFrame(int framePos,
+  Future<ServiceObject> evalFrame(int frameIndex,
                                   String expression) {
     Map params = {
-      'frame': framePos,
+      'frameIndex': frameIndex,
       'expression': expression,
     };
     return invokeRpc('evaluateInFrame', params);
@@ -1412,17 +1382,15 @@
 class DartError extends ServiceObject {
   DartError._empty(ServiceObject owner) : super._empty(owner);
 
-  @observable String kind;
   @observable String message;
   @observable Instance exception;
   @observable Instance stacktrace;
 
   void _update(ObservableMap map, bool mapIsRef) {
-    kind = map['kind'];
     message = map['message'];
     exception = new ServiceObject._fromMap(owner, map['exception']);
     stacktrace = new ServiceObject._fromMap(owner, map['stacktrace']);
-    name = 'DartError $kind';
+    name = 'DartError($message)';
     vmName = name;
   }
 
@@ -1431,7 +1399,7 @@
 
 /// A [ServiceEvent] is an asynchronous event notification from the vm.
 class ServiceEvent extends ServiceObject {
-  /// The possible 'eventType' values.
+  /// The possible 'kind' values.
   static const kIsolateStart       = 'IsolateStart';
   static const kIsolateExit        = 'IsolateExit';
   static const kIsolateUpdate      = 'IsolateUpdate';
@@ -1452,10 +1420,10 @@
   ServiceEvent._empty(ServiceObjectOwner owner) : super._empty(owner);
 
   ServiceEvent.connectionClosed(this.reason) : super._empty(null) {
-    eventType = kConnectionClosed;
+    kind = kConnectionClosed;
   }
 
-  @observable String eventType;
+  @observable String kind;
   @observable Breakpoint breakpoint;
   @observable ServiceMap topFrame;
   @observable ServiceMap exception;
@@ -1466,20 +1434,20 @@
   int chunkIndex, chunkCount, nodeCount;
 
   @observable bool get isPauseEvent {
-    return (eventType == kPauseStart ||
-            eventType == kPauseExit ||
-            eventType == kPauseBreakpoint ||
-            eventType == kPauseInterrupted ||
-            eventType == kPauseException);
+    return (kind == kPauseStart ||
+            kind == kPauseExit ||
+            kind == kPauseBreakpoint ||
+            kind == kPauseInterrupted ||
+            kind == kPauseException);
   }
 
   void _update(ObservableMap map, bool mapIsRef) {
     _loaded = true;
     _upgradeCollection(map, owner);
     assert(map['isolate'] == null || owner == map['isolate']);
-    eventType = map['eventType'];
+    kind = map['kind'];
     notifyPropertyChange(#isPauseEvent, 0, 1);
-    name = 'ServiceEvent $eventType';
+    name = 'ServiceEvent $kind';
     vmName = name;
     if (map['breakpoint'] != null) {
       breakpoint = map['breakpoint'];
@@ -1512,9 +1480,9 @@
 
   String toString() {
     if (data == null) {
-      return "ServiceEvent(owner='${owner.id}', type='${eventType}')";
+      return "ServiceEvent(owner='${owner.id}', kind='${kind}')";
     } else {
-      return "ServiceEvent(owner='${owner.id}', type='${eventType}', "
+      return "ServiceEvent(owner='${owner.id}', kind='${kind}', "
           "data.lengthInBytes=${data.lengthInBytes})";
     }
   }
@@ -1587,9 +1555,27 @@
   }
 }
 
+
+class LibraryDependency {
+  @reflectable final bool isImport;
+  @reflectable final bool isDeferred;
+  @reflectable final String prefix;
+  @reflectable final Library target;
+
+  bool get isExport => !isImport;
+
+  LibraryDependency._(this.isImport, this.isDeferred, this.prefix, this.target);
+
+  static _fromMap(map) => new LibraryDependency._(map["isImport"],
+                                                  map["isDeferred"],
+                                                  map["prefix"],
+                                                  map["target"]);
+}
+
+
 class Library extends ServiceObject with Coverage {
   @observable String uri;
-  @reflectable final imports = new ObservableList<Library>();
+  @reflectable final dependencies = new ObservableList<LibraryDependency>();
   @reflectable final scripts = new ObservableList<Script>();
   @reflectable final classes = new ObservableList<Class>();
   @reflectable final variables = new ObservableList<Field>();
@@ -1618,8 +1604,8 @@
     }
     _loaded = true;
     _upgradeCollection(map, isolate);
-    imports.clear();
-    imports.addAll(removeDuplicatesAndSortLexical(map['imports']));
+    dependencies.clear();
+    dependencies.addAll(map["dependencies"].map(LibraryDependency._fromMap));
     scripts.clear();
     scripts.addAll(removeDuplicatesAndSortLexical(map['scripts']));
     classes.clear();
@@ -1738,9 +1724,9 @@
 
     isAbstract = map['abstract'];
     isConst = map['const'];
-    isFinalized = map['finalized'];
-    isPatch = map['patch'];
-    isImplemented = map['implemented'];
+    isFinalized = map['_finalized'];
+    isPatch = map['_patch'];
+    isImplemented = map['_implemented'];
 
     tokenPos = map['tokenPos'];
     endTokenPos = map['endTokenPos'];
@@ -1768,7 +1754,7 @@
     }
     error = map['error'];
 
-    var allocationStats = map['allocationStats'];
+    var allocationStats = map['_allocationStats'];
     if (allocationStats != null) {
       newSpace.update(allocationStats['new']);
       oldSpace.update(allocationStats['old']);
@@ -1794,6 +1780,7 @@
 }
 
 class Instance extends ServiceObject {
+  @observable String kind;
   @observable Class clazz;
   @observable int size;
   @observable int retainedSize;
@@ -1808,12 +1795,28 @@
   @observable var fields;
   @observable var nativeFields;
   @observable var elements;
-  @observable var userName;
   @observable var referent;  // If a MirrorReference.
   @observable Instance key;  // If a WeakProperty.
   @observable Instance value;  // If a WeakProperty.
 
-  bool get isClosure => function != null;
+  bool get isAbstractType {
+    return (kind == 'Type' || kind == 'TypeRef' ||
+            kind == 'TypeParameter' || kind == 'BoundedType');
+  }
+  bool get isNull => kind == 'Null';
+  bool get isBool => kind == 'Bool';
+  bool get isDouble => kind == 'Double';
+  bool get isString => kind == 'String';
+  bool get isInt => kind == 'Int';
+  bool get isList => kind == 'List';
+  bool get isMap => kind == 'Map';
+  bool get isMirrorReference => kind == 'MirrorReference';
+  bool get isWeakProperty => kind == 'WeakProperty';
+  bool get isClosure => kind == 'Closure';
+
+  // TODO(turnidge): Is this properly backwards compatible when new
+  // instance kinds are added?
+  bool get isPlainInstance => kind == 'PlainInstance';
 
   Instance._empty(ServiceObjectOwner owner) : super._empty(owner);
 
@@ -1821,13 +1824,14 @@
     // Extract full properties.
     _upgradeCollection(map, isolate);
 
+    kind = map['kind'];
     clazz = map['class'];
     size = map['size'];
     valueAsString = map['valueAsString'];
     // Coerce absence to false.
     valueAsStringIsTruncated = map['valueAsStringIsTruncated'] == true;
-    function = map['function'];
-    context = map['context'];
+    function = map['closureFunction'];
+    context = map['closureContext'];
     name = map['name'];
     length = map['length'];
 
@@ -1835,14 +1839,13 @@
       return;
     }
 
-    nativeFields = map['nativeFields'];
+    nativeFields = map['_nativeFields'];
     fields = map['fields'];
     elements = map['elements'];
-    typeClass = map['type_class'];
-    userName = map['user_name'];
-    referent = map['referent'];
-    key = map['key'];
-    value = map['value'];
+    typeClass = map['typeClass'];
+    referent = map['mirrorReferent'];
+    key = map['propertyKey'];
+    value = map['propertyValue'];
 
     // We are fully loaded.
     _loaded = true;
@@ -1984,7 +1987,7 @@
     _upgradeCollection(map, isolate);
 
     dartOwner = map['owner'];
-    kind = FunctionKind.fromJSON(map['kind']);
+    kind = FunctionKind.fromJSON(map['_kind']);
     isDart = !kind.isSynthetic();
 
     if (dartOwner is ServiceFunction) {
@@ -2030,7 +2033,7 @@
   @observable bool isStatic;
   @observable bool isFinal;
   @observable bool isConst;
-  @observable Instance value;
+  @observable Instance staticValue;
   @observable String name;
   @observable String vmName;
 
@@ -2053,7 +2056,7 @@
     isStatic = map['static'];
     isFinal = map['final'];
     isConst = map['const'];
-    value = map['value'];
+    staticValue = map['staticValue'];
 
     if (dartOwner is Class) {
       Class ownerClass = dartOwner;
diff --git a/runtime/observatory/tests/service/async_generator_breakpoint_test.dart b/runtime/observatory/tests/service/async_generator_breakpoint_test.dart
index 123edcd..c8a33e3 100644
--- a/runtime/observatory/tests/service/async_generator_breakpoint_test.dart
+++ b/runtime/observatory/tests/service/async_generator_breakpoint_test.dart
@@ -70,7 +70,7 @@
       });
 
   await for (ServiceEvent event in isolate.vm.events.stream) {
-    if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+    if (event.kind == ServiceEvent.kPauseBreakpoint) {
       var bp = event.breakpoint;
       print('Hit $bp');
       hits.add(bp);
diff --git a/runtime/observatory/tests/service/break_on_activation_test.dart b/runtime/observatory/tests/service/break_on_activation_test.dart
index 0b20631..9029587 100644
--- a/runtime/observatory/tests/service/break_on_activation_test.dart
+++ b/runtime/observatory/tests/service/break_on_activation_test.dart
@@ -6,7 +6,6 @@
 import 'package:observatory/service_io.dart';
 import 'package:unittest/unittest.dart';
 import 'test_helper.dart';
-import 'dart:async';
 
 genRepeater(value) {
   return () => print(value);
@@ -57,19 +56,20 @@
 
   var subscription;
   subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
-    if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+    if (event.kind == ServiceEvent.kPauseBreakpoint) {
       print("Hit breakpoint ${event.breakpoint}");
       breaksHit++;
       isolate.resume();
     }
   });
 
-  valueOfField(String name) {
-    return rootLib.variables.singleWhere((v) => v.name == name).value;
+  valueOfField(String name) async {
+    var field = rootLib.variables.singleWhere((v) => v.name == name);
+    await field.load();
+    return field.staticValue;
+
   }
-  var r1Ref = valueOfField('r1');
-  var r2Ref = valueOfField('r2');
-  var r3Ref = valueOfField('r3');
+  var r1Ref = await valueOfField('r1');
 
   var bpt1 = await isolate.addBreakOnActivation(r1Ref);
   print("Added breakpoint $bpt1");
@@ -97,19 +97,19 @@
 
   var subscription;
   subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
-    if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+    if (event.kind == ServiceEvent.kPauseBreakpoint) {
       print("Hit breakpoint ${event.breakpoint}");
       breaksHit++;
       isolate.resume();
     }
   });
 
-  valueOfField(String name) {
-    return rootLib.variables.singleWhere((v) => v.name == name).value;
+  valueOfField(String name) async {
+    var field = rootLib.variables.singleWhere((v) => v.name == name);
+    await field.load();
+    return field.staticValue;
   }
-  var r1Ref = valueOfField('r1_named');
-  var r2Ref = valueOfField('r2_named');
-  var r3Ref = valueOfField('r3_named');
+  var r1Ref = await valueOfField('r1_named');
 
   var bpt1 = await isolate.addBreakOnActivation(r1Ref);
   print("Added breakpoint $bpt1");
@@ -137,19 +137,20 @@
 
   var subscription;
   subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
-    if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+    if (event.kind == ServiceEvent.kPauseBreakpoint) {
       print("Hit breakpoint ${event.breakpoint}");
       breaksHit++;
       isolate.resume();
     }
   });
 
-  valueOfField(String name) {
-    return rootLib.variables.singleWhere((v) => v.name == name).value;
+  valueOfField(String name) async {
+    var field = rootLib.variables.singleWhere((v) => v.name == name);
+    await field.load();
+    return field.staticValue;
   }
-  var r1Ref = valueOfField('r1');
-  var r2Ref = valueOfField('r2');
-  var r3Ref = valueOfField('r3');
+  var r1Ref = await valueOfField('r1');
+  var r2Ref = await valueOfField('r2');
 
   var bpt1 = await isolate.addBreakOnActivation(r1Ref);
   print("Added breakpoint $bpt1");
diff --git a/runtime/observatory/tests/service/code_test.dart b/runtime/observatory/tests/service/code_test.dart
index 99c5f16..6b74b39 100644
--- a/runtime/observatory/tests/service/code_test.dart
+++ b/runtime/observatory/tests/service/code_test.dart
@@ -35,7 +35,7 @@
       // Set up a listener to wait for breakpoint events.
       Completer completer = new Completer();
       isolate.vm.events.stream.listen((ServiceEvent event) {
-        if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+        if (event.kind == ServiceEvent.kPauseBreakpoint) {
           print('Breakpoint reached');
           completer.complete();
         }
diff --git a/runtime/observatory/tests/service/contexts_test.dart b/runtime/observatory/tests/service/contexts_test.dart
index 6bbcacd..6b3e8c9 100644
--- a/runtime/observatory/tests/service/contexts_test.dart
+++ b/runtime/observatory/tests/service/contexts_test.dart
@@ -53,12 +53,14 @@
 (Isolate isolate) =>
   isolate.rootLibrary.load().then((Library lib) {
     Field field = lib.variables.singleWhere((v) => v.name == 'cleanBlock');
-    return field.value.load().then((Instance block) {
-      expect(block.isClosure, isTrue);
-      expect(block.context.isContext, isTrue);
-      expect(block.context.length, equals(0));
-      return block.context.load().then((Context ctxt) {
-        expect(ctxt.parentContext.isNull, isTrue);
+    return field.load().then((_) {
+      return field.staticValue.load().then((Instance block) {
+        expect(block.isClosure, isTrue);
+        expect(block.context.isContext, isTrue);
+        expect(block.context.length, equals(0));
+        return block.context.load().then((Context ctxt) {
+          expect(ctxt.parentContext.isNull, isTrue);
+        });
       });
     });
   }),
@@ -66,17 +68,19 @@
 (Isolate isolate) =>
   isolate.rootLibrary.load().then((Library lib) {
     Field field = lib.variables.singleWhere((v) => v.name == 'copyingBlock');
-    return field.value.load().then((Instance block) {
-      expect(block.isClosure, isTrue);
-      expect(block.context.isContext, isTrue);
-      expect(block.context.length, equals(1));
-      return block.context.load().then((Context ctxt) {
-        expect(ctxt.variables.single['value'].isString, isTrue);
-        expect(ctxt.variables.single['value'].valueAsString, equals('I could be copied into the block'));
-        expect(ctxt.parentContext.isContext, isTrue);
-        expect(ctxt.parentContext.length, equals(0));
-        return ctxt.parentContext.load().then((Context outerCtxt) {
-          expect(outerCtxt.parentContext.isNull, isTrue);
+    return field.load().then((_) {
+      return field.staticValue.load().then((Instance block) {
+        expect(block.isClosure, isTrue);
+        expect(block.context.isContext, isTrue);
+        expect(block.context.length, equals(1));
+        return block.context.load().then((Context ctxt) {
+          expect(ctxt.variables.single['value'].isString, isTrue);
+          expect(ctxt.variables.single['value'].valueAsString, equals('I could be copied into the block'));
+          expect(ctxt.parentContext.isContext, isTrue);
+          expect(ctxt.parentContext.length, equals(0));
+          return ctxt.parentContext.load().then((Context outerCtxt) {
+            expect(outerCtxt.parentContext.isNull, isTrue);
+          });
         });
       });
     });
@@ -85,17 +89,19 @@
 (Isolate isolate) =>
   isolate.rootLibrary.load().then((Library lib) {
     Field field = lib.variables.singleWhere((v) => v.name == 'fullBlock');
-    return field.value.load().then((Instance block) {
-      expect(block.isClosure, isTrue);
-      expect(block.context.isContext, isTrue);
-      expect(block.context.length, equals(1));
-      return block.context.load().then((ctxt) {
-        expect(ctxt.variables.single['value'].isInt, isTrue);
-        expect(ctxt.variables.single['value'].valueAsString, equals('43'));
-        expect(ctxt.parentContext.isContext, isTrue);
-        expect(ctxt.parentContext.length, equals(0));
-        return ctxt.parentContext.load().then((Context outerCtxt) {
-          expect(outerCtxt.parentContext.isNull, isTrue);
+    return field.load().then((_) {
+      return field.staticValue.load().then((Instance block) {
+        expect(block.isClosure, isTrue);
+        expect(block.context.isContext, isTrue);
+        expect(block.context.length, equals(1));
+        return block.context.load().then((ctxt) {
+          expect(ctxt.variables.single['value'].isInt, isTrue);
+          expect(ctxt.variables.single['value'].valueAsString, equals('43'));
+          expect(ctxt.parentContext.isContext, isTrue);
+          expect(ctxt.parentContext.length, equals(0));
+          return ctxt.parentContext.load().then((Context outerCtxt) {
+            expect(outerCtxt.parentContext.isNull, isTrue);
+          });
         });
       });
     });
@@ -104,22 +110,24 @@
 (Isolate isolate) =>
   isolate.rootLibrary.load().then((Library lib) {
     Field field = lib.variables.singleWhere((v) => v.name == 'fullBlockWithChain');
-    return field.value.load().then((Instance block) {
-      expect(block.isClosure, isTrue);
-      expect(block.context.isContext, isTrue);
-      expect(block.context.length, equals(1));
-      return block.context.load().then((Context ctxt) {
-        expect(ctxt.variables.single['value'].isInt, isTrue);
-        expect(ctxt.variables.single['value'].valueAsString, equals('4201'));
-        expect(ctxt.parentContext.isContext, isTrue);
-        expect(ctxt.parentContext.length, equals(1));
-        return ctxt.parentContext.load().then((Context outerCtxt) {
-          expect(outerCtxt.variables.single['value'].isInt, isTrue);
-          expect(outerCtxt.variables.single['value'].valueAsString, equals('421'));
-          expect(outerCtxt.parentContext.isContext, isTrue);
-          expect(outerCtxt.parentContext.length, equals(0));
-          return outerCtxt.parentContext.load().then((Context outerCtxt2) {
-            expect(outerCtxt2.parentContext.isNull, isTrue);
+    return field.load().then((_) {
+      return field.staticValue.load().then((Instance block) {
+        expect(block.isClosure, isTrue);
+        expect(block.context.isContext, isTrue);
+        expect(block.context.length, equals(1));
+        return block.context.load().then((Context ctxt) {
+          expect(ctxt.variables.single['value'].isInt, isTrue);
+          expect(ctxt.variables.single['value'].valueAsString, equals('4201'));
+          expect(ctxt.parentContext.isContext, isTrue);
+          expect(ctxt.parentContext.length, equals(1));
+          return ctxt.parentContext.load().then((Context outerCtxt) {
+            expect(outerCtxt.variables.single['value'].isInt, isTrue);
+            expect(outerCtxt.variables.single['value'].valueAsString, equals('421'));
+            expect(outerCtxt.parentContext.isContext, isTrue);
+            expect(outerCtxt.parentContext.length, equals(0));
+            return outerCtxt.parentContext.load().then((Context outerCtxt2) {
+              expect(outerCtxt2.parentContext.isNull, isTrue);
+            });
           });
         });
       });
diff --git a/runtime/observatory/tests/service/coverage_test.dart b/runtime/observatory/tests/service/coverage_test.dart
index 9a4fc59..1f75644 100644
--- a/runtime/observatory/tests/service/coverage_test.dart
+++ b/runtime/observatory/tests/service/coverage_test.dart
@@ -58,7 +58,7 @@
       // Set up a listener to wait for breakpoint events.
       Completer completer = new Completer();
       isolate.vm.events.stream.listen((ServiceEvent event) {
-        if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+        if (event.kind == ServiceEvent.kPauseBreakpoint) {
           print('Breakpoint reached');
           completer.complete();
         }
diff --git a/runtime/observatory/tests/service/debugger_inspect_test.dart b/runtime/observatory/tests/service/debugger_inspect_test.dart
index fdbc4c7..e6b8e9e 100644
--- a/runtime/observatory/tests/service/debugger_inspect_test.dart
+++ b/runtime/observatory/tests/service/debugger_inspect_test.dart
@@ -25,7 +25,7 @@
   var subscription;
   subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
     print(event);
-    if (event.eventType == ServiceEvent.kInspect) {
+    if (event.kind == ServiceEvent.kInspect) {
       expect((event.inspectee as Instance).clazz.name, equals('Point'));
 
       subscription.cancel();
diff --git a/runtime/observatory/tests/service/debugging_test.dart b/runtime/observatory/tests/service/debugging_test.dart
index a4ce042..9685707 100644
--- a/runtime/observatory/tests/service/debugging_test.dart
+++ b/runtime/observatory/tests/service/debugging_test.dart
@@ -30,7 +30,7 @@
   Completer completer = new Completer();
   var subscription;
   subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
-    if (event.eventType == ServiceEvent.kPauseInterrupted) {
+    if (event.kind == ServiceEvent.kPauseInterrupted) {
       subscription.cancel();
       completer.complete();
     }
@@ -44,7 +44,7 @@
   Completer completer = new Completer();
   var subscription;
   subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
-    if (event.eventType == ServiceEvent.kResume) {
+    if (event.kind == ServiceEvent.kResume) {
       subscription.cancel();
       completer.complete();
     }
@@ -61,7 +61,7 @@
   Completer completer = new Completer();
   var subscription;
   subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
-    if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+    if (event.kind == ServiceEvent.kPauseBreakpoint) {
       print('Breakpoint reached');
       subscription.cancel();
       completer.complete();
@@ -100,7 +100,7 @@
   Completer completer = new Completer();
   var subscription;
   subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
-    if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+    if (event.kind == ServiceEvent.kPauseBreakpoint) {
       print('Breakpoint reached');
       subscription.cancel();
       completer.complete();
@@ -128,7 +128,7 @@
   Completer completer = new Completer();
   var subscription;
   subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
-    if (event.eventType == ServiceEvent.kBreakpointRemoved) {
+    if (event.kind == ServiceEvent.kBreakpointRemoved) {
       print('Breakpoint removed');
       expect(isolate.breakpoints.length, equals(0));
       subscription.cancel();
@@ -147,7 +147,7 @@
   Completer completer = new Completer();
   var subscription;
   subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
-    if (event.eventType == ServiceEvent.kResume) {
+    if (event.kind == ServiceEvent.kResume) {
       subscription.cancel();
       completer.complete();
     }
@@ -162,7 +162,7 @@
   Completer completer = new Completer();
   var subscription;
   subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
-    if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+    if (event.kind == ServiceEvent.kPauseBreakpoint) {
       print('Breakpoint reached');
       subscription.cancel();
       completer.complete();
diff --git a/runtime/observatory/tests/service/dominator_tree_test.dart b/runtime/observatory/tests/service/dominator_tree_test.dart
index b5c6566..c5f62e8 100644
--- a/runtime/observatory/tests/service/dominator_tree_test.dart
+++ b/runtime/observatory/tests/service/dominator_tree_test.dart
@@ -6,7 +6,6 @@
 import 'package:observatory/service_io.dart';
 import 'package:unittest/unittest.dart';
 import 'test_helper.dart';
-import 'dart:async';
 
 // small example from [Lenguaer & Tarjan 1979]
 class R { var x; var y; var z; }
diff --git a/runtime/observatory/tests/service/echo_test.dart b/runtime/observatory/tests/service/echo_test.dart
index 8d31f2f..eab5888 100644
--- a/runtime/observatory/tests/service/echo_test.dart
+++ b/runtime/observatory/tests/service/echo_test.dart
@@ -25,7 +25,7 @@
 (Isolate isolate) {
   Completer completer = new Completer();
   isolate.vm.events.stream.listen((ServiceEvent event) {
-    if (event.eventType == '_Echo') {
+    if (event.kind == '_Echo') {
       expect(event.data.lengthInBytes, equals(3));
       expect(event.data.getUint8(0), equals(0));
       expect(event.data.getUint8(1), equals(128));
diff --git a/runtime/observatory/tests/service/eval_test.dart b/runtime/observatory/tests/service/eval_test.dart
index 2e23898..1893b00 100644
--- a/runtime/observatory/tests/service/eval_test.dart
+++ b/runtime/observatory/tests/service/eval_test.dart
@@ -35,7 +35,7 @@
       // Set up a listener to wait for breakpoint events.
       Completer completer = new Completer();
       isolate.vm.events.stream.listen((ServiceEvent event) {
-        if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+        if (event.kind == ServiceEvent.kPauseBreakpoint) {
           print('Breakpoint reached');
           completer.complete();
         }
diff --git a/runtime/observatory/tests/service/evaluate_activation_test.dart b/runtime/observatory/tests/service/evaluate_activation_test.dart
index 773f284..7862026 100644
--- a/runtime/observatory/tests/service/evaluate_activation_test.dart
+++ b/runtime/observatory/tests/service/evaluate_activation_test.dart
@@ -81,7 +81,7 @@
   var sub;
   sub = isolate.vm.events.stream.listen((ServiceEvent event) async {
     print("Event $event");
-    if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+    if (event.kind == ServiceEvent.kPauseBreakpoint) {
       var frameNumber = 1, r;
       r = await isolate.evalFrame(frameNumber, '123');  /// instance: ok
       expect(r.valueAsString, equals('123'));  /// instance: continued
@@ -129,7 +129,7 @@
   var sub;
   sub = isolate.vm.events.stream.listen((ServiceEvent event) async {
     print("Event $event");
-    if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+    if (event.kind == ServiceEvent.kPauseBreakpoint) {
       var frameNumber = 1, r;
       r = await isolate.evalFrame(frameNumber, '123');
       expect(r.valueAsString, equals('123'));
@@ -177,7 +177,7 @@
   var sub;
   sub = isolate.vm.events.stream.listen((ServiceEvent event) async {
     print("Event $event");
-    if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+    if (event.kind == ServiceEvent.kPauseBreakpoint) {
       var frameNumber = 1, r;
       r = await isolate.evalFrame(frameNumber, '123');
       expect(r.valueAsString, equals('123'));
@@ -218,7 +218,7 @@
   var sub;
   sub = isolate.vm.events.stream.listen((ServiceEvent event) async {
     print("Event $event");
-    if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+    if (event.kind == ServiceEvent.kPauseBreakpoint) {
       var frameNumber = 1, r;
       r = await isolate.evalFrame(frameNumber, '123');  /// instance: continued
       expect(r.valueAsString, equals('123'));  /// instance: continued
diff --git a/runtime/observatory/tests/service/gc_test.dart b/runtime/observatory/tests/service/gc_test.dart
index e5adaed..9d93b0a 100644
--- a/runtime/observatory/tests/service/gc_test.dart
+++ b/runtime/observatory/tests/service/gc_test.dart
@@ -27,7 +27,7 @@
   // Expect at least this many GC events.
   int gcCountdown = 3;
   isolate.vm.events.stream.listen((ServiceEvent event) {
-    if (event.eventType == ServiceEvent.kGC) {
+    if (event.kind == ServiceEvent.kGC) {
       print('Received GC event');
       if (--gcCountdown == 0) {
         completer.complete();
diff --git a/runtime/observatory/tests/service/get_isolate_rpc_test.dart b/runtime/observatory/tests/service/get_isolate_rpc_test.dart
index 6414ae2..bbdeabe 100644
--- a/runtime/observatory/tests/service/get_isolate_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_isolate_rpc_test.dart
@@ -20,7 +20,7 @@
     expect(result['startTime'], isPositive);
     expect(result['livePorts'], isPositive);
     expect(result['pauseOnExit'], isFalse);
-    expect(result['pauseEvent']['type'], equals('ServiceEvent'));
+    expect(result['pauseEvent']['type'], equals('Event'));
     expect(result['error'], isNull);
     expect(result['rootLib']['type'], equals('@Library'));
     expect(result['libraries'].length, isPositive);
diff --git a/runtime/observatory/tests/service/get_object_rpc_test.dart b/runtime/observatory/tests/service/get_object_rpc_test.dart
index 1d5f507..d95346e 100644
--- a/runtime/observatory/tests/service/get_object_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_object_rpc_test.dart
@@ -40,7 +40,8 @@
       'objectId': 'objects/null',
     };
     var result = await isolate.invokeRpcNoUpgrade('getObject', params);
-    expect(result['type'], equals('null'));
+    expect(result['type'], equals('Instance'));
+    expect(result['kind'], equals('Null'));
     expect(result['id'], equals('objects/null'));
     expect(result['valueAsString'], equals('null'));
     expect(result['class']['type'], equals('@Class'));
@@ -54,7 +55,8 @@
       'objectId': 'objects/bool-true',
     };
     var result = await isolate.invokeRpcNoUpgrade('getObject', params);
-    expect(result['type'], equals('bool'));
+    expect(result['type'], equals('Instance'));
+    expect(result['kind'], equals('Bool'));
     expect(result['id'], equals('objects/bool-true'));
     expect(result['valueAsString'], equals('true'));
     expect(result['class']['type'], equals('@Class'));
@@ -69,7 +71,8 @@
       'objectId': 'objects/int-123',
     };
     var result = await isolate.invokeRpcNoUpgrade('getObject', params);
-    expect(result['type'], equals('int'));
+    expect(result['type'], equals('Instance'));
+    expect(result['kind'], equals('Int'));
     expect(result['_vmType'], equals('Smi'));
     expect(result['id'], equals('objects/int-123'));
     expect(result['valueAsString'], equals('123'));
@@ -79,7 +82,7 @@
     expect(result['fields'], isEmpty);
   },
 
-  // A general Dart object.
+  // A built-in List.
   (Isolate isolate) async {
     // Call eval to get a Dart list.
     var evalResult = await eval(isolate, '[3, 2, 1]');
@@ -87,7 +90,8 @@
       'objectId': evalResult['id'],
     };
     var result = await isolate.invokeRpcNoUpgrade('getObject', params);
-    expect(result['type'], equals('List'));
+    expect(result['type'], equals('Instance'));
+    expect(result['kind'], equals('List'));
     expect(result['_vmType'], equals('GrowableObjectArray'));
     expect(result['id'], startsWith('objects/'));
     expect(result['valueAsString'], isNull);
@@ -97,7 +101,8 @@
     expect(result['fields'], isEmpty);
     expect(result['elements'].length, equals(3));
     expect(result['elements'][0]['index'], equals(0));
-    expect(result['elements'][0]['value']['type'], equals('@int'));
+    expect(result['elements'][0]['value']['type'], equals('@Instance'));
+    expect(result['elements'][0]['value']['kind'], equals('Int'));
     expect(result['elements'][0]['value']['valueAsString'], equals('3'));
   },
 
@@ -125,8 +130,9 @@
     expect(result['name'], equals('get_object_rpc_test'));
     expect(result['uri'], startsWith('file:'));
     expect(result['uri'], endsWith('get_object_rpc_test.dart'));
-    expect(result['imports'].length, isPositive);
-    expect(result['imports'][0]['type'], equals('@Library'));
+    expect(result['debuggable'], equals(true));
+    expect(result['dependencies'].length, isPositive);
+    expect(result['dependencies'][0]['target']['type'], equals('@Library'));
     expect(result['scripts'].length, isPositive);
     expect(result['scripts'][0]['type'], equals('@Script'));
     expect(result['variables'].length, isPositive);
@@ -212,9 +218,9 @@
     expect(result['_vmName'], startsWith('_DummyClass@'));
     expect(result['abstract'], equals(false));
     expect(result['const'], equals(false));
-    expect(result['finalized'], equals(true));
-    expect(result['implemented'], equals(false));
-    expect(result['patch'], equals(false));
+    expect(result['_finalized'], equals(true));
+    expect(result['_implemented'], equals(false));
+    expect(result['_patch'], equals(false));
     expect(result['library']['type'], equals('@Library'));
     expect(result['script']['type'], equals('@Script'));
     expect(result['super']['type'], equals('@Class'));
@@ -254,7 +260,8 @@
       'objectId': id,
     };
     var result = await isolate.invokeRpcNoUpgrade('getObject', params);
-    expect(result['type'], equals('Type'));
+    expect(result['type'], equals('Instance'));
+    expect(result['kind'], equals('Type'));
     expect(result['id'], equals(id));
     expect(result['class']['type'], equals('@Class'));
     expect(result['class']['name'], equals('_Type'));
@@ -296,7 +303,7 @@
     expect(result['type'], equals('Function'));
     expect(result['id'], equals(id));
     expect(result['name'], equals('dummyFunction'));
-    expect(result['kind'], equals('RegularFunction'));
+    expect(result['_kind'], equals('RegularFunction'));
     expect(result['static'], equals(false));
     expect(result['const'], equals(false));
     expect(result['script']['type'], equals('@Script'));
@@ -342,12 +349,12 @@
     expect(result['type'], equals('Field'));
     expect(result['id'], equals(id));
     expect(result['name'], equals('dummyVar'));
-    expect(result['value']['valueAsString'], equals('11'));
     expect(result['const'], equals(false));
     expect(result['static'], equals(true));
     expect(result['final'], equals(false));
     expect(result['script']['type'], equals('@Script'));
     expect(result['tokenPos'], isPositive);
+    expect(result['staticValue']['valueAsString'], equals('11'));
     expect(result['_guardNullable'], isNotNull);
     expect(result['_guardClass'], isNotNull);
     expect(result['_guardLength'], isNotNull);
diff --git a/runtime/observatory/tests/service/get_retained_size_rpc_test.dart b/runtime/observatory/tests/service/get_retained_size_rpc_test.dart
index 9311ccf..93740f3 100644
--- a/runtime/observatory/tests/service/get_retained_size_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_retained_size_rpc_test.dart
@@ -35,7 +35,8 @@
       'targetId': evalResult['id'],
     };
     var result = await isolate.invokeRpcNoUpgrade('_getRetainedSize', params);
-    expect(result['type'], equals('@int'));
+    expect(result['type'], equals('@Instance'));
+    expect(result['kind'], equals('Int'));
     int value1 = int.parse(result['valueAsString']);
     expect(value1, isPositive);
 
@@ -46,7 +47,8 @@
       'targetId': evalResult['id'],
     };
     result = await isolate.invokeRpcNoUpgrade('_getRetainedSize', params);
-    expect(result['type'], equals('@int'));
+    expect(result['type'], equals('@Instance'));
+    expect(result['kind'], equals('Int'));
     int value2 = int.parse(result['valueAsString']);
     expect(value2, isPositive);
 
@@ -58,7 +60,8 @@
       'targetId': evalResult['class']['id'],
     };
     result = await isolate.invokeRpcNoUpgrade('_getRetainedSize', params);
-    expect(result['type'], equals('@int'));
+    expect(result['type'], equals('@Instance'));
+    expect(result['kind'], equals('Int'));
     int value3 = int.parse(result['valueAsString']);
     expect(value3, isPositive);
     expect(value3, equals(value2));
diff --git a/runtime/observatory/tests/service/get_stack_rpc_test.dart b/runtime/observatory/tests/service/get_stack_rpc_test.dart
index 152fc2a..bba5575 100644
--- a/runtime/observatory/tests/service/get_stack_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_stack_rpc_test.dart
@@ -39,7 +39,7 @@
   await script.load();
   await hasStoppedAtBreakpoint(isolate);
   // Sanity check.
-  expect(isolate.pauseEvent.eventType, equals(ServiceEvent.kPauseBreakpoint));
+  expect(isolate.pauseEvent.kind, equals(ServiceEvent.kPauseBreakpoint));
 },
 
 // Get stack
@@ -58,7 +58,7 @@
   for (var frame in stack['frames']) {
     print('checking frame $frameDepth');
     expect(frame.type, equals('Frame'));
-    expect(frame['depth'], equals(frameDepth++));
+    expect(frame['index'], equals(frameDepth++));
     expect(frame['code'].type, equals('Code'));
     expect(frame['function'].type, equals('Function'));
     expect(frame['script'].type, equals('Script'));
@@ -74,12 +74,11 @@
   var msgHandlerObjectId;
   for (var message in stack['messages']) {
     print('checking message $messageDepth');
-    expect(message.type, equals('Message'));
-    expect(message['_destinationPort'], isNotNull);
-    expect(message['depth'], equals(messageDepth++));
+    expect(message['index'], equals(messageDepth++));
     expect(message['name'], isNotNull);
     expect(message['size'], greaterThanOrEqualTo(1));
-    expect(message['priority'], isNotNull);
+    expect(message['_priority'], isNotNull);
+    expect(message['_destinationPort'], isNotNull);
     expect(message['handlerFunction'].type, equals('Function'));
     if (message['handlerFunction'].name.contains('msgHandler')) {
       msgHandlerObjectId = message['messageObjectId'];
diff --git a/runtime/observatory/tests/service/get_version_rpc_test.dart b/runtime/observatory/tests/service/get_version_rpc_test.dart
new file mode 100644
index 0000000..92b8c06
--- /dev/null
+++ b/runtime/observatory/tests/service/get_version_rpc_test.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// VMOptions=--compile-all --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 {
+    var result = await vm.invokeRpcNoUpgrade('getVersion', {});
+    expect(result['type'], equals('Version'));
+    expect(result['major'], equals(1));
+    expect(result['minor'], equals(0));
+    expect(result['_privateMajor'], equals(0));
+    expect(result['_privateMinor'], equals(0));
+  },
+];
+
+main(args) async => runVMTests(args, tests);
diff --git a/runtime/observatory/tests/service/graph_test.dart b/runtime/observatory/tests/service/graph_test.dart
index 9b0b937..dd94d5c 100644
--- a/runtime/observatory/tests/service/graph_test.dart
+++ b/runtime/observatory/tests/service/graph_test.dart
@@ -3,7 +3,6 @@
 // BSD-style license that can be found in the LICENSE file.
 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override
 
-import 'dart:async';
 import 'package:observatory/object_graph.dart';
 import 'package:observatory/service_io.dart';
 import 'package:unittest/unittest.dart';
diff --git a/runtime/observatory/tests/service/inbound_references_test.dart b/runtime/observatory/tests/service/inbound_references_test.dart
index 21a6866..5807c4c 100644
--- a/runtime/observatory/tests/service/inbound_references_test.dart
+++ b/runtime/observatory/tests/service/inbound_references_test.dart
@@ -28,28 +28,28 @@
 
 var tests = [
 
-(Isolate isolate) =>
-  isolate.rootLibrary.load().then((Library lib) {
-    Instance e = lib.variables.where((v) => v.name == 'e').single.value;
-    return isolate.getInboundReferences(e, 100).then(
-        (ServiceMap response) {
-          List references = response['references'];
-          hasReferenceSuchThat(predicate) {
-            expect(references.any(predicate), isTrue);
-          }
+  (Isolate isolate) async {
+    var lib = await isolate.rootLibrary.load();
+    var field = lib.variables.where((v) => v.name == 'e').single;
+    await field.load();
+    Instance e = field.staticValue;
+    ServiceMap response = await isolate.getInboundReferences(e, 100);
+    List references = response['references'];
+    hasReferenceSuchThat(predicate) {
+      expect(references.any(predicate), isTrue);
+    }
 
-          // Assert e is referenced by at least n, array, and the top-level
-          // field e.
-          hasReferenceSuchThat((r) => r['slot'] is Field &&
-                                      r['slot'].name=='edge' &&
-                                      r['source'].isInstance &&
-                                      r['source'].clazz.name=='Node');
-          hasReferenceSuchThat((r) => r['slot'] == 1 &&
-                                      r['source'].isList);
-          hasReferenceSuchThat((r) => r['slot']=='<unknown>' &&
-                                      r['source'] is Field);
-    });
-}),
+    // Assert e is referenced by at least n, array, and the top-level
+    // field e.
+    hasReferenceSuchThat((r) => r['slot'] is Field &&
+                         r['slot'].name=='edge' &&
+                         r['source'].isInstance &&
+                         r['source'].clazz.name=='Node');
+    hasReferenceSuchThat((r) => r['slot'] == 1 &&
+                         r['source'].isList);
+    hasReferenceSuchThat((r) => r['slot']=='<unknown>' &&
+                         r['source'] is Field);
+  }
 
 ];
 
diff --git a/runtime/observatory/tests/service/isolate_lifecycle_test.dart b/runtime/observatory/tests/service/isolate_lifecycle_test.dart
index be878a2..3180137 100644
--- a/runtime/observatory/tests/service/isolate_lifecycle_test.dart
+++ b/runtime/observatory/tests/service/isolate_lifecycle_test.dart
@@ -55,7 +55,7 @@
     // Wait for the testee to start all of the isolates.
     if (vm.isolates.length != spawnCount + 1) {
       await processServiceEvents(vm, (event, sub, completer) {
-        if (event.eventType == ServiceEvent.kIsolateStart) {
+        if (event.kind == ServiceEvent.kIsolateStart) {
           if (vm.isolates.length == spawnCount + 1) {
             sub.cancel();
             completer.complete(null);
@@ -77,7 +77,7 @@
     // Wait for all spawned isolates to hit pause-at-exit.
     if (numPaused(vm) != spawnCount) {
       await processServiceEvents(vm, (event, sub, completer) {
-        if (event.eventType == ServiceEvent.kPauseExit) {
+        if (event.kind == ServiceEvent.kPauseExit) {
           if (numPaused(vm) == spawnCount) {
             sub.cancel();
             completer.complete(null);
@@ -93,7 +93,7 @@
   (VM vm) async {
     var resumedReceived = 0;
     var eventsDone = processServiceEvents(vm, (event, sub, completer) {
-      if (event.eventType == ServiceEvent.kIsolateExit) {
+      if (event.kind == ServiceEvent.kIsolateExit) {
         resumedReceived++;
         if (resumedReceived == resumeCount) {
           sub.cancel();
diff --git a/runtime/observatory/tests/service/library_dependency_test.dart b/runtime/observatory/tests/service/library_dependency_test.dart
new file mode 100644
index 0000000..4547e96
--- /dev/null
+++ b/runtime/observatory/tests/service/library_dependency_test.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// VMOptions=--compile-all --error_on_bad_type --error_on_bad_override
+
+import 'package:observatory/service_io.dart';
+import 'package:observatory/debugger.dart';
+import 'package:unittest/unittest.dart';
+import 'test_helper.dart';
+import 'dart:async';
+
+export 'dart:collection';
+import 'dart:mirrors' as mirrors;
+import 'dart:convert' deferred as convert;
+
+var tests = [
+
+(Isolate isolate) async {
+  var lib = await isolate.rootLibrary.load();
+
+  importOf(String uri) {
+    return lib.dependencies.singleWhere((dep) => dep.target.uri == uri);
+  }
+
+  expect(importOf("dart:collection").isImport, isFalse);
+  expect(importOf("dart:collection").isExport, isTrue);
+  expect(importOf("dart:collection").isDeferred, isFalse);
+  expect(importOf("dart:collection").prefix, equals(null));
+
+  expect(importOf("dart:mirrors").isImport, isTrue);
+  expect(importOf("dart:mirrors").isExport, isFalse);
+  expect(importOf("dart:mirrors").isDeferred, isFalse);
+  expect(importOf("dart:mirrors").prefix, equals("mirrors"));
+
+  expect(importOf("dart:convert").isImport, isTrue);
+  expect(importOf("dart:convert").isExport, isFalse);
+  expect(importOf("dart:convert").isDeferred, isTrue);
+  expect(importOf("dart:convert").prefix, equals("convert"));
+},
+];
+
+main(args) => runIsolateTests(args, tests);
diff --git a/runtime/observatory/tests/service/mirror_references_test.dart b/runtime/observatory/tests/service/mirror_references_test.dart
index 4446316..28a15c0f 100644
--- a/runtime/observatory/tests/service/mirror_references_test.dart
+++ b/runtime/observatory/tests/service/mirror_references_test.dart
@@ -25,22 +25,23 @@
 
 var tests = [
 
-(Isolate isolate) =>
-  isolate.rootLibrary.load().then((Library lib) {
+  (Isolate isolate) async {
+    var lib = await isolate.rootLibrary.load();
     Field fooField = lib.variables.singleWhere((v) => v.name == 'foo');
-    Instance foo = fooField.value;
+    await fooField.load();
+    Instance foo = fooField.staticValue;
     Field refField = lib.variables.singleWhere((v) => v.name == 'ref');
-    Instance ref = refField.value;
+    await refField.load();
+    Instance ref = refField.staticValue;
 
     expect(foo.isMirrorReference, isFalse);
     expect(ref.isMirrorReference, isTrue);
     expect(ref.referent, isNull);
-    return ref.load().then((Instance loadedRef) {
-      expect(loadedRef.referent, isNotNull);
-      expect(loadedRef.referent.name, equals('Foo'));
-      expect(loadedRef.referent, equals(foo.clazz));
-    });
-  }),
+    var loadedRef = await ref.load();
+    expect(loadedRef.referent, isNotNull);
+    expect(loadedRef.referent.name, equals('Foo'));
+    expect(loadedRef.referent, equals(foo.clazz));
+  },
 
 ];
 
diff --git a/runtime/observatory/tests/service/set_library_debuggable_rpc_test.dart b/runtime/observatory/tests/service/set_library_debuggable_rpc_test.dart
new file mode 100644
index 0000000..0f9aa40
--- /dev/null
+++ b/runtime/observatory/tests/service/set_library_debuggable_rpc_test.dart
@@ -0,0 +1,62 @@
+// 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=--compile-all --error_on_bad_type --error_on_bad_override
+
+library set_library_debuggable_rpc_test;
+
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+
+import 'test_helper.dart';
+
+var tests = [
+  (Isolate isolate) async {
+    var result;
+
+    // debuggable defaults to true.
+    var getObjectParams = {
+      'objectId': isolate.rootLibrary.id,
+    };
+    result = await isolate.invokeRpcNoUpgrade('getObject',
+                                              getObjectParams);
+    expect(result['debuggable'], equals(true));
+
+    // Change debuggable to false.
+    var setDebugParams = {
+      'libraryId': isolate.rootLibrary.id,
+      'isDebuggable': false,
+    };
+    result = await isolate.invokeRpcNoUpgrade('setLibraryDebuggable',
+                                              setDebugParams);
+    expect(result['type'], equals('Success'));
+
+    // Verify.
+    result = await isolate.invokeRpcNoUpgrade('getObject',
+                                              getObjectParams);
+    expect(result['debuggable'], equals(false));
+
+  },
+
+  // invalid library.
+  (Isolate isolate) async {
+    var params = {
+      'libraryId': 'libraries/9999999',
+      'isDebuggable': false,
+    };
+    bool caughtException;
+    try {
+      await isolate.invokeRpcNoUpgrade('setLibraryDebuggable', params);
+      expect(false, isTrue, reason:'Unreachable');
+    } on ServerRpcException catch(e) {
+      caughtException = true;
+      expect(e.code, equals(ServerRpcException.kInvalidParams));
+      expect(e.message,
+             "setLibraryDebuggable: "
+             "invalid 'libraryId' parameter: libraries/9999999");
+    }
+    expect(caughtException, isTrue);
+  },
+];
+
+main(args) async => runIsolateTests(args, tests);
diff --git a/runtime/observatory/tests/service/source_location_test.dart b/runtime/observatory/tests/service/source_location_test.dart
index 4fe8b08..128452c 100644
--- a/runtime/observatory/tests/service/source_location_test.dart
+++ b/runtime/observatory/tests/service/source_location_test.dart
@@ -57,7 +57,7 @@
       // Listen for breakpoint event.
       Completer completer = new Completer();
       isolate.vm.events.stream.listen((ServiceEvent event) {
-        if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+        if (event.kind == ServiceEvent.kPauseBreakpoint) {
           completer.complete();
         }
       });
diff --git a/runtime/observatory/tests/service/steal_breakpoint_test.dart b/runtime/observatory/tests/service/steal_breakpoint_test.dart
index 702bf93..5efc7de 100644
--- a/runtime/observatory/tests/service/steal_breakpoint_test.dart
+++ b/runtime/observatory/tests/service/steal_breakpoint_test.dart
@@ -31,7 +31,7 @@
   Completer completer = new Completer();
   var subscription;
   subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
-    if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+    if (event.kind == ServiceEvent.kPauseBreakpoint) {
       print('Isolate paused at breakpoint');
       subscription.cancel();
       completer.complete();
@@ -63,7 +63,7 @@
   Completer completer = new Completer();
   var subscription;
   subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
-    if (event.eventType == ServiceEvent.kResume) {
+    if (event.kind == ServiceEvent.kResume) {
       print('Isolate resumed');
       subscription.cancel();
       completer.complete();
diff --git a/runtime/observatory/tests/service/string_escaping_test.dart b/runtime/observatory/tests/service/string_escaping_test.dart
index 1f702f0..d3420db 100644
--- a/runtime/observatory/tests/service/string_escaping_test.dart
+++ b/runtime/observatory/tests/service/string_escaping_test.dart
@@ -54,15 +54,19 @@
   isolate.rootLibrary.load().then((Library lib) {
     expectFullString(String varName, String varValueAsString) {
       Field field = lib.variables.singleWhere((v) => v.name == varName);
-      Instance value = field.value;
-      expect(value.valueAsString, equals(varValueAsString));
-      expect(value.valueAsStringIsTruncated, isFalse);
+      field.load().then((_) {
+        Instance value = field.staticValue;
+        expect(value.valueAsString, equals(varValueAsString));
+        expect(value.valueAsStringIsTruncated, isFalse);
+      });
     }
     expectTruncatedString(String varName, String varValueAsString) {
       Field field = lib.variables.singleWhere((v) => v.name == varName);
-      Instance value = field.value;
-      expect(varValueAsString, startsWith(value.valueAsString));
-      expect(value.valueAsStringIsTruncated, isTrue);
+      field.load().then((_) {
+        Instance value = field.staticValue;
+        expect(varValueAsString, startsWith(value.valueAsString));
+        expect(value.valueAsStringIsTruncated, isTrue);
+      });
     }
 
     script();  // Need to initialize variables in the testing isolate.
diff --git a/runtime/observatory/tests/service/test_helper.dart b/runtime/observatory/tests/service/test_helper.dart
index fed6ee1..96828ae 100644
--- a/runtime/observatory/tests/service/test_helper.dart
+++ b/runtime/observatory/tests/service/test_helper.dart
@@ -153,7 +153,7 @@
 
 Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) {
   if ((isolate.pauseEvent != null) &&
-      (isolate.pauseEvent.eventType == ServiceEvent.kPauseBreakpoint)) {
+      (isolate.pauseEvent.kind == ServiceEvent.kPauseBreakpoint)) {
     // Already waiting at a breakpoint.
     print('Breakpoint reached');
     return new Future.value(isolate);
@@ -163,7 +163,7 @@
   Completer completer = new Completer();
   var subscription;
   subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
-    if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+    if (event.kind == ServiceEvent.kPauseBreakpoint) {
       print('Breakpoint reached');
       subscription.cancel();
       completer.complete(isolate);
diff --git a/runtime/observatory/tests/service/weak_properties_test.dart b/runtime/observatory/tests/service/weak_properties_test.dart
index cdcb645..30ae2a0 100644
--- a/runtime/observatory/tests/service/weak_properties_test.dart
+++ b/runtime/observatory/tests/service/weak_properties_test.dart
@@ -34,30 +34,32 @@
 
 var tests = [
 
-(Isolate isolate) =>
-  isolate.rootLibrary.load().then((Library lib) {
+  (Isolate isolate) async {
+    var lib = await isolate.rootLibrary.load();
     Field keyField = lib.variables.singleWhere((v) => v.name == 'key');
-    Instance key = keyField.value;
+    await keyField.load();
+    Instance key = keyField.staticValue;
     Field valueField = lib.variables.singleWhere((v) => v.name == 'value');
-    Instance value = valueField.value;
+    await valueField.load();
+    Instance value = valueField.staticValue;
     Field propField = lib.variables.singleWhere((v) => v.name == 'weak_property');
-    Instance prop = propField.value;
+    await propField.load();
+    Instance prop = propField.staticValue;
 
     expect(key.isWeakProperty, isFalse);
     expect(value.isWeakProperty, isFalse);
     expect(prop.isWeakProperty, isTrue);
     expect(prop.key, isNull);
     expect(prop.value, isNull);
-    return prop.load().then((Instance loadedProp) {
-      // Object ids are not cannonicalized, so we rely on the key and value
-      // being the sole instances of their classes to test we got the objects
-      // we expect.
-      expect(loadedProp.key, isNotNull);
-      expect(loadedProp.key.clazz, equals(key.clazz));
-      expect(loadedProp.value, isNotNull);
-      expect(loadedProp.value.clazz, equals(value.clazz));
-    });
-  }),
+    Instance loadedProp = await prop.load();
+    // Object ids are not cannonicalized, so we rely on the key and value
+    // being the sole instances of their classes to test we got the objects
+    // we expect.
+    expect(loadedProp.key, isNotNull);
+    expect(loadedProp.key.clazz, equals(key.clazz));
+    expect(loadedProp.value, isNotNull);
+    expect(loadedProp.value.clazz, equals(value.clazz));
+  },
 
 ];
 
diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h
index 6837265..72a0737 100644
--- a/runtime/platform/globals.h
+++ b/runtime/platform/globals.h
@@ -50,7 +50,7 @@
 #include <winsock2.h>
 #include <Rpc.h>
 #include <shellapi.h>
-#endif
+#endif  // defined(_WIN32)
 
 #if !defined(_WIN32)
 #include <arpa/inet.h>
@@ -89,7 +89,15 @@
 #elif defined(__linux__) || defined(__FreeBSD__)
 #define TARGET_OS_LINUX 1
 #elif defined(__APPLE__)
+// Define the flavor of Mac OS we are running on.
+#include <TargetConditionals.h>
+// TODO(iposva): Rename TARGET_OS_MACOS to TARGET_OS_MAC to inherit
+// the value defined in TargetConditionals.h
 #define TARGET_OS_MACOS 1
+#if TARGET_OS_IPHONE
+#define TARGET_OS_IOS
+#endif
+
 #elif defined(_WIN32)
 #define TARGET_OS_WINDOWS 1
 #else
@@ -171,6 +179,8 @@
 #define HOST_ARCH_ARM 1
 #define ARCH_IS_32_BIT 1
 #define kFpuRegisterSize 16
+// Mark the fact that we have defined simd_value_t.
+#define SIMD_VALUE_T_
 typedef struct {
   union {
     uint32_t u;
@@ -263,6 +273,30 @@
 #endif
 #endif
 
+// Determine whether we will be using the simulator.
+#if defined(TARGET_ARCH_IA32)
+  // No simulator used.
+#elif defined(TARGET_ARCH_X64)
+  // No simulator used.
+#elif defined(TARGET_ARCH_ARM)
+#if !defined(HOST_ARCH_ARM) || defined(TARGET_OS_IOS)
+#define USING_SIMULATOR 1
+#endif
+
+#elif defined(TARGET_ARCH_ARM64)
+#if !defined(HOST_ARCH_ARM64) || defined(TARGET_OS_IOS)
+#define USING_SIMULATOR 1
+#endif
+
+#elif defined(TARGET_ARCH_MIPS)
+#if !defined(HOST_ARCH_MIPS) || defined(TARGET_OS_IOS)
+#define USING_SIMULATOR 1
+#endif
+
+#else
+#error Unknown architecture.
+#endif
+
 
 // Short form printf format specifiers
 #define Pd PRIdPTR
diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc
index 51259a5..a6d6c18 100644
--- a/runtime/vm/benchmark_test.cc
+++ b/runtime/vm/benchmark_test.cc
@@ -607,4 +607,42 @@
   benchmark->set_score(elapsed_time);
 }
 
+
+BENCHMARK(LargeMap) {
+  const char* kScript =
+      "makeMap() {\n"
+      "  Map m = {};\n"
+      "  for (int i = 0; i < 100000; ++i) m[i*13+i*(i>>7)] = i;\n"
+      "  return m;\n"
+      "}";
+  Dart_Handle h_lib = TestCase::LoadTestScript(kScript, NULL);
+  EXPECT_VALID(h_lib);
+  Dart_Handle h_result = Dart_Invoke(h_lib, NewString("makeMap"), 0, NULL);
+  EXPECT_VALID(h_result);
+  Instance& map = Instance::Handle();
+  map ^= Api::UnwrapHandle(h_result);
+  const intptr_t kLoopCount = 100;
+  Isolate* isolate = Isolate::Current();
+  uint8_t* buffer;
+  Timer timer(true, "Large Map");
+  timer.Start();
+  for (intptr_t i = 0; i < kLoopCount; i++) {
+    StackZone zone(isolate);
+    MessageWriter writer(&buffer, &malloc_allocator, true);
+    writer.WriteMessage(map);
+    intptr_t buffer_len = writer.BytesWritten();
+
+    // Read object back from the snapshot.
+    MessageSnapshotReader reader(buffer,
+                                 buffer_len,
+                                 isolate,
+                                 zone.GetZone());
+    reader.ReadObject();
+    free(buffer);
+  }
+  timer.Stop();
+  int64_t elapsed_time = timer.TotalElapsedTime();
+  benchmark->set_score(elapsed_time);
+}
+
 }  // namespace dart
diff --git a/runtime/vm/block_scheduler.cc b/runtime/vm/block_scheduler.cc
index f04aa95..e8d950c 100644
--- a/runtime/vm/block_scheduler.cc
+++ b/runtime/vm/block_scheduler.cc
@@ -80,6 +80,9 @@
 
 
 void BlockScheduler::AssignEdgeWeights() const {
+  if (!FLAG_emit_edge_counters) {
+    return;
+  }
   const Code& unoptimized_code = flow_graph()->parsed_function().code();
   ASSERT(!unoptimized_code.IsNull());
 
diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h
index 78edd2f..270b76b 100644
--- a/runtime/vm/bootstrap_natives.h
+++ b/runtime/vm/bootstrap_natives.h
@@ -357,15 +357,16 @@
   V(Internal_makeFixedListUnmodifiable, 1)                                     \
   V(Internal_inquireIs64Bit, 0)                                                \
   V(LinkedHashMap_allocate, 1)                                                 \
-  V(LinkedHashMap_getLength, 1)                                                \
-  V(LinkedHashMap_insertOrUpdate, 3)                                           \
-  V(LinkedHashMap_lookUp, 2)                                                   \
-  V(LinkedHashMap_containsKey, 2)                                              \
-  V(LinkedHashMap_remove, 2)                                                   \
-  V(LinkedHashMap_clear, 1)                                                    \
-  V(LinkedHashMap_toArray, 1)                                                  \
-  V(LinkedHashMap_getModMark, 2)                                               \
-  V(LinkedHashMap_useInternal, 0)                                              \
+  V(LinkedHashMap_getIndex, 1)                                                 \
+  V(LinkedHashMap_setIndex, 2)                                                 \
+  V(LinkedHashMap_getData, 1)                                                  \
+  V(LinkedHashMap_setData, 2)                                                  \
+  V(LinkedHashMap_getHashMask, 1)                                              \
+  V(LinkedHashMap_setHashMask, 2)                                              \
+  V(LinkedHashMap_getUsedData, 1)                                              \
+  V(LinkedHashMap_setUsedData, 2)                                              \
+  V(LinkedHashMap_getDeletedKeys, 1)                                           \
+  V(LinkedHashMap_setDeletedKeys, 2)                                           \
   V(WeakProperty_new, 2)                                                       \
   V(WeakProperty_getKey, 1)                                                    \
   V(WeakProperty_getValue, 1)                                                  \
diff --git a/runtime/vm/cha.cc b/runtime/vm/cha.cc
index 065931c..4b00504 100644
--- a/runtime/vm/cha.cc
+++ b/runtime/vm/cha.cc
@@ -37,12 +37,7 @@
   }
   const GrowableObjectArray& direct_subclasses =
       GrowableObjectArray::Handle(thread_->zone(), cls.direct_subclasses());
-  bool result =
-      !direct_subclasses.IsNull() && (direct_subclasses.Length() > 0);
-  if (!result) {
-    AddToLeafClasses(cls);
-  }
-  return result;
+  return !direct_subclasses.IsNull() && (direct_subclasses.Length() > 0);
 }
 
 
@@ -62,11 +57,7 @@
   // classes.
   if (cls.InVMHeap()) return true;
 
-  bool result = cls.is_implemented();
-  if (!result) {
-    AddToLeafClasses(cls);
-  }
-  return result;
+  return cls.is_implemented();
 }
 
 
@@ -80,7 +71,6 @@
   }
 
   if (cls_direct_subclasses.IsNull()) {
-    AddToLeafClasses(cls);
     return false;
   }
   Class& direct_subclass = Class::Handle(thread_->zone());
@@ -97,7 +87,6 @@
       return true;
     }
   }
-  AddToLeafClasses(cls);
   return false;
 }
 
diff --git a/runtime/vm/cha.h b/runtime/vm/cha.h
index 9be0caa..8860a8b 100644
--- a/runtime/vm/cha.h
+++ b/runtime/vm/cha.h
@@ -32,28 +32,25 @@
   }
 
   // Returns true if the class has subclasses.
-  // Updates set of leaf classes that we register optimized code with for lazy
-  // deoptimization.
   bool HasSubclasses(const Class& cls);
   bool HasSubclasses(intptr_t cid);
 
   // Return true if the class is implemented by some other class.
-  // Updates set of leaf classes that we register optimized code with for lazy
-  // deoptimization.
   bool IsImplemented(const Class& cls);
 
   // Returns true if any subclass of 'cls' contains the function.
-  // Updates set of leaf classes that we register optimized code with for lazy
-  // deoptimization.
   bool HasOverride(const Class& cls, const String& function_name);
 
   const GrowableArray<Class*>& leaf_classes() const {
     return leaf_classes_;
   }
 
- private:
+  // Adds class 'cls' to the list of guarded leaf classes, deoptimization occurs
+  // if any of those leaf classes gets subclassed through later loaded/finalized
+  // libraries. Only classes that were used for CHA optimizations are added.
   void AddToLeafClasses(const Class& cls);
 
+ private:
   Thread* thread_;
   GrowableArray<Class*> leaf_classes_;
   CHA* previous_;
diff --git a/runtime/vm/cha_test.cc b/runtime/vm/cha_test.cc
index 3926daa..1cd95dc 100644
--- a/runtime/vm/cha_test.cc
+++ b/runtime/vm/cha_test.cc
@@ -89,7 +89,9 @@
   EXPECT(cha.HasSubclasses(class_a));
   EXPECT(cha.HasSubclasses(class_b));
   EXPECT(!cha.HasSubclasses(class_c));
+  cha.AddToLeafClasses(class_c);
   EXPECT(!cha.HasSubclasses(class_d));
+  cha.AddToLeafClasses(class_d);
 
   EXPECT(!ContainsCid(cha.leaf_classes(), class_a.id()));
   EXPECT(!ContainsCid(cha.leaf_classes(), class_b.id()));
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index 78d4539..d4b3e6d 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -22,7 +22,7 @@
 DEFINE_FLAG(bool, print_classes, false, "Prints details about loaded classes.");
 DEFINE_FLAG(bool, trace_class_finalization, false, "Trace class finalization.");
 DEFINE_FLAG(bool, trace_type_finalization, false, "Trace type finalization.");
-DECLARE_FLAG(bool, use_cha);
+DECLARE_FLAG(bool, use_cha_deopt);
 
 
 bool ClassFinalizer::AllClassesFinalized() {
@@ -33,13 +33,13 @@
 }
 
 
-// Removes optimized code once we load more classes, since --use_cha based
+// Removes optimized code once we load more classes, since CHA based
 // optimizations may have become invalid.
 // Only methods which owner classes where subclasses can be invalid.
 // TODO(srdjan): Be even more precise by recording the exact CHA optimization.
 static void RemoveCHAOptimizedCode(
     const GrowableArray<intptr_t>& added_subclass_to_cids) {
-  ASSERT(FLAG_use_cha);
+  ASSERT(FLAG_use_cha_deopt);
   if (added_subclass_to_cids.is_empty()) return;
   // Switch all functions' code to unoptimized.
   const ClassTable& class_table = *Isolate::Current()->class_table();
@@ -219,6 +219,8 @@
   ASSERT(ImmutableArray::InstanceSize() == cls.instance_size());
   cls = object_store->weak_property_class();
   ASSERT(WeakProperty::InstanceSize() == cls.instance_size());
+  cls = object_store->linked_hash_map_class();
+  ASSERT(LinkedHashMap::InstanceSize() == cls.instance_size());
 #endif  // defined(DEBUG)
 
   // Remember the currently pending classes.
@@ -2234,6 +2236,12 @@
     super_type = FinalizeType(cls, super_type, kCanonicalizeWellFormed);
     cls.set_super_type(super_type);
   }
+  // Finalize mixin type.
+  Type& mixin_type = Type::Handle(cls.mixin());
+  if (!mixin_type.IsNull()) {
+    mixin_type ^= FinalizeType(cls, mixin_type, kCanonicalizeWellFormed);
+    cls.set_mixin(mixin_type);
+  }
   if (cls.IsSignatureClass()) {
     // Check for illegal self references.
     GrowableArray<intptr_t> visited_aliases;
@@ -2372,7 +2380,7 @@
   if (cls.is_const()) {
     CheckForLegalConstClass(cls);
   }
-  if (FLAG_use_cha) {
+  if (FLAG_use_cha_deopt) {
     GrowableArray<intptr_t> cids;
     CollectFinalizedSuperClasses(cls, &cids);
     CollectImmediateSuperInterfaces(cls, &cids);
diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
index 2e7df3b..08e9e16 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -1182,7 +1182,9 @@
     intptr_t num_frames = stack->Length();
     for (intptr_t i = 0; i < num_frames; i++) {
       ActivationFrame* frame = stack->FrameAt(i);
-      const int num_vars = frame->NumLocalVariables();
+      // Variable locations and number are unknown when 'always_optimize'.
+      const int num_vars =
+         Compiler::always_optimize() ? 0 : frame->NumLocalVariables();
       intptr_t unused;
       for (intptr_t v = 0; v < num_vars; v++) {
         frame->VariableAt(v, &var_name, &unused, &unused, &var_value);
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index 7ff3ed9..57cfa7f 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -69,6 +69,11 @@
 DECLARE_FLAG(bool, trace_irregexp);
 DECLARE_FLAG(bool, trace_patching);
 
+
+bool Compiler::always_optimize_ = false;
+bool Compiler::guess_other_cid_ = true;
+
+
 // TODO(zerny): Factor out unoptimizing/optimizing pipelines and remove
 // separate helpers functions & `optimizing` args.
 class CompilationPipeline : public ZoneAllocated {
@@ -154,6 +159,7 @@
   IndirectGotoInstr* backtrack_goto_;
 };
 
+
 CompilationPipeline* CompilationPipeline::New(Zone* zone,
                                               const Function& function) {
   if (function.IsIrregexpFunction()) {
@@ -409,7 +415,6 @@
         ZoneGrowableArray<const ICData*>* ic_data_array =
             new(zone) ZoneGrowableArray<const ICData*>();
         if (optimized) {
-          ASSERT(function.HasCode());
           // Extract type feedback before the graph is built, as the graph
           // builder uses it to attach it to nodes.
           ASSERT(function.deoptimization_counter() <
@@ -476,6 +481,9 @@
         CSTAT_TIMER_SCOPE(isolate, graphoptimizer_timer);
 
         FlowGraphOptimizer optimizer(flow_graph);
+        if (Compiler::always_optimize()) {
+          optimizer.PopulateWithICData();
+        }
         optimizer.ApplyICData();
         DEBUG_ASSERT(flow_graph->VerifyUseLists());
 
@@ -738,7 +746,8 @@
         graph_compiler.FinalizeStaticCallTargetsTable(code);
 
         if (optimized) {
-          if (osr_id == Isolate::kNoDeoptId) {
+          // We may not have previous code if 'always_optimize' is set.
+          if ((osr_id == Isolate::kNoDeoptId) && function.HasCode()) {
             CodePatcher::PatchEntry(Code::Handle(function.CurrentCode()));
             if (FLAG_trace_compiler || FLAG_trace_patching) {
               if (FLAG_trace_compiler) {
@@ -765,7 +774,8 @@
             field->RegisterDependentCode(code);
           }
         } else {  // not optimized.
-          if (function.ic_data_array() == Array::null()) {
+          if (!Compiler::always_optimize() &&
+              (function.ic_data_array() == Array::null())) {
             function.SaveICDataMap(graph_compiler.deopt_id_to_ic_data());
           }
           function.set_unoptimized_code(code);
@@ -973,10 +983,12 @@
 
     // Restore unoptimized code if needed.
     if (optimized) {
-      const Error& error = Error::Handle(
-          zone, Compiler::EnsureUnoptimizedCode(Thread::Current(), function));
-      if (!error.IsNull()) {
-        return error.raw();
+      if (!Compiler::always_optimize()) {
+        const Error& error = Error::Handle(
+            zone, Compiler::EnsureUnoptimizedCode(Thread::Current(), function));
+        if (!error.IsNull()) {
+          return error.raw();
+        }
       }
     }
 
@@ -1001,7 +1013,8 @@
                                                      osr_id);
     if (!success) {
       if (optimized) {
-        // Optimizer bailed out. Disable optimizations and to never try again.
+        ASSERT(!Compiler::always_optimize());  // Optimized is the only code.
+        // Optimizer bailed out. Disable optimizations and never try again.
         if (FLAG_trace_compiler) {
           ISL_Print("--> disabling optimizations for '%s'\n",
                     function.ToFullyQualifiedCString());
@@ -1058,7 +1071,12 @@
   VMTagScope tagScope(thread->isolate(), VMTag::kCompileUnoptimizedTagId);
   CompilationPipeline* pipeline =
       CompilationPipeline::New(thread->zone(), function);
-  return CompileFunctionHelper(pipeline, function, false, Isolate::kNoDeoptId);
+
+  const bool optimized =
+      Compiler::always_optimize() && function.IsOptimizable();
+
+  return CompileFunctionHelper(pipeline, function, optimized,
+      Isolate::kNoDeoptId);
 }
 
 
diff --git a/runtime/vm/compiler.h b/runtime/vm/compiler.h
index 1e92e71..c510cd2 100644
--- a/runtime/vm/compiler.h
+++ b/runtime/vm/compiler.h
@@ -81,6 +81,22 @@
   //
   // Returns Error::null() if there is no compilation error.
   static RawError* CompileAllFunctions(const Class& cls);
+
+  // The following global flags are changed by --noopt handler;
+  // the flags are changed when generating best unoptimized code (no runtime
+  // feedback, no deoptimization).
+
+  // Default: false.
+  static bool always_optimize() { return always_optimize_; }
+  static void set_always_optimize(bool value) { always_optimize_ = value; }
+
+  // Default: true.
+  static bool guess_other_cid() { return guess_other_cid_; }
+  static void set_guess_other_cid(bool value) { guess_other_cid_ = value; }
+
+ private:
+  static bool always_optimize_;
+  static bool guess_other_cid_;
 };
 
 }  // namespace dart
diff --git a/runtime/vm/constant_propagator.cc b/runtime/vm/constant_propagator.cc
index 35ee3cc..a1abaad 100644
--- a/runtime/vm/constant_propagator.cc
+++ b/runtime/vm/constant_propagator.cc
@@ -702,10 +702,9 @@
 void ConstantPropagator::VisitLoadStaticField(LoadStaticFieldInstr* instr) {
   const Field& field = instr->StaticField();
   ASSERT(field.is_static());
-  if (field.is_final()) {
-    Instance& obj = Instance::Handle(I, field.value());
-    ASSERT(obj.raw() != Object::sentinel().raw());
-    ASSERT(obj.raw() != Object::transition_sentinel().raw());
+  Instance& obj = Instance::Handle(I, field.value());
+  if (field.is_final() && (obj.raw() != Object::sentinel().raw()) &&
+      (obj.raw() != Object::transition_sentinel().raw())) {
     if (obj.IsSmi() || obj.IsOld()) {
       SetValue(instr, obj);
       return;
diff --git a/runtime/vm/cpu_arm.cc b/runtime/vm/cpu_arm.cc
index fca5308..5a66954 100644
--- a/runtime/vm/cpu_arm.cc
+++ b/runtime/vm/cpu_arm.cc
@@ -13,7 +13,7 @@
 #include "vm/object.h"
 #include "vm/simulator.h"
 
-#if defined(HOST_ARCH_ARM)
+#if !defined(USING_SIMULATOR)
 #include <sys/syscall.h>  /* NOLINT */
 #include <unistd.h>  /* NOLINT */
 #endif
@@ -69,7 +69,7 @@
             "Use integer division instruction if supported");
 #endif
 
-#if !defined(HOST_ARCH_ARM)
+#if defined(USING_SIMULATOR)
 #if defined(TARGET_ARCH_ARM_5TE)
 DEFINE_FLAG(bool, sim_use_hardfp, false, "Use the softfp ABI.");
 #else
@@ -78,7 +78,7 @@
 #endif
 
 void CPU::FlushICache(uword start, uword size) {
-#if defined(HOST_ARCH_ARM)
+#if !defined(USING_SIMULATOR)
   // Nothing to do. Flushing no instructions.
   if (size == 0) {
     return;
@@ -97,16 +97,15 @@
   #else
     #error FlushICache only tested/supported on Linux and Android
   #endif
-
 #endif
 }
 
 
 const char* CPU::Id() {
   return
-#if !defined(HOST_ARCH_ARM)
+#if defined(USING_SIMULATOR)
   "sim"
-#endif  // !defined(HOST_ARCH_ARM)
+#endif  // defined(USING_SIMULATOR)
   "arm";
 }
 
@@ -123,7 +122,7 @@
 #endif
 
 
-#if defined(HOST_ARCH_ARM)
+#if !defined(USING_SIMULATOR)
 void HostCPUFeatures::InitOnce() {
   bool is_arm64 = false;
   CpuInfo::InitOnce();
@@ -236,7 +235,7 @@
   hardware_ = NULL;
   CpuInfo::Cleanup();
 }
-#endif  // defined(HOST_ARCH_ARM)
+#endif  // !defined(USING_SIMULATOR)
 
 }  // namespace dart
 
diff --git a/runtime/vm/cpu_arm64.cc b/runtime/vm/cpu_arm64.cc
index a31ddad..d9ec03b 100644
--- a/runtime/vm/cpu_arm64.cc
+++ b/runtime/vm/cpu_arm64.cc
@@ -10,7 +10,7 @@
 #include "vm/cpuinfo.h"
 #include "vm/simulator.h"
 
-#if defined(HOST_ARCH_ARM64)
+#if !defined(USING_SIMULATOR)
 #include <sys/syscall.h>  /* NOLINT */
 #include <unistd.h>  /* NOLINT */
 #endif
@@ -18,7 +18,7 @@
 namespace dart {
 
 void CPU::FlushICache(uword start, uword size) {
-#if defined(HOST_ARCH_ARM64)
+#if !defined(USING_SIMULATOR)
   // Nothing to do. Flushing no instructions.
   if (size == 0) {
     return;
@@ -41,7 +41,7 @@
 
 const char* CPU::Id() {
   return
-#if !defined(HOST_ARCH_ARM64)
+#if defined(USING_SIMULATOR)
   "sim"
 #endif  // !defined(HOST_ARCH_ARM64)
   "arm64";
@@ -54,7 +54,7 @@
 #endif
 
 
-#if defined(HOST_ARCH_ARM64)
+#if !defined(USING_SIMULATOR)
 void HostCPUFeatures::InitOnce() {
   CpuInfo::InitOnce();
   hardware_ = CpuInfo::GetCpuModel();
@@ -75,7 +75,7 @@
   CpuInfo::Cleanup();
 }
 
-#else
+#else  // !defined(USING_SIMULATOR)
 
 void HostCPUFeatures::InitOnce() {
   CpuInfo::InitOnce();
@@ -96,7 +96,7 @@
   hardware_ = NULL;
   CpuInfo::Cleanup();
 }
-#endif  // defined(HOST_ARCH_ARM64)
+#endif  // !defined(USING_SIMULATOR)
 
 }  // namespace dart
 
diff --git a/runtime/vm/cpu_mips.cc b/runtime/vm/cpu_mips.cc
index a8a7c89..5b97d32 100644
--- a/runtime/vm/cpu_mips.cc
+++ b/runtime/vm/cpu_mips.cc
@@ -10,7 +10,7 @@
 #include "vm/cpuinfo.h"
 #include "vm/simulator.h"
 
-#if defined(HOST_ARCH_MIPS)
+#if !defined(USING_SIMULATOR)
 #include <asm/cachectl.h> /* NOLINT */
 #include <sys/syscall.h>  /* NOLINT */
 #include <unistd.h>  /* NOLINT */
@@ -19,7 +19,7 @@
 namespace dart {
 
 void CPU::FlushICache(uword start, uword size) {
-#if defined(HOST_ARCH_MIPS)
+#if !defined(USING_SIMULATOR)
   int res;
   // See http://www.linux-mips.org/wiki/Cacheflush_Syscall.
   res = syscall(__NR_cacheflush, start, size, ICACHE);
@@ -33,7 +33,7 @@
 
 const char* CPU::Id() {
   return
-#if !defined(HOST_ARCH_MIPS)
+#if defined(USING_SIMULATOR)
   "sim"
 #endif  // !defined(HOST_ARCH_MIPS)
   "mips";
@@ -47,7 +47,7 @@
 #endif
 
 
-#if defined(HOST_ARCH_MIPS)
+#if !defined(USING_SIMULATOR)
 void HostCPUFeatures::InitOnce() {
   CpuInfo::InitOnce();
   hardware_ = CpuInfo::GetCpuModel();
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index 78d12cf..e7717f8 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -1871,7 +1871,8 @@
 
 static void TestDirectAccess(Dart_Handle lib,
                              Dart_Handle array,
-                             Dart_TypedData_Type expected_type) {
+                             Dart_TypedData_Type expected_type,
+                             bool is_external) {
   Dart_Handle result;
 
   // Invoke the dart function that sets initial values.
@@ -1894,6 +1895,15 @@
     EXPECT_EQ(i, dataP[i]);
   }
 
+  if (!is_external) {
+    // Now try allocating a string with outstanding Acquires and it should
+    // return an error.
+    result = NewString("We expect an error here");
+    EXPECT_ERROR(result,
+                 "Internal Dart data pointers have been acquired, "
+                 "please release them using Dart_TypedDataReleaseData.");
+  }
+
   // Now modify the values in the directly accessible array and then check
   // it we see the changes back in dart.
   for (int i = 0; i < kLength; i++) {
@@ -1942,7 +1952,7 @@
   Dart_Handle list_access_test_obj;
   list_access_test_obj = Dart_Invoke(lib, NewString("main"), 0, NULL);
   EXPECT_VALID(list_access_test_obj);
-  TestDirectAccess(lib, list_access_test_obj, Dart_TypedData_kInt8);
+  TestDirectAccess(lib, list_access_test_obj, Dart_TypedData_kInt8, false);
 
   // Test with an external typed data object.
   uint8_t data[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@@ -1951,7 +1961,7 @@
   ext_list_access_test_obj = Dart_NewExternalTypedData(Dart_TypedData_kUint8,
                                                        data, data_length);
   EXPECT_VALID(ext_list_access_test_obj);
-  TestDirectAccess(lib, ext_list_access_test_obj, Dart_TypedData_kUint8);
+  TestDirectAccess(lib, ext_list_access_test_obj, Dart_TypedData_kUint8, true);
 }
 
 
@@ -2002,7 +2012,7 @@
   Dart_Handle list_access_test_obj;
   list_access_test_obj = Dart_Invoke(lib, NewString("main"), 0, NULL);
   EXPECT_VALID(list_access_test_obj);
-  TestDirectAccess(lib, list_access_test_obj, Dart_TypedData_kInt8);
+  TestDirectAccess(lib, list_access_test_obj, Dart_TypedData_kInt8, false);
 }
 
 
@@ -2053,7 +2063,7 @@
   Dart_Handle list_access_test_obj;
   list_access_test_obj = Dart_Invoke(lib, NewString("main"), 0, NULL);
   EXPECT_VALID(list_access_test_obj);
-  TestDirectAccess(lib, list_access_test_obj, Dart_TypedData_kByteData);
+  TestDirectAccess(lib, list_access_test_obj, Dart_TypedData_kByteData, false);
 }
 
 
diff --git a/runtime/vm/dart_api_state.h b/runtime/vm/dart_api_state.h
index 31be5fb..34b9f9a 100644
--- a/runtime/vm/dart_api_state.h
+++ b/runtime/vm/dart_api_state.h
@@ -818,10 +818,11 @@
 
   void SetupAcquiredError() {
     ASSERT(acquired_error_ == NULL);
-    acquired_error_ = persistent_handles().AllocateHandle();
-    acquired_error_->set_raw(
+    const String& msg = String::Handle(
         String::New("Internal Dart data pointers have been acquired, "
                     "please release them using Dart_TypedDataReleaseData."));
+    acquired_error_ = persistent_handles().AllocateHandle();
+    acquired_error_->set_raw(ApiError::New(msg));
   }
 
   PersistentHandle* AcquiredError() const {
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index 516caf7..57190db 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -1035,10 +1035,9 @@
 }
 
 
-const uint8_t kSafepointKind =
-    RawPcDescriptors::kIcCall |  RawPcDescriptors::kOptStaticCall |
-    RawPcDescriptors::kUnoptStaticCall | RawPcDescriptors::kClosureCall |
-    RawPcDescriptors::kRuntimeCall;
+const uint8_t kSafepointKind = RawPcDescriptors::kIcCall
+                             | RawPcDescriptors::kUnoptStaticCall
+                             | RawPcDescriptors::kRuntimeCall;
 
 
 CodeBreakpoint::CodeBreakpoint(const Code& code,
@@ -1369,7 +1368,7 @@
     }
     if (frame->IsDartFrame()) {
       code = frame->LookupDartCode();
-      if (code.is_optimized()) {
+      if (code.is_optimized() && !Compiler::always_optimize()) {
         deopt_frame = DeoptimizeToArray(isolate, frame, code);
         for (InlinedFunctionsIterator it(code, frame->pc());
              !it.Done();
diff --git a/runtime/vm/debugger_api_impl_test.cc b/runtime/vm/debugger_api_impl_test.cc
index a516a99..4bbc7e8 100644
--- a/runtime/vm/debugger_api_impl_test.cc
+++ b/runtime/vm/debugger_api_impl_test.cc
@@ -2147,6 +2147,7 @@
   Dart_Handle object_name = Dart_NewStringFromCString("Object");
   Dart_Handle int_name = Dart_NewStringFromCString("int");
   Dart_Handle set_name = Dart_NewStringFromCString("Set");
+  Dart_Handle iterable_name = Dart_NewStringFromCString("Iterable");
   Dart_Handle list_name = Dart_NewStringFromCString("List");
 
   Dart_Handle object_type = Dart_GetType(core_lib, object_name, 0, NULL);
@@ -2207,7 +2208,7 @@
   {
     Dart_Handle set_type = Dart_GetType(core_lib, set_name, 0, NULL);
     Dart_Handle super_type = Dart_GetSupertype(set_type);
-    Dart_Handle iterable_type = Dart_GetType(core_lib, object_name, 0, NULL);
+    Dart_Handle iterable_type = Dart_GetType(core_lib, iterable_name, 0, NULL);
     const Type& expected_type = Api::UnwrapTypeHandle(isolate, iterable_type);
     const Type& actual_type = Api::UnwrapTypeHandle(isolate, super_type);
     EXPECT(expected_type.raw() == actual_type.raw());
diff --git a/runtime/vm/debugger_arm.cc b/runtime/vm/debugger_arm.cc
index 608d6d2..e84ffa9 100644
--- a/runtime/vm/debugger_arm.cc
+++ b/runtime/vm/debugger_arm.cc
@@ -27,9 +27,6 @@
     case RawPcDescriptors::kUnoptStaticCall:
       stub_target = stub_code->ICCallBreakpointEntryPoint();
       break;
-    case RawPcDescriptors::kClosureCall:
-      stub_target = stub_code->ClosureCallBreakpointEntryPoint();
-      break;
     case RawPcDescriptors::kRuntimeCall:
       stub_target = stub_code->RuntimeCallBreakpointEntryPoint();
       break;
@@ -49,7 +46,6 @@
   switch (breakpoint_kind_) {
     case RawPcDescriptors::kIcCall:
     case RawPcDescriptors::kUnoptStaticCall:
-    case RawPcDescriptors::kClosureCall:
     case RawPcDescriptors::kRuntimeCall: {
       CodePatcher::PatchStaticCallAt(pc_, code, saved_value_);
       break;
diff --git a/runtime/vm/debugger_arm64.cc b/runtime/vm/debugger_arm64.cc
index ff099e2..0674495 100644
--- a/runtime/vm/debugger_arm64.cc
+++ b/runtime/vm/debugger_arm64.cc
@@ -27,9 +27,6 @@
     case RawPcDescriptors::kUnoptStaticCall:
       stub_target = stub_code->ICCallBreakpointEntryPoint();
       break;
-    case RawPcDescriptors::kClosureCall:
-      stub_target = stub_code->ClosureCallBreakpointEntryPoint();
-      break;
     case RawPcDescriptors::kRuntimeCall: {
       stub_target = stub_code->RuntimeCallBreakpointEntryPoint();
       break;
@@ -50,7 +47,6 @@
   switch (breakpoint_kind_) {
     case RawPcDescriptors::kIcCall:
     case RawPcDescriptors::kUnoptStaticCall:
-    case RawPcDescriptors::kClosureCall:
     case RawPcDescriptors::kRuntimeCall: {
       CodePatcher::PatchPoolPointerCallAt(pc_, code, saved_value_);
       break;
diff --git a/runtime/vm/debugger_ia32.cc b/runtime/vm/debugger_ia32.cc
index b05ae16..6b9ae72 100644
--- a/runtime/vm/debugger_ia32.cc
+++ b/runtime/vm/debugger_ia32.cc
@@ -37,12 +37,6 @@
             pc_, code, isolate->stub_code()->ICCallBreakpointEntryPoint());
         break;
       }
-      case RawPcDescriptors::kClosureCall: {
-        saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code);
-        CodePatcher::PatchStaticCallAt(
-            pc_, code, isolate->stub_code()->ClosureCallBreakpointEntryPoint());
-        break;
-      }
       case RawPcDescriptors::kRuntimeCall: {
         saved_value_ = CodePatcher::GetStaticCallTargetAt(pc_, code);
         CodePatcher::PatchStaticCallAt(
@@ -66,7 +60,6 @@
     switch (breakpoint_kind_) {
       case RawPcDescriptors::kIcCall:
       case RawPcDescriptors::kUnoptStaticCall:
-      case RawPcDescriptors::kClosureCall:
       case RawPcDescriptors::kRuntimeCall: {
         CodePatcher::PatchStaticCallAt(pc_, code, saved_value_);
         break;
diff --git a/runtime/vm/debugger_mips.cc b/runtime/vm/debugger_mips.cc
index 96d4632..cd661db 100644
--- a/runtime/vm/debugger_mips.cc
+++ b/runtime/vm/debugger_mips.cc
@@ -27,9 +27,6 @@
     case RawPcDescriptors::kUnoptStaticCall:
       stub_target = stub_code->ICCallBreakpointEntryPoint();
       break;
-    case RawPcDescriptors::kClosureCall:
-      stub_target = stub_code->ClosureCallBreakpointEntryPoint();
-      break;
     case RawPcDescriptors::kRuntimeCall:
       stub_target = stub_code->RuntimeCallBreakpointEntryPoint();
       break;
@@ -49,7 +46,6 @@
   switch (breakpoint_kind_) {
     case RawPcDescriptors::kIcCall:
     case RawPcDescriptors::kUnoptStaticCall:
-    case RawPcDescriptors::kClosureCall:
     case RawPcDescriptors::kRuntimeCall: {
       CodePatcher::PatchStaticCallAt(pc_, code, saved_value_);
       break;
diff --git a/runtime/vm/debugger_x64.cc b/runtime/vm/debugger_x64.cc
index a2ca7a7..39b1ac1 100644
--- a/runtime/vm/debugger_x64.cc
+++ b/runtime/vm/debugger_x64.cc
@@ -29,9 +29,6 @@
     case RawPcDescriptors::kUnoptStaticCall:
       stub_target = stub_code->ICCallBreakpointEntryPoint();
       break;
-    case RawPcDescriptors::kClosureCall:
-      stub_target = stub_code->ClosureCallBreakpointEntryPoint();
-      break;
     case RawPcDescriptors::kRuntimeCall:
       stub_target = stub_code->RuntimeCallBreakpointEntryPoint();
       break;
@@ -51,7 +48,6 @@
   switch (breakpoint_kind_) {
     case RawPcDescriptors::kIcCall:
     case RawPcDescriptors::kUnoptStaticCall:
-    case RawPcDescriptors::kClosureCall:
     case RawPcDescriptors::kRuntimeCall: {
       CodePatcher::PatchPoolPointerCallAt(pc_, code, saved_value_);
       break;
diff --git a/runtime/vm/deferred_objects.cc b/runtime/vm/deferred_objects.cc
index f3cb4d8..ba620c4 100644
--- a/runtime/vm/deferred_objects.cc
+++ b/runtime/vm/deferred_objects.cc
@@ -137,6 +137,10 @@
     CodePatcher::GetInstanceCallAt(pc, code, &ic_data);
     if (!ic_data.IsNull()) {
       ic_data.AddDeoptReason(deopt_context->deopt_reason());
+      // Propagate the reason to all ICData-s with same deopt_id since
+      // only unoptimized-code ICData (IC calls) are propagated.
+      function.SetDeoptReasonForAll(ic_data.deopt_id(),
+                                    deopt_context->deopt_reason());
     }
   } else {
     if (deopt_context->HasDeoptFlag(ICData::kHoisted)) {
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index 75ef322..fa2e441 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -566,16 +566,12 @@
                                  const Integer& argument_value,
                                  intptr_t expected_from,
                                  intptr_t expected_to) {
-  const String& error = String::Handle(String::NewFormatted(
-      "%s (%s) must be in the range [%" Pd "..%" Pd ")",
-      argument_name,
-      argument_value.ToCString(),
-      expected_from,
-      expected_to));
-
-  const Array& args = Array::Handle(Array::New(1));
-  args.SetAt(0, error);
-  Exceptions::ThrowByType(Exceptions::kRange, args);
+  const Array& args = Array::Handle(Array::New(4));
+  args.SetAt(0, argument_value);
+  args.SetAt(1, Integer::Handle(Integer::New(expected_from)));
+  args.SetAt(2, Integer::Handle(Integer::New(expected_to)));
+  args.SetAt(3, String::Handle(String::New(argument_name)));
+  Exceptions::ThrowByType(Exceptions::kRangeRange, args);
 }
 
 
@@ -593,6 +589,11 @@
       library = Library::CoreLibrary();
       class_name = &Symbols::RangeError();
       break;
+    case kRangeRange:
+      library = Library::CoreLibrary();
+      class_name = &Symbols::RangeError();
+      constructor_name = &Symbols::DotRange();
+      break;
     case kArgument:
       library = Library::CoreLibrary();
       class_name = &Symbols::ArgumentError();
diff --git a/runtime/vm/exceptions.h b/runtime/vm/exceptions.h
index 0264778..a2a1cb1 100644
--- a/runtime/vm/exceptions.h
+++ b/runtime/vm/exceptions.h
@@ -51,6 +51,7 @@
   enum ExceptionType {
     kNone,
     kRange,
+    kRangeRange,
     kArgument,
     kNoSuchMethod,
     kFormat,
diff --git a/runtime/vm/flags.cc b/runtime/vm/flags.cc
index 6aec343..b9cda6a 100644
--- a/runtime/vm/flags.cc
+++ b/runtime/vm/flags.cc
@@ -429,23 +429,23 @@
   jsflag.AddProperty("comment", flag->comment_);
   switch (flag->type_) {
     case Flag::kBoolean: {
-      jsflag.AddProperty("flagType", "bool");
+      jsflag.AddProperty("_flagType", "Bool");
       jsflag.AddProperty("valueAsString",
                          (*flag->bool_ptr_ ? "true" : "false"));
       break;
     }
     case Flag::kInteger: {
-      jsflag.AddProperty("flagType", "int");
+      jsflag.AddProperty("_flagType", "Int");
       jsflag.AddPropertyF("valueAsString", "%d", *flag->int_ptr_);
       break;
     }
     case Flag::kUint64: {
-      jsflag.AddProperty("flagType", "uint64_t");
+      jsflag.AddProperty("_flagType", "UInt64");
       jsflag.AddPropertyF("valueAsString", "%" Pu64, *flag->uint64_ptr_);
       break;
     }
     case Flag::kString: {
-      jsflag.AddProperty("flagType", "string");
+      jsflag.AddProperty("_flagType", "String");
       if (flag->charp_ptr_ != NULL) {
         jsflag.AddPropertyF("valueAsString", "%s", *flag->charp_ptr_);
       } else {
diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc
index 8327146..53106a8 100644
--- a/runtime/vm/flow_graph.cc
+++ b/runtime/vm/flow_graph.cc
@@ -15,6 +15,7 @@
 namespace dart {
 
 DEFINE_FLAG(bool, prune_dead_locals, true, "optimize dead locals away");
+DECLARE_FLAG(bool, emit_edge_counters);
 DECLARE_FLAG(bool, reorder_basic_blocks);
 DECLARE_FLAG(bool, trace_optimization);
 DECLARE_FLAG(bool, verify_compiler);
@@ -83,7 +84,8 @@
 
 bool FlowGraph::ShouldReorderBlocks(const Function& function,
                                     bool is_optimized) {
-  return is_optimized && FLAG_reorder_basic_blocks && !function.is_intrinsic();
+  return is_optimized && FLAG_reorder_basic_blocks &&
+      FLAG_emit_edge_counters && !function.is_intrinsic();
 }
 
 
diff --git a/runtime/vm/flow_graph_allocator.cc b/runtime/vm/flow_graph_allocator.cc
index 07e3086..6f5deb4 100644
--- a/runtime/vm/flow_graph_allocator.cc
+++ b/runtime/vm/flow_graph_allocator.cc
@@ -168,7 +168,7 @@
       // Initialize location summary for instruction.
       current->InitializeLocationSummary(zone(), true);  // opt
       LocationSummary* locs = current->locs();
-#if DEBUG
+#if defined(DEBUG)
       locs->DiscoverWritableInputs();
 #endif
 
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index c414fe9..aa73c55 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -3324,6 +3324,25 @@
 }
 
 
+ConstantInstr* EffectGraphVisitor::DoNativeSetterStoreValue(
+    NativeBodyNode* node,
+    intptr_t offset,
+    StoreBarrierType emit_store_barrier) {
+  Value* receiver = Bind(BuildLoadThisVar(node->scope()));
+  LocalVariable* value_var =
+      node->scope()->LookupVariable(Symbols::Value(), true);
+  Value* value = Bind(new(Z) LoadLocalInstr(*value_var));
+  StoreInstanceFieldInstr* store = new(Z) StoreInstanceFieldInstr(
+      offset,
+      receiver,
+      value,
+      emit_store_barrier,
+      node->token_pos());
+  Do(store);
+  return new(Z) ConstantInstr(Object::ZoneHandle(Z, Object::null()));
+}
+
+
 void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) {
   const Function& function = owner()->function();
   if (!function.IsClosureFunction()) {
@@ -3427,6 +3446,59 @@
             node, kind, Bigint::used_offset(),
             Type::ZoneHandle(Z, Type::SmiType()), kSmiCid));
       }
+      case MethodRecognizer::kLinkedHashMap_getIndex: {
+        return ReturnDefinition(BuildNativeGetter(
+            node, kind, LinkedHashMap::index_offset(),
+            Type::ZoneHandle(Z, Type::DynamicType()),
+            kTypedDataUint32ArrayCid));
+      }
+      case MethodRecognizer::kLinkedHashMap_setIndex: {
+        return ReturnDefinition(DoNativeSetterStoreValue(
+            node, LinkedHashMap::index_offset(), kEmitStoreBarrier));
+      }
+      case MethodRecognizer::kLinkedHashMap_getData: {
+        return ReturnDefinition(BuildNativeGetter(
+            node, kind, LinkedHashMap::data_offset(),
+            Type::ZoneHandle(Z, Type::DynamicType()),
+            kArrayCid));
+      }
+      case MethodRecognizer::kLinkedHashMap_setData: {
+        return ReturnDefinition(DoNativeSetterStoreValue(
+            node, LinkedHashMap::data_offset(), kEmitStoreBarrier));
+      }
+      case MethodRecognizer::kLinkedHashMap_getHashMask: {
+        return ReturnDefinition(BuildNativeGetter(
+            node, kind, LinkedHashMap::hash_mask_offset(),
+            Type::ZoneHandle(Z, Type::SmiType()),
+            kSmiCid));
+      }
+      case MethodRecognizer::kLinkedHashMap_setHashMask: {
+        // Smi field; no barrier needed.
+        return ReturnDefinition(DoNativeSetterStoreValue(
+            node, LinkedHashMap::hash_mask_offset(), kNoStoreBarrier));
+      }
+      case MethodRecognizer::kLinkedHashMap_getUsedData: {
+        return ReturnDefinition(BuildNativeGetter(
+            node, kind, LinkedHashMap::used_data_offset(),
+            Type::ZoneHandle(Z, Type::SmiType()),
+            kSmiCid));
+      }
+      case MethodRecognizer::kLinkedHashMap_setUsedData: {
+        // Smi field; no barrier needed.
+        return ReturnDefinition(DoNativeSetterStoreValue(
+            node, LinkedHashMap::used_data_offset(), kNoStoreBarrier));
+      }
+      case MethodRecognizer::kLinkedHashMap_getDeletedKeys: {
+        return ReturnDefinition(BuildNativeGetter(
+            node, kind, LinkedHashMap::deleted_keys_offset(),
+            Type::ZoneHandle(Z, Type::SmiType()),
+            kSmiCid));
+      }
+      case MethodRecognizer::kLinkedHashMap_setDeletedKeys: {
+        // Smi field; no barrier needed.
+        return ReturnDefinition(DoNativeSetterStoreValue(
+            node, LinkedHashMap::deleted_keys_offset(), kNoStoreBarrier));
+      }
       case MethodRecognizer::kBigint_getNeg: {
         return ReturnDefinition(BuildNativeGetter(
             node, kind, Bigint::neg_offset(),
diff --git a/runtime/vm/flow_graph_builder.h b/runtime/vm/flow_graph_builder.h
index b2daac8..4c127f1 100644
--- a/runtime/vm/flow_graph_builder.h
+++ b/runtime/vm/flow_graph_builder.h
@@ -31,9 +31,9 @@
 // List of recognized list factories:
 // (factory-name-symbol, result-cid, fingerprint).
 #define RECOGNIZED_LIST_FACTORY_LIST(V)                                        \
-  V(_ListFactory, kArrayCid, 335347617)                                        \
+  V(_ListFactory, kArrayCid, 850375012)                                        \
   V(_GrowableListWithData, kGrowableObjectArrayCid, 2094352700)                \
-  V(_GrowableListFactory, kGrowableObjectArrayCid, 619206641)                  \
+  V(_GrowableListFactory, kGrowableObjectArrayCid, 1518848600)                 \
   V(_Int8ArrayFactory, kTypedDataInt8ArrayCid, 439914696)                      \
   V(_Uint8ArrayFactory, kTypedDataUint8ArrayCid, 1442599030)                   \
   V(_Uint8ClampedArrayFactory, kTypedDataUint8ClampedArrayCid, 1320015159)     \
@@ -342,6 +342,11 @@
       intptr_t offset,
       const Type& type,
       intptr_t class_id);
+  // Assumes setter parameter is named 'value'. Returns null constant.
+  ConstantInstr* DoNativeSetterStoreValue(
+      NativeBodyNode* node,
+      intptr_t offset,
+      StoreBarrierType emit_store_barrier);
 
   // Helpers for translating parts of the AST.
   void BuildPushArguments(const ArgumentListNode& node,
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index 865e027..ff214ae 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -8,6 +8,7 @@
 
 #include "vm/bit_vector.h"
 #include "vm/cha.h"
+#include "vm/compiler.h"
 #include "vm/dart_entry.h"
 #include "vm/debugger.h"
 #include "vm/deopt_instructions.h"
@@ -41,12 +42,15 @@
 DEFINE_FLAG(bool, use_megamorphic_stub, true, "Out of line megamorphic lookup");
 
 DECLARE_FLAG(bool, code_comments);
+DECLARE_FLAG(bool, deoptimize_alot);
 DECLARE_FLAG(int, deoptimize_every);
 DECLARE_FLAG(charp, deoptimize_filter);
 DECLARE_FLAG(bool, disassemble);
 DECLARE_FLAG(bool, disassemble_optimized);
 DECLARE_FLAG(bool, emit_edge_counters);
+DECLARE_FLAG(bool, ic_range_profiling);
 DECLARE_FLAG(bool, intrinsify);
+DECLARE_FLAG(bool, load_deferred_eagerly);
 DECLARE_FLAG(int, optimization_counter_threshold);
 DECLARE_FLAG(bool, propagate_ic_data);
 DECLARE_FLAG(int, regexp_optimization_counter_threshold);
@@ -54,11 +58,11 @@
 DECLARE_FLAG(int, stacktrace_every);
 DECLARE_FLAG(charp, stacktrace_filter);
 DECLARE_FLAG(bool, support_debugger);
-DECLARE_FLAG(bool, use_cha);
 DECLARE_FLAG(bool, use_field_guards);
+DECLARE_FLAG(bool, use_cha_deopt);
 DECLARE_FLAG(bool, use_osr);
 DECLARE_FLAG(bool, warn_on_javascript_compatibility);
-DECLARE_FLAG(bool, ic_range_profiling);
+
 
 static void NooptModeHandler(bool value) {
   if (value) {
@@ -70,6 +74,15 @@
     FLAG_support_debugger = false;
     FLAG_ic_range_profiling = false;
     FLAG_collect_code = false;
+    FLAG_load_deferred_eagerly = true;
+    FLAG_deoptimize_alot = false;  // Used in some tests.
+    FLAG_deoptimize_every = 0;  // Used in some tests.
+    FLAG_collect_code = false;
+    Compiler::set_always_optimize(true);
+    Compiler::set_guess_other_cid(false);
+    // TODO(srdjan): Enable CHA deoptimization when eager class finalization is
+    // implemented, either with precompilation or as a special pass.
+    FLAG_use_cha_deopt = false;
   }
 }
 
@@ -206,7 +219,6 @@
         const ICData* ic_data = NULL;
         if (current->IsInstanceCall()) {
           ic_data = current->AsInstanceCall()->ic_data();
-          ASSERT(ic_data != NULL);
         }
         if ((ic_data != NULL) && (ic_data->NumberOfUsedChecks() == 0)) {
           may_reoptimize_ = true;
@@ -846,6 +858,8 @@
     return &intrinsic_slow_path_label_;
   }
 
+  // No deoptimization allowed when 'always_optimize' is set.
+  ASSERT(!Compiler::always_optimize());
   ASSERT(is_optimizing_);
   CompilerDeoptInfoWithStub* stub =
       new CompilerDeoptInfoWithStub(deopt_id,
@@ -881,6 +895,10 @@
 
 
 RawArray* FlowGraphCompiler::CreateDeoptInfo(Assembler* assembler) {
+  // No deopt information if we 'always_optimize' (no deoptimization allowed).
+  if (Compiler::always_optimize()) {
+    return Array::empty_array().raw();
+  }
   // For functions with optional arguments, all incoming arguments are copied
   // to spill slots. The deoptimization environment does not track them.
   const Function& function = parsed_function().function();
diff --git a/runtime/vm/flow_graph_compiler_arm.cc b/runtime/vm/flow_graph_compiler_arm.cc
index 3fd9733..71bb862 100644
--- a/runtime/vm/flow_graph_compiler_arm.cc
+++ b/runtime/vm/flow_graph_compiler_arm.cc
@@ -1353,7 +1353,7 @@
   GenerateDartCall(deopt_id,
                    token_pos,
                    &stub_code->CallStaticFunctionLabel(),
-                   RawPcDescriptors::kOptStaticCall,
+                   RawPcDescriptors::kOther,
                    locs);
   AddStaticCallTarget(function);
   __ Drop(argument_count);
@@ -1547,7 +1547,7 @@
     GenerateDartCall(deopt_id,
                      token_index,
                      &stub_code->CallStaticFunctionLabel(),
-                     RawPcDescriptors::kOptStaticCall,
+                     RawPcDescriptors::kOther,
                      locs);
     const Function& function = *sorted[i].target;
     AddStaticCallTarget(function);
diff --git a/runtime/vm/flow_graph_compiler_arm64.cc b/runtime/vm/flow_graph_compiler_arm64.cc
index dec7a2b..ffd907b 100644
--- a/runtime/vm/flow_graph_compiler_arm64.cc
+++ b/runtime/vm/flow_graph_compiler_arm64.cc
@@ -1334,7 +1334,7 @@
   GenerateDartCall(deopt_id,
                    token_pos,
                    &stub_code->CallStaticFunctionLabel(),
-                   RawPcDescriptors::kOptStaticCall,
+                   RawPcDescriptors::kOther,
                    locs);
   AddStaticCallTarget(function);
   __ Drop(argument_count);
@@ -1511,7 +1511,7 @@
     GenerateDartCall(deopt_id,
                      token_index,
                      &stub_code->CallStaticFunctionLabel(),
-                     RawPcDescriptors::kOptStaticCall,
+                     RawPcDescriptors::kOther,
                      locs);
     const Function& function = *sorted[i].target;
     AddStaticCallTarget(function);
diff --git a/runtime/vm/flow_graph_compiler_ia32.cc b/runtime/vm/flow_graph_compiler_ia32.cc
index b389d5d..3b83202 100644
--- a/runtime/vm/flow_graph_compiler_ia32.cc
+++ b/runtime/vm/flow_graph_compiler_ia32.cc
@@ -1356,7 +1356,7 @@
   GenerateDartCall(deopt_id,
                    token_pos,
                    &stub_code->CallStaticFunctionLabel(),
-                   RawPcDescriptors::kOptStaticCall,
+                   RawPcDescriptors::kOther,
                    locs);
   AddStaticCallTarget(function);
   __ Drop(argument_count);
@@ -1544,7 +1544,7 @@
     GenerateDartCall(deopt_id,
                      token_index,
                      &stub_code->CallStaticFunctionLabel(),
-                     RawPcDescriptors::kOptStaticCall,
+                     RawPcDescriptors::kOther,
                      locs);
     const Function& function = *sorted[i].target;
     AddStaticCallTarget(function);
diff --git a/runtime/vm/flow_graph_compiler_mips.cc b/runtime/vm/flow_graph_compiler_mips.cc
index 556a673..925796d 100644
--- a/runtime/vm/flow_graph_compiler_mips.cc
+++ b/runtime/vm/flow_graph_compiler_mips.cc
@@ -1357,7 +1357,7 @@
   GenerateDartCall(deopt_id,
                    token_pos,
                    &stub_code->CallStaticFunctionLabel(),
-                   RawPcDescriptors::kOptStaticCall,
+                   RawPcDescriptors::kOther,
                    locs);
   AddStaticCallTarget(function);
   __ Drop(argument_count);
@@ -1574,7 +1574,7 @@
     GenerateDartCall(deopt_id,
                      token_index,
                      &stub_code->CallStaticFunctionLabel(),
-                     RawPcDescriptors::kOptStaticCall,
+                     RawPcDescriptors::kOther,
                      locs);
     const Function& function = *sorted[i].target;
     AddStaticCallTarget(function);
diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc
index a590735..b3bbe79 100644
--- a/runtime/vm/flow_graph_compiler_x64.cc
+++ b/runtime/vm/flow_graph_compiler_x64.cc
@@ -1362,7 +1362,7 @@
   GenerateDartCall(deopt_id,
                    token_pos,
                    &stub_code->CallStaticFunctionLabel(),
-                   RawPcDescriptors::kOptStaticCall,
+                   RawPcDescriptors::kOther,
                    locs);
   AddStaticCallTarget(function);
   __ Drop(argument_count, RCX);
@@ -1506,7 +1506,7 @@
     GenerateDartCall(deopt_id,
                      token_index,
                      &stub_code->CallStaticFunctionLabel(),
-                     RawPcDescriptors::kOptStaticCall,
+                     RawPcDescriptors::kOther,
                      locs);
     const Function& function = *sorted[i].target;
     AddStaticCallTarget(function);
diff --git a/runtime/vm/flow_graph_inliner.cc b/runtime/vm/flow_graph_inliner.cc
index 5448bd1..5e79772 100644
--- a/runtime/vm/flow_graph_inliner.cc
+++ b/runtime/vm/flow_graph_inliner.cc
@@ -269,9 +269,14 @@
 
     GrowableArray<intptr_t> static_call_counts(num_static_calls);
     for (intptr_t i = 0; i < num_static_calls; ++i) {
-      const intptr_t aggregate_count =
-          static_calls_[i + static_call_start_ix].
-              call->ic_data()->AggregateCount();
+      intptr_t aggregate_count = 0;
+      if (static_calls_[i + static_call_start_ix].call->ic_data() == NULL) {
+        aggregate_count = 0;
+      } else {
+        aggregate_count =
+            static_calls_[i + static_call_start_ix].
+                call->ic_data()->AggregateCount();
+      }
       static_call_counts.Add(aggregate_count);
       if (aggregate_count > max_count) max_count = aggregate_count;
     }
@@ -682,10 +687,12 @@
       ParsedFunction* parsed_function;
       {
         CSTAT_TIMER_SCOPE(isolate(), graphinliner_parse_timer);
-        const Error& error = Error::Handle(Z,
-            Compiler::EnsureUnoptimizedCode(Thread::Current(), function));
-        if (!error.IsNull()) {
-          Exceptions::PropagateError(error);
+        if (!Compiler::always_optimize()) {
+          const Error& error = Error::Handle(Z,
+              Compiler::EnsureUnoptimizedCode(Thread::Current(), function));
+          if (!error.IsNull()) {
+            Exceptions::PropagateError(error);
+          }
         }
         parsed_function = GetParsedFunction(function, &in_cache);
       }
@@ -770,6 +777,9 @@
         CSTAT_TIMER_SCOPE(isolate(), graphinliner_opt_timer);
         // TODO(zerny): Do more optimization passes on the callee graph.
         FlowGraphOptimizer optimizer(callee_graph);
+        if (Compiler::always_optimize()) {
+          optimizer.PopulateWithICData();
+        }
         optimizer.ApplyICData();
         DEBUG_ASSERT(callee_graph->VerifyUseLists());
 
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index e4a5183..c51d952 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -6,6 +6,7 @@
 
 #include "vm/bit_vector.h"
 #include "vm/cha.h"
+#include "vm/compiler.h"
 #include "vm/cpu.h"
 #include "vm/dart_entry.h"
 #include "vm/exceptions.h"
@@ -39,7 +40,8 @@
 DEFINE_FLAG(bool, trace_optimization, false, "Print optimization details.");
 DEFINE_FLAG(bool, truncating_left_shift, true,
     "Optimize left shift to truncate if possible");
-DEFINE_FLAG(bool, use_cha, true, "Use class hierarchy analysis.");
+DEFINE_FLAG(bool, use_cha_deopt, true,
+    "Use class hierarchy analysis even if it can cause deoptimization.");
 #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_IA32)
 DEFINE_FLAG(bool, trace_smi_widening, false, "Trace Smi->Int32 widening pass.");
 #endif
@@ -87,6 +89,33 @@
 }
 
 
+void FlowGraphOptimizer::PopulateWithICData() {
+  ASSERT(current_iterator_ == NULL);
+  for (intptr_t i = 0; i < block_order_.length(); ++i) {
+    BlockEntryInstr* entry = block_order_[i];
+    ForwardInstructionIterator it(entry);
+    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()));
+          call->set_ic_data(&ic_data);
+        }
+      }
+    }
+    current_iterator_ = NULL;
+  }
+}
+
+
 // Optimize instance calls using cid.  This is called after optimizer
 // converted instance calls to instructions. Any remaining
 // instance calls are either megamorphic calls, cannot be optimized or
@@ -162,12 +191,14 @@
       Token::IsBinaryOperator(op_kind)) {
     // Guess cid: if one of the inputs is a number assume that the other
     // is a number of same type.
-    const intptr_t cid_0 = class_ids[0];
-    const intptr_t cid_1 = class_ids[1];
-    if ((cid_0 == kDynamicCid) && (IsNumberCid(cid_1))) {
-      class_ids[0] = cid_1;
-    } else if (IsNumberCid(cid_0) && (cid_1 == kDynamicCid)) {
-      class_ids[1] = cid_0;
+    if (Compiler::guess_other_cid()) {
+      const intptr_t cid_0 = class_ids[0];
+      const intptr_t cid_1 = class_ids[1];
+      if ((cid_0 == kDynamicCid) && (IsNumberCid(cid_1))) {
+        class_ids[0] = cid_1;
+      } else if (IsNumberCid(cid_0) && (cid_1 == kDynamicCid)) {
+        class_ids[1] = cid_0;
+      }
     }
   }
 
@@ -1413,7 +1444,10 @@
     case MethodRecognizer::kInt16ArraySetIndexed:
     case MethodRecognizer::kUint16ArraySetIndexed:
       // Optimistically assume Smi.
-      // TODO(srdjan): Check deopt reason to prevent repeated deoptimizations.
+      if (ic_data.HasDeoptReason(ICData::kDeoptCheckSmi)) {
+        // Optimistic assumption failed at least once.
+        return false;
+      }
       value_check = ic_data.AsUnaryClassChecksForCid(kSmiCid, target);
       return InlineSetIndexed(kind, target, call, receiver, token_pos,
                               value_check, entry, last);
@@ -2246,7 +2280,11 @@
 // callee functions, then no class check is needed.
 bool FlowGraphOptimizer::InstanceCallNeedsClassCheck(
     InstanceCallInstr* call, RawFunction::Kind kind) const {
-  if (!FLAG_use_cha) return true;
+  if (!FLAG_use_cha_deopt) {
+    // Even if class or function are private, lazy class finalization
+    // may later add overriding methods.
+    return true;
+  }
   Definition* callee_receiver = call->ArgumentAt(0);
   ASSERT(callee_receiver != NULL);
   const Function& function = flow_graph_->function();
@@ -2256,14 +2294,18 @@
     const String& name = (kind == RawFunction::kMethodExtractor)
         ? String::Handle(Z, Field::NameFromGetter(call->function_name()))
         : call->function_name();
-    return thread()->cha()->HasOverride(Class::Handle(Z, function.Owner()),
-                                        name);
+    const Class& cls = Class::Handle(Z, function.Owner());
+    if (!thread()->cha()->HasOverride(cls, name)) {
+      thread()->cha()->AddToLeafClasses(cls);
+      return false;
+    }
   }
   return true;
 }
 
 
-void FlowGraphOptimizer::InlineImplicitInstanceGetter(InstanceCallInstr* call) {
+bool FlowGraphOptimizer::InlineImplicitInstanceGetter(InstanceCallInstr* call,
+                                                      bool allow_check) {
   ASSERT(call->HasICData());
   const ICData& ic_data = *call->ic_data();
   ASSERT(ic_data.HasOneTarget());
@@ -2279,6 +2321,9 @@
   ASSERT(!field.IsNull());
 
   if (InstanceCallNeedsClassCheck(call, RawFunction::kImplicitGetter)) {
+    if (!allow_check) {
+      return false;
+    }
     AddReceiverCheck(call);
   }
   LoadFieldInstr* load = new(Z) LoadFieldInstr(
@@ -2307,6 +2352,7 @@
       it.Current()->SetReachingType(NULL);
     }
   }
+  return true;
 }
 
 
@@ -2584,7 +2630,9 @@
 
 
 // Only unique implicit instance getters can be currently handled.
-bool FlowGraphOptimizer::TryInlineInstanceGetter(InstanceCallInstr* call) {
+// Returns false if 'allow_check' is false and a check is needed.
+bool FlowGraphOptimizer::TryInlineInstanceGetter(InstanceCallInstr* call,
+                                                 bool allow_check) {
   ASSERT(call->HasICData());
   const ICData& ic_data = *call->ic_data();
   if (ic_data.NumberOfUsedChecks() == 0) {
@@ -2604,8 +2652,7 @@
     // inlining in FlowGraphInliner.
     return false;
   }
-  InlineImplicitInstanceGetter(call);
-  return true;
+  return InlineImplicitInstanceGetter(call, allow_check);
 }
 
 
@@ -3126,6 +3173,10 @@
 bool FlowGraphOptimizer::TryInlineFloat32x4Constructor(
     StaticCallInstr* call,
     MethodRecognizer::Kind recognized_kind) {
+  if (Compiler::always_optimize()) {
+    // Cannot handle unboxed instructions.
+    return false;
+  }
   if (!ShouldInlineSimd()) {
     return false;
   }
@@ -3169,6 +3220,10 @@
 bool FlowGraphOptimizer::TryInlineFloat64x2Constructor(
     StaticCallInstr* call,
     MethodRecognizer::Kind recognized_kind) {
+  if (Compiler::always_optimize()) {
+    // Cannot handle unboxed instructions.
+    return false;
+  }
   if (!ShouldInlineSimd()) {
     return false;
   }
@@ -3204,6 +3259,10 @@
 bool FlowGraphOptimizer::TryInlineInt32x4Constructor(
     StaticCallInstr* call,
     MethodRecognizer::Kind recognized_kind) {
+  if (Compiler::always_optimize()) {
+    // Cannot handle unboxed instructions.
+    return false;
+  }
   if (!ShouldInlineSimd()) {
     return false;
   }
@@ -3917,7 +3976,6 @@
 bool FlowGraphOptimizer::TypeCheckAsClassEquality(const AbstractType& type) {
   ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded());
   // Requires CHA.
-  if (!FLAG_use_cha) return false;
   if (!type.IsInstantiated()) return false;
   const Class& type_class = Class::Handle(type.type_class());
   // Signature classes have different type checking rules.
@@ -3925,7 +3983,18 @@
   // Could be an interface check?
   if (thread()->cha()->IsImplemented(type_class)) return false;
   // Check if there are subclasses.
-  if (thread()->cha()->HasSubclasses(type_class)) return false;
+  if (thread()->cha()->HasSubclasses(type_class)) {
+    return false;
+  }
+
+  // Private classes cannot be subclassed by later loaded libs.
+  if (!type_class.IsPrivate()) {
+    if (FLAG_use_cha_deopt) {
+      thread()->cha()->AddToLeafClasses(type_class);
+    } else {
+      return false;
+    }
+  }
   const intptr_t num_type_args = type_class.NumTypeArguments();
   if (num_type_args > 0) {
     // Only raw types can be directly compared, thus disregarding type
@@ -4152,6 +4221,15 @@
   }
 
   const Token::Kind op_kind = instr->token_kind();
+  if (Compiler::always_optimize()) {
+    // TODO(srdjan): Investigate other attempts, as they are not allowed to
+    // deoptimize.
+    if ((op_kind == Token::kGET) && TryInlineInstanceGetter(instr, false)) {
+      return;
+    }
+    return;
+  }
+
   // Type test is special as it always gets converted into inlined code.
   if (Token::IsTypeTestOperator(op_kind)) {
     ReplaceWithInstanceOf(instr);
@@ -4275,11 +4353,15 @@
       break;
   }
   if (unary_kind != MathUnaryInstr::kIllegal) {
-    MathUnaryInstr* math_unary =
-        new(Z) MathUnaryInstr(unary_kind,
-                              new(Z) Value(call->ArgumentAt(0)),
-                              call->deopt_id());
-    ReplaceCall(call, math_unary);
+    if (Compiler::always_optimize()) {
+      // TODO(srdjan): Adapt MathUnaryInstr to allow tagged inputs as well.
+    } else {
+      MathUnaryInstr* math_unary =
+          new(Z) MathUnaryInstr(unary_kind,
+                                new(Z) Value(call->ArgumentAt(0)),
+                                call->deopt_id());
+      ReplaceCall(call, math_unary);
+    }
   } else if ((recognized_kind == MethodRecognizer::kFloat32x4Zero) ||
              (recognized_kind == MethodRecognizer::kFloat32x4Splat) ||
              (recognized_kind == MethodRecognizer::kFloat32x4Constructor) ||
@@ -4340,6 +4422,10 @@
       }
     }
   } else if (recognized_kind == MethodRecognizer::kMathDoublePow) {
+    if (Compiler::always_optimize()) {
+      // No UnboxDouble instructons allowed.
+      return;
+    }
     // We know that first argument is double, the second is num.
     // InvokeMathCFunctionInstr requires unboxed doubles. UnboxDouble
     // instructions contain type checks and conversions to double.
diff --git a/runtime/vm/flow_graph_optimizer.h b/runtime/vm/flow_graph_optimizer.h
index ba3c4d8..92b6042 100644
--- a/runtime/vm/flow_graph_optimizer.h
+++ b/runtime/vm/flow_graph_optimizer.h
@@ -23,6 +23,10 @@
 
   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();
 
@@ -108,7 +112,8 @@
   bool TryReplaceWithEqualityOp(InstanceCallInstr* call, Token::Kind op_kind);
   bool TryReplaceWithRelationalOp(InstanceCallInstr* call, Token::Kind op_kind);
 
-  bool TryInlineInstanceGetter(InstanceCallInstr* call);
+  bool TryInlineInstanceGetter(InstanceCallInstr* call,
+                               bool allow_check = true);
   bool TryInlineInstanceSetter(InstanceCallInstr* call,
                                const ICData& unary_ic_data);
 
@@ -233,7 +238,7 @@
                               Token::Kind op_kind);
   bool InlineFloat64x2BinaryOp(InstanceCallInstr* call,
                                Token::Kind op_kind);
-  void InlineImplicitInstanceGetter(InstanceCallInstr* call);
+  bool InlineImplicitInstanceGetter(InstanceCallInstr* call, bool allow_check);
 
   RawBool* InstanceOfAsBool(const ICData& ic_data,
                             const AbstractType& type,
@@ -257,6 +262,8 @@
   Isolate* isolate() const { return flow_graph_->isolate(); }
   Zone* zone() const { return flow_graph_->zone(); }
 
+  const Function& function() const { return flow_graph_->function(); }
+
   FlowGraph* flow_graph_;
 
   DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer);
diff --git a/runtime/vm/flow_graph_type_propagator.cc b/runtime/vm/flow_graph_type_propagator.cc
index bbf8d64..64471b7 100644
--- a/runtime/vm/flow_graph_type_propagator.cc
+++ b/runtime/vm/flow_graph_type_propagator.cc
@@ -15,7 +15,7 @@
             "Trace flow graph type propagation");
 
 DECLARE_FLAG(bool, propagate_types);
-DECLARE_FLAG(bool, use_cha);
+DECLARE_FLAG(bool, use_cha_deopt);
 
 
 void FlowGraphTypePropagator::Propagate(FlowGraph* flow_graph) {
@@ -538,14 +538,18 @@
     } else if (type_->IsVoidType()) {
       cid_ = kNullCid;
     } else if (type_->HasResolvedTypeClass()) {
-      if (FLAG_use_cha) {
-        const Class& type_class = Class::Handle(type_->type_class());
-        CHA* cha = Thread::Current()->cha();
-        // Don't infer a cid from an abstract type for signature classes since
-        // there can be multiple compatible classes with different cids.
-        if (!type_class.IsSignatureClass() &&
-            !cha->IsImplemented(type_class) &&
-            !cha->HasSubclasses(type_class.id())) {
+      const Class& type_class = Class::Handle(type_->type_class());
+      CHA* cha = Thread::Current()->cha();
+      // Don't infer a cid from an abstract type for signature classes since
+      // there can be multiple compatible classes with different cids.
+      if (!type_class.IsSignatureClass() &&
+          !cha->IsImplemented(type_class) &&
+          !cha->HasSubclasses(type_class)) {
+        if (type_class.IsPrivate()) {
+          // Type of a private class cannot change through later loaded libs.
+          cid_ = type_class.id();
+        } else if (FLAG_use_cha_deopt) {
+          cha->AddToLeafClasses(type_class);
           cid_ = type_class.id();
         } else {
           cid_ = kDynamicCid;
@@ -772,10 +776,20 @@
 
     // Receiver can't be null but can be an instance of a subclass.
     intptr_t cid = kDynamicCid;
-    if (FLAG_use_cha && type.HasResolvedTypeClass()) {
+
+    if (type.HasResolvedTypeClass()) {
+      Thread* thread = Thread::Current();
       const Class& type_class = Class::Handle(type.type_class());
-      if (!Thread::Current()->cha()->HasSubclasses(type_class.id())) {
-        cid = type_class.id();
+      if (!thread->cha()->HasSubclasses(type_class)) {
+        if (type_class.IsPrivate()) {
+          // Private classes can never be subclassed by later loaded libs.
+          cid = type_class.id();
+        } else {
+          if (FLAG_use_cha_deopt) {
+            thread->cha()->AddToLeafClasses(type_class);
+            cid = type_class.id();
+          }
+        }
       }
     }
 
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index bd570f7..c5077d0 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -2950,7 +2950,8 @@
 void InstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
   Zone* zone = compiler->zone();
   const ICData* call_ic_data = NULL;
-  if (!FLAG_propagate_ic_data || !compiler->is_optimizing()) {
+  if (!FLAG_propagate_ic_data || !compiler->is_optimizing() ||
+      (ic_data() == NULL)) {
     const Array& arguments_descriptor =
         Array::Handle(zone, ArgumentsDescriptor::New(ArgumentCount(),
                                                      argument_names()));
@@ -2960,7 +2961,7 @@
   } else {
     call_ic_data = &ICData::ZoneHandle(zone, ic_data()->raw());
   }
-  if (compiler->is_optimizing()) {
+  if (compiler->is_optimizing() && HasICData()) {
     ASSERT(HasICData());
     if (ic_data()->NumberOfUsedChecks() > 0) {
       const ICData& unary_ic_data =
@@ -3066,7 +3067,8 @@
 
 void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
   const ICData* call_ic_data = NULL;
-  if (!FLAG_propagate_ic_data || !compiler->is_optimizing()) {
+  if (!FLAG_propagate_ic_data || !compiler->is_optimizing() ||
+      (ic_data() == NULL)) {
     const Array& arguments_descriptor =
         Array::Handle(ArgumentsDescriptor::New(ArgumentCount(),
                                                argument_names()));
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index 1216a6a..c943680 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -3191,7 +3191,9 @@
     return (*arguments_)[index];
   }
 
-  virtual intptr_t CallCount() const { return ic_data()->AggregateCount(); }
+  virtual intptr_t CallCount() const {
+    return ic_data() == NULL ? 0 : ic_data()->AggregateCount();
+  }
 
   virtual void PrintOperandsTo(BufferFormatter* f) const;
 
@@ -8044,7 +8046,6 @@
         deopt_id_(deopt_id),
         parsed_function_(parsed_function),
         outer_(outer) {
-    ASSERT(!parsed_function_.code().IsNull());
   }
 
 
diff --git a/runtime/vm/intermediate_language_arm.cc b/runtime/vm/intermediate_language_arm.cc
index 2142327..41921f0 100644
--- a/runtime/vm/intermediate_language_arm.cc
+++ b/runtime/vm/intermediate_language_arm.cc
@@ -226,22 +226,19 @@
   __ LoadImmediate(R5, 0);
   __ AddImmediate(R2, Instructions::HeaderSize() - kHeapObjectTag);
   __ blx(R2);
-  compiler->AddCurrentDescriptor(RawPcDescriptors::kClosureCall,
-                                 deopt_id(),
-                                 token_pos());
   compiler->RecordSafepoint(locs());
   // Marks either the continuation point in unoptimized code or the
   // deoptimization point in optimized code, after call.
   const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id());
   if (compiler->is_optimizing()) {
     compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos());
-  } else {
-    // Add deoptimization continuation point after the call and before the
-    // arguments are removed.
-    compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
-                                   deopt_id_after,
-                                   token_pos());
   }
+  // Add deoptimization continuation point after the call and before the
+  // arguments are removed.
+  // In optimized code this descriptor is needed for exception handling.
+  compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
+                                 deopt_id_after,
+                                 token_pos());
   __ Drop(argument_count);
 }
 
diff --git a/runtime/vm/intermediate_language_arm64.cc b/runtime/vm/intermediate_language_arm64.cc
index d6b8718..a260302 100644
--- a/runtime/vm/intermediate_language_arm64.cc
+++ b/runtime/vm/intermediate_language_arm64.cc
@@ -222,22 +222,19 @@
   __ LoadImmediate(R5, 0, PP);
   __ AddImmediate(R2, R2, Instructions::HeaderSize() - kHeapObjectTag, PP);
   __ blr(R2);
-  compiler->AddCurrentDescriptor(RawPcDescriptors::kClosureCall,
-                                 deopt_id(),
-                                 token_pos());
   compiler->RecordSafepoint(locs());
   // Marks either the continuation point in unoptimized code or the
   // deoptimization point in optimized code, after call.
   const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id());
   if (compiler->is_optimizing()) {
     compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos());
-  } else {
-    // Add deoptimization continuation point after the call and before the
-    // arguments are removed.
-    compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
-                                   deopt_id_after,
-                                   token_pos());
   }
+  // Add deoptimization continuation point after the call and before the
+  // arguments are removed.
+  // In optimized code this descriptor is needed for exception handling.
+  compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
+                                 deopt_id_after,
+                                 token_pos());
   __ Drop(argument_count);
 }
 
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index e88e35e..a4c8d41 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -6787,22 +6787,19 @@
   __ xorl(ECX, ECX);
   __ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
   __ call(EBX);
-  compiler->AddCurrentDescriptor(RawPcDescriptors::kClosureCall,
-                                 deopt_id(),
-                                 token_pos());
   compiler->RecordSafepoint(locs());
   // Marks either the continuation point in unoptimized code or the
   // deoptimization point in optimized code, after call.
   const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id());
   if (compiler->is_optimizing()) {
     compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos());
-  } else {
-    // Add deoptimization continuation point after the call and before the
-    // arguments are removed.
-    compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
-                                   deopt_id_after,
-                                   token_pos());
   }
+  // Add deoptimization continuation point after the call and before the
+  // arguments are removed.
+  // In optimized code this descriptor is needed for exception handling.
+  compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
+                                 deopt_id_after,
+                                 token_pos());
   __ Drop(argument_count);
 }
 
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc
index 302c5e1..4e279c5 100644
--- a/runtime/vm/intermediate_language_mips.cc
+++ b/runtime/vm/intermediate_language_mips.cc
@@ -276,22 +276,19 @@
   __ lw(T2, FieldAddress(T0, Function::instructions_offset()));
   __ AddImmediate(T2, Instructions::HeaderSize() - kHeapObjectTag);
   __ jalr(T2);
-  compiler->AddCurrentDescriptor(RawPcDescriptors::kClosureCall,
-                                 deopt_id(),
-                                 token_pos());
   compiler->RecordSafepoint(locs());
   // Marks either the continuation point in unoptimized code or the
   // deoptimization point in optimized code, after call.
   const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id());
   if (compiler->is_optimizing()) {
     compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos());
-  } else {
-    // Add deoptimization continuation point after the call and before the
-    // arguments are removed.
-    compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
-                                   deopt_id_after,
-                                   token_pos());
   }
+  // Add deoptimization continuation point after the call and before the
+  // arguments are removed.
+  // In optimized code this descriptor is needed for exception handling.
+  compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
+                                 deopt_id_after,
+                                 token_pos());
   __ Drop(argument_count);
 }
 
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
index a7bad0a..830df84 100644
--- a/runtime/vm/intermediate_language_x64.cc
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -6364,22 +6364,19 @@
   __ xorq(RBX, RBX);
   __ addq(RCX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
   __ call(RCX);
-  compiler->AddCurrentDescriptor(RawPcDescriptors::kClosureCall,
-                                 deopt_id(),
-                                 token_pos());
   compiler->RecordSafepoint(locs());
   // Marks either the continuation point in unoptimized code or the
   // deoptimization point in optimized code, after call.
   const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id());
   if (compiler->is_optimizing()) {
     compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos());
-  } else {
-    // Add deoptimization continuation point after the call and before the
-    // arguments are removed.
-    compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
-                                   deopt_id_after,
-                                   token_pos());
   }
+  // Add deoptimization continuation point after the call and before the
+  // arguments are removed.
+  // In optimized code this descriptor is needed for exception handling.
+  compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
+                                 deopt_id_after,
+                                 token_pos());
   __ Drop(argument_count);
 }
 
diff --git a/runtime/vm/json_stream.cc b/runtime/vm/json_stream.cc
index efb1290..2470d19 100644
--- a/runtime/vm/json_stream.cc
+++ b/runtime/vm/json_stream.cc
@@ -95,14 +95,12 @@
       return "Invalid params";
     case kInternalError:
       return "Internal error";
+    case kFeatureDisabled:
+      return "Feature is disabled";
     case kVMMustBePaused:
       return "VM must be paused";
-    case kNoBreakAtLine:
-      return "Cannot set breakpoint at line";
-    case kNoBreakAtFunction:
-      return "Cannot set breakpoint at function";
-    case kProfilingDisabled:
-      return "Profiling is disabled";
+    case kCannotAddBreakpoint:
+      return "Cannot add breakpoint";
     default:
       UNIMPLEMENTED();
       return "Unexpected rpc error code";
diff --git a/runtime/vm/json_stream.h b/runtime/vm/json_stream.h
index 5e0bf0c..39bb0ac 100644
--- a/runtime/vm/json_stream.h
+++ b/runtime/vm/json_stream.h
@@ -27,6 +27,7 @@
 class Zone;
 
 
+// Keep this in sync with runtime/observatory/lib/src/service/object.dart.
 enum JSONRpcErrorCode {
   kParseError     = -32700,
   kInvalidRequest = -32600,
@@ -34,11 +35,9 @@
   kInvalidParams  = -32602,
   kInternalError  = -32603,
 
-  kVMMustBePaused    = 100,
-  kNoBreakAtLine     = 101,
-  kNoBreakAtFunction = 102,
-
-  kProfilingDisabled = 200,
+  kFeatureDisabled     = 100,
+  kVMMustBePaused      = 101,
+  kCannotAddBreakpoint = 102,
 };
 
 
diff --git a/runtime/vm/json_test.cc b/runtime/vm/json_test.cc
index d4bdf036..5bce0d39 100644
--- a/runtime/vm/json_test.cc
+++ b/runtime/vm/json_test.cc
@@ -299,10 +299,17 @@
     JSONObject jsobj(&jsarr);
     jsobj.AddProperty("object_key", Object::Handle(Object::null()));
   }
-  EXPECT_STREQ("[{\"type\":\"@null\",\"fixedId\":true,"
+  EXPECT_STREQ("[{\"type\":\"@Instance\","
+               "\"_vmType\":\"null\","
+               "\"kind\":\"Null\","
+               "\"fixedId\":true,"
                "\"id\":\"objects\\/null\","
                "\"valueAsString\":\"null\"},"
-               "{\"object_key\":{\"type\":\"@null\",\"fixedId\":true,"
+               "{\"object_key\":"
+               "{\"type\":\"@Instance\","
+               "\"_vmType\":\"null\","
+               "\"kind\":\"Null\","
+               "\"fixedId\":true,"
                "\"id\":\"objects\\/null\","
                "\"valueAsString\":\"null\"}}]",
                js.ToCString());
diff --git a/runtime/vm/message.cc b/runtime/vm/message.cc
index e5bc7ed..906a16c 100644
--- a/runtime/vm/message.cc
+++ b/runtime/vm/message.cc
@@ -191,15 +191,14 @@
   while (it.HasNext()) {
     Message* current = it.Next();
     JSONObject message(&messages);
-    message.AddProperty("type", "Message");
     message.AddPropertyF("name", "Isolate Message (%" Px ")", current->Id());
     message.AddPropertyF("messageObjectId", "messages/%" Px "",
                          current->Id());
     message.AddProperty("size", current->len());
-    message.AddProperty("depth", depth++);
+    message.AddProperty("index", depth++);
     message.AddProperty("_destinationPort",
         static_cast<intptr_t>(current->dest_port()));
-    message.AddProperty("priority",
+    message.AddProperty("_priority",
         Message::PriorityAsString(current->priority()));
     // TODO(johnmccutchan): Move port -> handler map out of Dart and into the
     // VM, that way we can lookup the handler without invoking Dart code.
diff --git a/runtime/vm/method_recognizer.h b/runtime/vm/method_recognizer.h
index 48c7c42..cc3ef7d 100644
--- a/runtime/vm/method_recognizer.h
+++ b/runtime/vm/method_recognizer.h
@@ -118,35 +118,46 @@
   V(_Int32x4, withFlagY, Int32x4WithFlagY, 1903359978)                         \
   V(_Int32x4, withFlagZ, Int32x4WithFlagZ, 862460960)                          \
   V(_Int32x4, withFlagW, Int32x4WithFlagW, 1095242907)                         \
-  V(_Float32Array, [], Float32ArrayGetIndexed, 275040752)                      \
-  V(_Float32Array, []=, Float32ArraySetIndexed, 157872912)                     \
-  V(_Int8Array, [], Int8ArrayGetIndexed, 1025829142)                           \
-  V(_Int8Array, []=, Int8ArraySetIndexed, 1696011449)                          \
-  V(_Uint8ClampedArray, [], Uint8ClampedArrayGetIndexed, 1787928039)           \
-  V(_Uint8ClampedArray, []=, Uint8ClampedArraySetIndexed, 1339679592)          \
+  V(_Float32Array, [], Float32ArrayGetIndexed, 321832479)                      \
+  V(_Float32Array, []=, Float32ArraySetIndexed, 979306169)                     \
+  V(_Int8Array, [], Int8ArrayGetIndexed, 1390782783)                           \
+  V(_Int8Array, []=, Int8ArraySetIndexed, 1774152196)                          \
+  V(_Uint8ClampedArray, [], Uint8ClampedArrayGetIndexed, 1297457028)           \
+  V(_Uint8ClampedArray, []=, Uint8ClampedArraySetIndexed, 2018722539)          \
   V(_ExternalUint8ClampedArray, [],                                            \
-      ExternalUint8ClampedArrayGetIndexed, 114948407)                          \
+      ExternalUint8ClampedArrayGetIndexed, 1871828532)                         \
   V(_ExternalUint8ClampedArray, []=,                                           \
-      ExternalUint8ClampedArraySetIndexed, 1455109614)                         \
-  V(_Int16Array, [], Int16ArrayGetIndexed, 747531885)                          \
-  V(_Int16Array, []=, Int16ArraySetIndexed, 1537264797)                        \
-  V(_Uint16Array, [], Uint16ArrayGetIndexed, 1977340041)                       \
-  V(_Uint16Array, []=, Uint16ArraySetIndexed, 1199796786)                      \
-  V(_Int32Array, [], Int32ArrayGetIndexed, 445698866)                          \
-  V(_Int32Array, []=, Int32ArraySetIndexed, 1911096077)                        \
-  V(_Uint32Array, [], Uint32ArrayGetIndexed, 2138962134)                       \
-  V(_Uint32Array, []=, Uint32ArraySetIndexed, 1903916835)                      \
-  V(_Int64Array, [], Int64ArrayGetIndexed, 1010752424)                         \
-  V(_Int64Array, []=, Int64ArraySetIndexed, 1007378595)                        \
-  V(_Float32x4Array, [], Float32x4ArrayGetIndexed, 31307067)                   \
-  V(_Float32x4Array, []=, Float32x4ArraySetIndexed, 525088372)                 \
-  V(_Int32x4Array, [], Int32x4ArrayGetIndexed, 2007476980)                     \
-  V(_Int32x4Array, []=, Int32x4ArraySetIndexed, 431354302)                     \
-  V(_Float64x2Array, [], Float64x2ArrayGetIndexed, 1295393472)                 \
-  V(_Float64x2Array, []=, Float64x2ArraySetIndexed, 808434270)                 \
+      ExternalUint8ClampedArraySetIndexed, 1746834469)                         \
+  V(_Int16Array, [], Int16ArrayGetIndexed, 1699340532)                         \
+  V(_Int16Array, []=, Int16ArraySetIndexed, 799870496)                         \
+  V(_Uint16Array, [], Uint16ArrayGetIndexed, 452576118)                        \
+  V(_Uint16Array, []=, Uint16ArraySetIndexed, 1594961463)                      \
+  V(_Int32Array, [], Int32ArrayGetIndexed, 2052925823)                         \
+  V(_Int32Array, []=, Int32ArraySetIndexed, 504626978)                         \
+  V(_Uint32Array, [], Uint32ArrayGetIndexed, 1034114777)                       \
+  V(_Uint32Array, []=, Uint32ArraySetIndexed, 918159348)                       \
+  V(_Int64Array, [], Int64ArrayGetIndexed, 297668331)                          \
+  V(_Int64Array, []=, Int64ArraySetIndexed, 36465128)                          \
+  V(_Float32x4Array, [], Float32x4ArrayGetIndexed, 35821240)                   \
+  V(_Float32x4Array, []=, Float32x4ArraySetIndexed, 428758949)                 \
+  V(_Int32x4Array, [], Int32x4ArrayGetIndexed, 1830534333)                     \
+  V(_Int32x4Array, []=, Int32x4ArraySetIndexed, 1631676655)                    \
+  V(_Float64x2Array, [], Float64x2ArrayGetIndexed, 1860837505)                 \
+  V(_Float64x2Array, []=, Float64x2ArraySetIndexed, 821269609)                 \
   V(_Bigint, get:_neg, Bigint_getNeg, 1151633263)                              \
   V(_Bigint, get:_used, Bigint_getUsed, 1308648707)                            \
   V(_Bigint, get:_digits, Bigint_getDigits, 1408181836)                        \
+  V(_HashVMBase, get:_index, LinkedHashMap_getIndex, 1431607529)               \
+  V(_HashVMBase, set:_index, LinkedHashMap_setIndex, 2007926178)               \
+  V(_HashVMBase, get:_data, LinkedHashMap_getData, 958070909)                  \
+  V(_HashVMBase, set:_data, LinkedHashMap_setData, 1134236592)                 \
+  V(_HashVMBase, get:_usedData, LinkedHashMap_getUsedData, 421669312)          \
+  V(_HashVMBase, set:_usedData, LinkedHashMap_setUsedData, 1152062737)         \
+  V(_HashVMBase, get:_hashMask, LinkedHashMap_getHashMask, 969476186)          \
+  V(_HashVMBase, set:_hashMask, LinkedHashMap_setHashMask, 1781420082)         \
+  V(_HashVMBase, get:_deletedKeys, LinkedHashMap_getDeletedKeys, 63633039)     \
+  V(_HashVMBase, set:_deletedKeys, LinkedHashMap_setDeletedKeys, 2079107858)   \
+
 
 // List of intrinsics:
 // (class-name, function-name, intrinsification method, fingerprint).
@@ -266,12 +277,12 @@
   V(_Float64x2Array, ., TypedData_Float64x2Array_factory, 1699696799)          \
 
 #define GRAPH_TYPED_DATA_INTRINSICS_LIST(V) \
-  V(_Uint8Array, [], Uint8ArrayGetIndexed, 1821875314)                         \
-  V(_Uint8Array, []=, Uint8ArraySetIndexed, 914362419)                         \
-  V(_ExternalUint8Array, [], ExternalUint8ArrayGetIndexed, 1824504903)         \
-  V(_ExternalUint8Array, []=, ExternalUint8ArraySetIndexed, 1186933547)        \
-  V(_Float64Array, []=, Float64ArraySetIndexed, 931916848)                     \
-  V(_Float64Array, [], Float64ArrayGetIndexed, 70640323)                       \
+  V(_Uint8Array, [], Uint8ArrayGetIndexed, 579862489)                          \
+  V(_Uint8Array, []=, Uint8ArraySetIndexed, 447309008)                         \
+  V(_ExternalUint8Array, [], ExternalUint8ArrayGetIndexed, 1293647140)         \
+  V(_ExternalUint8Array, []=, ExternalUint8ArraySetIndexed, 1593599192)        \
+  V(_Float64Array, []=, Float64ArraySetIndexed, 887301703)                     \
+  V(_Float64Array, [], Float64ArrayGetIndexed, 1959896670)                     \
   V(_TypedList, get:length, TypedDataLength, 522684521)                        \
 
 #define GRAPH_CORE_INTRINSICS_LIST(V)                                          \
@@ -338,48 +349,48 @@
   V(_ImmutableList, [], ImmutableArrayGetIndexed, 886511484)                   \
   V(_GrowableList, [], GrowableArrayGetIndexed, 1962926024)                    \
   V(_GrowableList, []=, GrowableArraySetIndexed, 457344024)                    \
-  V(_Float32Array, [], Float32ArrayGetIndexed, 275040752)                      \
-  V(_Float32Array, []=, Float32ArraySetIndexed, 157872912)                     \
-  V(_Float64Array, [], Float64ArrayGetIndexed, 70640323)                       \
-  V(_Float64Array, []=, Float64ArraySetIndexed, 931916848)                     \
-  V(_Int8Array, [], Int8ArrayGetIndexed, 1025829142)                           \
-  V(_Int8Array, []=, Int8ArraySetIndexed, 1696011449)                          \
-  V(_Uint8Array, [], Uint8ArrayGetIndexed, 1821875314)                         \
-  V(_Uint8Array, []=, Uint8ArraySetIndexed, 914362419)                         \
-  V(_Uint8ClampedArray, [], Uint8ClampedArrayGetIndexed, 1787928039)           \
-  V(_Uint8ClampedArray, []=, Uint8ClampedArraySetIndexed, 1339679592)          \
-  V(_Uint16Array, [], Uint16ArrayGetIndexed, 1977340041)                       \
-  V(_Uint16Array, []=, Uint16ArraySetIndexed, 1199796786)                      \
-  V(_Int16Array, [], Int16ArrayGetIndexed, 747531885)                          \
-  V(_Int16Array, []=, Int16ArraySetIndexed, 1537264797)                        \
-  V(_Int32Array, [], Int32ArrayGetIndexed, 445698866)                          \
-  V(_Int32Array, []=, Int32ArraySetIndexed, 1911096077)                        \
-  V(_Int64Array, [], Int64ArrayGetIndexed, 1010752424)                         \
-  V(_Int64Array, []=, Int64ArraySetIndexed, 1007378595)                        \
-  V(_Uint8ArrayView, [], Uint8ArrayViewGetIndexed, 1590194821)                 \
-  V(_Uint8ArrayView, []=, Uint8ArrayViewSetIndexed, 1468172313)                \
-  V(_Int8ArrayView, [], Int8ArrayViewGetIndexed, 1822801478)                   \
-  V(_Int8ArrayView, []=, Int8ArrayViewSetIndexed, 1125233200)                  \
-  V(_ByteDataView, setInt8, ByteDataViewSetInt8, 1157522735)                   \
-  V(_ByteDataView, setUint8, ByteDataViewSetUint8, 553855676)                  \
-  V(_ByteDataView, setInt16, ByteDataViewSetInt16, 2093298369)                 \
-  V(_ByteDataView, setUint16, ByteDataViewSetUint16, 74482884)                 \
-  V(_ByteDataView, setInt32, ByteDataViewSetInt32, 911540082)                  \
-  V(_ByteDataView, setUint32, ByteDataViewSetUint32, 1388215959)               \
-  V(_ByteDataView, setInt64, ByteDataViewSetInt64, 1590727231)                 \
-  V(_ByteDataView, setUint64, ByteDataViewSetUint64, 388990242)                \
-  V(_ByteDataView, setFloat32, ByteDataViewSetFloat32, 1599158058)             \
-  V(_ByteDataView, setFloat64, ByteDataViewSetFloat64, 586864117)              \
-  V(_ByteDataView, getInt8, ByteDataViewGetInt8, 1627121016)                   \
-  V(_ByteDataView, getUint8, ByteDataViewGetUint8, 1050030150)                 \
-  V(_ByteDataView, getInt16, ByteDataViewGetInt16, 891399987)                  \
-  V(_ByteDataView, getUint16, ByteDataViewGetUint16, 206709785)                \
-  V(_ByteDataView, getInt32, ByteDataViewGetInt32, 1680668347)                 \
-  V(_ByteDataView, getUint32, ByteDataViewGetUint32, 1978213659)               \
-  V(_ByteDataView, getInt64, ByteDataViewGetInt64, 1179480395)                 \
-  V(_ByteDataView, getUint64, ByteDataViewGetUint64, 1783456139)               \
-  V(_ByteDataView, getFloat32, ByteDataViewGetFloat32, 354362094)              \
-  V(_ByteDataView, getFloat64, ByteDataViewGetFloat64, 687470816)              \
+  V(_Float32Array, [], Float32ArrayGetIndexed, 321832479)                      \
+  V(_Float32Array, []=, Float32ArraySetIndexed, 979306169)                     \
+  V(_Float64Array, [], Float64ArrayGetIndexed, 1959896670)                     \
+  V(_Float64Array, []=, Float64ArraySetIndexed, 887301703)                     \
+  V(_Int8Array, [], Int8ArrayGetIndexed, 1390782783)                           \
+  V(_Int8Array, []=, Int8ArraySetIndexed, 1774152196)                          \
+  V(_Uint8Array, [], Uint8ArrayGetIndexed, 579862489)                          \
+  V(_Uint8Array, []=, Uint8ArraySetIndexed, 447309008)                         \
+  V(_Uint8ClampedArray, [], Uint8ClampedArrayGetIndexed, 1297457028)           \
+  V(_Uint8ClampedArray, []=, Uint8ClampedArraySetIndexed, 2018722539)          \
+  V(_Uint16Array, [], Uint16ArrayGetIndexed, 452576118)                        \
+  V(_Uint16Array, []=, Uint16ArraySetIndexed, 1594961463)                      \
+  V(_Int16Array, [], Int16ArrayGetIndexed, 1699340532)                         \
+  V(_Int16Array, []=, Int16ArraySetIndexed, 799870496)                         \
+  V(_Int32Array, [], Int32ArrayGetIndexed, 2052925823)                         \
+  V(_Int32Array, []=, Int32ArraySetIndexed, 504626978)                         \
+  V(_Int64Array, [], Int64ArrayGetIndexed, 297668331)                          \
+  V(_Int64Array, []=, Int64ArraySetIndexed, 36465128)                          \
+  V(_Uint8ArrayView, [], Uint8ArrayViewGetIndexed, 662241408)                  \
+  V(_Uint8ArrayView, []=, Uint8ArrayViewSetIndexed, 1550171024)                \
+  V(_Int8ArrayView, [], Int8ArrayViewGetIndexed, 875752635)                    \
+  V(_Int8ArrayView, []=, Int8ArrayViewSetIndexed, 689961281)                   \
+  V(_ByteDataView, setInt8, ByteDataViewSetInt8, 1039277590)                   \
+  V(_ByteDataView, setUint8, ByteDataViewSetUint8, 497316431)                  \
+  V(_ByteDataView, setInt16, ByteDataViewSetInt16, 27520778)                   \
+  V(_ByteDataView, setUint16, ByteDataViewSetUint16, 1543151983)               \
+  V(_ByteDataView, setInt32, ByteDataViewSetInt32, 535913934)                  \
+  V(_ByteDataView, setUint32, ByteDataViewSetUint32, 596009393)                \
+  V(_ByteDataView, setInt64, ByteDataViewSetInt64, 787812783)                  \
+  V(_ByteDataView, setUint64, ByteDataViewSetUint64, 1078002910)               \
+  V(_ByteDataView, setFloat32, ByteDataViewSetFloat32, 2098528020)             \
+  V(_ByteDataView, setFloat64, ByteDataViewSetFloat64, 659619201)              \
+  V(_ByteDataView, getInt8, ByteDataViewGetInt8, 2117136369)                   \
+  V(_ByteDataView, getUint8, ByteDataViewGetUint8, 298860761)                  \
+  V(_ByteDataView, getInt16, ByteDataViewGetInt16, 975961124)                  \
+  V(_ByteDataView, getUint16, ByteDataViewGetUint16, 1503060990)               \
+  V(_ByteDataView, getInt32, ByteDataViewGetInt32, 1096620023)                 \
+  V(_ByteDataView, getUint32, ByteDataViewGetUint32, 1698446167)               \
+  V(_ByteDataView, getInt64, ByteDataViewGetInt64, 1950535797)                 \
+  V(_ByteDataView, getUint64, ByteDataViewGetUint64, 786884343)                \
+  V(_ByteDataView, getFloat32, ByteDataViewGetFloat32, 889064264)              \
+  V(_ByteDataView, getFloat64, ByteDataViewGetFloat64, 1577605354)             \
   V(::, asin, MathASin, 1651042633)                                            \
   V(::, acos, MathACos, 1139647090)                                            \
   V(::, atan, MathATan, 1668754384)                                            \
@@ -397,6 +408,17 @@
   V(_Bigint, get:_neg, Bigint_getNeg, 1151633263)                              \
   V(_Bigint, get:_used, Bigint_getUsed, 1308648707)                            \
   V(_Bigint, get:_digits, Bigint_getDigits, 1408181836)                        \
+  V(_HashVMBase, get:_index, LinkedHashMap_getIndex, 1431607529)               \
+  V(_HashVMBase, set:_index, LinkedHashMap_setIndex, 2007926178)               \
+  V(_HashVMBase, get:_data, LinkedHashMap_getData, 958070909)                  \
+  V(_HashVMBase, set:_data, LinkedHashMap_setData, 1134236592)                 \
+  V(_HashVMBase, get:_usedData, LinkedHashMap_getUsedData, 421669312)          \
+  V(_HashVMBase, set:_usedData, LinkedHashMap_setUsedData, 1152062737)         \
+  V(_HashVMBase, get:_hashMask, LinkedHashMap_getHashMask, 969476186)          \
+  V(_HashVMBase, set:_hashMask, LinkedHashMap_setHashMask, 1781420082)         \
+  V(_HashVMBase, get:_deletedKeys, LinkedHashMap_getDeletedKeys, 63633039)     \
+  V(_HashVMBase, set:_deletedKeys, LinkedHashMap_setDeletedKeys, 2079107858)   \
+
 
 // A list of core function that should never be inlined.
 #define INLINE_BLACK_LIST(V)                                                   \
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 674a65a..2896d72 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -965,10 +965,11 @@
   cls = Class::New<Array>();
   object_store->set_array_class(cls);
 
-  // Array and ImmutableArray are the only VM classes that are parameterized.
-  // Since they are pre-finalized, CalculateFieldOffsets() is not called, so we
-  // need to set the offset of their type_arguments_ field, which is explicitly
-  // declared in RawArray.
+  // VM classes that are parameterized (Array, ImmutableArray,
+  // GrowableObjectArray, and LinkedHashMap) are also pre-finalized,
+  // so CalculateFieldOffsets() is not called, so we need to set the
+  // offset of their type_arguments_ field, which is explicitly
+  // declared in their respective Raw* classes.
   cls.set_type_arguments_field_offset(Array::type_arguments_offset());
   cls.set_num_type_arguments(1);
 
@@ -1225,7 +1226,6 @@
   }
   ASSERT(!lib.IsNull());
   ASSERT(lib.raw() == Library::CollectionLibrary());
-
   cls = Class::New<LinkedHashMap>();
   object_store->set_linked_hash_map_class(cls);
   cls.set_type_arguments_field_offset(LinkedHashMap::type_arguments_offset());
@@ -1593,14 +1593,11 @@
   bool same_type = (strcmp(user_type, vm_type) == 0);
   if (ref) {
     jsobj->AddPropertyF("type", "@%s", user_type);
-    if (!same_type) {
-      jsobj->AddPropertyF("_vmType", "@%s", vm_type);
-    }
   } else {
     jsobj->AddProperty("type", user_type);
-    if (!same_type) {
-      jsobj->AddProperty("_vmType", vm_type);
-    }
+  }
+  if (!same_type) {
+    jsobj->AddProperty("_vmType", vm_type);
   }
 }
 
@@ -1608,7 +1605,8 @@
 void Object::PrintJSON(JSONStream* stream, bool ref) const {
   if (IsNull()) {
     JSONObject jsobj(stream);
-    AddTypeProperties(&jsobj, "null", JSONType(), ref);
+    AddTypeProperties(&jsobj, "Instance", JSONType(), ref);
+    jsobj.AddProperty("kind", "Null");
     jsobj.AddFixedServiceId("objects/null");
     jsobj.AddProperty("valueAsString", "null");
     if (!ref) {
@@ -3791,6 +3789,11 @@
 }
 
 
+bool Class::IsPrivate() const {
+  return Library::IsPrivate(String::Handle(Name()));
+}
+
+
 RawFunction* Class::LookupDynamicFunction(const String& name) const {
   return LookupFunction(name, kInstance);
 }
@@ -4126,11 +4129,11 @@
   if (!err.IsNull()) {
     jsobj.AddProperty("error", err);
   }
-  jsobj.AddProperty("implemented", is_implemented());
   jsobj.AddProperty("abstract", is_abstract());
-  jsobj.AddProperty("patch", is_patch());
-  jsobj.AddProperty("finalized", is_finalized());
   jsobj.AddProperty("const", is_const());
+  jsobj.AddProperty("_finalized", is_finalized());
+  jsobj.AddProperty("_implemented", is_implemented());
+  jsobj.AddProperty("_patch", is_patch());
   const Class& superClass = Class::Handle(SuperClass());
   if (!superClass.IsNull()) {
     jsobj.AddProperty("super", superClass);
@@ -4193,7 +4196,7 @@
     ClassTable* class_table = Isolate::Current()->class_table();
     const ClassHeapStats* stats = class_table->StatsWithUpdatedSize(id());
     if (stats != NULL) {
-      JSONObject allocation_stats(&jsobj, "allocationStats");
+      JSONObject allocation_stats(&jsobj, "_allocationStats");
       stats->PrintToJSONObject(*this, &allocation_stats);
     }
   }
@@ -6722,7 +6725,7 @@
     ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data) const {
   Zone* zone = Thread::Current()->zone();
   const Array& saved_icd = Array::Handle(zone, ic_data_array());
-  if (saved_icd.Length() == 0) {
+  if (saved_icd.IsNull() || (saved_icd.Length() == 0)) {
     deopt_id_to_ic_data->Clear();
     return;
   }
@@ -6750,11 +6753,24 @@
   return raw_ptr()->ic_data_array_;
 }
 
-void Function::ClearICData() const {
+void Function::ClearICDataArray() const {
   set_ic_data_array(Array::Handle());
 }
 
 
+void Function::SetDeoptReasonForAll(intptr_t deopt_id,
+                                    ICData::DeoptReasonId reason) {
+  const Array& icd_array = Array::Handle(ic_data_array());
+  ICData& icd = ICData::Handle();
+  for (intptr_t i = 0; i < icd_array.Length(); i++) {
+    icd ^= icd_array.At(i);
+    if (icd.deopt_id() == deopt_id) {
+      icd.AddDeoptReason(reason);
+    }
+  }
+}
+
+
 bool Function::CheckSourceFingerprint(const char* prefix, int32_t fp) const {
   if (SourceFingerprint() != fp) {
     const bool recalculatingFingerprints = false;
@@ -6891,12 +6907,12 @@
   }
 
   const char* kind_string = Function::KindToCString(kind());
-  jsobj.AddProperty("kind", kind_string);
+  jsobj.AddProperty("_kind", kind_string);
+  jsobj.AddProperty("static", is_static());
+  jsobj.AddProperty("const", is_const());
   if (ref) {
     return;
   }
-  jsobj.AddProperty("static", is_static());
-  jsobj.AddProperty("const", is_const());
   Code& code = Code::Handle(CurrentCode());
   if (!code.IsNull()) {
     jsobj.AddProperty("code", code);
@@ -7230,11 +7246,6 @@
   const String& user_name = String::Handle(PrettyName());
   const String& vm_name = String::Handle(name());
   AddNameProperties(&jsobj, user_name, vm_name);
-  if (is_static()) {
-    const Instance& valueObj = Instance::Handle(value());
-    jsobj.AddProperty("value", valueObj);
-  }
-
   if (cls.IsTopLevel()) {
     const Library& library = Library::Handle(cls.library());
     jsobj.AddProperty("owner", library);
@@ -7250,6 +7261,11 @@
   if (ref) {
     return;
   }
+  if (is_static()) {
+    const Instance& valueObj = Instance::Handle(value());
+    jsobj.AddProperty("staticValue", valueObj);
+  }
+
   jsobj.AddProperty("_guardNullable", is_nullable());
   if (guarded_cid() == kIllegalCid) {
     jsobj.AddProperty("_guardClass", "unknown");
@@ -9903,6 +9919,7 @@
   if (ref) {
     return;
   }
+  jsobj.AddProperty("debuggable", IsDebuggable());
   {
     JSONArray jsarr(&jsobj, "classes");
     ClassDictionaryIterator class_iter(*this);
@@ -9916,11 +9933,65 @@
     }
   }
   {
-    JSONArray jsarr(&jsobj, "imports");
-    Library& lib = Library::Handle();
-    for (intptr_t i = 0; i < num_imports(); i++) {
-      lib = ImportLibraryAt(i);
-      jsarr.AddValue(lib);
+    JSONArray jsarr(&jsobj, "dependencies");
+
+    Array& ports = Array::Handle();
+    Namespace& ns = Namespace::Handle();
+    Library& target = Library::Handle();
+
+    // Unprefixed imports.
+    ports = imports();
+    for (intptr_t i = 0; i < ports.Length(); i++) {
+      ns ^= ports.At(i);
+      if (ns.IsNull()) continue;
+
+      JSONObject jsdep(&jsarr);
+      jsdep.AddProperty("isDeferred", false);
+      jsdep.AddProperty("isExport", false);
+      jsdep.AddProperty("isImport", true);
+      target = ns.library();
+      jsdep.AddProperty("target", target);
+    }
+
+    // Exports.
+    ports = exports();
+    for (intptr_t i = 0; i < ports.Length(); i++) {
+      ns ^= ports.At(i);
+      if (ns.IsNull()) continue;
+
+      JSONObject jsdep(&jsarr);
+      jsdep.AddProperty("isDeferred", false);
+      jsdep.AddProperty("isExport", true);
+      jsdep.AddProperty("isImport", false);
+      target = ns.library();
+      jsdep.AddProperty("target", target);
+    }
+
+    // Prefixed imports.
+    DictionaryIterator entries(*this);
+    Object& entry = Object::Handle();
+    LibraryPrefix& prefix = LibraryPrefix::Handle();
+    String& prefixName = String::Handle();
+    while (entries.HasNext()) {
+      entry = entries.GetNext();
+      if (entry.IsLibraryPrefix()) {
+        prefix ^= entry.raw();
+        ports = prefix.imports();
+        for (intptr_t i = 0; i < ports.Length(); i++) {
+          ns ^= ports.At(i);
+          if (ns.IsNull()) continue;
+
+          JSONObject jsdep(&jsarr);
+          jsdep.AddProperty("isDeferred", prefix.is_deferred_load());
+          jsdep.AddProperty("isExport", false);
+          jsdep.AddProperty("isImport", true);
+          prefixName = prefix.name();
+          ASSERT(!prefixName.IsNull());
+          jsdep.AddProperty("prefix", prefixName.ToCString());
+          target = ns.library();
+          jsdep.AddProperty("target", target);
+        }
+      }
     }
   }
   {
@@ -10482,6 +10553,7 @@
 
   all_libs.Add(&Library::ZoneHandle(Library::MathLibrary()));
   all_libs.Add(&Library::ZoneHandle(Library::TypedDataLibrary()));
+  all_libs.Add(&Library::ZoneHandle(Library::CollectionLibrary()));
   OTHER_RECOGNIZED_LIST(CHECK_FINGERPRINTS);
   INLINE_WHITE_LIST(CHECK_FINGERPRINTS);
   INLINE_BLACK_LIST(CHECK_FINGERPRINTS);
@@ -10637,9 +10709,7 @@
   switch (kind) {
     case RawPcDescriptors::kDeopt:           return "deopt        ";
     case RawPcDescriptors::kIcCall:          return "ic-call      ";
-    case RawPcDescriptors::kOptStaticCall:   return "opt-call     ";
     case RawPcDescriptors::kUnoptStaticCall: return "unopt-call   ";
-    case RawPcDescriptors::kClosureCall:     return "closure-call ";
     case RawPcDescriptors::kRuntimeCall:     return "runtime-call ";
     case RawPcDescriptors::kOsrEntry:        return "osr-entry    ";
     case RawPcDescriptors::kOther:           return "other        ";
@@ -14094,6 +14164,7 @@
 
 void Instance::PrintSharedInstanceJSON(JSONObject* jsobj,
                                        bool ref) const {
+  AddTypeProperties(jsobj, "Instance", JSONType(), ref);
   Class& cls = Class::Handle(this->clazz());
   jsobj->AddProperty("class", cls);
   // TODO(turnidge): Provide the type arguments here too.
@@ -14130,7 +14201,7 @@
   }
 
   if (NumNativeFields() > 0) {
-    JSONArray jsarr(jsobj, "nativeFields");
+    JSONArray jsarr(jsobj, "_nativeFields");
     for (intptr_t i = 0; i < NumNativeFields(); i++) {
       intptr_t value = GetNativeField(i);
       JSONObject jsfield(&jsarr);
@@ -14147,22 +14218,28 @@
   // Handle certain special instance values.
   if (raw() == Object::sentinel().raw()) {
     jsobj.AddProperty("type", "Sentinel");
-    jsobj.AddFixedServiceId("objects/not-initialized");
+    jsobj.AddProperty("kind", "NotInitialized");
     jsobj.AddProperty("valueAsString", "<not initialized>");
     return;
   } else if (raw() == Object::transition_sentinel().raw()) {
     jsobj.AddProperty("type", "Sentinel");
-    jsobj.AddFixedServiceId("objects/being-initialized");
+    jsobj.AddProperty("kind", "BeingInitialized");
     jsobj.AddProperty("valueAsString", "<being initialized>");
     return;
   }
 
-  AddTypeProperties(&jsobj, "Instance", JSONType(), ref);
   PrintSharedInstanceJSON(&jsobj, ref);
+  if (IsClosure()) {
+    jsobj.AddProperty("kind", "Closure");
+  } else {
+    jsobj.AddProperty("kind", "PlainInstance");
+  }
   jsobj.AddServiceId(*this);
   if (IsClosure()) {
-    jsobj.AddProperty("function", Function::Handle(Closure::function(*this)));
-    jsobj.AddProperty("context", Context::Handle(Closure::context(*this)));
+    jsobj.AddProperty("closureFunction",
+                      Function::Handle(Closure::function(*this)));
+    jsobj.AddProperty("closureContext",
+                      Context::Handle(Closure::context(*this)));
   }
   if (ref) {
     return;
@@ -15255,8 +15332,8 @@
 
 void Type::PrintJSONImpl(JSONStream* stream, bool ref) const {
   JSONObject jsobj(stream);
-  AddTypeProperties(&jsobj, "Type", JSONType(), ref);
   PrintSharedInstanceJSON(&jsobj, ref);
+  jsobj.AddProperty("kind", "Type");
   if (IsCanonical()) {
     const Class& type_cls = Class::Handle(type_class());
     intptr_t id = type_cls.FindCanonicalTypeIndex(*this);
@@ -15446,8 +15523,8 @@
 
 void TypeRef::PrintJSONImpl(JSONStream* stream, bool ref) const {
   JSONObject jsobj(stream);
-  AddTypeProperties(&jsobj, "TypeRef", JSONType(), ref);
   PrintSharedInstanceJSON(&jsobj, ref);
+  jsobj.AddProperty("kind", "TypeRef");
   jsobj.AddServiceId(*this);
   const String& user_name = String::Handle(PrettyName());
   const String& vm_name = String::Handle(Name());
@@ -15455,7 +15532,7 @@
   if (ref) {
     return;
   }
-  jsobj.AddProperty("refType", AbstractType::Handle(type()));
+  jsobj.AddProperty("type", AbstractType::Handle(type()));
 }
 
 
@@ -15680,8 +15757,8 @@
 
 void TypeParameter::PrintJSONImpl(JSONStream* stream, bool ref) const {
   JSONObject jsobj(stream);
-  AddTypeProperties(&jsobj, "TypeParameter", JSONType(), ref);
   PrintSharedInstanceJSON(&jsobj, ref);
+  jsobj.AddProperty("kind", "TypeParameter");
   jsobj.AddServiceId(*this);
   const String& user_name = String::Handle(PrettyName());
   const String& vm_name = String::Handle(Name());
@@ -15691,9 +15768,9 @@
   if (ref) {
     return;
   }
-  jsobj.AddProperty("index", index());
+  jsobj.AddProperty("parameterIndex", index());
   const AbstractType& upper_bound = AbstractType::Handle(bound());
-  jsobj.AddProperty("upperBound", upper_bound);
+  jsobj.AddProperty("bound", upper_bound);
 }
 
 
@@ -15896,8 +15973,8 @@
 
 void BoundedType::PrintJSONImpl(JSONStream* stream, bool ref) const {
   JSONObject jsobj(stream);
-  AddTypeProperties(&jsobj, "BoundedType", JSONType(), ref);
   PrintSharedInstanceJSON(&jsobj, ref);
+  jsobj.AddProperty("kind", "BoundedType");
   jsobj.AddServiceId(*this);
   const String& user_name = String::Handle(PrettyName());
   const String& vm_name = String::Handle(Name());
@@ -15905,8 +15982,8 @@
   if (ref) {
     return;
   }
-  jsobj.AddProperty("boundedType", AbstractType::Handle(type()));
-  jsobj.AddProperty("upperBound", AbstractType::Handle(bound()));
+  jsobj.AddProperty("type", AbstractType::Handle(type()));
+  jsobj.AddProperty("bound", AbstractType::Handle(bound()));
 }
 
 
@@ -15999,8 +16076,8 @@
 
 void Integer::PrintJSONImpl(JSONStream* stream, bool ref) const {
   JSONObject jsobj(stream);
-  AddTypeProperties(&jsobj, "int", JSONType(), ref);
   PrintSharedInstanceJSON(&jsobj, ref);
+  jsobj.AddProperty("kind", "Int");
   jsobj.AddServiceId(*this);
   jsobj.AddProperty("valueAsString", ToCString());
 }
@@ -16428,8 +16505,8 @@
 
 void Smi::PrintJSONImpl(JSONStream* stream, bool ref) const {
   JSONObject jsobj(stream);
-  AddTypeProperties(&jsobj, "int", JSONType(), ref);
   PrintSharedInstanceJSON(&jsobj, ref);
+  jsobj.AddProperty("kind", "Int");
   jsobj.AddFixedServiceId("objects/int-%" Pd "", Value());
   jsobj.AddPropertyF("valueAsString", "%" Pd "", Value());
 }
@@ -16690,10 +16767,8 @@
 
 void Double::PrintJSONImpl(JSONStream* stream, bool ref) const {
   JSONObject jsobj(stream);
-  // Suppress the fact that the internal vm name for this type is
-  // "Double".  Return "double" instead.
-  AddTypeProperties(&jsobj, "double", "double", ref);
   PrintSharedInstanceJSON(&jsobj, ref);
+  jsobj.AddProperty("kind", "Double");
   jsobj.AddServiceId(*this);
   jsobj.AddProperty("valueAsString", ToCString());
 }
@@ -18268,12 +18343,12 @@
     // special string in their program.  Fixing this involves updating
     // the debugging api a bit.
     jsobj.AddProperty("type", "Sentinel");
-    jsobj.AddFixedServiceId("objects/optimized-out");
+    jsobj.AddProperty("kind", "OptimizedOut");
     jsobj.AddProperty("valueAsString", "<optimized out>");
     return;
   }
-  AddTypeProperties(&jsobj, "String", JSONType(), ref);
   PrintSharedInstanceJSON(&jsobj, ref);
+  jsobj.AddProperty("kind", "String");
   jsobj.AddServiceId(*this);
   if (ref) {
     bool did_truncate = jsobj.AddPropertyStr("valueAsString", *this, 128);
@@ -19181,10 +19256,8 @@
 void Bool::PrintJSONImpl(JSONStream* stream, bool ref) const {
   const char* str = ToCString();
   JSONObject jsobj(stream);
-  // Suppress the fact that the internal vm name for this type is
-  // "Bool".  Return "bool" instead.
-  AddTypeProperties(&jsobj, "bool", "bool", ref);
   PrintSharedInstanceJSON(&jsobj, ref);
+  jsobj.AddProperty("kind", "Bool");
   jsobj.AddFixedServiceId("objects/bool-%s", str);
   jsobj.AddPropertyF("valueAsString", "%s", str);
 }
@@ -19295,8 +19368,8 @@
 
 void Array::PrintJSONImpl(JSONStream* stream, bool ref) const {
   JSONObject jsobj(stream);
-  AddTypeProperties(&jsobj, "List", JSONType(), ref);
   PrintSharedInstanceJSON(&jsobj, ref);
+  jsobj.AddProperty("kind", "List");
   jsobj.AddServiceId(*this);
   jsobj.AddProperty("length", Length());
   if (ref) {
@@ -19541,8 +19614,8 @@
 void GrowableObjectArray::PrintJSONImpl(JSONStream* stream,
                                         bool ref) const {
   JSONObject jsobj(stream);
-  AddTypeProperties(&jsobj, "List", JSONType(), ref);
   PrintSharedInstanceJSON(&jsobj, ref);
+  jsobj.AddProperty("kind", "List");
   jsobj.AddServiceId(*this);
   jsobj.AddProperty("length", Length());
   if (ref) {
@@ -19595,103 +19668,45 @@
 typedef EnumIndexHashMap<DefaultHashTraits> EnumIndexDefaultMap;
 
 
-intptr_t LinkedHashMap::Length() const {
-  EnumIndexDefaultMap map(data());
-  intptr_t result = map.NumOccupied();
-  ASSERT(map.Release().raw() == data());
-  return result;
+RawLinkedHashMap* LinkedHashMap::NewDefault(Heap::Space space) {
+  // Keep this in sync with Dart implementation (lib/compact_hash.dart).
+  static const intptr_t kInitialIndexBits = 3;
+  static const intptr_t kInitialIndexSize = 1 << (kInitialIndexBits + 1);
+  const Array& data = Array::Handle(Array::New(kInitialIndexSize, space));
+  const TypedData& index = TypedData::Handle(TypedData::New(
+      kTypedDataUint32ArrayCid, kInitialIndexSize, space));
+  static const intptr_t kInitialHashMask =
+#if defined(ARCH_IS_64_BIT)
+      (1 << (32 - kInitialIndexBits)) - 1;
+#else
+      (1 << (30 - kInitialIndexBits)) - 1;
+#endif
+  return LinkedHashMap::New(data, index, kInitialHashMask, 0, 0, space);
 }
 
 
-void LinkedHashMap::InsertOrUpdate(const Object& key,
-                                     const Object& value) const {
-  ASSERT(!IsNull());
-  EnumIndexDefaultMap map(data());
-  if (!map.UpdateOrInsert(key, value)) {
-    SetModified();
-  }
-  StorePointer(&raw_ptr()->data_, map.Release().raw());
-}
-
-
-RawObject* LinkedHashMap::LookUp(const Object& key) const {
-  ASSERT(!IsNull());
-  EnumIndexDefaultMap map(data());
-  {
-    NoSafepointScope no_safepoint;
-    RawObject* result = map.GetOrNull(key);
-    ASSERT(map.Release().raw() == data());
-    return result;
-  }
-}
-
-
-bool LinkedHashMap::Contains(const Object& key) const {
-  ASSERT(!IsNull());
-  EnumIndexDefaultMap map(data());
-  bool result = map.ContainsKey(key);
-  ASSERT(map.Release().raw() == data());
-  return result;
-}
-
-
-RawObject* LinkedHashMap::Remove(const Object& key) const {
-  ASSERT(!IsNull());
-  EnumIndexDefaultMap map(data());
-  // TODO(koda): Make 'Remove' also return the old value.
-  const PassiveObject& result = PassiveObject::Handle(map.GetOrNull(key));
-  if (map.Remove(key)) {
-    SetModified();
-  }
-  StorePointer(&raw_ptr()->data_, map.Release().raw());
-  return result.raw();
-}
-
-
-void LinkedHashMap::Clear() const {
-  ASSERT(!IsNull());
-  if (Length() != 0) {
-    EnumIndexDefaultMap map(data());
-    map.Initialize();
-    SetModified();
-    StorePointer(&raw_ptr()->data_, map.Release().raw());
-  }
-}
-
-
-RawArray* LinkedHashMap::ToArray() const {
-  EnumIndexDefaultMap map(data());
-  const Array& result = Array::Handle(HashTables::ToArray(map, true));
-  ASSERT(map.Release().raw() == data());
-  return result.raw();
-}
-
-
-void LinkedHashMap::SetModified() const {
-  StorePointer(&raw_ptr()->cme_mark_, Instance::null());
-}
-
-
-RawInstance* LinkedHashMap::GetModificationMark(bool create) const {
-  if (create && raw_ptr()->cme_mark_ == Instance::null()) {
-    Isolate* isolate = Isolate::Current();
-    const Class& object_class =
-        Class::Handle(isolate, isolate->object_store()->object_class());
-    const Instance& current =
-        Instance::Handle(isolate, Instance::New(object_class));
-    StorePointer(&raw_ptr()->cme_mark_, current.raw());
-  }
-  return raw_ptr()->cme_mark_;
-}
-
-
-RawLinkedHashMap* LinkedHashMap::New(Heap::Space space) {
+RawLinkedHashMap* LinkedHashMap::New(const Array& data,
+                                     const TypedData& index,
+                                     intptr_t hash_mask,
+                                     intptr_t used_data,
+                                     intptr_t deleted_keys,
+                                     Heap::Space space) {
   ASSERT(Isolate::Current()->object_store()->linked_hash_map_class()
          != Class::null());
-  static const intptr_t kInitialCapacity = 4;
-  const Array& data =
-      Array::Handle(HashTables::New<EnumIndexDefaultMap>(kInitialCapacity,
-                                                         space));
+  LinkedHashMap& result = LinkedHashMap::Handle(
+      LinkedHashMap::NewUninitialized(space));
+  result.SetData(data);
+  result.SetIndex(index);
+  result.SetHashMask(hash_mask);
+  result.SetUsedData(used_data);
+  result.SetDeletedKeys(deleted_keys);
+  return result.raw();
+}
+
+
+RawLinkedHashMap* LinkedHashMap::NewUninitialized(Heap::Space space) {
+  ASSERT(Isolate::Current()->object_store()->linked_hash_map_class()
+         != Class::null());
   LinkedHashMap& result = LinkedHashMap::Handle();
   {
     RawObject* raw = Object::Allocate(LinkedHashMap::kClassId,
@@ -19699,8 +19714,6 @@
                                       space);
     NoSafepointScope no_safepoint;
     result ^= raw;
-    result.SetData(data);
-    result.SetModified();
   }
   return result.raw();
 }
@@ -19713,8 +19726,15 @@
 
 
 void LinkedHashMap::PrintJSONImpl(JSONStream* stream, bool ref) const {
+  JSONObject jsobj(stream);
+  PrintSharedInstanceJSON(&jsobj, ref);
+  jsobj.AddProperty("kind", "Map");
+  jsobj.AddServiceId(*this);
+  // TODO(koda): Print length.
+  if (ref) {
+    return;
+  }
   // TODO(koda): Print key/value pairs.
-  Instance::PrintJSONImpl(stream, ref);
 }
 
 
@@ -20589,17 +20609,17 @@
 
 void WeakProperty::PrintJSONImpl(JSONStream* stream, bool ref) const {
   JSONObject jsobj(stream);
-  AddTypeProperties(&jsobj, "Instance", JSONType(), ref);
   PrintSharedInstanceJSON(&jsobj, ref);
+  jsobj.AddProperty("kind", "WeakProperty");
   jsobj.AddServiceId(*this);
   if (ref) {
     return;
   }
 
   const Object& key_handle = Object::Handle(key());
-  jsobj.AddProperty("key", key_handle);
+  jsobj.AddProperty("propertyKey", key_handle);
   const Object& value_handle = Object::Handle(value());
-  jsobj.AddProperty("value", value_handle);
+  jsobj.AddProperty("propertyValue", value_handle);
 }
 
 RawAbstractType* MirrorReference::GetAbstractTypeReferent() const {
@@ -20660,8 +20680,8 @@
 
 void MirrorReference::PrintJSONImpl(JSONStream* stream, bool ref) const {
   JSONObject jsobj(stream);
-  AddTypeProperties(&jsobj, "Instance", JSONType(), ref);
   PrintSharedInstanceJSON(&jsobj, ref);
+  jsobj.AddProperty("kind", "MirrorReference");
   jsobj.AddServiceId(*this);
 
   if (ref) {
@@ -20669,7 +20689,7 @@
   }
 
   const Object& referent_handle = Object::Handle(referent());
-  jsobj.AddProperty("referent", referent_handle);
+  jsobj.AddProperty("mirrorReferent", referent_handle);
 }
 
 
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 3e0a630..39a57ba 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -1121,6 +1121,8 @@
   // Check if this is the top level class.
   bool IsTopLevel() const;
 
+  bool IsPrivate() const;
+
   RawArray* fields() const { return raw_ptr()->fields_; }
   void SetFields(const Array& value) const;
   void AddField(const Field& field) const;
@@ -1704,6 +1706,314 @@
 };
 
 
+// Object holding information about an IC: test classes and their
+// corresponding targets.
+class ICData : public Object {
+ public:
+  RawFunction* owner() const {
+    return raw_ptr()->owner_;
+  }
+
+  RawString* target_name() const {
+    return raw_ptr()->target_name_;
+  }
+
+  RawArray* arguments_descriptor() const {
+    return raw_ptr()->args_descriptor_;
+  }
+
+  intptr_t NumArgsTested() const;
+
+  intptr_t deopt_id() const {
+    return raw_ptr()->deopt_id_;
+  }
+
+  // Note: only deopts with reasons before Unknown in this list are recorded in
+  // the ICData. All other reasons are used purely for informational messages
+  // printed during deoptimization itself.
+  #define DEOPT_REASONS(V)                                                     \
+    V(BinarySmiOp)                                                             \
+    V(BinaryMintOp)                                                            \
+    V(DoubleToSmi)                                                             \
+    V(CheckSmi)                                                                \
+    V(Unknown)                                                                 \
+    V(PolymorphicInstanceCallTestFail)                                         \
+    V(UnaryMintOp)                                                             \
+    V(BinaryDoubleOp)                                                          \
+    V(UnaryOp)                                                                 \
+    V(UnboxInteger)                                                            \
+    V(CheckClass)                                                              \
+    V(CheckArrayBound)                                                         \
+    V(AtCall)                                                                  \
+    V(Uint32Load)                                                              \
+    V(GuardField)                                                              \
+    V(TestCids)                                                                \
+    V(NumReasons)                                                              \
+
+  enum DeoptReasonId {
+  #define DEFINE_ENUM_LIST(name) kDeopt##name,
+  DEOPT_REASONS(DEFINE_ENUM_LIST)
+  #undef DEFINE_ENUM_LIST
+  };
+
+  static const intptr_t kLastRecordedDeoptReason = kDeoptUnknown - 1;
+
+  enum DeoptFlags {
+    // Deoptimization is caused by an optimistically hoisted instruction.
+    kHoisted = 1 << 0,
+
+    // Deoptimization is caused by an optimistically generalized bounds check.
+    kGeneralized = 1 << 1
+  };
+
+  bool HasDeoptReasons() const { return DeoptReasons() != 0; }
+  uint32_t DeoptReasons() const;
+  void SetDeoptReasons(uint32_t reasons) const;
+
+  bool HasDeoptReason(ICData::DeoptReasonId reason) const;
+  void AddDeoptReason(ICData::DeoptReasonId reason) const;
+
+  bool IssuedJSWarning() const;
+  void SetIssuedJSWarning() const;
+
+  // Return true if the target function of this IC data may check for (and
+  // possibly issue) a Javascript compatibility warning.
+  bool MayCheckForJSWarning() const;
+
+  intptr_t NumberOfChecks() const;
+
+  // Discounts any checks with usage of zero.
+  intptr_t NumberOfUsedChecks() const;
+
+  static intptr_t InstanceSize() {
+    return RoundedAllocationSize(sizeof(RawICData));
+  }
+
+  static intptr_t target_name_offset() {
+    return OFFSET_OF(RawICData, target_name_);
+  }
+
+  static intptr_t state_bits_offset() {
+    return OFFSET_OF(RawICData, state_bits_);
+  }
+
+  static intptr_t NumArgsTestedShift() {
+    return kNumArgsTestedPos;
+  }
+
+  static intptr_t NumArgsTestedMask() {
+    return ((1 << kNumArgsTestedSize) - 1) << kNumArgsTestedPos;
+  }
+
+  static intptr_t arguments_descriptor_offset() {
+    return OFFSET_OF(RawICData, args_descriptor_);
+  }
+
+  static intptr_t ic_data_offset() {
+    return OFFSET_OF(RawICData, ic_data_);
+  }
+
+  static intptr_t owner_offset() {
+    return OFFSET_OF(RawICData, owner_);
+  }
+
+  // Used for unoptimized static calls when no class-ids are checked.
+  void AddTarget(const Function& target) const;
+
+  // Adding checks.
+
+  // 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;
+  // Adds sorted so that Smi is the first class-id. Use only for
+  // num_args_tested == 1.
+  void AddReceiverCheck(intptr_t receiver_class_id,
+                        const Function& target,
+                        intptr_t count = 1) const;
+
+  // Retrieving checks.
+
+  // TODO(srdjan): GetCheckAt without target.
+  void GetCheckAt(intptr_t index,
+                  GrowableArray<intptr_t>* class_ids,
+                  Function* target) const;
+  // Only for 'num_args_checked == 1'.
+  void GetOneClassCheckAt(intptr_t index,
+                          intptr_t* class_id,
+                          Function* target) const;
+  // Only for 'num_args_checked == 1'.
+  intptr_t GetCidAt(intptr_t index) const;
+
+  intptr_t GetReceiverClassIdAt(intptr_t index) const;
+  intptr_t GetClassIdAt(intptr_t index, intptr_t arg_nr) const;
+
+  RawFunction* GetTargetAt(intptr_t index) const;
+  RawFunction* GetTargetForReceiverClassId(intptr_t class_id) const;
+
+  void IncrementCountAt(intptr_t index, intptr_t value) const;
+  void SetCountAt(intptr_t index, intptr_t value) const;
+  intptr_t GetCountAt(intptr_t index) const;
+  intptr_t AggregateCount() const;
+
+  // Returns this->raw() if num_args_tested == 1 and arg_nr == 1, otherwise
+  // returns a new ICData object containing only unique arg_nr checks.
+  // Returns only used entries.
+  RawICData* AsUnaryClassChecksForArgNr(intptr_t arg_nr) const;
+  RawICData* AsUnaryClassChecks() const {
+    return AsUnaryClassChecksForArgNr(0);
+  }
+  RawICData* AsUnaryClassChecksForCid(
+      intptr_t cid, const Function& target) const;
+
+  // Consider only used entries.
+  bool AllTargetsHaveSameOwner(intptr_t owner_cid) const;
+  bool AllReceiversAreNumbers() const;
+  bool HasOneTarget() const;
+  bool HasReceiverClassId(intptr_t class_id) const;
+
+  static RawICData* New(const Function& owner,
+                        const String& target_name,
+                        const Array& arguments_descriptor,
+                        intptr_t deopt_id,
+                        intptr_t num_args_tested);
+  static RawICData* NewFrom(const ICData& from, intptr_t num_args_tested);
+
+  static intptr_t TestEntryLengthFor(intptr_t num_args);
+
+  static intptr_t TargetIndexFor(intptr_t num_args) {
+    return num_args;
+  }
+
+  static intptr_t CountIndexFor(intptr_t num_args) {
+    return (num_args + 1);
+  }
+
+  bool IsUsedAt(intptr_t i) const;
+
+  void GetUsedCidsForTwoArgs(GrowableArray<intptr_t>* first,
+                             GrowableArray<intptr_t>* second) const;
+
+  // Range feedback tracking functionality.
+
+  // For arithmetic operations we store range information for inputs and the
+  // result. The goal is to discover:
+  //
+  //    - on 32-bit platforms:
+  //         - when Mint operation is actually a int32/uint32 operation;
+  //         - when Smi operation produces non-smi results;
+  //
+  //    - on 64-bit platforms:
+  //         - when Smi operation is actually int32/uint32 operation;
+  //         - when Mint operation produces non-smi results;
+  //
+  enum RangeFeedback {
+    kSmiRange,
+    kInt32Range,
+    kUint32Range,
+    kInt64Range
+  };
+
+  // We use 4 bits per operand/result feedback. Our lattice allows us to
+  // express the following states:
+  //
+  //   - usmi   0000 [used only on 32bit platforms]
+  //   - smi    0001
+  //   - uint31 0010
+  //   - int32  0011
+  //   - uint32 0100
+  //   - int33  x1x1
+  //   - int64  1xxx
+  //
+  // DecodeRangeFeedbackAt() helper maps these states into the RangeFeedback
+  // enumeration.
+  enum RangeFeedbackLatticeBits {
+    kSignedRangeBit = 1 << 0,
+    kInt32RangeBit = 1 << 1,
+    kUint32RangeBit = 1 << 2,
+    kInt64RangeBit = 1 << 3,
+    kBitsPerRangeFeedback = 4,
+    kRangeFeedbackMask = (1 << kBitsPerRangeFeedback) - 1,
+    kRangeFeedbackSlots = 3
+  };
+
+  static bool IsValidRangeFeedbackIndex(intptr_t index) {
+    return (0 <= index) && (index < kRangeFeedbackSlots);
+  }
+
+  static intptr_t RangeFeedbackShift(intptr_t index) {
+    return (index * kBitsPerRangeFeedback) + kRangeFeedbackPos;
+  }
+
+  static const char* RangeFeedbackToString(RangeFeedback feedback) {
+    switch (feedback) {
+      case kSmiRange:
+        return "smi";
+      case kInt32Range:
+        return "int32";
+      case kUint32Range:
+        return "uint32";
+      case kInt64Range:
+        return "int64";
+      default:
+        UNREACHABLE();
+        return "?";
+    }
+  }
+
+  // It is only meaningful to interptret range feedback stored in the ICData
+  // when all checks are Mint or Smi.
+  bool HasRangeFeedback() const;
+  RangeFeedback DecodeRangeFeedbackAt(intptr_t idx) const;
+
+  void PrintToJSONArray(const JSONArray& jsarray,
+                        intptr_t token_pos,
+                        bool is_static_call) const;
+
+ private:
+  RawArray* ic_data() const {
+    return raw_ptr()->ic_data_;
+  }
+
+  void set_owner(const Function& value) const;
+  void set_target_name(const String& value) const;
+  void set_arguments_descriptor(const Array& value) const;
+  void set_deopt_id(intptr_t value) const;
+  void SetNumArgsTested(intptr_t value) const;
+  void set_ic_data(const Array& value) const;
+  void set_state_bits(uint32_t bits) const;
+
+  enum {
+    kNumArgsTestedPos = 0,
+    kNumArgsTestedSize = 2,
+    kDeoptReasonPos = kNumArgsTestedPos + kNumArgsTestedSize,
+    kDeoptReasonSize = kLastRecordedDeoptReason + 1,
+    kIssuedJSWarningBit = kDeoptReasonPos + kDeoptReasonSize,
+    kRangeFeedbackPos = kIssuedJSWarningBit + 1,
+    kRangeFeedbackSize = kBitsPerRangeFeedback * kRangeFeedbackSlots
+  };
+
+  class NumArgsTestedBits : public BitField<uint32_t,
+      kNumArgsTestedPos, kNumArgsTestedSize> {};  // NOLINT
+  class DeoptReasonBits : public BitField<uint32_t,
+      ICData::kDeoptReasonPos, ICData::kDeoptReasonSize> {};  // NOLINT
+  class IssuedJSWarningBit : public BitField<bool, kIssuedJSWarningBit, 1> {};
+  class RangeFeedbackBits : public BitField<uint32_t,
+      ICData::kRangeFeedbackPos, ICData::kRangeFeedbackSize> {};  // NOLINT
+
+#if defined(DEBUG)
+  // Used in asserts to verify that a check is not added twice.
+  bool HasCheck(const GrowableArray<intptr_t>& cids) const;
+#endif  // DEBUG
+
+  intptr_t TestEntryLength() const;
+  void WriteSentinel(const Array& data) const;
+
+  FINAL_HEAP_OBJECT_IMPLEMENTATION(ICData, Object);
+  friend class Class;
+};
+
+
 class Function : public Object {
  public:
   RawString* name() const { return raw_ptr()->name_; }
@@ -2229,7 +2539,10 @@
       ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data) const;
 
   RawArray* ic_data_array() const;
-  void ClearICData() const;
+  void ClearICDataArray() const;
+
+  // Sets deopt reason in all ICData-s with given deopt_id.
+  void SetDeoptReasonForAll(intptr_t deopt_id, ICData::DeoptReasonId reason);
 
   static const int kCtorPhaseInit = 1 << 0;
   static const int kCtorPhaseBody = 1 << 1;
@@ -2297,7 +2610,7 @@
     kKindTagPos = 0,
     kKindTagSize = 4,
     kRecognizedTagPos = kKindTagPos + kKindTagSize,
-    kRecognizedTagSize = 8,
+    kRecognizedTagSize = 9,
     kModifierPos = kRecognizedTagPos + kRecognizedTagSize,
     kModifierSize = 2,
     kLastModifierBitPos = kModifierPos + (kModifierSize - 1),
@@ -3549,314 +3862,6 @@
 };
 
 
-// Object holding information about an IC: test classes and their
-// corresponding targets.
-class ICData : public Object {
- public:
-  RawFunction* owner() const {
-    return raw_ptr()->owner_;
-  }
-
-  RawString* target_name() const {
-    return raw_ptr()->target_name_;
-  }
-
-  RawArray* arguments_descriptor() const {
-    return raw_ptr()->args_descriptor_;
-  }
-
-  intptr_t NumArgsTested() const;
-
-  intptr_t deopt_id() const {
-    return raw_ptr()->deopt_id_;
-  }
-
-  // Note: only deopts with reasons before Unknown in this list are recorded in
-  // the ICData. All other reasons are used purely for informational messages
-  // printed during deoptimization itself.
-  #define DEOPT_REASONS(V)                                                     \
-    V(BinarySmiOp)                                                             \
-    V(BinaryMintOp)                                                            \
-    V(DoubleToSmi)                                                             \
-    V(Unknown)                                                                 \
-    V(PolymorphicInstanceCallTestFail)                                         \
-    V(UnaryMintOp)                                                             \
-    V(BinaryDoubleOp)                                                          \
-    V(UnaryOp)                                                                 \
-    V(UnboxInteger)                                                            \
-    V(CheckClass)                                                              \
-    V(CheckSmi)                                                                \
-    V(CheckArrayBound)                                                         \
-    V(AtCall)                                                                  \
-    V(Uint32Load)                                                              \
-    V(GuardField)                                                              \
-    V(TestCids)                                                                \
-    V(NumReasons)                                                              \
-
-  enum DeoptReasonId {
-  #define DEFINE_ENUM_LIST(name) kDeopt##name,
-  DEOPT_REASONS(DEFINE_ENUM_LIST)
-  #undef DEFINE_ENUM_LIST
-  };
-
-  static const intptr_t kLastRecordedDeoptReason = kDeoptUnknown - 1;
-
-  enum DeoptFlags {
-    // Deoptimization is caused by an optimistically hoisted instruction.
-    kHoisted = 1 << 0,
-
-    // Deoptimization is caused by an optimistically generalized bounds check.
-    kGeneralized = 1 << 1
-  };
-
-  bool HasDeoptReasons() const { return DeoptReasons() != 0; }
-  uint32_t DeoptReasons() const;
-  void SetDeoptReasons(uint32_t reasons) const;
-
-  bool HasDeoptReason(ICData::DeoptReasonId reason) const;
-  void AddDeoptReason(ICData::DeoptReasonId reason) const;
-
-  bool IssuedJSWarning() const;
-  void SetIssuedJSWarning() const;
-
-  // Return true if the target function of this IC data may check for (and
-  // possibly issue) a Javascript compatibility warning.
-  bool MayCheckForJSWarning() const;
-
-  intptr_t NumberOfChecks() const;
-
-  // Discounts any checks with usage of zero.
-  intptr_t NumberOfUsedChecks() const;
-
-  static intptr_t InstanceSize() {
-    return RoundedAllocationSize(sizeof(RawICData));
-  }
-
-  static intptr_t target_name_offset() {
-    return OFFSET_OF(RawICData, target_name_);
-  }
-
-  static intptr_t state_bits_offset() {
-    return OFFSET_OF(RawICData, state_bits_);
-  }
-
-  static intptr_t NumArgsTestedShift() {
-    return kNumArgsTestedPos;
-  }
-
-  static intptr_t NumArgsTestedMask() {
-    return ((1 << kNumArgsTestedSize) - 1) << kNumArgsTestedPos;
-  }
-
-  static intptr_t arguments_descriptor_offset() {
-    return OFFSET_OF(RawICData, args_descriptor_);
-  }
-
-  static intptr_t ic_data_offset() {
-    return OFFSET_OF(RawICData, ic_data_);
-  }
-
-  static intptr_t owner_offset() {
-    return OFFSET_OF(RawICData, owner_);
-  }
-
-  // Used for unoptimized static calls when no class-ids are checked.
-  void AddTarget(const Function& target) const;
-
-  // Adding checks.
-
-  // 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;
-  // Adds sorted so that Smi is the first class-id. Use only for
-  // num_args_tested == 1.
-  void AddReceiverCheck(intptr_t receiver_class_id,
-                        const Function& target,
-                        intptr_t count = 1) const;
-
-  // Retrieving checks.
-
-  // TODO(srdjan): GetCheckAt without target.
-  void GetCheckAt(intptr_t index,
-                  GrowableArray<intptr_t>* class_ids,
-                  Function* target) const;
-  // Only for 'num_args_checked == 1'.
-  void GetOneClassCheckAt(intptr_t index,
-                          intptr_t* class_id,
-                          Function* target) const;
-  // Only for 'num_args_checked == 1'.
-  intptr_t GetCidAt(intptr_t index) const;
-
-  intptr_t GetReceiverClassIdAt(intptr_t index) const;
-  intptr_t GetClassIdAt(intptr_t index, intptr_t arg_nr) const;
-
-  RawFunction* GetTargetAt(intptr_t index) const;
-  RawFunction* GetTargetForReceiverClassId(intptr_t class_id) const;
-
-  void IncrementCountAt(intptr_t index, intptr_t value) const;
-  void SetCountAt(intptr_t index, intptr_t value) const;
-  intptr_t GetCountAt(intptr_t index) const;
-  intptr_t AggregateCount() const;
-
-  // Returns this->raw() if num_args_tested == 1 and arg_nr == 1, otherwise
-  // returns a new ICData object containing only unique arg_nr checks.
-  // Returns only used entries.
-  RawICData* AsUnaryClassChecksForArgNr(intptr_t arg_nr) const;
-  RawICData* AsUnaryClassChecks() const {
-    return AsUnaryClassChecksForArgNr(0);
-  }
-  RawICData* AsUnaryClassChecksForCid(
-      intptr_t cid, const Function& target) const;
-
-  // Consider only used entries.
-  bool AllTargetsHaveSameOwner(intptr_t owner_cid) const;
-  bool AllReceiversAreNumbers() const;
-  bool HasOneTarget() const;
-  bool HasReceiverClassId(intptr_t class_id) const;
-
-  static RawICData* New(const Function& owner,
-                        const String& target_name,
-                        const Array& arguments_descriptor,
-                        intptr_t deopt_id,
-                        intptr_t num_args_tested);
-  static RawICData* NewFrom(const ICData& from, intptr_t num_args_tested);
-
-  static intptr_t TestEntryLengthFor(intptr_t num_args);
-
-  static intptr_t TargetIndexFor(intptr_t num_args) {
-    return num_args;
-  }
-
-  static intptr_t CountIndexFor(intptr_t num_args) {
-    return (num_args + 1);
-  }
-
-  bool IsUsedAt(intptr_t i) const;
-
-  void GetUsedCidsForTwoArgs(GrowableArray<intptr_t>* first,
-                             GrowableArray<intptr_t>* second) const;
-
-  // Range feedback tracking functionality.
-
-  // For arithmetic operations we store range information for inputs and the
-  // result. The goal is to discover:
-  //
-  //    - on 32-bit platforms:
-  //         - when Mint operation is actually a int32/uint32 operation;
-  //         - when Smi operation produces non-smi results;
-  //
-  //    - on 64-bit platforms:
-  //         - when Smi operation is actually int32/uint32 operation;
-  //         - when Mint operation produces non-smi results;
-  //
-  enum RangeFeedback {
-    kSmiRange,
-    kInt32Range,
-    kUint32Range,
-    kInt64Range
-  };
-
-  // We use 4 bits per operand/result feedback. Our lattice allows us to
-  // express the following states:
-  //
-  //   - usmi   0000 [used only on 32bit platforms]
-  //   - smi    0001
-  //   - uint31 0010
-  //   - int32  0011
-  //   - uint32 0100
-  //   - int33  x1x1
-  //   - int64  1xxx
-  //
-  // DecodeRangeFeedbackAt() helper maps these states into the RangeFeedback
-  // enumeration.
-  enum RangeFeedbackLatticeBits {
-    kSignedRangeBit = 1 << 0,
-    kInt32RangeBit = 1 << 1,
-    kUint32RangeBit = 1 << 2,
-    kInt64RangeBit = 1 << 3,
-    kBitsPerRangeFeedback = 4,
-    kRangeFeedbackMask = (1 << kBitsPerRangeFeedback) - 1,
-    kRangeFeedbackSlots = 3
-  };
-
-  static bool IsValidRangeFeedbackIndex(intptr_t index) {
-    return (0 <= index) && (index < kRangeFeedbackSlots);
-  }
-
-  static intptr_t RangeFeedbackShift(intptr_t index) {
-    return (index * kBitsPerRangeFeedback) + kRangeFeedbackPos;
-  }
-
-  static const char* RangeFeedbackToString(RangeFeedback feedback) {
-    switch (feedback) {
-      case kSmiRange:
-        return "smi";
-      case kInt32Range:
-        return "int32";
-      case kUint32Range:
-        return "uint32";
-      case kInt64Range:
-        return "int64";
-      default:
-        UNREACHABLE();
-        return "?";
-    }
-  }
-
-  // It is only meaningful to interptret range feedback stored in the ICData
-  // when all checks are Mint or Smi.
-  bool HasRangeFeedback() const;
-  RangeFeedback DecodeRangeFeedbackAt(intptr_t idx) const;
-
-  void PrintToJSONArray(const JSONArray& jsarray,
-                        intptr_t token_pos,
-                        bool is_static_call) const;
-
- private:
-  RawArray* ic_data() const {
-    return raw_ptr()->ic_data_;
-  }
-
-  void set_owner(const Function& value) const;
-  void set_target_name(const String& value) const;
-  void set_arguments_descriptor(const Array& value) const;
-  void set_deopt_id(intptr_t value) const;
-  void SetNumArgsTested(intptr_t value) const;
-  void set_ic_data(const Array& value) const;
-  void set_state_bits(uint32_t bits) const;
-
-  enum {
-    kNumArgsTestedPos = 0,
-    kNumArgsTestedSize = 2,
-    kDeoptReasonPos = kNumArgsTestedPos + kNumArgsTestedSize,
-    kDeoptReasonSize = kLastRecordedDeoptReason + 1,
-    kIssuedJSWarningBit = kDeoptReasonPos + kDeoptReasonSize,
-    kRangeFeedbackPos = kIssuedJSWarningBit + 1,
-    kRangeFeedbackSize = kBitsPerRangeFeedback * kRangeFeedbackSlots
-  };
-
-  class NumArgsTestedBits : public BitField<uint32_t,
-      kNumArgsTestedPos, kNumArgsTestedSize> {};  // NOLINT
-  class DeoptReasonBits : public BitField<uint32_t,
-      ICData::kDeoptReasonPos, ICData::kDeoptReasonSize> {};  // NOLINT
-  class IssuedJSWarningBit : public BitField<bool, kIssuedJSWarningBit, 1> {};
-  class RangeFeedbackBits : public BitField<uint32_t,
-      ICData::kRangeFeedbackPos, ICData::kRangeFeedbackSize> {};  // NOLINT
-
-#if defined(DEBUG)
-  // Used in asserts to verify that a check is not added twice.
-  bool HasCheck(const GrowableArray<intptr_t>& cids) const;
-#endif  // DEBUG
-
-  intptr_t TestEntryLength() const;
-  void WriteSentinel(const Array& data) const;
-
-  FINAL_HEAP_OBJECT_IMPLEMENTATION(ICData, Object);
-  friend class Class;
-};
-
-
 class Code : public Object {
  public:
   RawInstructions* instructions() const { return raw_ptr()->instructions_; }
@@ -6678,53 +6683,6 @@
 };
 
 
-// Corresponds to
-// - "new Map()",
-// - non-const map literals, and
-// - the default constructor of LinkedHashMap in dart:collection.
-class LinkedHashMap : public Instance {
- public:
-  intptr_t Length() const;
-  RawObject* LookUp(const Object& key) const;
-  void InsertOrUpdate(const Object& key, const Object& value) const;
-  bool Contains(const Object& key) const;
-  RawObject* Remove(const Object& key) const;
-  void Clear() const;
-  // List of key, value pairs in iteration (i.e., key insertion) order.
-  RawArray* ToArray() const;
-
-  static intptr_t InstanceSize() {
-    return RoundedAllocationSize(sizeof(RawLinkedHashMap));
-  }
-
-  static RawLinkedHashMap* New(Heap::Space space = Heap::kNew);
-
-  virtual RawTypeArguments* GetTypeArguments() const {
-    return raw_ptr()->type_arguments_;
-  }
-  virtual void SetTypeArguments(const TypeArguments& value) const {
-    ASSERT(value.IsNull() || ((value.Length() >= 2) && value.IsInstantiated()));
-    StorePointer(&raw_ptr()->type_arguments_, value.raw());
-  }
-  static intptr_t type_arguments_offset() {
-    return OFFSET_OF(RawLinkedHashMap, type_arguments_);
-  }
-
-  // Called whenever the set of keys changes.
-  void SetModified() const;
-  RawInstance* GetModificationMark(bool create) const;
-
- private:
-  RawArray* data() const { return raw_ptr()->data_; }
-  void SetData(const Array& value) const {
-    StorePointer(&raw_ptr()->data_, value.raw());
-  }
-
-  FINAL_HEAP_OBJECT_IMPLEMENTATION(LinkedHashMap, Instance);
-  friend class Class;
-};
-
-
 class Float32x4 : public Instance {
  public:
   static RawFloat32x4* New(float value0, float value1, float value2,
@@ -7195,6 +7153,97 @@
 };
 
 
+// Corresponds to
+// - "new Map()",
+// - non-const map literals, and
+// - the default constructor of LinkedHashMap in dart:collection.
+class LinkedHashMap : public Instance {
+ public:
+  static intptr_t InstanceSize() {
+    return RoundedAllocationSize(sizeof(RawLinkedHashMap));
+  }
+
+  // Allocates a map with some default capacity, just like "new Map()".
+  static RawLinkedHashMap* NewDefault(Heap::Space space = Heap::kNew);
+  static RawLinkedHashMap* New(const Array& data,
+                               const TypedData& index,
+                               intptr_t hash_mask,
+                               intptr_t used_data,
+                               intptr_t deleted_keys,
+                               Heap::Space space = Heap::kNew);
+
+  virtual RawTypeArguments* GetTypeArguments() const {
+    return raw_ptr()->type_arguments_;
+  }
+  virtual void SetTypeArguments(const TypeArguments& value) const {
+    ASSERT(value.IsNull() || ((value.Length() >= 2) && value.IsInstantiated()));
+    StorePointer(&raw_ptr()->type_arguments_, value.raw());
+  }
+  static intptr_t type_arguments_offset() {
+    return OFFSET_OF(RawLinkedHashMap, type_arguments_);
+  }
+
+  RawTypedData* index() const {
+    return raw_ptr()->index_;
+  }
+  void SetIndex(const TypedData& value) const {
+    StorePointer(&raw_ptr()->index_, value.raw());
+  }
+  static intptr_t index_offset() {
+    return OFFSET_OF(RawLinkedHashMap, index_);
+  }
+
+  RawArray* data() const {
+    return raw_ptr()->data_;
+  }
+  void SetData(const Array& value) const {
+    StorePointer(&raw_ptr()->data_, value.raw());
+  }
+  static intptr_t data_offset() {
+    return OFFSET_OF(RawLinkedHashMap, data_);
+  }
+
+  RawSmi* hash_mask() const {
+    return raw_ptr()->hash_mask_;
+  }
+  void SetHashMask(intptr_t value) const {
+    StoreSmi(&raw_ptr()->hash_mask_, Smi::New(value));
+  }
+  static intptr_t hash_mask_offset() {
+    return OFFSET_OF(RawLinkedHashMap, hash_mask_);
+  }
+
+  RawSmi* used_data() const {
+    return raw_ptr()->used_data_;
+  }
+  void SetUsedData(intptr_t value) const {
+    StoreSmi(&raw_ptr()->used_data_, Smi::New(value));
+  }
+  static intptr_t used_data_offset() {
+    return OFFSET_OF(RawLinkedHashMap, used_data_);
+  }
+
+  RawSmi* deleted_keys() const {
+    return raw_ptr()->deleted_keys_;
+  }
+  void SetDeletedKeys(intptr_t value) const {
+    StoreSmi(&raw_ptr()->deleted_keys_, Smi::New(value));
+  }
+  static intptr_t deleted_keys_offset() {
+    return OFFSET_OF(RawLinkedHashMap, deleted_keys_);
+  }
+
+ private:
+  FINAL_HEAP_OBJECT_IMPLEMENTATION(LinkedHashMap, Instance);
+
+  // Allocate a map, but leave all fields set to null.
+  // Used during deserialization (since map might contain itself as key/value).
+  static RawLinkedHashMap* NewUninitialized(Heap::Space space = Heap::kNew);
+
+  friend class Class;
+};
+
+
 class Closure : public AllStatic {
  public:
   static RawFunction* function(const Instance& closure) {
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index 7e678a6..ebe0ba0 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -4331,7 +4331,8 @@
         "\"id\":\"\",\"name\":\"toString\","
         "\"owner\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
         "\"name\":\"bool\"},"
-        "\"kind\":\"RegularFunction\"}",
+        "\"_kind\":\"RegularFunction\","
+        "\"static\":false,\"const\":false}",
         buffer);
   }
   // Library reference
@@ -4351,9 +4352,12 @@
     Bool::True().PrintJSON(&js, true);
     elideSubstring("classes", js.ToCString(), buffer);
     EXPECT_STREQ(
-        "{\"type\":\"@bool\","
+        "{\"type\":\"@Instance\","
+        "\"_vmType\":\"Bool\","
         "\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
-        "\"name\":\"bool\"},\"fixedId\":true,"
+        "\"name\":\"bool\"},"
+        "\"kind\":\"Bool\","
+        "\"fixedId\":true,"
         "\"id\":\"objects\\/bool-true\",\"valueAsString\":\"true\"}",
         buffer);
   }
@@ -4365,10 +4369,13 @@
     elideSubstring("classes", js.ToCString(), buffer);
     elideSubstring("_Smi@", buffer, buffer);
     EXPECT_STREQ(
-        "{\"type\":\"@int\",\"_vmType\":\"@Smi\","
+        "{\"type\":\"@Instance\","
+        "\"_vmType\":\"Smi\","
         "\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
         "\"name\":\"_Smi\","
-        "\"_vmName\":\"\"},\"fixedId\":true,"
+        "\"_vmName\":\"\"},"
+        "\"kind\":\"Int\","
+        "\"fixedId\":true,"
         "\"id\":\"objects\\/int-7\",\"valueAsString\":\"7\"}",
         buffer);
   }
@@ -4381,9 +4388,11 @@
     elideSubstring("objects", buffer, buffer);
     elideSubstring("_Mint@", buffer, buffer);
     EXPECT_STREQ(
-        "{\"type\":\"@int\",\"_vmType\":\"@Mint\","
+        "{\"type\":\"@Instance\","
+        "\"_vmType\":\"Mint\","
         "\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
         "\"name\":\"_Mint\",\"_vmName\":\"\"},"
+        "\"kind\":\"Int\","
         "\"id\":\"\",\"valueAsString\":\"-9223372036854775808\"}",
         buffer);
   }
@@ -4398,9 +4407,11 @@
     elideSubstring("objects", buffer, buffer);
     elideSubstring("_Bigint@", buffer, buffer);
     EXPECT_STREQ(
-        "{\"type\":\"@int\",\"_vmType\":\"@Bigint\","
+        "{\"type\":\"@Instance\","
+        "\"_vmType\":\"Bigint\","
         "\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
         "\"name\":\"_Bigint\",\"_vmName\":\"\"},"
+        "\"kind\":\"Int\","
         "\"id\":\"\",\"valueAsString\":\"44444444444444444444444444444444\"}",
         buffer);
   }
@@ -4413,9 +4424,11 @@
     elideSubstring("objects", buffer, buffer);
     elideSubstring("_Double@", buffer, buffer);
     EXPECT_STREQ(
-        "{\"type\":\"@double\","
+        "{\"type\":\"@Instance\","
+        "\"_vmType\":\"Double\","
         "\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
         "\"name\":\"_Double\",\"_vmName\":\"\"},"
+        "\"kind\":\"Double\","
         "\"id\":\"\",\"valueAsString\":\"0.1234\"}",
         buffer);
   }
@@ -4428,9 +4441,11 @@
     elideSubstring("objects", buffer, buffer);
     elideSubstring("_OneByteString@", buffer, buffer);
     EXPECT_STREQ(
-        "{\"type\":\"@String\","
+        "{\"type\":\"@Instance\","
+        "\"_vmType\":\"String\","
         "\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
         "\"name\":\"_OneByteString\",\"_vmName\":\"\"},"
+        "\"kind\":\"String\","
         "\"id\":\"\",\"valueAsString\":\"dw\"}",
         buffer);
   }
@@ -4443,9 +4458,11 @@
     elideSubstring("objects", buffer, buffer);
     elideSubstring("_List@", buffer, buffer);
     EXPECT_STREQ(
-        "{\"type\":\"@List\",\"_vmType\":\"@Array\","
+        "{\"type\":\"@Instance\","
+        "\"_vmType\":\"Array\","
         "\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
         "\"name\":\"_List\",\"_vmName\":\"\"},"
+        "\"kind\":\"List\","
         "\"id\":\"\",\"length\":0}",
         buffer);
   }
@@ -4459,24 +4476,31 @@
     elideSubstring("objects", buffer, buffer);
     elideSubstring("_GrowableList@", buffer, buffer);
     EXPECT_STREQ(
-        "{\"type\":\"@List\",\"_vmType\":\"@GrowableObjectArray\","
+        "{\"type\":\"@Instance\","
+        "\"_vmType\":\"GrowableObjectArray\","
         "\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
         "\"name\":\"_GrowableList\","
-        "\"_vmName\":\"\"},\"id\":\"\",\"length\":0}",
+        "\"_vmName\":\"\"},"
+        "\"kind\":\"List\","
+        "\"id\":\"\",\"length\":0}",
         buffer);
   }
   // LinkedHashMap reference
   {
     JSONStream js;
-    const LinkedHashMap& array = LinkedHashMap::Handle(LinkedHashMap::New());
+    const LinkedHashMap& array =
+        LinkedHashMap::Handle(LinkedHashMap::NewDefault());
     array.PrintJSON(&js, true);
     elideSubstring("classes", js.ToCString(), buffer);
     elideSubstring("objects", buffer, buffer);
     elideSubstring("_InternalLinkedHashMap@", buffer, buffer);
     EXPECT_STREQ(
-        "{\"type\":\"@Instance\",\"_vmType\":\"@LinkedHashMap\","
+        "{\"type\":\"@Instance\","
+        "\"_vmType\":\"LinkedHashMap\","
         "\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
-        "\"name\":\"_InternalLinkedHashMap\",\"_vmName\":\"\"},\"id\":\"\"}",
+        "\"name\":\"_InternalLinkedHashMap\",\"_vmName\":\"\"},"
+        "\"kind\":\"Map\","
+        "\"id\":\"\"}",
         buffer);
   }
   // UserTag reference
@@ -4488,9 +4512,11 @@
     elideSubstring("objects", buffer, buffer);
     elideSubstring("_UserTag@", buffer, buffer);
     EXPECT_STREQ(
-        "{\"type\":\"@Instance\",\"_vmType\":\"@UserTag\","
+        "{\"type\":\"@Instance\","
+        "\"_vmType\":\"UserTag\","
         "\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
         "\"name\":\"_UserTag\",\"_vmName\":\"\"},"
+        "\"kind\":\"PlainInstance\","
         "\"id\":\"\"}",
         buffer);
   }
@@ -4504,9 +4530,12 @@
     elideSubstring("objects", buffer, buffer);
     elideSubstring("_Type@", buffer, buffer);
     EXPECT_STREQ(
-        "{\"type\":\"@Type\","
+        "{\"type\":\"@Instance\","
+        "\"_vmType\":\"Type\","
         "\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
-        "\"name\":\"_Type\",\"_vmName\":\"\"},\"fixedId\":true,\"id\":\"\","
+        "\"name\":\"_Type\",\"_vmName\":\"\"},"
+        "\"kind\":\"Type\","
+        "\"fixedId\":true,\"id\":\"\","
         "\"typeClass\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
         "\"name\":\"bool\"},\"name\":\"bool\"}",
         buffer);
@@ -4516,7 +4545,10 @@
     JSONStream js;
     Object::null_object().PrintJSON(&js, true);
     EXPECT_STREQ(
-        "{\"type\":\"@null\",\"fixedId\":true,"
+        "{\"type\":\"@Instance\","
+        "\"_vmType\":\"null\","
+        "\"kind\":\"Null\","
+        "\"fixedId\":true,"
         "\"id\":\"objects\\/null\","
         "\"valueAsString\":\"null\"}",
         js.ToCString());
@@ -4526,8 +4558,8 @@
     JSONStream js;
     Object::sentinel().PrintJSON(&js, true);
     EXPECT_STREQ(
-        "{\"type\":\"Sentinel\",\"fixedId\":true,"
-        "\"id\":\"objects\\/not-initialized\","
+        "{\"type\":\"Sentinel\","
+        "\"kind\":\"NotInitialized\","
         "\"valueAsString\":\"<not initialized>\"}",
         js.ToCString());
   }
@@ -4536,8 +4568,8 @@
     JSONStream js;
     Object::transition_sentinel().PrintJSON(&js, true);
     EXPECT_STREQ(
-        "{\"type\":\"Sentinel\",\"fixedId\":true,"
-        "\"id\":\"objects\\/being-initialized\","
+        "{\"type\":\"Sentinel\","
+        "\"kind\":\"BeingInitialized\","
         "\"valueAsString\":\"<being initialized>\"}",
         js.ToCString());
   }
@@ -4550,7 +4582,7 @@
     tok.PrintJSON(&js, true);
     elideSubstring("objects", js.ToCString(), buffer);
     EXPECT_STREQ(
-        "{\"type\":\"@Object\",\"_vmType\":\"@LiteralToken\",\"id\":\"\"}",
+        "{\"type\":\"@Object\",\"_vmType\":\"LiteralToken\",\"id\":\"\"}",
         buffer);
   }
 }
@@ -4607,4 +4639,71 @@
   EXPECT(result.IsIdenticalTo(expected));
 }
 
+
+static void CheckIdenticalHashStructure(const Instance& a, const Instance& b) {
+  const char* kScript =
+      "(a, b) {\n"
+      "  if (a._usedData != b._usedData ||\n"
+      "      a._deletedKeys != b._deletedKeys ||\n"
+      "      a._hashMask != b._hashMask ||\n"
+      "      a._index.length != b._index.length ||\n"
+      "      a._data.length != b._data.length) {\n"
+      "    return false;\n"
+      "  }\n"
+      "  for (var i = 0; i < a._index.length; ++i) {\n"
+      "    if (a._index[i] != b._index[i]) {\n"
+      "      return false;\n"
+      "    }\n"
+      "  }\n"
+      "  for (var i = 0; i < a._data.length; ++i) {\n"
+      "    var ad = a._data[i];\n"
+      "    var bd = b._data[i];\n"
+      "    if (!identical(ad, bd) && !(ad == a && bd == b)) {\n"
+      "      return false;\n"
+      "    }\n"
+      "  }\n"
+      "  return true;\n"
+      "}(a, b)";
+  String& name = String::Handle();
+  Array& param_names = Array::Handle(Array::New(2));
+  name = String::New("a");
+  param_names.SetAt(0, name);
+  name = String::New("b");
+  param_names.SetAt(1, name);
+  Array& param_values = Array::Handle(Array::New(2));
+  param_values.SetAt(0, a);
+  param_values.SetAt(1, b);
+  name = String::New(kScript);
+  Library& lib = Library::Handle(Library::CollectionLibrary());
+  EXPECT(lib.Evaluate(name, param_names, param_values) == Bool::True().raw());
+}
+
+
+TEST_CASE(LinkedHashMap) {
+  // Check that initial index size and hash mask match in Dart vs. C++.
+  // 1. Create an empty custom linked hash map in Dart.
+  const char* kScript =
+      "import 'dart:collection';\n"
+      "makeMap() {\n"
+      "  Function eq = (a, b) => true;\n"
+      "  Function hc = (a) => 42;\n"
+      "  return new LinkedHashMap(equals: eq, hashCode: hc);\n"
+      "}";
+  Dart_Handle h_lib = TestCase::LoadTestScript(kScript, NULL);
+  EXPECT_VALID(h_lib);
+  Library& lib = Library::Handle();
+  lib ^= Api::UnwrapHandle(h_lib);
+  EXPECT(!lib.IsNull());
+  Dart_Handle h_result = Dart_Invoke(h_lib, NewString("makeMap"), 0, NULL);
+  EXPECT_VALID(h_result);
+
+  // 2. Create an empty internalized LinkedHashMap in C++.
+  Instance& dart_map = Instance::Handle();
+  dart_map ^= Api::UnwrapHandle(h_result);
+  LinkedHashMap& cc_map = LinkedHashMap::Handle(LinkedHashMap::NewDefault());
+
+  // 3. Expect them to have identical structure.
+  CheckIdenticalHashStructure(dart_map, cc_map);
+}
+
 }  // namespace dart
diff --git a/runtime/vm/os_android.cc b/runtime/vm/os_android.cc
index eef54b6..6606381 100644
--- a/runtime/vm/os_android.cc
+++ b/runtime/vm/os_android.cc
@@ -281,7 +281,7 @@
 
 
 void OS::DebugBreak() {
-  UNIMPLEMENTED();
+  __builtin_trap();
 }
 
 
diff --git a/runtime/vm/os_linux.cc b/runtime/vm/os_linux.cc
index 55c6c36..430af48 100644
--- a/runtime/vm/os_linux.cc
+++ b/runtime/vm/os_linux.cc
@@ -508,17 +508,7 @@
 // CodeImmutability test in object_test.cc, it will be called only from the
 // simulator, which means that only the Intel implementation is needed.
 void OS::DebugBreak() {
-#if defined(HOST_ARCH_X64) || defined(HOST_ARCH_IA32)
-  asm("int $3");
-#elif defined(HOST_ARCH_ARM) && !defined(__THUMBEL__)
-  asm("svc #0x9f0001");  // __ARM_NR_breakpoint
-#elif defined(HOST_ARCH_ARM) && defined(__THUMBEL__)
-  UNIMPLEMENTED();
-#elif defined(HOST_ARCH_MIPS) || defined(HOST_ARCH_ARM64)
-  UNIMPLEMENTED();
-#else
-#error Unsupported architecture.
-#endif
+  __builtin_trap();
 }
 
 
diff --git a/runtime/vm/os_macos.cc b/runtime/vm/os_macos.cc
index 046d475..efdcd2b 100644
--- a/runtime/vm/os_macos.cc
+++ b/runtime/vm/os_macos.cc
@@ -154,11 +154,7 @@
 
 
 void OS::DebugBreak() {
-#if defined(HOST_ARCH_X64) || defined(HOST_ARCH_IA32)
-  asm("int $3");
-#else
-#error Unsupported architecture.
-#endif
+  __builtin_trap();
 }
 
 
diff --git a/runtime/vm/os_win.cc b/runtime/vm/os_win.cc
index 7c32ec6..1f66ad4 100644
--- a/runtime/vm/os_win.cc
+++ b/runtime/vm/os_win.cc
@@ -186,8 +186,7 @@
   // Microsoft Visual C/C++ or drop-in replacement.
   __debugbreak();
 #elif defined(__GCC__)
-  // MinGW?
-  asm("int $3");
+  __builtin_trap();
 #else
   // Microsoft style assembly.
   __asm {
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 0b82d60..7479a09 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -6188,7 +6188,7 @@
                                     // No outer try statement
                                     CatchClauseNode::kInvalidTryIndex);
       finally_clause = NULL;
-      AddFinallyBlockToNode(true, node_to_inline, node);
+      AddFinallyClauseToNode(true, node_to_inline, node);
       node_index++;
     }
   } while (finally_clause == NULL);
@@ -8609,7 +8609,7 @@
                                     context_var,
                                     outer_try_index);
       finally_clause = NULL;
-      AddFinallyBlockToNode(true, node_to_inline, node);
+      AddFinallyClauseToNode(true, node_to_inline, node);
       node_index++;
     }
   } while (finally_clause == NULL);
@@ -8973,15 +8973,19 @@
 }
 
 
-SequenceNode* Parser::ParseFinallyBlock(
+SequenceNode* Parser::EnsureFinallyClause(
+    bool parse,
     bool is_async,
     LocalVariable* exception_var,
     LocalVariable* stack_trace_var,
     LocalVariable* rethrow_exception_var,
     LocalVariable* rethrow_stack_trace_var) {
-  TRACE_PARSER("ParseFinallyBlock");
+  TRACE_PARSER("EnsureFinallyClause");
+  ASSERT(parse || (is_async && (try_stack_ != NULL)));
   OpenBlock();
-  ExpectToken(Token::kLBRACE);
+  if (parse) {
+    ExpectToken(Token::kLBRACE);
+  }
 
   if (try_stack_ != NULL) {
     try_stack_->enter_finally();
@@ -9017,13 +9021,15 @@
                                rethrow_stack_trace_var);
   }
 
-  ParseStatementSequence();
-  ExpectToken(Token::kRBRACE);
-  SequenceNode* finally_block = CloseBlock();
+  if (parse) {
+    ParseStatementSequence();
+    ExpectToken(Token::kRBRACE);
+  }
+  SequenceNode* finally_clause = CloseBlock();
   if (try_stack_ != NULL) {
     try_stack_->exit_finally();
   }
-  return finally_block;
+  return finally_clause;
 }
 
 
@@ -9067,19 +9073,19 @@
 }
 
 
-// Add the inlined finally block to the specified node.
-void Parser::AddFinallyBlockToNode(bool is_async,
-                                   AstNode* node,
-                                   InlinedFinallyNode* finally_node) {
+// Add the inlined finally clause to the specified node.
+void Parser::AddFinallyClauseToNode(bool is_async,
+                                    AstNode* node,
+                                    InlinedFinallyNode* finally_clause) {
   ReturnNode* return_node = node->AsReturnNode();
   if (return_node != NULL) {
     parsed_function()->EnsureFinallyReturnTemp(is_async);
-    return_node->AddInlinedFinallyNode(finally_node);
+    return_node->AddInlinedFinallyNode(finally_clause);
     return;
   }
   JumpNode* jump_node = node->AsJumpNode();
   ASSERT(jump_node != NULL);
-  jump_node->AddInlinedFinallyNode(finally_node);
+  jump_node->AddInlinedFinallyNode(finally_clause);
 }
 
 
@@ -9464,31 +9470,39 @@
   const intptr_t outer_try_index = (outer_try != NULL) ?
       outer_try->try_index() : CatchClauseNode::kInvalidTryIndex;
 
-  // Finally parse the 'finally' block.
-  SequenceNode* finally_block = NULL;
-  if (CurrentToken() == Token::kFINALLY) {
-    ConsumeToken();  // Consume the 'finally'.
+  // Finally, parse or generate the 'finally' clause.
+  // A finally clause is required in async code to restore the saved try context
+  // of an existing outer try. Generate a finally clause to this purpose if it
+  // is not declared.
+  SequenceNode* finally_clause = NULL;
+  const bool parse = CurrentToken() == Token::kFINALLY;
+  if (parse || (is_async && (try_stack_ != NULL))) {
+    if (parse) {
+      ConsumeToken();  // Consume the 'finally'.
+    }
     const intptr_t finally_pos = TokenPos();
     // Add the finally block to the exit points recorded so far.
     intptr_t node_index = 0;
     AstNode* node_to_inline = try_statement->GetNodeToInlineFinally(node_index);
     while (node_to_inline != NULL) {
-      finally_block = ParseFinallyBlock(
+      finally_clause = EnsureFinallyClause(
+          parse,
           is_async,
           exception_var,
           stack_trace_var,
           is_async ? saved_exception_var : exception_var,
           is_async ? saved_stack_trace_var : stack_trace_var);
       InlinedFinallyNode* node = new(Z) InlinedFinallyNode(finally_pos,
-                                                           finally_block,
+                                                           finally_clause,
                                                            context_var,
                                                            outer_try_index);
-      AddFinallyBlockToNode(is_async, node_to_inline, node);
+      AddFinallyClauseToNode(is_async, node_to_inline, node);
       node_index += 1;
       node_to_inline = try_statement->GetNodeToInlineFinally(node_index);
       tokens_iterator_.SetCurrentPosition(finally_pos);
     }
-    finally_block = ParseFinallyBlock(
+    finally_clause = EnsureFinallyClause(
+        parse,
         is_async,
         exception_var,
         stack_trace_var,
@@ -9505,7 +9519,7 @@
       stack_trace_var,
       is_async ? saved_exception_var : exception_var,
       is_async ? saved_stack_trace_var : stack_trace_var,
-      (finally_block != NULL) ?
+      (finally_clause != NULL) ?
           AllocateTryIndex() : CatchClauseNode::kInvalidTryIndex,
       needs_stack_trace);
 
@@ -9513,7 +9527,7 @@
   // on the try/catch, close the block that's embedding the try statement
   // and attach the label to it.
   AstNode* try_catch_node = new(Z) TryCatchNode(
-      try_pos, try_block, context_var, catch_clause, finally_block, try_index);
+      try_pos, try_block, context_var, catch_clause, finally_clause, try_index);
 
   if (try_label != NULL) {
     current_block_->statements->Add(try_catch_node);
diff --git a/runtime/vm/parser.h b/runtime/vm/parser.h
index 8233e0b..a2492a6 100644
--- a/runtime/vm/parser.h
+++ b/runtime/vm/parser.h
@@ -618,12 +618,13 @@
                                   LocalVariable* rethrow_stack_trace_var,
                                   const GrowableObjectArray& handler_types,
                                   bool* needs_stack_trace);
-  // Parse finally block and create an AST for it.
-  SequenceNode* ParseFinallyBlock(bool is_async,
-                                  LocalVariable* exception_var,
-                                  LocalVariable* stack_trace_var,
-                                  LocalVariable* rethrow_exception_var,
-                                  LocalVariable* rethrow_stack_trace_var);
+  // Parse or generate a finally clause.
+  SequenceNode* EnsureFinallyClause(bool parse,
+                                    bool is_async,
+                                    LocalVariable* exception_var,
+                                    LocalVariable* stack_trace_var,
+                                    LocalVariable* rethrow_exception_var,
+                                    LocalVariable* rethrow_stack_trace_var);
   // Push try block onto the stack of try blocks in scope.
   void PushTry(Block* try_block);
   // Pop the inner most try block from the stack.
@@ -637,10 +638,10 @@
   // Add specified node to try block list so that it can be patched with
   // inlined finally code if needed.
   void AddNodeForFinallyInlining(AstNode* node);
-  // Add the inlined finally block to the specified node.
-  void AddFinallyBlockToNode(bool is_async,
-                             AstNode* node,
-                             InlinedFinallyNode* finally_node);
+  // Add the inlined finally clause to the specified node.
+  void AddFinallyClauseToNode(bool is_async,
+                              AstNode* node,
+                              InlinedFinallyNode* finally_clause);
   AstNode* ParseTryStatement(String* label_name);
   RawAbstractType* ParseConstFinalVarOrType(
       ClassFinalizer::FinalizationKind finalization);
diff --git a/runtime/vm/profiler_service.cc b/runtime/vm/profiler_service.cc
index 87fe0d0..29be014 100644
--- a/runtime/vm/profiler_service.cc
+++ b/runtime/vm/profiler_service.cc
@@ -2166,7 +2166,7 @@
   MutexLocker profiler_data_lock(isolate->profiler_data_mutex());
   IsolateProfilerData* profiler_data = isolate->profiler_data();
   if (profiler_data == NULL) {
-    stream->PrintError(kProfilingDisabled, NULL);
+    stream->PrintError(kFeatureDisabled, NULL);
     return;
   }
   SampleBuffer* sample_buffer = profiler_data->sample_buffer();
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index a40c524..f571979 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -1037,10 +1037,8 @@
   enum Kind {
     kDeopt           = 1,  // Deoptimization continuation point.
     kIcCall          = kDeopt << 1,  // IC call.
-    kOptStaticCall   = kIcCall << 1,  // Call directly to known target.
-    kUnoptStaticCall = kOptStaticCall << 1,  // Call to a known target via stub.
-    kClosureCall     = kUnoptStaticCall << 1,  // Closure call.
-    kRuntimeCall     = kClosureCall << 1,  // Runtime call.
+    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,
     kLastKind        = kOther,
@@ -1700,12 +1698,16 @@
     return reinterpret_cast<RawObject**>(&ptr()->type_arguments_);
   }
   RawTypeArguments* type_arguments_;
-  RawInstance* cme_mark_;
+  RawTypedData* index_;
+  RawSmi* hash_mask_;
   RawArray* data_;
+  RawSmi* used_data_;
+  RawSmi* deleted_keys_;
   RawObject** to() {
-    return reinterpret_cast<RawObject**>(&ptr()->data_);
+    return reinterpret_cast<RawObject**>(&ptr()->deleted_keys_);
   }
 
+
   friend class SnapshotReader;
 };
 
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index 838145c..27ec70d 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -116,8 +116,6 @@
     SnapshotWriterVisitor visitor(writer);
     visitor.VisitPointers(from(), to());
   } else {
-    // Until we have maps implemented as internal VM objects we will use
-    // the collections library qualifier to allow maps to be sent across.
     if (writer->can_send_any_object() ||
         writer->AllowObjectsInDartLibrary(ptr()->library_)) {
       writer->WriteClassId(this);
@@ -2218,13 +2216,19 @@
     // we don't reach this.
     UNREACHABLE();
   } else {
-    map = LinkedHashMap::New(HEAP_SPACE(kind));
+    // Since the map might contain itself as a key or value, allocate first.
+    map = LinkedHashMap::NewUninitialized(HEAP_SPACE(kind));
   }
   reader->AddBackRef(object_id, &map, kIsDeserialized);
-  *(reader->ArrayHandle()) ^= reader->ReadObjectImpl();
-  map.SetData(*(reader->ArrayHandle()));
-  *(reader->TypeArgumentsHandle()) = reader->ArrayHandle()->GetTypeArguments();
-  map.SetTypeArguments(*(reader->TypeArgumentsHandle()));
+  // Set the object tags.
+  map.set_tags(tags);
+  // Read and set the fields.
+  intptr_t num_flds = (map.raw()->to() - map.raw()->from());
+  for (intptr_t i = 0; i <= num_flds; i++) {
+    (*reader->PassiveObjectHandle()) = reader->ReadObjectRef();
+    map.StorePointer((map.raw()->from() + i),
+                     reader->PassiveObjectHandle()->raw());
+  }
   return map.raw();
 }
 
@@ -2246,10 +2250,12 @@
   writer->WriteIndexedObject(kLinkedHashMapCid);
   writer->WriteTags(writer->GetObjectTags(this));
 
-  // Write out the backing array.
-  // TODO(koda): Serialize as pairs (like ToArray) instead, to reduce space and
-  // support per-isolate salted hash codes.
-  writer->WriteObjectImpl(ptr()->data_);
+  // Write out all the object pointer fields.
+  // TODO(koda): Serialize only used parts of data_ (after compaction), to
+  // reduce space and support per-isolate salted hash codes. All allowed keys
+  // have types for which we can rehash without running Dart code.
+  SnapshotWriterVisitor visitor(writer);
+  visitor.VisitPointers(from(), to());
 }
 
 
diff --git a/runtime/vm/report.cc b/runtime/vm/report.cc
index 9c1b811..4ef7362 100644
--- a/runtime/vm/report.cc
+++ b/runtime/vm/report.cc
@@ -21,6 +21,7 @@
             "Warn on incompatibilities between vm and dart2js.");
 DEFINE_FLAG(bool, warning_as_error, false, "Treat warnings as errors.");
 
+DECLARE_FLAG(bool, always_megamorphic_calls);
 
 RawString* Report::PrependSnippet(Kind kind,
                                   const Script& script,
@@ -178,8 +179,13 @@
     // Assume an unoptimized static call. Optimization was prevented.
     CodePatcher::GetUnoptimizedStaticCallAt(caller_pc, caller_code, &ic_data);
   } else {
-    // Assume an instance call.
-    CodePatcher::GetInstanceCallAt(caller_pc, caller_code, &ic_data);
+    if (FLAG_always_megamorphic_calls) {
+      Report::JSWarningFromFrame(caller_frame, msg);
+      return;
+    } else {
+      // Assume an instance call.
+      CodePatcher::GetInstanceCallAt(caller_pc, caller_code, &ic_data);
+    }
   }
   ASSERT(!ic_data.IsNull());
   // Report warning only if not already reported at this location.
diff --git a/runtime/vm/report_test.cc b/runtime/vm/report_test.cc
index 4d99e01..24a1825 100644
--- a/runtime/vm/report_test.cc
+++ b/runtime/vm/report_test.cc
@@ -33,7 +33,7 @@
                        "\"id\":\"libraries\\/-1\\/scripts\\/Plug\","
                        "\"uri\":\"Plug\","
                        "\"_kind\":\"script\"},\"tokenPos\":0,"
-                       "\"message\":{\"type\":\"@String\"",
+                       "\"message\":{\"type\":\"@Instance\"",
                        js.ToCString());
       // Skip private _OneByteString.
       EXPECT_SUBSTRING("\"valueAsString\":\"High Voltage\"",
@@ -51,7 +51,7 @@
                    "\"id\":\"libraries\\/-1\\/scripts\\/Plug\","
                    "\"uri\":\"Plug\","
                    "\"_kind\":\"script\"},\"tokenPos\":0,"
-                   "\"message\":{\"type\":\"@String\"",
+                   "\"message\":{\"type\":\"@Instance\"",
                    trace_buffer->At(0)->message);
   // Skip private _OneByteString.
   EXPECT_SUBSTRING("\"valueAsString\":\"High Voltage\"",
@@ -62,7 +62,7 @@
                    "\"id\":\"libraries\\/-1\\/scripts\\/Plug\","
                    "\"uri\":\"Plug\","
                    "\"_kind\":\"script\"},\"tokenPos\":1,"
-                   "\"message\":{\"type\":\"@String\"",
+                   "\"message\":{\"type\":\"@Instance\"",
                    trace_buffer->At(1)->message);
   // Skip private _OneByteString.
   EXPECT_SUBSTRING("\"valueAsString\":\"Low Voltage\"",
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 4acbb78..ef3d12e 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -99,6 +99,11 @@
 }
 
 
+static void PrintSuccess(JSONStream* js) {
+  JSONObject jsobj(js);
+  jsobj.AddProperty("type", "Success");
+}
+
 static bool GetIntegerId(const char* s, intptr_t* id, int base = 10) {
   if ((s == NULL) || (*s == '\0')) {
     // Empty string.
@@ -733,9 +738,7 @@
       ActivationFrame* frame = stack->FrameAt(i);
       JSONObject jsobj(&jsarr);
       frame->PrintToJSONObject(&jsobj, full);
-      // TODO(turnidge): Implement depth differently -- differentiate
-      // inlined frames.
-      jsobj.AddProperty("depth", i);
+      jsobj.AddProperty("index", i);
     }
   }
 
@@ -764,8 +767,8 @@
     JSONObject jsobj(&js);
     {
       JSONObject event(&jsobj, "event");
-      event.AddProperty("type", "ServiceEvent");
-      event.AddProperty("eventType", "_Echo");
+      event.AddProperty("type", "Event");
+      event.AddProperty("kind", "_Echo");
       event.AddProperty("isolate", isolate);
       if (text != NULL) {
         event.AddProperty("text", text);
@@ -853,10 +856,6 @@
     return Bool::False().raw();
   } else if (strcmp(arg, "null") == 0) {
     return Object::null();
-  } else if (strcmp(arg, "not-initialized") == 0) {
-    return Object::sentinel().raw();
-  } else if (strcmp(arg, "being-initialized") == 0) {
-    return Object::transition_sentinel().raw();
   }
 
   ObjectIdRing* ring = isolate->object_id_ring();
@@ -1556,7 +1555,7 @@
 
 static const MethodParameter* evaluate_in_frame_params[] = {
   ISOLATE_PARAMETER,
-  new UIntParameter("frame", true),
+  new UIntParameter("frameIndex", true),
   new MethodParameter("expression", true),
   NULL,
 };
@@ -1564,9 +1563,9 @@
 
 static bool EvaluateInFrame(Isolate* isolate, JSONStream* js) {
   DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
-  intptr_t framePos = UIntParameter::Parse(js->LookupParam("frame"));
+  intptr_t framePos = UIntParameter::Parse(js->LookupParam("frameIndex"));
   if (framePos > stack->Length()) {
-    PrintInvalidParamError(js, "frame");
+    PrintInvalidParamError(js, "frameIndex");
     return true;
   }
   ActivationFrame* frame = stack->FrameAt(framePos);
@@ -1811,7 +1810,9 @@
   Breakpoint* bpt =
       isolate->debugger()->SetBreakpointAtLine(script_url, line);
   if (bpt == NULL) {
-    js->PrintError(kNoBreakAtLine, NULL);
+    js->PrintError(kCannotAddBreakpoint,
+                   "%s: Cannot add breakpoint at line '%s'",
+                   js->method(), line_param);
     return true;
   }
   bpt->PrintJSON(js);
@@ -1837,7 +1838,9 @@
   Breakpoint* bpt =
       isolate->debugger()->SetBreakpointAtEntry(function, false);
   if (bpt == NULL) {
-    js->PrintError(kNoBreakAtFunction, NULL);
+    js->PrintError(kCannotAddBreakpoint,
+                   "%s: Cannot add breakpoint at function '%s'",
+                   js->method(), function.ToCString());
     return true;
   }
   bpt->PrintJSON(js);
@@ -1863,7 +1866,9 @@
   Breakpoint* bpt =
       isolate->debugger()->SetBreakpointAtActivation(closure);
   if (bpt == NULL) {
-    js->PrintError(kNoBreakAtFunction, NULL);
+    js->PrintError(kCannotAddBreakpoint,
+                   "%s: Cannot add breakpoint at activation",
+                   js->method());
     return true;
   }
   bpt->PrintJSON(js);
@@ -1885,15 +1890,11 @@
   const char* bpt_id = js->LookupParam("breakpointId");
   Breakpoint* bpt = LookupBreakpoint(isolate, bpt_id);
   if (bpt == NULL) {
-    fprintf(stderr, "ERROR1");
     PrintInvalidParamError(js, "breakpointId");
     return true;
   }
   isolate->debugger()->RemoveBreakpoint(bpt->id());
-
-  // TODO(turnidge): Consider whether the 'Success' type is proper.
-  JSONObject jsobj(js);
-  jsobj.AddProperty("type", "Success");
+  PrintSuccess(js);
   return true;
 }
 
@@ -2090,28 +2091,26 @@
   const char* step_param = js->LookupParam("step");
   if (isolate->message_handler()->paused_on_start()) {
     isolate->message_handler()->set_pause_on_start(false);
-    JSONObject jsobj(js);
-    jsobj.AddProperty("type", "Success");
     {
       ServiceEvent event(isolate, ServiceEvent::kResume);
       Service::HandleEvent(&event);
     }
+    PrintSuccess(js);
     return true;
   }
   if (isolate->message_handler()->paused_on_exit()) {
     isolate->message_handler()->set_pause_on_exit(false);
-    JSONObject jsobj(js);
-    jsobj.AddProperty("type", "Success");
     // We don't send a resume event because we will be exiting.
+    PrintSuccess(js);
     return true;
   }
   if (isolate->debugger()->PauseEvent() != NULL) {
     if (step_param != NULL) {
-      if (strcmp(step_param, "into") == 0) {
+      if (strcmp(step_param, "Into") == 0) {
         isolate->debugger()->SetSingleStep();
-      } else if (strcmp(step_param, "over") == 0) {
+      } else if (strcmp(step_param, "Over") == 0) {
         isolate->debugger()->SetStepOver();
-      } else if (strcmp(step_param, "out") == 0) {
+      } else if (strcmp(step_param, "Out") == 0) {
         isolate->debugger()->SetStepOut();
       } else {
         PrintInvalidParamError(js, "step");
@@ -2119,8 +2118,7 @@
       }
     }
     isolate->Resume();
-    JSONObject jsobj(js);
-    jsobj.AddProperty("type", "Success");
+    PrintSuccess(js);
     return true;
   }
 
@@ -2138,8 +2136,7 @@
 static bool Pause(Isolate* isolate, JSONStream* js) {
   // TODO(turnidge): Don't double-interrupt the isolate here.
   isolate->ScheduleInterrupts(Isolate::kApiInterrupt);
-  JSONObject jsobj(js);
-  jsobj.AddProperty("type", "Success");
+  PrintSuccess(js);
   return true;
 }
 
@@ -2201,8 +2198,7 @@
 
 static bool ClearCpuProfile(Isolate* isolate, JSONStream* js) {
   ProfilerService::ClearSamples();
-  JSONObject jsobj(js);
-  jsobj.AddProperty("type", "Success");
+  PrintSuccess(js);
   return true;
 }
 
@@ -2289,8 +2285,8 @@
       JSONObject jsobj(&js);
       {
         JSONObject event(&jsobj, "event");
-        event.AddProperty("type", "ServiceEvent");
-        event.AddProperty("eventType", "_Graph");
+        event.AddProperty("type", "Event");
+        event.AddProperty("kind", "_Graph");
         event.AddProperty("isolate", isolate);
 
         event.AddProperty("chunkIndex", i);
@@ -2491,6 +2487,23 @@
 }
 
 
+static const MethodParameter* get_version_params[] = {
+  NO_ISOLATE_PARAMETER,
+  NULL,
+};
+
+
+static bool GetVersion(Isolate* isolate, JSONStream* js) {
+  JSONObject jsobj(js);
+  jsobj.AddProperty("type", "Version");
+  jsobj.AddProperty("major", static_cast<intptr_t>(1));
+  jsobj.AddProperty("minor", static_cast<intptr_t>(0));
+  jsobj.AddProperty("_privateMajor", static_cast<intptr_t>(0));
+  jsobj.AddProperty("_privateMinor", static_cast<intptr_t>(0));
+  return true;
+}
+
+
 class ServiceIsolateVisitor : public IsolateVisitor {
  public:
   explicit ServiceIsolateVisitor(JSONArray* jsarr)
@@ -2572,12 +2585,12 @@
     PrintMissingParamError(js, "value");
     return true;
   }
-  JSONObject jsobj(js);
   const char* error = NULL;
   if (Flags::SetFlag(flag_name, flag_value, &error)) {
-    jsobj.AddProperty("type", "Success");
+    PrintSuccess(js);
     return true;
   } else {
+    JSONObject jsobj(js);
     jsobj.AddProperty("type", "Error");
     jsobj.AddProperty("message", error);
     return true;
@@ -2585,6 +2598,32 @@
 }
 
 
+static const MethodParameter* set_library_debuggable_params[] = {
+  ISOLATE_PARAMETER,
+  new IdParameter("libraryId", true),
+  new BoolParameter("isDebuggable", true),
+  NULL,
+};
+
+
+static bool SetLibraryDebuggable(Isolate* isolate, JSONStream* js) {
+  const char* lib_id = js->LookupParam("libraryId");
+  ObjectIdRing::LookupResult lookup_result;
+  Object& obj = Object::Handle(LookupHeapObject(isolate, lib_id,
+                                                &lookup_result));
+  const bool is_debuggable =
+      BoolParameter::Parse(js->LookupParam("isDebuggable"), false);
+  if (obj.IsLibrary()) {
+    const Library& lib = Library::Cast(obj);
+    lib.set_debuggable(is_debuggable);
+    PrintSuccess(js);
+    return true;
+  }
+  PrintInvalidParamError(js, "libraryId");
+  return true;
+}
+
+
 static const MethodParameter* set_name_params[] = {
   ISOLATE_PARAMETER,
   new MethodParameter("name", true),
@@ -2598,8 +2637,7 @@
     ServiceEvent event(isolate, ServiceEvent::kIsolateUpdate);
     Service::HandleEvent(&event);
   }
-  JSONObject jsobj(js);
-  jsobj.AddProperty("type", "Success");
+  PrintSuccess(js);
   return true;
 }
 
@@ -2664,6 +2702,8 @@
     get_tag_profile_params },
   { "_getTypeArgumentsList", GetTypeArgumentsList,
     get_type_arguments_list_params },
+  { "getVersion", GetVersion,
+    get_version_params },
   { "getVM", GetVM,
     get_vm_params },
   { "_getVMMetric", GetVMMetric,
@@ -2680,6 +2720,8 @@
     request_heap_snapshot_params },
   { "_setFlag", SetFlag,
     set_flags_params },
+  { "setLibraryDebuggable", SetLibraryDebuggable,
+    set_library_debuggable_params },
   { "setName", SetName,
     set_name_params },
 };
diff --git a/runtime/vm/service/service.md b/runtime/vm/service/service.md
index 93e1ed6..005a771 100644
--- a/runtime/vm/service/service.md
+++ b/runtime/vm/service/service.md
@@ -38,10 +38,10 @@
 	- [removeBreakpoint](#removebreakpoint)
 	- [resume](#resume)
 	- [setName](#setname)
+	- [setLibraryDebuggable](#setlibrarydebuggable)
 	- [streamCancel](#streamcancel)
 	- [streamListen](#streamlisten)
 - [Public Types](#public-types)
-	- [Bool](#bool)
 	- [BoundField](#boundfield)
 	- [BoundVariable](#boundvariable)
 	- [Breakpoint](#breakpoint)
@@ -49,35 +49,28 @@
 	- [ClassList](#classlist)
 	- [Code](#code)
 	- [CodeKind](#codekind)
-	- [Double](#double)
 	- [Error](#error)
 	- [Event](#event)
-	- [EventType](#eventtype)
+	- [EventKind](#eventkind)
 	- [Field](#field)
 	- [Flag](#flag)
 	- [FlagList](#flaglist)
-	- [FlagType](#flagtype)
 	- [Frame](#frame)
 	- [Function](#function)
-	- [FunctionKind](#functionkind)
 	- [Instance](#instance)
-	- [Int](#int)
 	- [Isolate](#isolate)
 	- [Library](#library)
-	- [List](#list)
+	- [LibraryDependency](#librarydependency)
 	- [ListElement](#listelement)
 	- [Message](#message)
 	- [Null](#null)
 	- [Object](#object)
 	- [Sentinel](#sentinel)
-	- [SentinelType](#sentineltype)
+	- [SentinelKind](#sentinelkind)
 	- [Script](#script)
-	- [ScriptKind](#scriptkind)
 	- [Stack](#stack)
 	- [StepOption](#stepoption)
-	- [String](#string)
 	- [Success](#success)
-	- [Type](#type)
 	- [TypeArguments](#typearguments)
 	- [Response](#response)
 	- [Version](#version)
@@ -155,7 +148,7 @@
 {
   "json-rpc": "2.0",
   "error": {
-    "code": 101,
+    "code": 103,
     "message": "Stream already subscribed",
     "data": {
       "details": "The stream 'GC' is already subscribed"
@@ -170,12 +163,14 @@
 
 code | message | meaning
 ---- | ------- | -------
-100 | Invalid stream | An invalid _streamId_ parameter was provided
-101 | Stream already subscribed | The client is already subscribed to the specified _streamId_
-102 | Stream not subscribed | The client is not subscribed to the specified _streamId_
-200 | VM must be paused | This operation is only valid when the VM is paused
-201 | Cannot set breakpoint | The VM is unable to set a breakpoint at the specified line or function
-300 | Profiling is disabled | The operation is unable to complete because profiling is disabled
+100 | Feature is disabled | The operation is unable to complete because a feature is disabled
+101 | VM must be paused | This operation is only valid when the VM is paused
+102 | Cannot add breakpoint | The VM is unable to add a breakpoint at the specified line or function
+103 | Stream already subscribed | The client is already subscribed to the specified _streamId_
+104 | Stream not subscribed | The client is not subscribed to the specified _streamId_
+
+
+
 
 ## Events
 
@@ -195,7 +190,7 @@
 {
   "event": {
     "type": "Event",
-    "eventType": "IsolateExit",
+    "kind": "IsolateExit",
     "isolate": {
       "type": "@Isolate",
       "id": "isolates/33",
@@ -307,6 +302,13 @@
 in a _backwards compatible_ way.  An example of a backwards compatible
 change is adding a property to a result.
 
+Certain changes that would normally not be backwards compatible are
+considered backwards compatible for the purposes of versioning.
+Specifically, additions can be made to the [EventKind](#eventkind) and
+[InstanceKind](#instancekind) enumerated types and the client must
+handle this gracefully.  See the notes on these enumerated types for more
+information.
+
 ## Private RPCs, Types, and Properties
 
 Any RPC, type, or property which begins with an underscore is said to
@@ -366,7 +368,7 @@
 The _addBreakpoint_ RPC is used to add a breakpoint at a specific line
 of some script.
 
-If no breakpoint is possible at that line, the _201_ (Cannot set
+If no breakpoint is possible at that line, the _102_ (Cannot add
 breakpoint) error code is returned.
 
 Note that breakpoints are added and removed on a per-isolate basis.
@@ -382,7 +384,7 @@
 The _addBreakpointAtEntry_ RPC is used to add a breakpoint at the
 entrypoint of some function.
 
-If no breakpoint is possible at the function entry, the _201_ (Cannot set
+If no breakpoint is possible at the function entry, the _102_ (Cannot add
 breakpoint) error code is returned.
 
 See [Breakpoint](#breakpoint).
@@ -420,13 +422,14 @@
 
 ```
 @Instance|@Error evaluateInFrame(string isolateId,
-                                 int frame,
+                                 int frameIndex,
                                  string expression)
 ```
 
-The _evaluateInFrame_ RPC is used to evaluate an expression in the context of
-a particular stack frame.  _frame_ is the index of the desired [Frame](#frame),
-with an index of _0_ indicating the top (most recent) frame.
+The _evaluateInFrame_ RPC is used to evaluate an expression in the
+context of a particular stack frame.  _frameIndex_ is the index of the
+desired [Frame](#frame), with an index of _0_ indicating the top (most
+recent) frame.
 
 If an error occurs while evaluating the expression, an [@Error](#error)
 reference will be returned.
@@ -548,9 +551,9 @@
 
 step | meaning
 ---- | -------
-into | Single step, entering function calls
-over | Single step, skipping over function calls
-out | Single step until the current function exits
+Into | Single step, entering function calls
+Over | Single step, skipping over function calls
+Out | Single step until the current function exits
 
 See [Success](#success), [StepOption](#StepOption).
 
@@ -565,6 +568,19 @@
 
 See [Success](#success).
 
+### setLibraryDebuggable
+
+```
+Success setLibraryDebuggable(string isolateId,
+                             string libraryId,
+                             bool isDebuggable)
+```
+
+The _setLibraryDebuggable_ RPC is used to enable or disable whether
+breakpoints and stepping work for a given library.
+
+See [Success](#success).
+
 ### streamCancel
 
 ```
@@ -573,7 +589,7 @@
 
 The _streamCancel_ RPC cancels a stream subscription in the VM.
 
-If the client is not subscribed to the stream, the _102_ (Stream not
+If the client is not subscribed to the stream, the _104_ (Stream not
 subscribed) error code is returned.
 
 See [Success](#success).
@@ -587,7 +603,7 @@
 The _streamListen_ RPC subscribes to a stream in the VM.  Once
 subscribed, the client will begin receiving events from the stream.
 
-If the client is not subscribed to the stream, the _101_ (Stream already
+If the client is not subscribed to the stream, the _103_ (Stream already
 subscribed) error code is returned.
 
 The _streamId_ parameter may have the following published values:
@@ -679,26 +695,6 @@
 This means that _PermittedValues_ is a _string_ with two potential values,
 _Value1_ and _Value2_.
 
-### Bool
-
-```
-class @Bool extends @Instance {
-  // The value of this bool as a string, either 'true' or 'false'.
-  string valueAsString;
-}
-```
-
-_@Bool_ is a reference to a _Bool_.
-
-```
-class Bool extends Instance {
-  // The value of this bool as a string, either 'true' or 'false'.
-  string valueAsString;
-}
-```
-
-An _Bool_ represents an instance of the Dart language class _bool_.
-
 ### BoundField
 
 ```
@@ -859,30 +855,25 @@
 }
 ```
 
-### Double
+### Context
 
 ```
-class @Double extends @Instance {
-  // The value of this double as a string.
-  //
-  // Suitable for passing to double.parse().
-  string valueAsString;
+class @Context {
+  // The number of variables in this context.
+  int length;
 }
 ```
 
-_@Double_ is a reference to a _Double_.
-
 ```
-class Double extends Instance {
-  // The value of this double as a string.
-  //
-  // Suitable for passing to double.parse().
-  string valueAsString;
+class Context {
+  // The number of variables in this context.
+  int length;
+
+  // The variables in this context object.
+  ListElement[] variables;
 }
 ```
 
-A _Double_ represents an instance of the Dart language class _double_.
-
 ### Error
 
 ```
@@ -924,14 +915,14 @@
 ```
 class Event extends Response {
   // What kind of event is this?
-  EventType eventType;
+  EventKind kind;
 
   // The isolate with which this event is associated.
   @Isolate isolate;
 
   // The breakpoint associated with this event, if applicable.
   //
-  // This is provided for the events:
+  // This is provided for the event kinds:
   //   PauseBreakpoint
   //   BreakpointAdded
   //   BreakpointRemoved
@@ -940,7 +931,7 @@
 
   // The top stack frame associated with this event, if applicable.
   //
-  // This is provided for the events:
+  // This is provided for the event kinds:
   //   PauseBreakpoint
   //   PauseInterrupted
   //   PauseException
@@ -962,10 +953,10 @@
 
 For more information, see [events](#events).
 
-### EventType
+### EventKind
 
 ```
-enum EventType {
+enum EventKind {
   // Notification that a new isolate has started.
   IsolateStart,
 
@@ -974,7 +965,7 @@
 
   // Notification that isolate identifying information has changed.
   // Currently used to notify of changes to the isolate debugging name
-  // via <code>setName</code>.
+  // via setName.
   IsolateUpdate,
 
   // An isolate has paused at start, before executing code.
@@ -986,7 +977,7 @@
   // An isolate has paused at a breakpoint or due to stepping.
   PauseBreakpoint,
 
-  // An isolate has paused due to interruption via <code>pause</code>.
+  // An isolate has paused due to interruption via pause.
   PauseInterrupted,
 
   // An isolate has paused due to an exception.
@@ -1009,6 +1000,9 @@
 }
 ```
 
+Adding new values to _EventKind_ is considered a backwards compatible
+change.  Clients should ignore unrecognized events.
+
 ### Field
 
 ```
@@ -1031,9 +1025,6 @@
 
   // Is this field static?
   bool static;
-
-  // The value of this field, if the field is static.
-  @Instance value [optional];
 }
 ```
 
@@ -1061,7 +1052,7 @@
   bool static;
 
   // The value of this field, if the field is static.
-  @Instance value [optional];
+  @Instance staticValue [optional];
 
   // The script containing this feild.
   @Script script [optional];
@@ -1085,9 +1076,6 @@
   // A description of the flag.
   string comment;
 
-  // The type of the flag.
-  FlagType flagType;
-
   // The value of this flag as a string.
   //
   // If this property is absent, then the value of the flag was NULL.
@@ -1111,19 +1099,6 @@
 
 A _FlagList_ represents the complete set of VM command line flags.
 
-### FlagType
-
-```
-enum FlagType {
-  bool,
-  int,
-  uint64_t,
-  string
-}
-```
-
-A _FlagType_ indicates the type of a VM command line flag.
-
 ### Frame
 
 ```
@@ -1148,8 +1123,12 @@
   // Function.
   @Library|@Class|@Function owner;
 
-  // What kind of function is this?
-  FunctionKind kind;
+  // Is this function static?
+  bool static
+
+  // Is this function const?
+  bool const;
+
 }
 ```
 
@@ -1166,15 +1145,6 @@
   // Function.
   @Library|@Class|@Function owner;
 
-  // What kind of function is this?
-  FunctionKind kind;
-
-  // Is this function static?
-  bool static
-
-  // Is this function const?
-  bool const;
-
   // The script containing this function.
   @Script script [optional];
 
@@ -1191,38 +1161,53 @@
 
 A _Function_ represents a Dart language function.
 
-### FunctionKind
-
-```
-enum FunctionKind {
-  RegularFunction,
-  ClosureFunction,
-  GetterFunction,
-  SetterFunction,
-  Constructor,
-  ImplicitGetter,
-  ImplicitSetter,
-  ImplicitStaticFinalGetter,
-  IrregexpFunction,
-  StaticInitializer,
-  MethodExtractor,
-  NoSuchMethodDispatcher,
-  InvokeFieldDispatcher,
-  Collected,
-  Native,
-  Stub,
-  Tag
-}
-```
-
-TODO: Do we need to expose all of this?
-
 ### Instance
 
 ```
 class @Instance extends @Object {
+  // What kind of instance is this?
+  InstanceKind kind;
+
   // Instance references include their class.
   @Class class;
+
+  // The value of this instance as a string.
+  //
+  // Provided for the instance kinds:
+  //   Null (null)
+  //   Bool (true or false)
+  //   Double (suitable for passing to Double.parse())
+  //   Int (suitable for passing to int.parse())
+  //   String (value may be truncated)
+  string valueAsString [optional];
+
+  // The valueAsString for String references may be truncated.  If so,
+  // this property is added with the value 'true'.
+  bool valueAsStringIsTruncated [optional];
+
+  // The length of a List instance.
+  //
+  // Provided for instance kinds:
+  //   List
+  int length [optional];
+
+  // The name of a Type instance.
+  //
+  // Provided for instance kinds:
+  //   Type
+  string name [optional];
+
+  // The corresponding Class if this Type is canonical.
+  //
+  // Provided for instance kinds:
+  //   Type
+  @Class typeClass [optional];
+
+  // The parameterized class of a type parameter:
+  //
+  // Provided for instance kinds:
+  //   TypeParameter
+  @Class parameterizedClass [optional];
 }
 ```
 
@@ -1230,35 +1215,183 @@
 
 ```
 class Instance extends Object {
+  // What kind of instance is this?
+  InstanceKind kind;
+
+  // Instance references include their class.
+  @Class class;
+
+  // The value of this instance as a string.
+  //
+  // Provided for the instance kinds:
+  //   Bool (true or false)
+  //   Double (suitable for passing to Double.parse())
+  //   Int (suitable for passing to int.parse())
+  //   String (value may be truncated)
+  string valueAsString [optional];
+
+  // The valueAsString for String references may be truncated.  If so,
+  // this property is added with the value 'true'.
+  bool valueAsStringIsTruncated [optional];
+
+  // The length of a List instance.
+  //
+  // Provided for instance kinds:
+  //   List
+  int length [optional];
+
+  // The name of a Type instance.
+  //
+  // Provided for instance kinds:
+  //   Type
+  string name [optional];
+
+  // The corresponding Class if this Type is canonical.
+  //
+  // Provided for instance kinds:
+  //   Type
+  @Class typeClass [optional];
+
+  // The parameterized class of a type parameter:
+  //
+  // Provided for instance kinds:
+  //   TypeParameter
+  @Class parameterizedClass [optional];
+
+  // The fields of this Instance.
   BoundField fields [optional];
+
+  // The elements of a List instance.
+  //
+  // Provided for instance kinds:
+  //   List
+  ListElement[] elements [optional];
+
+  // The function associated with a Closure instance.
+  //
+  // Provided for instance kinds:
+  //   Closure
+  @Function closureFunction [optional];
+
+  // The context associated with a Closure instance.
+  //
+  // Provided for instance kinds:
+  //   Closure
+  @Function closureContext [optional];
+
+  // The referent of a MirrorReference instance.
+  //
+  // Provided for instance kinds:
+  //   MirrorReference
+  @Instance mirrorReferent [optional];
+  
+  // The key for a WeakProperty instance.
+  //
+  // Provided for instance kinds:
+  //   WeakProperty
+  @Instance propertyKey [optional];
+  
+  // The key for a WeakProperty instance.
+  //
+  // Provided for instance kinds:
+  //   WeakProperty
+  @Instance propertyValue [optional];
+
+  // The type arguments for this type.
+  //
+  // Provided for instance kinds:
+  //   Type
+  @TypeArguments typeArguments [optional];
+
+  // The index of a TypeParameter instance.
+  //
+  // Provided for instance kinds:
+  //   TypeParameter
+  int parameterIndex [optional];
+
+  // The type bounded by a BoundedType instance
+  // or
+  // The referent of a TypeRef instance.
+  //
+  // The value will always be one of:
+  // Type, TypeRef, TypeParameter, BoundedType.
+  //
+  // Provided for instance kinds:
+  //   BoundedType
+  //   TypeRef
+  @Instance type [optional];
+
+  // The bound of a TypeParameter or BoundedType.
+  //
+  // The value will always be one of:
+  // Type, TypeRef, TypeParameter, BoundedType.
+  //
+  // Provided for instance kinds:
+  //   BoundedType
+  //   TypeParameter
+  @Instance bound [optional];
 }
 ```
 
 An _Instance_ represents an instance of the Dart language class _Object_.
 
-### Int
+### InstanceKind
 
 ```
-class @Int extends @Instance {
-  // The value of this int as a string.
-  //
-  // Suitable for passing to int.parse().
-  string valueAsString;
+enum {
+  // A general instance of the Dart class Object.
+  PlainInstance,
+
+  // null instance.
+  Null,
+
+  // true or false.
+  Bool,
+
+  // An instance of the Dart class double.
+  Double,
+
+  // An instance of the Dart class int.
+  Int,
+
+  // An instance of the Dart class String.
+  String,
+
+  // An instance of the built-in VM List implementation.  User-defined
+  // Lists will be PlainInstance.
+  List,
+
+  // An instance of the built-in VM Map implementation.  User-defined
+  // Maps will be PlainInstance.
+  Map,
+
+  // An instance of the built-in VM Closure implementation.  User-defined
+  // Closures will be PlainInstance.
+  Closure,
+
+  // An instance of the Dart class MirrorReference.
+  MirrorReference,
+
+  // An instance of the Dart class WeakProperty.
+  WeakProperty,
+
+  // An instance of the Dart class Type
+  Type,
+
+  // An instance of the Dart class TypeParamer
+  TypeParameter,
+
+  // An instance of the Dart class TypeRef
+  TypeRef,
+
+  // An instance of the Dart class BoundedType
+  BoundedType,
 }
 ```
 
-_@Int_ is a reference to an _Int_.
-
-```
-class Int extends Instance {
-  // The value of this int as a string.
-  //
-  // Suitable for passing to int.parse().
-  string valueAsString;
-}
-```
-
-An _Int_ represents an instance of the Dart language class _int_.
+Adding new values to _InstanceKind_ is considered a backwards
+compatible change.  Clients should treat unrecognized instance kinds
+as _PlainInstance_.
 
 ### Isolate
 
@@ -1345,8 +1478,11 @@
   // The uri of this library.
   string uri;
 
+  // Is this library debuggable?  Default true.
+  bool debuggable;
+
   // A list of the imports for this library.
-  @Library[] imports;
+  LibraryDependency[] dependencies;
 
   // A list of the scripts which constitute this library.
   @Script[] scripts;
@@ -1364,29 +1500,27 @@
 
 A _Library_ provides information about a Dart language library.
 
-### List
+See [setLibraryDebuggable](#setlibrarydebuggable).
+
+### LibraryDependency
 
 ```
-class @List extends @Instance {
-  // The length of this list.
-  int length;
+class LibraryDependency {
+  // Is this dependency an import (rather than an export)?
+  bool isImport;
+
+  // Is this dependency deferred?
+  bool isDeferred;
+
+  // The prefix of an 'as' import, or null.
+  String prefix;
+
+  // The library being imported or exported.
+  @Library target;
 }
 ```
 
-_@List_ is a reference to a _List_.
-
-```
-class List extends Instance {
-  // The length of this list.
-  int length;
-
-  // The elements of this list.
-  ListElement[] elements;
-}
-```
-
-A _List_ represents an built-in instance of the Dart class _List_.
-User-defined lists will be represented as _Instance_.
+A _LibraryDependency_ provides information about an import or export.
 
 ### ListElement
 
@@ -1405,7 +1539,6 @@
   string name;
   string messageObjectId;
   int size;
-  int priority;
   @Function handlerFunction [optional];
   @Script handleScript [optional];
   int handlerTokenPos [optional];
@@ -1469,7 +1602,7 @@
 ```
 class Sentinel extends Response {
   // What kind of sentinel is this?
-  SentinelType sentinelType;
+  SentinelKind kind;
 
   // A reasonable string representation of this sentinel.
   string valueAsString;
@@ -1481,10 +1614,10 @@
 We use a _Sentinel_ instead of an [error](#errors) for these cases because
 they do not represent a problematic condition.  They are normal.
 
-### SentinelType
+### SentinelKind
 
 ```
-enum SentinelType {
+enum SentinelKind {
   // Indicates that the object referred to has been collected by the GC.
   Collected,
 
@@ -1498,11 +1631,17 @@
   BeingInitialized,
 
   // Indicates that a variable has been eliminated by the optimizing compiler.
-  OptimizedOut
+  OptimizedOut,
+
+  // Reserved for future use.
+  Free,
 }
 ```
 
-A _SentinelType_ is used to distinguish different kinds of _Sentinel_ objects.
+A _SentinelKind_ is used to distinguish different kinds of _Sentinel_ objects.
+
+Adding new values to _SentinelKind_ is considered a backwards
+compatible change.  Clients must handle this gracefully.
 
 ### Script
 
@@ -1564,51 +1703,14 @@
 
 ```
 enum StepOption {
-  into,
-  over,
-  out
+  Into,
+  Over,
+  Out
 }
 ```
 
 A _StepOption_ indicates which form of stepping is requested in a [resume](#resume) RPC.
 
-### String
-
-```
-class @String extends @Instance {
-  // The value of this double as a string.
-  //
-  // Note that this may be truncated.
-  //
-  // Suitable for passing to double.parse().
-  string valueAsString;
-
-  // The valueAsString for String references may be truncated.  If so,
-  // this property is added with the value 'true'.
-  bool valueAsStringIsTruncated [optional];
-}
-```
-
-_@String_ is a reference to a _String_.
-
-```
-class String extends Instance {
-  // The value of this double as a string.
-  //
-  // Note that this will never be truncated.
-  //
-  // Suitable for passing to double.parse().
-  string valueAsString;
-}
-```
-
-An _String_ represents an instance of the Dart language class _String_.
-
-The _valueAsString_ property for an _@String_ may be truncated.  To get
-the untruncated _valueAsString_, call the [getObject](#getobject) RPC
-on the String's _id_.  A _String_ object never truncates the
-_valueAsString_.
-
 ### Success
 
 ```
@@ -1618,35 +1720,6 @@
 
 The _Success_ type is used to indicate that an operation completed successfully.
 
-### Type
-
-```
-class @Type extends @Instance {
-  // The name of this type.
-  string name;
-
-  // The corresponding Class if this Type is canonical.
-  @Class typeClass [optional];
-}
-```
-
-_@Type_ is a reference to a _Type_.
-
-```
-class Type extends Instance {
-  // The name of this type.
-  string name;
-
-  // The corresponding Class if this Type is canonical.
-  @Class typeClass [optional];
-
-  // The type arguments for this type.
-  @TypeArguments typeArgs [optional];
-}
-```
-
-An _Type_ represents an instance of the Dart language class _Type_.
-
 ### TypeArguments
 
 ```
diff --git a/runtime/vm/service_event.cc b/runtime/vm/service_event.cc
index 070125d..a60ca8b 100644
--- a/runtime/vm/service_event.cc
+++ b/runtime/vm/service_event.cc
@@ -93,8 +93,8 @@
 
 void ServiceEvent::PrintJSON(JSONStream* js) const {
   JSONObject jsobj(js);
-  jsobj.AddProperty("type", "ServiceEvent");
-  jsobj.AddProperty("eventType", EventTypeToCString(type()));
+  jsobj.AddProperty("type", "Event");
+  jsobj.AddProperty("kind", EventTypeToCString(type()));
   jsobj.AddProperty("isolate", isolate());
   if (breakpoint() != NULL) {
     jsobj.AddProperty("breakpoint", breakpoint());
@@ -102,6 +102,8 @@
   if (top_frame() != NULL) {
     JSONObject jsFrame(&jsobj, "topFrame");
     top_frame()->PrintToJSONObject(&jsFrame);
+    intptr_t index = 0;  // Avoid ambiguity in call to AddProperty.
+    jsFrame.AddProperty("index", index);
   }
   if (exception() != NULL) {
     jsobj.AddProperty("exception", *(exception()));
diff --git a/runtime/vm/service_test.cc b/runtime/vm/service_test.cc
index f6a20a1..5356581 100644
--- a/runtime/vm/service_test.cc
+++ b/runtime/vm/service_test.cc
@@ -245,9 +245,8 @@
                       address);
   Service::HandleIsolateMessage(isolate, service_msg);
   handler.HandleNextMessage();
-  EXPECT_SUBSTRING("{\"type\":\"null\",\"fixedId\":true,"
-                   "\"id\":\"objects\\/null\","
-                   "\"valueAsString\":\"null\"",
+  // TODO(turnidge): It is pretty broken to return an Instance here.  Fix.
+  EXPECT_SUBSTRING("\"kind\":\"Null\"",
                    handler.msg());
 
   // Request malformed native code.
@@ -467,9 +466,10 @@
     service_msg = Eval(lib, buf);
     Service::HandleIsolateMessage(isolate, service_msg);
     handler.HandleNextMessage();
-    EXPECT_SUBSTRING(ref ? "\"type\":\"@String\"" :
-                           "\"type\":\"String\"",
+    EXPECT_SUBSTRING(ref ? "\"type\":\"@Instance\"" :
+                           "\"type\":\"Instance\"",
                      handler.msg());
+    EXPECT_SUBSTRING("\"kind\":\"String\"", handler.msg());
     EXPECT_SUBSTRING("foobar", handler.msg());
   }
   // Expect null when no object is found.
diff --git a/runtime/vm/signal_handler_android.cc b/runtime/vm/signal_handler_android.cc
index bbde84d..cc42e69 100644
--- a/runtime/vm/signal_handler_android.cc
+++ b/runtime/vm/signal_handler_android.cc
@@ -12,13 +12,13 @@
 uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) {
   uintptr_t pc = 0;
 
-#if defined(TARGET_ARCH_ARM)
+#if defined(HOST_ARCH_ARM)
   pc = static_cast<uintptr_t>(mcontext.arm_pc);
-#elif defined(TARGET_ARCH_ARM64)
+#elif defined(HOST_ARCH_ARM64)
   pc = static_cast<uintptr_t>(mcontext.pc);
 #else
-  UNIMPLEMENTED();
-#endif  // TARGET_ARCH_...
+#error Unsupported architecture.
+#endif  // HOST_ARCH_...
   return pc;
 }
 
@@ -26,13 +26,13 @@
 uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) {
   uintptr_t fp = 0;
 
-#if defined(TARGET_ARCH_ARM)
+#if defined(HOST_ARCH_ARM)
   fp = static_cast<uintptr_t>(mcontext.arm_fp);
-#elif defined(TARGET_ARCH_ARM64)
+#elif defined(HOST_ARCH_ARM64)
   fp = static_cast<uintptr_t>(mcontext.regs[29]);
 #else
-  UNIMPLEMENTED();
-#endif  // TARGET_ARCH_...
+#error Unsupported architecture.
+#endif  // HOST_ARCH_...
 
   return fp;
 }
@@ -41,13 +41,13 @@
 uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) {
   uintptr_t sp = 0;
 
-#if defined(TARGET_ARCH_ARM)
+#if defined(HOST_ARCH_ARM)
   sp = static_cast<uintptr_t>(mcontext.arm_sp);
-#elif defined(TARGET_ARCH_ARM64)
+#elif defined(HOST_ARCH_ARM64)
   sp = static_cast<uintptr_t>(mcontext.sp);
 #else
-  UNIMPLEMENTED();
-#endif  // TARGET_ARCH_...
+#error Unsupported architecture.
+#endif  // HOST_ARCH_...
   return sp;
 }
 
@@ -55,26 +55,26 @@
 uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) {
   uintptr_t sp = 0;
 
-#if defined(TARGET_ARCH_ARM)
+#if defined(HOST_ARCH_ARM)
   sp = static_cast<uintptr_t>(mcontext.arm_sp);
-#elif defined(TARGET_ARCH_ARM64)
+#elif defined(HOST_ARCH_ARM64)
   sp = static_cast<uintptr_t>(mcontext.regs[18]);
 #else
-  UNIMPLEMENTED();
-#endif  // TARGET_ARCH_...
+#error Unsupported architecture.
+#endif  // HOST_ARCH_...
   return sp;
 }
 
 
 uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) {
   uintptr_t lr = 0;
-#if defined(TARGET_ARCH_ARM)
+#if defined(HOST_ARCH_ARM)
   lr = static_cast<uintptr_t>(mcontext.arm_lr);
-#elif defined(TARGET_ARCH_ARM64)
+#elif defined(HOST_ARCH_ARM64)
   lr = static_cast<uintptr_t>(mcontext.regs[30]);
 #else
-  UNIMPLEMENTED();
-#endif  // TARGET_ARCH_...
+#error Unsupported architecture.
+#endif  // HOST_ARCH_...
   return lr;
 }
 
diff --git a/runtime/vm/signal_handler_linux.cc b/runtime/vm/signal_handler_linux.cc
index 2d7b74d..45fa50d 100644
--- a/runtime/vm/signal_handler_linux.cc
+++ b/runtime/vm/signal_handler_linux.cc
@@ -12,25 +12,19 @@
 uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) {
   uintptr_t pc = 0;
 
-#if defined(TARGET_ARCH_IA32)
+#if defined(HOST_ARCH_IA32)
   pc = static_cast<uintptr_t>(mcontext.gregs[REG_EIP]);
-#elif defined(TARGET_ARCH_X64)
+#elif defined(HOST_ARCH_X64)
   pc = static_cast<uintptr_t>(mcontext.gregs[REG_RIP]);
-#elif defined(TARGET_ARCH_MIPS) && defined(USING_SIMULATOR)
-  pc = static_cast<uintptr_t>(mcontext.gregs[REG_EIP]);
-#elif defined(TARGET_ARCH_ARM) && defined(USING_SIMULATOR)
-  pc = static_cast<uintptr_t>(mcontext.gregs[REG_EIP]);
-#elif defined(TARGET_ARCH_ARM64) && defined(USING_SIMULATOR)
-  pc = static_cast<uintptr_t>(mcontext.gregs[REG_RIP]);
-#elif defined(TARGET_ARCH_ARM)
+#elif defined(HOST_ARCH_ARM)
   pc = static_cast<uintptr_t>(mcontext.arm_pc);
-#elif defined(TARGET_ARCH_ARM64)
+#elif defined(HOST_ARCH_ARM64)
   pc = static_cast<uintptr_t>(mcontext.pc);
-#elif defined(TARGET_ARCH_MIPS)
+#elif defined(HOST_ARCH_MIPS)
   pc = static_cast<uintptr_t>(mcontext.pc);
 #else
-  UNIMPLEMENTED();
-#endif  // TARGET_ARCH_...
+#error Unsupported architecture.
+#endif  // HOST_ARCH_...
   return pc;
 }
 
@@ -38,25 +32,19 @@
 uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) {
   uintptr_t fp = 0;
 
-#if defined(TARGET_ARCH_IA32)
+#if defined(HOST_ARCH_IA32)
   fp = static_cast<uintptr_t>(mcontext.gregs[REG_EBP]);
-#elif defined(TARGET_ARCH_X64)
+#elif defined(HOST_ARCH_X64)
   fp = static_cast<uintptr_t>(mcontext.gregs[REG_RBP]);
-#elif defined(TARGET_ARCH_MIPS) && defined(USING_SIMULATOR)
-  fp = static_cast<uintptr_t>(mcontext.gregs[REG_EBP]);
-#elif defined(TARGET_ARCH_ARM) && defined(USING_SIMULATOR)
-  fp = static_cast<uintptr_t>(mcontext.gregs[REG_EBP]);
-#elif defined(TARGET_ARCH_ARM64) && defined(USING_SIMULATOR)
-  fp = static_cast<uintptr_t>(mcontext.gregs[REG_RBP]);
-#elif defined(TARGET_ARCH_ARM)
+#elif defined(HOST_ARCH_ARM)
   fp = static_cast<uintptr_t>(mcontext.arm_fp);
-#elif defined(TARGET_ARCH_ARM64)
+#elif defined(HOST_ARCH_ARM64)
   fp = static_cast<uintptr_t>(mcontext.regs[29]);
-#elif defined(TARGET_ARCH_MIPS)
+#elif defined(HOST_ARCH_MIPS)
   fp = static_cast<uintptr_t>(mcontext.gregs[30]);
 #else
-  UNIMPLEMENTED();
-#endif  // TARGET_ARCH_...
+#error Unsupported architecture.
+#endif  // HOST_ARCH_...
 
   return fp;
 }
@@ -65,25 +53,19 @@
 uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) {
   uintptr_t sp = 0;
 
-#if defined(TARGET_ARCH_IA32)
+#if defined(HOST_ARCH_IA32)
   sp = static_cast<uintptr_t>(mcontext.gregs[REG_ESP]);
-#elif defined(TARGET_ARCH_X64)
+#elif defined(HOST_ARCH_X64)
   sp = static_cast<uintptr_t>(mcontext.gregs[REG_RSP]);
-#elif defined(TARGET_ARCH_MIPS) && defined(USING_SIMULATOR)
-  sp = static_cast<uintptr_t>(mcontext.gregs[REG_ESP]);
-#elif defined(TARGET_ARCH_ARM) && defined(USING_SIMULATOR)
-  sp = static_cast<uintptr_t>(mcontext.gregs[REG_ESP]);
-#elif defined(TARGET_ARCH_ARM64) && defined(USING_SIMULATOR)
-  sp = static_cast<uintptr_t>(mcontext.gregs[REG_RSP]);
-#elif defined(TARGET_ARCH_ARM)
+#elif defined(HOST_ARCH_ARM)
   sp = static_cast<uintptr_t>(mcontext.arm_sp);
-#elif defined(TARGET_ARCH_ARM64)
+#elif defined(HOST_ARCH_ARM64)
   sp = static_cast<uintptr_t>(mcontext.sp);
-#elif defined(TARGET_ARCH_MIPS)
+#elif defined(HOST_ARCH_MIPS)
   sp = static_cast<uintptr_t>(mcontext.gregs[29]);
 #else
-  UNIMPLEMENTED();
-#endif  // TARGET_ARCH_...
+#error Unsupported architecture.
+#endif  // HOST_ARCH_...
   return sp;
 }
 
@@ -100,25 +82,19 @@
 uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) {
   uintptr_t lr = 0;
 
-#if defined(TARGET_ARCH_IA32)
+#if defined(HOST_ARCH_IA32)
   lr = 0;
-#elif defined(TARGET_ARCH_X64)
+#elif defined(HOST_ARCH_X64)
   lr = 0;
-#elif defined(TARGET_ARCH_MIPS) && defined(USING_SIMULATOR)
-  lr = 0;
-#elif defined(TARGET_ARCH_ARM) && defined(USING_SIMULATOR)
-  lr = 0;
-#elif defined(TARGET_ARCH_ARM64) && defined(USING_SIMULATOR)
-  lr = 0;
-#elif defined(TARGET_ARCH_ARM)
+#elif defined(HOST_ARCH_ARM)
   lr = static_cast<uintptr_t>(mcontext.arm_lr);
-#elif defined(TARGET_ARCH_ARM64)
+#elif defined(HOST_ARCH_ARM64)
   lr = static_cast<uintptr_t>(mcontext.regs[30]);
-#elif defined(TARGET_ARCH_MIPS)
+#elif defined(HOST_ARCH_MIPS)
   lr = static_cast<uintptr_t>(mcontext.gregs[31]);
 #else
-  UNIMPLEMENTED();
-#endif  // TARGET_ARCH_...
+#error Unsupported architecture.
+#endif  // HOST_ARCH_...
   return lr;
 }
 
diff --git a/runtime/vm/signal_handler_macos.cc b/runtime/vm/signal_handler_macos.cc
index 79117c2..e0a2a14 100644
--- a/runtime/vm/signal_handler_macos.cc
+++ b/runtime/vm/signal_handler_macos.cc
@@ -12,19 +12,17 @@
 uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) {
   uintptr_t pc = 0;
 
-#if defined(TARGET_ARCH_IA32)
+#if defined(HOST_ARCH_IA32)
   pc = static_cast<uintptr_t>(mcontext->__ss.__eip);
-#elif defined(TARGET_ARCH_X64)
+#elif defined(HOST_ARCH_X64)
   pc = static_cast<uintptr_t>(mcontext->__ss.__rip);
-#elif defined(TARGET_ARCH_MIPS) && defined(USING_SIMULATOR)
-  pc = static_cast<uintptr_t>(mcontext->__ss.__eip);
-#elif defined(TARGET_ARCH_ARM) && defined(USING_SIMULATOR)
-  pc = static_cast<uintptr_t>(mcontext->__ss.__eip);
-#elif defined(TARGET_ARCH_ARM64) && defined(USING_SIMULATOR)
-  pc = static_cast<uintptr_t>(mcontext->__ss.__rip);
+#elif defined(HOST_ARCH_ARM)
+  pc = static_cast<uintptr_t>(mcontext->__ss.__pc);
+#elif defined(HOST_ARCH_ARM64)
+  pc = static_cast<uintptr_t>(mcontext->__ss.__pc);
 #else
-  UNIMPLEMENTED();
-#endif  // TARGET_ARCH_...
+#error Unsuported architecture.
+#endif  // HOST_ARCH_...
 
   return pc;
 }
@@ -33,19 +31,17 @@
 uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) {
   uintptr_t fp = 0;
 
-#if defined(TARGET_ARCH_IA32)
+#if defined(HOST_ARCH_IA32)
   fp = static_cast<uintptr_t>(mcontext->__ss.__ebp);
-#elif defined(TARGET_ARCH_X64)
+#elif defined(HOST_ARCH_X64)
   fp = static_cast<uintptr_t>(mcontext->__ss.__rbp);
-#elif defined(TARGET_ARCH_MIPS) && defined(USING_SIMULATOR)
-  fp = static_cast<uintptr_t>(mcontext->__ss.__ebp);
-#elif defined(TARGET_ARCH_ARM) && defined(USING_SIMULATOR)
-  fp = static_cast<uintptr_t>(mcontext->__ss.__ebp);
-#elif defined(TARGET_ARCH_ARM64) && defined(USING_SIMULATOR)
-  fp = static_cast<uintptr_t>(mcontext->__ss.__rbp);
+#elif defined(HOST_ARCH_ARM)
+  fp = static_cast<uintptr_t>(mcontext->__ss.__r[11]);
+#elif defined(HOST_ARCH_ARM64)
+  fp = static_cast<uintptr_t>(mcontext->__ss.__fp);
 #else
-  UNIMPLEMENTED();
-#endif  // TARGET_ARCH_...
+#error Unsuported architecture.
+#endif  // HOST_ARCH_...
 
   return fp;
 }
@@ -54,19 +50,17 @@
 uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) {
   uintptr_t sp = 0;
 
-#if defined(TARGET_ARCH_IA32)
+#if defined(HOST_ARCH_IA32)
   sp = static_cast<uintptr_t>(mcontext->__ss.__esp);
-#elif defined(TARGET_ARCH_X64)
+#elif defined(HOST_ARCH_X64)
   sp = static_cast<uintptr_t>(mcontext->__ss.__rsp);
-#elif defined(TARGET_ARCH_MIPS) && defined(USING_SIMULATOR)
-  sp = static_cast<uintptr_t>(mcontext->__ss.__esp);
-#elif defined(TARGET_ARCH_ARM) && defined(USING_SIMULATOR)
-  sp = static_cast<uintptr_t>(mcontext->__ss.__esp);
-#elif defined(TARGET_ARCH_ARM64) && defined(USING_SIMULATOR)
-  sp = static_cast<uintptr_t>(mcontext->__ss.__rsp);
+#elif defined(HOST_ARCH_ARM)
+  sp = static_cast<uintptr_t>(mcontext->__ss.__sp);
+#elif defined(HOST_ARCH_ARM64)
+  sp = static_cast<uintptr_t>(mcontext->__ss.__sp);
 #else
   UNIMPLEMENTED();
-#endif  // TARGET_ARCH_...
+#endif  // HOST_ARCH_...
 
   return sp;
 }
diff --git a/runtime/vm/simulator.h b/runtime/vm/simulator.h
index 5838f7c..8a859e3 100644
--- a/runtime/vm/simulator.h
+++ b/runtime/vm/simulator.h
@@ -7,38 +7,19 @@
 
 #include "vm/globals.h"
 
-#if defined(TARGET_ARCH_IA32)
+#if defined(USING_SIMULATOR)
+#if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
 // No simulator used.
-
-#elif defined(TARGET_ARCH_X64)
-// No simulator used.
-
+#error Simulator not supported.
 #elif defined(TARGET_ARCH_ARM)
-#if defined(HOST_ARCH_ARM)
-// No simulator used.
-#else
-#define USING_SIMULATOR 1
 #include "vm/simulator_arm.h"
-#endif
-
 #elif defined(TARGET_ARCH_ARM64)
-#if defined(HOST_ARCH_ARM64)
-// No simulator used.
-#else
-#define USING_SIMULATOR 1
 #include "vm/simulator_arm64.h"
-#endif
-
 #elif defined(TARGET_ARCH_MIPS)
-#if defined(HOST_ARCH_MIPS)
-// No simulator used.
-#else
-#define USING_SIMULATOR 1
 #include "vm/simulator_mips.h"
-#endif
-
 #else
 #error Unknown architecture.
-#endif
+#endif  // defined(TARGET_ARCH_...)
+#endif  // defined(USING_SIMULATOR)
 
 #endif  // VM_SIMULATOR_H_
diff --git a/runtime/vm/simulator_arm.cc b/runtime/vm/simulator_arm.cc
index 42ae595..37d4f43 100644
--- a/runtime/vm/simulator_arm.cc
+++ b/runtime/vm/simulator_arm.cc
@@ -9,7 +9,7 @@
 #if defined(TARGET_ARCH_ARM)
 
 // Only build the simulator if not compiling for real ARM hardware.
-#if !defined(HOST_ARCH_ARM)
+#if defined(USING_SIMULATOR)
 
 #include "vm/simulator.h"
 
@@ -457,7 +457,7 @@
           uint32_t value;
           if (strcmp(arg1, "icount") == 0) {
             const uint64_t icount = sim_->get_icount();
-            OS::Print("icount: %"Pu64" 0x%"Px64"\n", icount, icount);
+            OS::Print("icount: %" Pu64 " 0x%" Px64 "\n", icount, icount);
           } else if (GetValue(arg1, &value)) {
             OS::Print("%s: %u 0x%x\n", arg1, value, value);
           } else {
@@ -3879,6 +3879,6 @@
 
 }  // namespace dart
 
-#endif  // !defined(HOST_ARCH_ARM)
+#endif  // defined(USING_SIMULATOR)
 
 #endif  // defined TARGET_ARCH_ARM
diff --git a/runtime/vm/simulator_arm.h b/runtime/vm/simulator_arm.h
index 712e679..5e0d1ed 100644
--- a/runtime/vm/simulator_arm.h
+++ b/runtime/vm/simulator_arm.h
@@ -26,12 +26,14 @@
 class SimulatorSetjmpBuffer;
 class Thread;
 
+#if !defined(SIMD_VALUE_T_)
 typedef struct {
   union {
     uint32_t u;
     float f;
   } data_[4];
 } simd_value_t;
+#endif
 
 class Simulator {
  public:
diff --git a/runtime/vm/simulator_arm64.cc b/runtime/vm/simulator_arm64.cc
index 0a8775e..c3dadd2 100644
--- a/runtime/vm/simulator_arm64.cc
+++ b/runtime/vm/simulator_arm64.cc
@@ -9,7 +9,7 @@
 #if defined(TARGET_ARCH_ARM64)
 
 // Only build the simulator if not compiling for real ARM hardware.
-#if !defined(HOST_ARCH_ARM64)
+#if defined(USING_SIMULATOR)
 
 #include "vm/simulator.h"
 
@@ -3539,6 +3539,6 @@
 
 }  // namespace dart
 
-#endif  // !defined(HOST_ARCH_ARM64)
+#endif  // !defined(USING_SIMULATOR)
 
 #endif  // defined TARGET_ARCH_ARM64
diff --git a/runtime/vm/simulator_mips.cc b/runtime/vm/simulator_mips.cc
index 684d81da..cd20f68 100644
--- a/runtime/vm/simulator_mips.cc
+++ b/runtime/vm/simulator_mips.cc
@@ -9,7 +9,7 @@
 #if defined(TARGET_ARCH_MIPS)
 
 // Only build the simulator if not compiling for real MIPS hardware.
-#if !defined(HOST_ARCH_MIPS)
+#if defined(USING_SIMULATOR)
 
 #include "vm/simulator.h"
 
@@ -2487,6 +2487,6 @@
 
 }  // namespace dart
 
-#endif  // !defined(HOST_ARCH_MIPS)
+#endif  // defined(USING_SIMULATOR)
 
 #endif  // defined TARGET_ARCH_MIPS
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index 93ca5e8..6bce497 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -188,6 +188,7 @@
       tokens_(Array::Handle(isolate)),
       stream_(TokenStream::Handle(isolate)),
       data_(ExternalTypedData::Handle(isolate)),
+      typed_data_(TypedData::Handle(isolate)),
       error_(UnhandledException::Handle(isolate)),
       max_vm_isolate_object_id_(
           Object::vm_isolate_snapshot_object_table().Length()),
@@ -595,8 +596,10 @@
                 Version::SnapshotString(),
                 actual_version);
     free(actual_version);
-    const String& msg = String::Handle(String::New(message_buffer));
-    return ApiError::New(msg);
+    // This can also fail while bringing up the VM isolate, so make sure to
+    // allocate the error message in old space.
+    const String& msg = String::Handle(String::New(message_buffer, Heap::kOld));
+    return ApiError::New(msg, Heap::kOld);
   }
   Advance(version_len);
   return ApiError::null();
@@ -2161,8 +2164,7 @@
 
 
 bool SnapshotWriter::AllowObjectsInDartLibrary(RawLibrary* library) {
-  return (library == object_store()->collection_library() ||
-          library == object_store()->typed_data_library());
+  return library == object_store()->typed_data_library();
 }
 
 
diff --git a/runtime/vm/snapshot.h b/runtime/vm/snapshot.h
index 8ce36a5..13c2ecd 100644
--- a/runtime/vm/snapshot.h
+++ b/runtime/vm/snapshot.h
@@ -77,6 +77,7 @@
 class String;
 class TokenStream;
 class TypeArguments;
+class TypedData;
 class UnhandledException;
 
 // Serialized object header encoding is as follows:
@@ -275,6 +276,7 @@
   Array* TokensHandle() { return &tokens_; }
   TokenStream* StreamHandle() { return &stream_; }
   ExternalTypedData* DataHandle() { return &data_; }
+  TypedData* TypedDataHandle() { return &typed_data_; }
   Snapshot::Kind kind() const { return kind_; }
 
   // Reads an object.
@@ -400,6 +402,7 @@
   Array& tokens_;  // Temporary tokens handle.
   TokenStream& stream_;  // Temporary token stream handle.
   ExternalTypedData& data_;  // Temporary stream data handle.
+  TypedData& typed_data_;  // Temporary typed data handle.
   UnhandledException& error_;  // Error handle.
   intptr_t max_vm_isolate_object_id_;
   ZoneGrowableArray<BackRefNode>* backward_references_;
diff --git a/runtime/vm/stub_code.h b/runtime/vm/stub_code.h
index a618111..6852f3b 100644
--- a/runtime/vm/stub_code.h
+++ b/runtime/vm/stub_code.h
@@ -68,7 +68,6 @@
   V(Deoptimize)                                                                \
   V(DeoptimizeLazy)                                                            \
   V(ICCallBreakpoint)                                                          \
-  V(ClosureCallBreakpoint)                                                     \
   V(RuntimeCallBreakpoint)                                                     \
   V(UnoptimizedIdenticalWithNumberCheck)                                       \
   V(OptimizedIdenticalWithNumberCheck)                                         \
@@ -231,7 +230,8 @@
       intptr_t num_args,
       const RuntimeEntry& handle_ic_miss,
       Token::Kind kind,
-      RangeCollectionMode range_collection_mode);
+      RangeCollectionMode range_collection_mode,
+      bool optimized = false);
   static void GenerateUsageCounterIncrement(Assembler* assembler,
                                             Register temp_reg);
   static void GenerateOptimizedUsageCounterIncrement(Assembler* assembler);
diff --git a/runtime/vm/stub_code_arm.cc b/runtime/vm/stub_code_arm.cc
index e7e6a66..08a6d0e 100644
--- a/runtime/vm/stub_code_arm.cc
+++ b/runtime/vm/stub_code_arm.cc
@@ -1336,7 +1336,8 @@
     intptr_t num_args,
     const RuntimeEntry& handle_ic_miss,
     Token::Kind kind,
-    RangeCollectionMode range_collection_mode) {
+    RangeCollectionMode range_collection_mode,
+    bool optimized) {
   ASSERT(num_args > 0);
 #if defined(DEBUG)
   { Label ok;
@@ -1353,7 +1354,7 @@
 #endif  // DEBUG
 
   Label stepping, done_stepping;
-  if (FLAG_support_debugger) {
+  if (FLAG_support_debugger && !optimized) {
     __ Comment("Check single stepping");
     __ LoadIsolate(R6);
     __ ldrb(R6, Address(R6, Isolate::single_step_offset()));
@@ -1507,7 +1508,7 @@
     __ bx(R2);
   }
 
-  if (FLAG_support_debugger) {
+  if (FLAG_support_debugger && !optimized) {
     __ Bind(&stepping);
     __ EnterStubFrame();
     __ Push(R5);  // Preserve IC data.
@@ -1600,7 +1601,7 @@
   GenerateOptimizedUsageCounterIncrement(assembler);
   GenerateNArgsCheckInlineCacheStub(assembler, 1,
       kInlineCacheMissHandlerOneArgRuntimeEntry, Token::kILLEGAL,
-      kIgnoreRanges);
+      kIgnoreRanges, true /* optimized */);
 }
 
 
@@ -1609,7 +1610,7 @@
   GenerateOptimizedUsageCounterIncrement(assembler);
   GenerateNArgsCheckInlineCacheStub(assembler, 2,
       kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kILLEGAL,
-      kIgnoreRanges);
+      kIgnoreRanges, true /* optimized */);
 }
 
 
@@ -1731,21 +1732,6 @@
 }
 
 
-// R5: Contains Smi 0 (need to preserve a GC-safe value for the lazy compile
-// stub).
-// R4: Contains an arguments descriptor.
-void StubCode::GenerateClosureCallBreakpointStub(Assembler* assembler) {
-  __ EnterStubFrame();
-  __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null()));
-  // Preserve arguments descriptor and make room for result.
-  __ PushList((1 << R0) | (1 << R4) | (1 << R5));
-  __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
-  __ PopList((1 << R0) | (1 << R4) | (1 << R5));
-  __ LeaveStubFrame();
-  __ bx(R0);
-}
-
-
 void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) {
   __ EnterStubFrame();
   __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null()));
diff --git a/runtime/vm/stub_code_arm64.cc b/runtime/vm/stub_code_arm64.cc
index e443039..af419b2 100644
--- a/runtime/vm/stub_code_arm64.cc
+++ b/runtime/vm/stub_code_arm64.cc
@@ -1380,7 +1380,8 @@
     intptr_t num_args,
     const RuntimeEntry& handle_ic_miss,
     Token::Kind kind,
-    RangeCollectionMode range_collection_mode) {
+    RangeCollectionMode range_collection_mode,
+    bool optimized) {
   ASSERT(num_args > 0);
 #if defined(DEBUG)
   { Label ok;
@@ -1398,7 +1399,7 @@
 #endif  // DEBUG
 
   Label stepping, done_stepping;
-  if (FLAG_support_debugger) {
+  if (FLAG_support_debugger && !optimized) {
     __ Comment("Check single stepping");
     __ LoadIsolate(R6, kNoPP);
     __ LoadFromOffset(
@@ -1570,7 +1571,7 @@
     __ br(R2);
   }
 
-  if (FLAG_support_debugger) {
+  if (FLAG_support_debugger && !optimized) {
     __ Bind(&stepping);
     __ EnterStubFrame();
     __ Push(R5);  // Preserve IC data.
@@ -1657,7 +1658,7 @@
   GenerateOptimizedUsageCounterIncrement(assembler);
   GenerateNArgsCheckInlineCacheStub(assembler, 1,
       kInlineCacheMissHandlerOneArgRuntimeEntry, Token::kILLEGAL,
-      kIgnoreRanges);
+      kIgnoreRanges, true /* optimized */);
 }
 
 
@@ -1666,7 +1667,7 @@
   GenerateOptimizedUsageCounterIncrement(assembler);
   GenerateNArgsCheckInlineCacheStub(assembler, 2,
       kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kILLEGAL,
-      kIgnoreRanges);
+      kIgnoreRanges, true /* optimized */);
 }
 
 
@@ -1792,23 +1793,6 @@
 }
 
 
-// R5: Contains Smi 0 (need to preserve a GC-safe value for the lazy compile
-// stub).
-// R4: Contains an arguments descriptor.
-void StubCode::GenerateClosureCallBreakpointStub(Assembler* assembler) {
-  __ EnterStubFrame();
-  __ Push(R5);
-  __ Push(R4);
-  __ PushObject(Object::null_object(), PP);  // Space for result.
-  __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
-  __ Pop(R0);
-  __ Pop(R4);
-  __ Pop(R5);
-  __ LeaveStubFrame();
-  __ br(R0);
-}
-
-
 void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) {
   __ EnterStubFrame();
   __ PushObject(Object::null_object(), PP);  // Space for result.
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index 70d03bc..5837c80 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -1293,7 +1293,8 @@
     intptr_t num_args,
     const RuntimeEntry& handle_ic_miss,
     Token::Kind kind,
-    RangeCollectionMode range_collection_mode) {
+    RangeCollectionMode range_collection_mode,
+    bool optimized) {
   ASSERT(num_args > 0);
 #if defined(DEBUG)
   { Label ok;
@@ -1310,7 +1311,7 @@
 #endif  // DEBUG
 
   Label stepping, done_stepping;
-  if (FLAG_support_debugger) {
+  if (FLAG_support_debugger && !optimized) {
     __ Comment("Check single stepping");
     uword single_step_address = reinterpret_cast<uword>(Isolate::Current()) +
         Isolate::single_step_offset();
@@ -1468,7 +1469,7 @@
     __ jmp(EBX);
   }
 
-  if (FLAG_support_debugger) {
+  if (FLAG_support_debugger && !optimized) {
     __ Bind(&stepping);
     __ EnterStubFrame();
     __ pushl(ECX);
@@ -1572,7 +1573,8 @@
   GenerateNArgsCheckInlineCacheStub(assembler, 1,
       kInlineCacheMissHandlerOneArgRuntimeEntry,
       Token::kILLEGAL,
-      kIgnoreRanges);
+      kIgnoreRanges,
+      true /* optimized */);
 }
 
 
@@ -1582,7 +1584,8 @@
   GenerateNArgsCheckInlineCacheStub(assembler, 2,
      kInlineCacheMissHandlerTwoArgsRuntimeEntry,
      Token::kILLEGAL,
-     kIgnoreRanges);
+     kIgnoreRanges,
+     true /* optimized */);
 }
 
 
@@ -1712,28 +1715,6 @@
 }
 
 
-// ECX: Contains Smi 0 (need to preserve a GC-safe value for the lazy compile
-// stub).
-// EDX: Contains an arguments descriptor.
-void StubCode::GenerateClosureCallBreakpointStub(Assembler* assembler) {
-  __ EnterStubFrame();
-  // Save arguments to original stub.
-  __ pushl(ECX);
-  __ pushl(EDX);
-  // Room for result. Debugger stub returns address of the
-  // unpatched runtime stub.
-  const Immediate& raw_null =
-      Immediate(reinterpret_cast<intptr_t>(Object::null()));
-  __ pushl(raw_null);  // Room for result.
-  __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
-  __ popl(EAX);  // Address of original stub.
-  __ popl(EDX);  // Restore arguments to original stub.
-  __ popl(ECX);
-  __ LeaveFrame();
-  __ jmp(EAX);   // Jump to original stub.
-}
-
-
 void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) {
   __ EnterStubFrame();
   // Room for result. Debugger stub returns address of the
diff --git a/runtime/vm/stub_code_mips.cc b/runtime/vm/stub_code_mips.cc
index 85a93c5..9210b45 100644
--- a/runtime/vm/stub_code_mips.cc
+++ b/runtime/vm/stub_code_mips.cc
@@ -1443,7 +1443,8 @@
     intptr_t num_args,
     const RuntimeEntry& handle_ic_miss,
     Token::Kind kind,
-    RangeCollectionMode range_collection_mode) {
+    RangeCollectionMode range_collection_mode,
+    bool optimized) {
   __ Comment("NArgsCheckInlineCacheStub");
   ASSERT(num_args > 0);
 #if defined(DEBUG)
@@ -1461,7 +1462,7 @@
 
 
   Label stepping, done_stepping;
-  if (FLAG_support_debugger) {
+  if (FLAG_support_debugger && !optimized) {
     __ Comment("Check single stepping");
     __ LoadIsolate(T0);
     __ lbu(T0, Address(T0, Isolate::single_step_offset()));
@@ -1651,7 +1652,7 @@
   }
 
   // Call single step callback in debugger.
-  if (FLAG_support_debugger) {
+  if (FLAG_support_debugger && !optimized) {
     __ Bind(&stepping);
     __ EnterStubFrame();
     __ addiu(SP, SP, Immediate(-2 * kWordSize));
@@ -1742,7 +1743,7 @@
   GenerateOptimizedUsageCounterIncrement(assembler);
   GenerateNArgsCheckInlineCacheStub(assembler, 1,
       kInlineCacheMissHandlerOneArgRuntimeEntry, Token::kILLEGAL,
-      kIgnoreRanges);
+      kIgnoreRanges, true /* optimized */);
 }
 
 
@@ -1751,7 +1752,7 @@
   GenerateOptimizedUsageCounterIncrement(assembler);
   GenerateNArgsCheckInlineCacheStub(assembler, 2,
       kInlineCacheMissHandlerTwoArgsRuntimeEntry, Token::kILLEGAL,
-      kIgnoreRanges);
+      kIgnoreRanges, true /* optimized */);
 }
 
 
@@ -1887,29 +1888,6 @@
 }
 
 
-// S5: Contains Smi 0 (need to preserve a GC-safe value for the lazy compile
-// stub).
-// S4: Contains an arguments descriptor.
-void StubCode::GenerateClosureCallBreakpointStub(Assembler* assembler) {
-  __ Comment("ClosureCallBreakpoint stub");
-  __ EnterStubFrame();
-  __ addiu(SP, SP, Immediate(-3 * kWordSize));
-  __ sw(S5, Address(SP, 2 * kWordSize));
-  __ sw(S4, Address(SP, 1 * kWordSize));
-  __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null()));
-  __ sw(TMP, Address(SP, 0 * kWordSize));
-
-  __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
-
-  __ lw(S5, Address(SP, 2 * kWordSize));
-  __ lw(S4, Address(SP, 1 * kWordSize));
-  __ lw(T0, Address(SP, 0 * kWordSize));
-  __ addiu(SP, SP, Immediate(3 * kWordSize));
-  __ LeaveStubFrame();
-  __ jr(T0);
-}
-
-
 void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) {
   __ Comment("RuntimeCallBreakpoint stub");
   __ EnterStubFrame();
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index 6ae08ec..7016668 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -1334,7 +1334,8 @@
     intptr_t num_args,
     const RuntimeEntry& handle_ic_miss,
     Token::Kind kind,
-    RangeCollectionMode range_collection_mode) {
+    RangeCollectionMode range_collection_mode,
+    bool optimized) {
   ASSERT(num_args > 0);
 #if defined(DEBUG)
   { Label ok;
@@ -1351,7 +1352,7 @@
 #endif  // DEBUG
 
   Label stepping, done_stepping;
-  if (FLAG_support_debugger) {
+  if (FLAG_support_debugger && !optimized) {
     __ Comment("Check single stepping");
     __ LoadIsolate(RAX);
     __ cmpb(Address(RAX, Isolate::single_step_offset()), Immediate(0));
@@ -1511,7 +1512,7 @@
     __ jmp(RCX);
   }
 
-  if (FLAG_support_debugger) {
+  if (FLAG_support_debugger && !optimized) {
     __ Bind(&stepping);
     __ EnterStubFrame();
     __ pushq(RBX);
@@ -1615,7 +1616,7 @@
   GenerateNArgsCheckInlineCacheStub(assembler, 1,
       kInlineCacheMissHandlerOneArgRuntimeEntry,
       Token::kILLEGAL,
-      kIgnoreRanges);
+      kIgnoreRanges, true /* optimized */);
 }
 
 
@@ -1625,7 +1626,7 @@
   GenerateNArgsCheckInlineCacheStub(assembler, 2,
       kInlineCacheMissHandlerTwoArgsRuntimeEntry,
       Token::kILLEGAL,
-      kIgnoreRanges);
+      kIgnoreRanges, true /* optimized */);
 }
 
 
@@ -1762,28 +1763,6 @@
 }
 
 
-// RBX: Contains Smi 0 (need to preserve a GC-safe value for the lazy compile
-// stub).
-// R10: Contains an arguments descriptor.
-// TOS(0): return address (Dart code).
-void StubCode::GenerateClosureCallBreakpointStub(Assembler* assembler) {
-  __ EnterStubFrame();
-  // Preserve runtime args.
-  __ pushq(RBX);
-  __ pushq(R10);
-  // Room for result. Debugger stub returns address of the
-  // unpatched runtime stub.
-  __ LoadObject(R12, Object::null_object(), PP);
-  __ pushq(R12);  // Room for result.
-  __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
-  __ popq(RAX);  // Address of original.
-  __ popq(R10);  // Restore arguments.
-  __ popq(RBX);
-  __ LeaveStubFrame();
-  __ jmp(RAX);   // Jump to original stub.
-}
-
-
 //  TOS(0): return address (Dart code).
 void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) {
   __ EnterStubFrame();
diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h
index ee01b1b..ab8e379 100644
--- a/runtime/vm/symbols.h
+++ b/runtime/vm/symbols.h
@@ -287,6 +287,7 @@
   V(DotWithType, "._withType")                                                 \
   V(_get, "_get")                                                              \
   V(RangeError, "RangeError")                                                  \
+  V(DotRange, ".range")                                                        \
   V(ArgumentError, "ArgumentError")                                            \
   V(FormatException, "FormatException")                                        \
   V(UnsupportedError, "UnsupportedError")                                      \
diff --git a/runtime/vm/weak_code.cc b/runtime/vm/weak_code.cc
index 9e223bc..fa11174 100644
--- a/runtime/vm/weak_code.cc
+++ b/runtime/vm/weak_code.cc
@@ -108,7 +108,7 @@
       function.SwitchToUnoptimizedCode();
     } else if (function.unoptimized_code() == code.raw()) {
       ReportSwitchingCode(code);
-      function.ClearICData();
+      function.ClearICDataArray();
       // Remove the code object from the function. The next time the
       // function is invoked, it will be compiled again.
       function.ClearCode();
diff --git a/sdk/bin/pub b/sdk/bin/pub
index 1e787e0..96cc0df 100755
--- a/sdk/bin/pub
+++ b/sdk/bin/pub
@@ -53,5 +53,5 @@
 PACKAGES_DIR="$BUILD_DIR/packages/"
 
 # Run pub.
-PUB="$SDK_DIR/lib/_internal/pub/bin/pub.dart"
+PUB="$SDK_DIR/../third_party/pkg_tested/pub/bin/pub.dart"
 exec "$DART" "${VM_OPTIONS[@]}" "--package-root=$PACKAGES_DIR" "$PUB" "$@"
diff --git a/sdk/bin/pub.bat b/sdk/bin/pub.bat
index 904d054..d64b492 100644
--- a/sdk/bin/pub.bat
+++ b/sdk/bin/pub.bat
@@ -35,7 +35,7 @@
 set DART=%BUILD_DIR%\dart-sdk\bin\dart
 
 rem Run pub.
-set PUB="%SDK_DIR%\lib\_internal\pub\bin\pub.dart"
+set PUB="%SDK_DIR%\..\third_party\pkg_tested\pub\bin\pub.dart"
 "%DART%" %VM_OPTIONS% --package-root="%PACKAGES_DIR%" "%PUB%" %*
 
 endlocal
diff --git a/sdk/lib/_internal/compiler/js_lib/collection_patch.dart b/sdk/lib/_internal/compiler/js_lib/collection_patch.dart
index 06d944a..9df7c99 100644
--- a/sdk/lib/_internal/compiler/js_lib/collection_patch.dart
+++ b/sdk/lib/_internal/compiler/js_lib/collection_patch.dart
@@ -430,7 +430,7 @@
 }
 
 class HashMapKeyIterable<E> extends Iterable<E>
-                            implements EfficientLengthIterable<E> {
+                            implements EfficientLength {
   final _map;
   HashMapKeyIterable(this._map);
 
diff --git a/sdk/lib/_internal/compiler/js_lib/js_array.dart b/sdk/lib/_internal/compiler/js_lib/js_array.dart
index bef5026..d706b75 100644
--- a/sdk/lib/_internal/compiler/js_lib/js_array.dart
+++ b/sdk/lib/_internal/compiler/js_lib/js_array.dart
@@ -124,7 +124,7 @@
   void insertAll(int index, Iterable<E> iterable) {
     checkGrowable('insertAll');
     RangeError.checkValueInInterval(index, 0, this.length, "index");
-    if (iterable is! EfficientLengthIterable) {
+    if (iterable is! EfficientLength) {
       iterable = iterable.toList();
     }
     int insertionLength = iterable.length;
@@ -439,7 +439,7 @@
   void replaceRange(int start, int end, Iterable<E> replacement) {
     checkGrowable('replace range');
     RangeError.checkValidRange(start, end, this.length);
-    if (replacement is! EfficientLengthIterable) {
+    if (replacement is! EfficientLength) {
       replacement = replacement.toList();
     }
     int removeLength = end - start;
diff --git a/sdk/lib/_internal/compiler/js_lib/js_helper.dart b/sdk/lib/_internal/compiler/js_lib/js_helper.dart
index 470b0da..02ef267 100644
--- a/sdk/lib/_internal/compiler/js_lib/js_helper.dart
+++ b/sdk/lib/_internal/compiler/js_lib/js_helper.dart
@@ -64,7 +64,7 @@
 
 import 'dart:_interceptors';
 import 'dart:_internal' as _symbol_dev;
-import 'dart:_internal' show MappedIterable;
+import 'dart:_internal' show EfficientLength, MappedIterable;
 
 import 'dart:_native_typed_data';
 
diff --git a/sdk/lib/_internal/compiler/js_lib/linked_hash_map.dart b/sdk/lib/_internal/compiler/js_lib/linked_hash_map.dart
index eb5f295..bbf76d3 100644
--- a/sdk/lib/_internal/compiler/js_lib/linked_hash_map.dart
+++ b/sdk/lib/_internal/compiler/js_lib/linked_hash_map.dart
@@ -370,7 +370,7 @@
 }
 
 class LinkedHashMapKeyIterable<E> extends Iterable<E>
-                                  implements EfficientLengthIterable<E> {
+                                  implements EfficientLength {
   final _map;
   LinkedHashMapKeyIterable(this._map);
 
diff --git a/sdk/lib/_internal/compiler/js_lib/native_typed_data.dart b/sdk/lib/_internal/compiler/js_lib/native_typed_data.dart
index 84b25bc..b09537d 100644
--- a/sdk/lib/_internal/compiler/js_lib/native_typed_data.dart
+++ b/sdk/lib/_internal/compiler/js_lib/native_typed_data.dart
@@ -1540,42 +1540,42 @@
   }
 
   /// Shuffle the lane values. [mask] must be one of the 256 shuffle constants.
-  Float32x4 shuffle(int m) {
-    if ((m < 0) || (m > 255)) {
-      throw new RangeError('mask $m must be in the range [0..256)');
+  Float32x4 shuffle(int mask) {
+    if ((mask < 0) || (mask > 255)) {
+      throw new RangeError.range(mask, 0, 255, "mask");
     }
     _list[0] = x;
     _list[1] = y;
     _list[2] = z;
     _list[3] = w;
 
-    double _x = _list[m & 0x3];
-    double _y = _list[(m >> 2) & 0x3];
-    double _z = _list[(m >> 4) & 0x3];
-    double _w = _list[(m >> 6) & 0x3];
+    double _x = _list[mask & 0x3];
+    double _y = _list[(mask >> 2) & 0x3];
+    double _z = _list[(mask >> 4) & 0x3];
+    double _w = _list[(mask >> 6) & 0x3];
     return new NativeFloat32x4._truncated(_x, _y, _z, _w);
   }
 
   /// Shuffle the lane values in [this] and [other]. The returned
   /// Float32x4 will have XY lanes from [this] and ZW lanes from [other].
   /// Uses the same [mask] as [shuffle].
-  Float32x4 shuffleMix(Float32x4 other, int m) {
-    if ((m < 0) || (m > 255)) {
-      throw new RangeError('mask $m must be in the range [0..256)');
+  Float32x4 shuffleMix(Float32x4 other, int mask) {
+    if ((mask < 0) || (mask > 255)) {
+      throw new RangeError.range(mask, 0, 255, "mask");
     }
     _list[0] = x;
     _list[1] = y;
     _list[2] = z;
     _list[3] = w;
-    double _x = _list[m & 0x3];
-    double _y = _list[(m >> 2) & 0x3];
+    double _x = _list[mask & 0x3];
+    double _y = _list[(mask >> 2) & 0x3];
 
     _list[0] = other.x;
     _list[1] = other.y;
     _list[2] = other.z;
     _list[3] = other.w;
-    double _z = _list[(m >> 4) & 0x3];
-    double _w = _list[(m >> 6) & 0x3];
+    double _z = _list[(mask >> 4) & 0x3];
+    double _w = _list[(mask >> 6) & 0x3];
     return new NativeFloat32x4._truncated(_x, _y, _z, _w);
   }
 
@@ -1763,7 +1763,7 @@
   /// Shuffle the lane values. [mask] must be one of the 256 shuffle constants.
   Int32x4 shuffle(int mask) {
     if ((mask < 0) || (mask > 255)) {
-      throw new RangeError('mask $mask must be in the range [0..256)');
+      throw new RangeError.range(mask, 0, 255, "mask");
     }
     _list[0] = x;
     _list[1] = y;
@@ -1781,7 +1781,7 @@
   /// Uses the same [mask] as [shuffle].
   Int32x4 shuffleMix(Int32x4 other, int mask) {
     if ((mask < 0) || (mask > 255)) {
-      throw new RangeError('mask $mask must be in the range [0..256)');
+      throw new RangeError.range(mask, 0, 255, "mask");
     }
     _list[0] = x;
     _list[1] = y;
diff --git a/sdk/lib/_internal/pub/README.md b/sdk/lib/_internal/pub/README.md
deleted file mode 100644
index cb92901..0000000
--- a/sdk/lib/_internal/pub/README.md
+++ /dev/null
@@ -1,90 +0,0 @@
-# Contributing to pub
-
-Thanks for being interested in contributing to pub! Contributing to a new
-project can be hard: there's a lot of new code and practices to learn. This
-document is intended to get you up and running as quickly as possible. If you're
-looking for documentation on using pub, try
-[pub.dartlang.org](http://pub.dartlang.org/doc).
-
-The first step towards contributing is to contact the pub dev team and let us
-know what you're working on, so we can be sure not to start working on the same
-thing at the same time. Just send an email to [misc@dartlang.org] letting us
-know that you're interested in contributing and what you plan on working on.
-This will also let us give you specific advice about where to start.
-
-[misc@dartlang.org]: mailto:misc@dartlang.org
-
-## Organization
-
-Pub isn't a package, but it's organized like one. It has four top-level
-directories:
-
-* `lib/` contains the implementation of pub. Currently, it's all in `lib/src/`,
-  since there are no libraries intended for public consumption.
-
-* `test/` contains the tests for pub.
-
-* `bin/` contains `pub.dart`, the entrypoint script that's run whenever a user
-  types "pub" on the command line or runs it in the Dart editor. This is usually
-  run through shell scripts in `sdk/bin` at the root of the Dart repository.
-
-* `resource/` contains static resource files that pub uses. They're
-  automatically distributed in the Dart SDK.
-
-It's probably easiest to start diving into the codebase by looking at a
-particular pub command. Each command is encapsulated in files in
-`lib/src/command/`.
-
-## Running pub
-
-To run pub from the Dart repository, first [build Dart][building]. From the root
-of the repo:
-
-    ./tools/build.py -m release
-
-You'll need to re-build whenever you sync the repository, but not when you
-modify pub or any packages it depends on. To run pub, just run `sdk/bin/pub` (or
-`sdk/bin/pub.bat` on Windows).
-
-[building]: https://code.google.com/p/dart/wiki/Building
-
-## Testing pub
-
-Before any change is made to pub, all tests should pass. To run all the pub
-tests, run this from the root of the Dart repository:
-
-    ./tools/test.py -m release pub
-
-Changes to pub should be accompanied by one or more tests that exercise the new
-functionality. When adding a test, the best strategy is to find a similar test
-in `test/` and follow the same patterns. Note that pub makes wide use of the
-[scheduled_test] package in its tests, so it's usually important to be familiar
-with that when adding tests.
-
-[scheduled_test]: http://pub.dartlang.org/packages/scheduled_test
-
-Pub tests come in two basic forms. The first, which is usually used to unit test
-classes and libraries internal to pub, has many tests in a single file. This is
-used when each test will take a short time to run. For example,
-`test/version_test.dart` contains unit tests for pub's Version class.
-
-The other form, used by most pub tests, is usually used for integration tests of
-user-visible pub commands. Each test has a file to itself, which is named after
-the test description. This is used when tests can take a long time to run to
-avoid having the tests time out when running on the build bots. For example,
-`tests/get/hosted/get_transitive_test.dart` tests the resolution of transitive
-hosted dependencies when using `pub get`.
-
-When testing new functionality, it's often useful to run a single test rather
-than the entire test suite. You can do this by appending the path to the test
-file to the test command. For example, to run `get/relative_symlink_test.dart`:
-
-    ./tools/test.py -m release pub/get/relative_symlink_test
-
-## Landing your patch
-
-All patches to the Dart repo, including to pub, need to undergo code review
-before they're submitted. The full process for putting up your patch for review
-is [documented elsewhere][contributing].
-
-[contributing]: https://code.google.com/p/dart/wiki/Contributing
diff --git a/sdk/lib/_internal/pub/asset/dart/serialize.dart b/sdk/lib/_internal/pub/asset/dart/serialize.dart
deleted file mode 100644
index f37ab70..0000000
--- a/sdk/lib/_internal/pub/asset/dart/serialize.dart
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.asset.serialize;
-
-import 'dart:async';
-import 'dart:isolate';
-
-import 'package:barback/barback.dart';
-
-//# if source_maps >=0.9.0 <0.10.0
-//> import 'package:source_maps/span.dart';
-//# end
-
-//# if source_span
-import 'package:source_span/source_span.dart';
-//# end
-
-import 'serialize/exception.dart';
-import 'utils.dart';
-
-export 'serialize/aggregate_transform.dart';
-export 'serialize/exception.dart';
-export 'serialize/transform.dart';
-export 'serialize/transformer.dart';
-
-/// Converts [id] into a serializable map.
-Map serializeId(AssetId id) => {'package': id.package, 'path': id.path};
-
-/// Converts a serializable map into an [AssetId].
-AssetId deserializeId(Map id) => new AssetId(id['package'], id['path']);
-
-/// Converts [span] into a serializable map.
-///
-/// [span] may be a [SourceSpan] or a [Span].
-Map serializeSpan(span) {
-  // TODO(nweiz): convert FileSpans to FileSpans.
-  // Handily, this code works for both source_map and source_span spans.
-  return {
-    'sourceUrl': span.sourceUrl.toString(),
-    'start': serializeLocation(span.start),
-    'end': serializeLocation(span.end),
-    'text': span.text,
-  };
-}
-
-/// Converts a serializable map into a [SourceSpan].
-SourceSpan deserializeSpan(Map span) {
-  return new SourceSpan(
-      deserializeLocation(span['start']),
-      deserializeLocation(span['end']),
-      span['text']);
-}
-
-/// Converts [location] into a serializable map.
-///
-/// [location] may be a [SourceLocation] or a [SourceLocation].
-Map serializeLocation(location) {
-//# if source_maps >=0.9.0 <0.10.0
-//>  if (location is Location) {
-//>    return {
-//>      'sourceUrl': location.sourceUrl,
-//>      'offset': location.offset,
-//>      'line': location.line,
-//>      'column': location.column
-//>    };
-//>  }
-//# end
-
-//# if source_span
-  // TODO(nweiz): convert FileLocations to FileLocations.
-  if (location is SourceLocation) {
-    return {
-      'sourceUrl': location.sourceUrl.toString(),
-      'offset': location.offset,
-      'line': location.line,
-      'column': location.column
-    };
-  }
-//# end
-
-  throw new ArgumentError("Unknown type ${location.runtimeType} for location.");
-}
-
-/// Converts a serializable map into a [Location].
-SourceLocation deserializeLocation(Map location) {
-  return new SourceLocation(location['offset'],
-      sourceUrl: location['sourceUrl'],
-      line: location['line'],
-      column: location['column']);
-}
-
-/// Converts [stream] into a serializable map.
-///
-/// [serializeEvent] is used to serialize each event from the stream.
-Map serializeStream(Stream stream, serializeEvent(event)) {
-  var receivePort = new ReceivePort();
-  var map = {'replyTo': receivePort.sendPort};
-
-  receivePort.first.then((message) {
-    var sendPort = message['replyTo'];
-    stream.listen((event) {
-      sendPort.send({
-        'type': 'event',
-        'value': serializeEvent(event)
-      });
-    }, onError: (error, stackTrace) {
-      sendPort.send({
-        'type': 'error',
-        'error': serializeException(error, stackTrace)
-      });
-    }, onDone: () => sendPort.send({'type': 'done'}));
-  });
-
-  return map;
-}
-
-/// Converts a serializable map into a [Stream].
-///
-/// [deserializeEvent] is used to deserialize each event from the stream.
-Stream deserializeStream(Map stream, deserializeEvent(event)) {
-  return callbackStream(() {
-    var receivePort = new ReceivePort();
-    stream['replyTo'].send({'replyTo': receivePort.sendPort});
-
-    var controller = new StreamController(sync: true);
-    receivePort.listen((event) {
-      switch (event['type']) {
-        case 'event':
-          controller.add(deserializeEvent(event['value']));
-          break;
-        case 'error':
-          var exception = deserializeException(event['error']);
-          controller.addError(exception, exception.stackTrace);
-          break;
-        case 'done':
-          controller.close();
-          receivePort.close();
-          break;
-      }
-    });
-
-    return controller.stream;
-  });
-}
-
-/// Wraps [message] and sends it across [port], then waits for a response which
-/// should be sent using [respond].
-///
-/// The returned Future will complete to the value or error returned by
-/// [respond].
-Future call(SendPort port, message) {
-  var receivePort = new ReceivePort();
-  port.send({
-    'message': message,
-    'replyTo': receivePort.sendPort
-  });
-
-  return receivePort.first.then((response) {
-    if (response['type'] == 'success') return response['value'];
-    assert(response['type'] == 'error');
-    var exception = deserializeException(response['error']);
-    return new Future.error(exception, exception.stackTrace);
-  });
-}
-
-/// Responds to a message sent by [call].
-///
-/// [wrappedMessage] is the raw message sent by [call]. This unwraps it and
-/// passes the contents of the message to [callback], then sends the return
-/// value of [callback] back to [call]. If [callback] returns a Future or
-/// throws an error, that will also be sent.
-void respond(wrappedMessage, callback(message)) {
-  var replyTo = wrappedMessage['replyTo'];
-  new Future.sync(() => callback(wrappedMessage['message']))
-      .then((result) => replyTo.send({'type': 'success', 'value': result}))
-      .catchError((error, stackTrace) {
-    replyTo.send({
-      'type': 'error',
-      'error': serializeException(error, stackTrace)
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/asset/dart/serialize/aggregate_transform.dart b/sdk/lib/_internal/pub/asset/dart/serialize/aggregate_transform.dart
deleted file mode 100644
index 5b7acc8..0000000
--- a/sdk/lib/_internal/pub/asset/dart/serialize/aggregate_transform.dart
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.asset.serialize.aggregate_transform;
-
-import 'dart:async';
-import 'dart:isolate';
-
-import 'package:barback/barback.dart';
-// TODO(nweiz): don't import from "src" once issue 14966 is fixed.
-import 'package:barback/src/internal_asset.dart';
-
-import '../serialize.dart';
-import 'get_input_transform.dart';
-
-/// Serialize the methods shared between [AggregateTransform] and
-/// [DeclaringAggregateTransform].
-///
-/// [additionalFields] contains additional serialized fields to add to the
-/// serialized transform. [methodHandlers] is a set of additional methods. Each
-/// value should take a JSON message and return the response (which may be a
-/// Future).
-Map _serializeBaseAggregateTransform(transform, Map additionalFields,
-    Map<String, Function> methodHandlers) {
-  var receivePort = new ReceivePort();
-  receivePort.listen((wrappedMessage) {
-    respond(wrappedMessage, (message) {
-      var handler = methodHandlers[message['type']];
-      if (handler != null) return handler(message);
-
-      if (message['type'] == 'consumePrimary') {
-        transform.consumePrimary(deserializeId(message['assetId']));
-        return null;
-      }
-
-      assert(message['type'] == 'log');
-      var method = {
-        'Info': transform.logger.info,
-        'Fine': transform.logger.fine,
-        'Warning': transform.logger.warning,
-        'Error': transform.logger.error
-      }[message['level']];
-      assert(method != null);
-
-      var assetId = message['assetId'] == null ? null :
-        deserializeId(message['assetId']);
-      var span = message['span'] == null ? null :
-        deserializeSpan(message['span']);
-      method(message['message'], asset: assetId, span: span);
-    });
-  });
-
-  return {
-    'port': receivePort.sendPort,
-    'key': transform.key,
-    'package': transform.package
-  }..addAll(additionalFields);
-}
-
-/// Converts [transform] into a serializable map.
-Map serializeAggregateTransform(AggregateTransform transform) {
-  return _serializeBaseAggregateTransform(transform, {
-    'primaryInputs': serializeStream(transform.primaryInputs, serializeAsset)
-  }, {
-    'getInput': (message) => transform.getInput(deserializeId(message['id']))
-        .then((asset) => serializeAsset(asset)),
-    'addOutput': (message) =>
-        transform.addOutput(deserializeAsset(message['output']))
-  });
-}
-
-/// Converts [transform] into a serializable map.
-Map serializeDeclaringAggregateTransform(
-    DeclaringAggregateTransform transform) {
-  return _serializeBaseAggregateTransform(transform, {
-    'primaryIds': serializeStream(transform.primaryIds, serializeId)
-  }, {
-    'declareOutput': (message) =>
-        transform.declareOutput(deserializeId(message['output']))
-  });
-}
-
-/// The base class for wrappers for [AggregateTransform]s that are in the host
-/// isolate.
-class _ForeignBaseAggregateTransform {
-  /// The port with which we communicate with the host isolate.
-  ///
-  /// This port and all messages sent across it are specific to this transform.
-  final SendPort _port;
-
-  final String key;
-
-  final String package;
-
-  TransformLogger get logger => _logger;
-  TransformLogger _logger;
-
-  _ForeignBaseAggregateTransform(Map transform)
-      : _port = transform['port'],
-        key = transform['key'],
-        package = transform['package'] {
-    _logger = new TransformLogger((assetId, level, message, span) {
-      call(_port, {
-        'type': 'log',
-        'level': level.name,
-        'message': message,
-        'assetId': assetId == null ? null : serializeId(assetId),
-        'span': span == null ? null : serializeSpan(span)
-      });
-    });
-  }
-
-  void consumePrimary(AssetId id) {
-    call(_port, {'type': 'consumePrimary', 'assetId': serializeId(id)});
-  }
-}
-
-// We can get away with only removing the class declarations in incompatible
-// barback versions because merely referencing undefined types in type
-// annotations isn't a static error. Only implementing an undefined interface is
-// a static error.
-//# if barback >=0.14.1
-
-/// A wrapper for an [AggregateTransform] that's in the host isolate.
-///
-/// This retrieves inputs from and sends outputs and logs to the host isolate.
-class ForeignAggregateTransform extends _ForeignBaseAggregateTransform
-    with GetInputTransform implements AggregateTransform {
-  final Stream<Asset> primaryInputs;
-
-  /// Creates a transform from a serialized map sent from the host isolate.
-  ForeignAggregateTransform(Map transform)
-      : primaryInputs = deserializeStream(
-            transform['primaryInputs'], deserializeAsset),
-        super(transform);
-
-  Future<Asset> getInput(AssetId id) {
-    return call(_port, {
-      'type': 'getInput',
-      'id': serializeId(id)
-    }).then(deserializeAsset);
-  }
-
-  void addOutput(Asset output) {
-    call(_port, {
-      'type': 'addOutput',
-      'output': serializeAsset(output)
-    });
-  }
-}
-
-/// A wrapper for a [DeclaringAggregateTransform] that's in the host isolate.
-class ForeignDeclaringAggregateTransform
-    extends _ForeignBaseAggregateTransform
-    implements DeclaringAggregateTransform {
-  final Stream<AssetId> primaryIds;
-
-  /// Creates a transform from a serializable map sent from the host isolate.
-  ForeignDeclaringAggregateTransform(Map transform)
-      : primaryIds = deserializeStream(
-            transform['primaryIds'], deserializeId),
-        super(transform);
-
-  void declareOutput(AssetId id) {
-    call(_port, {
-      'type': 'declareOutput',
-      'output': serializeId(id)
-    });
-  }
-}
-
-//# end
diff --git a/sdk/lib/_internal/pub/asset/dart/serialize/exception.dart b/sdk/lib/_internal/pub/asset/dart/serialize/exception.dart
deleted file mode 100644
index 26040a9..0000000
--- a/sdk/lib/_internal/pub/asset/dart/serialize/exception.dart
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.asset.serialize.exception;
-
-import 'package:barback/barback.dart';
-import 'package:stack_trace/stack_trace.dart';
-
-import '../utils.dart';
-
-/// An exception that was originally raised in another isolate.
-///
-/// Exception objects can't cross isolate boundaries in general, so this class
-/// wraps as much information as can be consistently serialized.
-class CrossIsolateException implements Exception {
-  /// The name of the type of exception thrown.
-  ///
-  /// This is the return value of [error.runtimeType.toString()]. Keep in mind
-  /// that objects in different libraries may have the same type name.
-  final String type;
-
-  /// The exception's message, or its [toString] if it didn't expose a `message`
-  /// property.
-  final String message;
-
-  /// The exception's stack chain, or `null` if no stack chain was available.
-  final Chain stackTrace;
-
-  /// Loads a [CrossIsolateException] from a serialized representation.
-  ///
-  /// [error] should be the result of [CrossIsolateException.serialize].
-  CrossIsolateException.deserialize(Map error)
-      : type = error['type'],
-        message = error['message'],
-        stackTrace = error['stack'] == null ? null :
-            new Chain.parse(error['stack']);
-
-  /// Serializes [error] to an object that can safely be passed across isolate
-  /// boundaries.
-  static Map serialize(error, [StackTrace stack]) {
-    if (stack == null && error is Error) stack = error.stackTrace;
-    return {
-      'type': error.runtimeType.toString(),
-      'message': getErrorMessage(error),
-      'stack': stack == null ? null : new Chain.forTrace(stack).toString()
-    };
-  }
-
-  String toString() => "$message\n$stackTrace";
-}
-
-/// An [AssetNotFoundException] that was originally raised in another isolate. 
-class _CrossIsolateAssetNotFoundException extends CrossIsolateException
-    implements AssetNotFoundException {
-  final AssetId id;
-
-  String get message => "Could not find asset $id.";
-
-  /// Loads a [_CrossIsolateAssetNotFoundException] from a serialized
-  /// representation.
-  ///
-  /// [error] should be the result of
-  /// [_CrossIsolateAssetNotFoundException.serialize].
-  _CrossIsolateAssetNotFoundException.deserialize(Map error)
-      : id = new AssetId(error['package'], error['path']),
-        super.deserialize(error);
-
-  /// Serializes [error] to an object that can safely be passed across isolate
-  /// boundaries.
-  static Map serialize(AssetNotFoundException error, [StackTrace stack]) {
-    var map = CrossIsolateException.serialize(error);
-    map['package'] = error.id.package;
-    map['path'] = error.id.path;
-    return map;
-  }
-}
-
-/// Serializes [error] to an object that can safely be passed across isolate
-/// boundaries.
-///
-/// This handles [AssetNotFoundException]s specially, ensuring that their
-/// metadata is preserved.
-Map serializeException(error, [StackTrace stack]) {
-  if (error is AssetNotFoundException) {
-    return _CrossIsolateAssetNotFoundException.serialize(error, stack);
-  } else {
-    return CrossIsolateException.serialize(error, stack);
-  }
-}
-
-/// Loads an exception from a serialized representation.
-///
-/// This handles [AssetNotFoundException]s specially, ensuring that their
-/// metadata is preserved.
-CrossIsolateException deserializeException(Map error) {
-  if (error['type'] == 'AssetNotFoundException') {
-    return new _CrossIsolateAssetNotFoundException.deserialize(error);
-  } else {
-    return new CrossIsolateException.deserialize(error);
-  }
-}
diff --git a/sdk/lib/_internal/pub/asset/dart/serialize/get_input_transform.dart b/sdk/lib/_internal/pub/asset/dart/serialize/get_input_transform.dart
deleted file mode 100644
index 9ab6540..0000000
--- a/sdk/lib/_internal/pub/asset/dart/serialize/get_input_transform.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.asset.serialize.get_input_transform;
-
-import 'dart:async';
-import 'dart:convert';
-
-import 'package:barback/barback.dart';
-
-import '../utils.dart';
-
-/// A mixin for transforms that support [getInput] and the associated suite of
-/// methods.
-abstract class GetInputTransform {
-  Future<Asset> getInput(AssetId id);
-
-  Future<String> readInputAsString(AssetId id, {Encoding encoding}) {
-    if (encoding == null) encoding = UTF8;
-    return getInput(id).then((input) =>
-        input.readAsString(encoding: encoding));
-  }
-
-  Stream<List<int>> readInput(AssetId id) =>
-      futureStream(getInput(id).then((input) => input.read()));
-
-  Future<bool> hasInput(AssetId id) {
-    return getInput(id).then((_) => true).catchError((error) {
-      if (error is AssetNotFoundException && error.id == id) return false;
-      throw error;
-    });
-  }
-}
diff --git a/sdk/lib/_internal/pub/asset/dart/serialize/transform.dart b/sdk/lib/_internal/pub/asset/dart/serialize/transform.dart
deleted file mode 100644
index 911f6f6..0000000
--- a/sdk/lib/_internal/pub/asset/dart/serialize/transform.dart
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.asset.serialize.transform;
-
-import 'dart:async';
-import 'dart:isolate';
-
-import 'package:barback/barback.dart';
-// TODO(nweiz): don't import from "src" once issue 14966 is fixed.
-import 'package:barback/src/internal_asset.dart';
-
-import '../serialize.dart';
-import 'get_input_transform.dart';
-
-/// Serialize the methods shared between [Transform] and [DeclaringTransform].
-///
-/// [additionalFields] contains additional serialized fields to add to the
-/// serialized transform. [methodHandlers] is a set of additional methods. Each
-/// value should take a JSON message and return the response (which may be a
-/// Future).
-Map _serializeBaseTransform(transform, Map additionalFields,
-    Map<String, Function> methodHandlers) {
-  var receivePort = new ReceivePort();
-  receivePort.listen((wrappedMessage) {
-    respond(wrappedMessage, (message) {
-      var handler = methodHandlers[message['type']];
-      if (handler != null) return handler(message);
-
-      if (message['type'] == 'consumePrimary') {
-        transform.consumePrimary();
-        return null;
-      }
-
-      assert(message['type'] == 'log');
-      var method = {
-        'Info': transform.logger.info,
-        'Fine': transform.logger.fine,
-        'Warning': transform.logger.warning,
-        'Error': transform.logger.error
-      }[message['level']];
-      assert(method != null);
-
-      var assetId = message['assetId'] == null ? null :
-        deserializeId(message['assetId']);
-      var span = message['span'] == null ? null :
-        deserializeSpan(message['span']);
-      method(message['message'], asset: assetId, span: span);
-    });
-  });
-
-  return {'port': receivePort.sendPort}..addAll(additionalFields);
-}
-
-/// Converts [transform] into a serializable map.
-Map serializeTransform(Transform transform) {
-  return _serializeBaseTransform(transform, {
-    'primaryInput': serializeAsset(transform.primaryInput)
-  }, {
-    'getInput': (message) => transform.getInput(deserializeId(message['id']))
-        .then((asset) => serializeAsset(asset)),
-    'addOutput': (message) =>
-        transform.addOutput(deserializeAsset(message['output']))
-  });
-}
-
-/// Converts [transform] into a serializable map.
-Map serializeDeclaringTransform(DeclaringTransform transform) {
-  return _serializeBaseTransform(transform, {
-    'primaryId': serializeId(transform.primaryId)
-  }, {
-    'declareOutput': (message) =>
-        transform.declareOutput(deserializeId(message['output']))
-  });
-}
-
-/// The base class for wrappers for [Transform]s that are in the host isolate.
-class _ForeignBaseTransform {
-  /// The port with which we communicate with the host isolate.
-  ///
-  /// This port and all messages sent across it are specific to this transform.
-  final SendPort _port;
-
-  TransformLogger get logger => _logger;
-  TransformLogger _logger;
-
-  _ForeignBaseTransform(Map transform)
-      : _port = transform['port'] {
-    _logger = new TransformLogger((assetId, level, message, span) {
-      call(_port, {
-        'type': 'log',
-        'level': level.name,
-        'message': message,
-        'assetId': assetId == null ? null : serializeId(assetId),
-        'span': span == null ? null : serializeSpan(span)
-      });
-    });
-  }
-
-  void consumePrimary() {
-    call(_port, {'type': 'consumePrimary'});
-  }
-}
-
-/// A wrapper for a [Transform] that's in the host isolate.
-///
-/// This retrieves inputs from and sends outputs and logs to the host isolate.
-class ForeignTransform extends _ForeignBaseTransform
-    with GetInputTransform implements Transform {
-  final Asset primaryInput;
-
-  /// Creates a transform from a serialized map sent from the host isolate.
-  ForeignTransform(Map transform)
-      : primaryInput = deserializeAsset(transform['primaryInput']),
-        super(transform);
-
-  Future<Asset> getInput(AssetId id) {
-    return call(_port, {
-      'type': 'getInput',
-      'id': serializeId(id)
-    }).then(deserializeAsset);
-  }
-
-  void addOutput(Asset output) {
-    call(_port, {
-      'type': 'addOutput',
-      'output': serializeAsset(output)
-    });
-  }
-}
-
-/// A wrapper for a [DeclaringTransform] that's in the host isolate.
-class ForeignDeclaringTransform extends _ForeignBaseTransform
-    implements DeclaringTransform {
-  final AssetId primaryId;
-
-  /// Creates a transform from a serializable map sent from the host isolate.
-  ForeignDeclaringTransform(Map transform)
-      : primaryId = deserializeId(transform['primaryId']),
-        super(transform);
-
-  void declareOutput(AssetId id) {
-    call(_port, {
-      'type': 'declareOutput',
-      'output': serializeId(id)
-    });
-  }
-}
diff --git a/sdk/lib/_internal/pub/asset/dart/serialize/transformer.dart b/sdk/lib/_internal/pub/asset/dart/serialize/transformer.dart
deleted file mode 100644
index 16d02de..0000000
--- a/sdk/lib/_internal/pub/asset/dart/serialize/transformer.dart
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.asset.serialize.transformer;
-
-import 'dart:async';
-import 'dart:isolate';
-
-import 'package:barback/barback.dart';
-
-import '../serialize.dart';
-import 'transform.dart';
-
-/// Converts [transformer] into a serializable map.
-Map _serializeTransformer(Transformer transformer) {
-  var port = new ReceivePort();
-  port.listen((wrappedMessage) {
-    respond(wrappedMessage, (message) {
-      if (message['type'] == 'isPrimary') {
-        return transformer.isPrimary(deserializeId(message['id']));
-      } else if (message['type'] == 'declareOutputs') {
-        return new Future.sync(() {
-          return (transformer as DeclaringTransformer).declareOutputs(
-              new ForeignDeclaringTransform(message['transform']));
-        }).then((_) => null);
-      } else {
-        assert(message['type'] == 'apply');
-
-        // Make sure we return null so that if the transformer's [apply] returns
-        // a non-serializable value it doesn't cause problems.
-        return new Future.sync(() {
-          return transformer.apply(new ForeignTransform(message['transform']));
-        }).then((_) => null);
-      }
-    });
-  });
-
-  var type;
-  if (transformer is LazyTransformer) {
-    type = 'LazyTransformer';
-  } else if (transformer is DeclaringTransformer) {
-    type = 'DeclaringTransformer';
-  } else {
-    type = 'Transformer';
-  }
-
-  return {
-    'type': type,
-    'toString': transformer.toString(),
-    'port': port.sendPort
-  };
-}
-
-/// Converts [transformer] into a serializable map.
-Map _serializeAggregateTransformer(AggregateTransformer transformer) {
-  var port = new ReceivePort();
-  port.listen((wrappedMessage) {
-    respond(wrappedMessage, (message) {
-      if (message['type'] == 'classifyPrimary') {
-        return transformer.classifyPrimary(deserializeId(message['id']));
-      } else if (message['type'] == 'declareOutputs') {
-        return new Future.sync(() {
-          return (transformer as DeclaringAggregateTransformer).declareOutputs(
-              new ForeignDeclaringAggregateTransform(message['transform']));
-        }).then((_) => null);
-      } else {
-        assert(message['type'] == 'apply');
-
-        // Make sure we return null so that if the transformer's [apply] returns
-        // a non-serializable value it doesn't cause problems.
-        return new Future.sync(() {
-          return transformer.apply(
-              new ForeignAggregateTransform(message['transform']));
-        }).then((_) => null);
-      }
-    });
-  });
-
-  var type;
-  if (transformer is LazyAggregateTransformer) {
-    type = 'LazyAggregateTransformer';
-  } else if (transformer is DeclaringAggregateTransformer) {
-    type = 'DeclaringAggregateTransformer';
-  } else {
-    type = 'AggregateTransformer';
-  }
-
-  return {
-    'type': type,
-    'toString': transformer.toString(),
-    'port': port.sendPort
-  };
-}
-
-// Converts [group] into a serializable map.
-Map _serializeTransformerGroup(TransformerGroup group) {
-  if (group.phases == null) {
-    throw "TransformerGroup $group phases cannot be null.";
-  }
-
-  return {
-    'type': 'TransformerGroup',
-    'toString': group.toString(),
-    'phases': group.phases.map((phase) {
-      return phase.map(serializeTransformerLike).toList();
-    }).toList()
-  };
-}
-
-/// Converts [transformerLike] into a serializable map.
-///
-/// [transformerLike] can be a [Transformer], an [AggregateTransformer], or a
-/// [TransformerGroup].
-Map serializeTransformerLike(transformerLike) {
-  if (transformerLike is Transformer) {
-    return _serializeTransformer(transformerLike);
-  } else if (transformerLike is TransformerGroup) {
-    return _serializeTransformerGroup(transformerLike);
-  } else {
-    // This has to be last, since "transformerLike is AggregateTransformer" will
-    // throw on older versions of barback.
-    assert(transformerLike is AggregateTransformer);
-    return _serializeAggregateTransformer(transformerLike);
-  }
-}
diff --git a/sdk/lib/_internal/pub/asset/dart/transformer_isolate.dart b/sdk/lib/_internal/pub/asset/dart/transformer_isolate.dart
deleted file mode 100644
index 50bb97b..0000000
--- a/sdk/lib/_internal/pub/asset/dart/transformer_isolate.dart
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.asset.transformer_isolate;
-
-import 'dart:convert';
-import 'dart:isolate';
-import 'dart:mirrors';
-
-import 'package:barback/barback.dart';
-
-import 'serialize.dart';
-
-/// The mirror system.
-///
-/// Cached to avoid re-instantiating each time a transformer is initialized.
-final _mirrors = currentMirrorSystem();
-
-/// Sets up the initial communication with the host isolate.
-void loadTransformers(SendPort replyTo) {
-  var port = new ReceivePort();
-  replyTo.send(port.sendPort);
-  port.listen((wrappedMessage) {
-    // TODO(nweiz): When issue 19228 is fixed, spin up a separate isolate for
-    // libraries loaded beyond the first so they can run in parallel.
-    respond(wrappedMessage, (message) {
-      var configuration = JSON.decode(message['configuration']);
-      var mode = new BarbackMode(message['mode']);
-      return _initialize(message['library'], configuration, mode).
-          map(serializeTransformerLike).toList();
-    });
-  });
-}
-
-/// Loads all the transformers and groups defined in [uri].
-///
-/// Loads the library, finds any [Transformer] or [TransformerGroup] subclasses
-/// in it, instantiates them with [configuration] and [mode], and returns them.
-List _initialize(String uri, Map configuration, BarbackMode mode) {
-  var transformerClass = reflectClass(Transformer);
-  var aggregateClass = _aggregateTransformerClass;
-  var groupClass = reflectClass(TransformerGroup);
-
-  var seen = new Set();
-  var transformers = [];
-
-  loadFromLibrary(library) {
-    if (seen.contains(library)) return;
-    seen.add(library);
-
-    // Load transformers from libraries exported by [library].
-    for (var dependency in library.libraryDependencies) {
-      if (!dependency.isExport) continue;
-      loadFromLibrary(dependency.targetLibrary);
-    }
-
-    // TODO(nweiz): if no valid transformers are found, throw an error message
-    // describing candidates and why they were rejected.
-    transformers.addAll(library.declarations.values.map((declaration) {
-      if (declaration is! ClassMirror) return null;
-      var classMirror = declaration;
-      if (classMirror.isPrivate) return null;
-      if (classMirror.isAbstract) return null;
-      if (!classMirror.isSubtypeOf(transformerClass) &&
-          !classMirror.isSubtypeOf(groupClass) &&
-          (aggregateClass == null ||
-              !classMirror.isSubtypeOf(aggregateClass))) {
-        return null;
-      }
-
-      var constructor = _getConstructor(classMirror, 'asPlugin');
-      if (constructor == null) return null;
-      if (constructor.parameters.isEmpty) {
-        if (configuration.isNotEmpty) return null;
-        return classMirror.newInstance(const Symbol('asPlugin'), []).reflectee;
-      }
-      if (constructor.parameters.length != 1) return null;
-
-      return classMirror.newInstance(const Symbol('asPlugin'),
-          [new BarbackSettings(configuration, mode)]).reflectee;
-    }).where((classMirror) => classMirror != null));
-  }
-
-  var library = _mirrors.libraries[Uri.parse(uri)];
-
-  // This should only happen if something's wrong with the logic in pub itself.
-  // If it were user error, the entire isolate would fail to load.
-  if (library == null) throw "Couldn't find library at $uri.";
-
-  loadFromLibrary(library);
-  return transformers;
-}
-
-// TODO(nweiz): clean this up when issue 13248 is fixed.
-MethodMirror _getConstructor(ClassMirror classMirror, String constructor) {
-  var name = new Symbol("${MirrorSystem.getName(classMirror.simpleName)}"
-      ".$constructor");
-  var candidate = classMirror.declarations[name];
-  if (candidate is MethodMirror && candidate.isConstructor) return candidate;
-  return null;
-}
-
-// Older barbacks don't support [AggregateTransformer], and calling
-// [reflectClass] on an undefined class will throw an error, so we just define a
-// null getter for them.
-//# if barback >=0.14.1
-ClassMirror get _aggregateTransformerClass =>
-    reflectClass(AggregateTransformer);
-//# else
-//>   ClassMirror get _aggregateTransformerClass => null;
-//# end
diff --git a/sdk/lib/_internal/pub/asset/dart/utils.dart b/sdk/lib/_internal/pub/asset/dart/utils.dart
deleted file mode 100644
index 72150ed..0000000
--- a/sdk/lib/_internal/pub/asset/dart/utils.dart
+++ /dev/null
@@ -1,86 +0,0 @@
-// 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.
-
-/// Functions go in this file as opposed to lib/src/utils.dart if they need to
-/// be accessible to the transformer-loading isolate.
-library pub.asset.utils;
-
-import 'dart:async';
-
-/// A regular expression to match the exception prefix that some exceptions'
-/// [Object.toString] values contain.
-final _exceptionPrefix = new RegExp(r'^([A-Z][a-zA-Z]*)?(Exception|Error): ');
-
-/// Get a string description of an exception.
-///
-/// Many exceptions include the exception class name at the beginning of their
-/// [toString], so we remove that if it exists.
-String getErrorMessage(error) =>
-  error.toString().replaceFirst(_exceptionPrefix, '');
-
-/// Returns a buffered stream that will emit the same values as the stream
-/// returned by [future] once [future] completes.
-///
-/// If [future] completes to an error, the return value will emit that error and
-/// then close.
-///
-/// If [broadcast] is true, a broadcast stream is returned. This assumes that
-/// the stream returned by [future] will be a broadcast stream as well.
-/// [broadcast] defaults to false.
-Stream futureStream(Future<Stream> future, {bool broadcast: false}) {
-  var subscription;
-  var controller;
-
-  future = future.catchError((e, stackTrace) {
-    // Since [controller] is synchronous, it's likely that emitting an error
-    // will cause it to be cancelled before we call close.
-    if (controller != null) controller.addError(e, stackTrace);
-    if (controller != null) controller.close();
-    controller = null;
-  });
-
-  onListen() {
-    future.then((stream) {
-      if (controller == null) return;
-      subscription = stream.listen(
-          controller.add,
-          onError: controller.addError,
-          onDone: controller.close);
-    });
-  }
-
-  onCancel() {
-    if (subscription != null) subscription.cancel();
-    subscription = null;
-    controller = null;
-  }
-
-  if (broadcast) {
-    controller = new StreamController.broadcast(
-        sync: true, onListen: onListen, onCancel: onCancel);
-  } else {
-    controller = new StreamController(
-        sync: true, onListen: onListen, onCancel: onCancel);
-  }
-  return controller.stream;
-}
-
-/// Returns a [Stream] that will emit the same values as the stream returned by
-/// [callback].
-///
-/// [callback] will only be called when the returned [Stream] gets a subscriber.
-Stream callbackStream(Stream callback()) {
-  var subscription;
-  var controller;
-  controller = new StreamController(onListen: () {
-    subscription = callback().listen(controller.add,
-        onError: controller.addError,
-        onDone: controller.close);
-  },
-      onCancel: () => subscription.cancel(),
-      onPause: () => subscription.pause(),
-      onResume: () => subscription.resume(),
-      sync: true);
-  return controller.stream;
-}
diff --git a/sdk/lib/_internal/pub/bin/pub.dart b/sdk/lib/_internal/pub/bin/pub.dart
deleted file mode 100644
index e781f94..0000000
--- a/sdk/lib/_internal/pub/bin/pub.dart
+++ /dev/null
@@ -1,9 +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 '../lib/src/command_runner.dart';
-
-void main(List<String> arguments) {
-  new PubCommandRunner().run(arguments);
-}
diff --git a/sdk/lib/_internal/pub/lib/src/ascii_tree.dart b/sdk/lib/_internal/pub/lib/src/ascii_tree.dart
deleted file mode 100644
index 015a6e2..0000000
--- a/sdk/lib/_internal/pub/lib/src/ascii_tree.dart
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// A simple library for rendering tree-like structures in ASCII.
-library pub.ascii_tree;
-
-import 'package:path/path.dart' as path;
-
-import 'log.dart' as log;
-import 'utils.dart';
-
-/// Draws a tree for the given list of files. Given files like:
-///
-///     TODO
-///     example/console_example.dart
-///     example/main.dart
-///     example/web copy/web_example.dart
-///     test/absolute_test.dart
-///     test/basename_test.dart
-///     test/dirname_test.dart
-///     test/extension_test.dart
-///     test/is_absolute_test.dart
-///     test/is_relative_test.dart
-///     test/join_test.dart
-///     test/normalize_test.dart
-///     test/relative_test.dart
-///     test/split_test.dart
-///     .gitignore
-///     README.md
-///     lib/path.dart
-///     pubspec.yaml
-///     test/all_test.dart
-///     test/path_posix_test.dart
-///     test/path_windows_test.dart
-///
-/// this renders:
-///
-///     |-- .gitignore
-///     |-- README.md
-///     |-- TODO
-///     |-- example
-///     |   |-- console_example.dart
-///     |   |-- main.dart
-///     |   '-- web copy
-///     |       '-- web_example.dart
-///     |-- lib
-///     |   '-- path.dart
-///     |-- pubspec.yaml
-///     '-- test
-///         |-- absolute_test.dart
-///         |-- all_test.dart
-///         |-- basename_test.dart
-///         | (7 more...)
-///         |-- path_windows_test.dart
-///         |-- relative_test.dart
-///         '-- split_test.dart
-///
-/// If [baseDir] is passed, it will be used as the root of the tree.
-///
-/// If [showAllChildren] is `false`, then directories with more than ten items
-/// will have their contents truncated. Defaults to `false`.
-String fromFiles(List<String> files, {String baseDir, bool showAllChildren}) {
-  // Parse out the files into a tree of nested maps.
-  var root = {};
-  for (var file in files) {
-    if (baseDir != null) file = path.relative(file, from: baseDir);
-    var directory = root;
-    for (var part in path.split(file)) {
-      directory = directory.putIfAbsent(part, () => {});
-    }
-  }
-
-  // Walk the map recursively and render to a string.
-  return fromMap(root, showAllChildren: showAllChildren);
-}
-
-/// Draws a tree from a nested map. Given a map like:
-///
-///     {
-///       "analyzer": {
-///         "args": {
-///           "collection": ""
-///         },
-///         "logging": {}
-///       },
-///       "barback": {}
-///     }
-///
-/// this renders:
-///
-///     analyzer
-///     |-- args
-///     |   '-- collection
-///     '---logging
-///     barback
-///
-/// Items with no children should have an empty map as the value.
-///
-/// If [showAllChildren] is `false`, then directories with more than ten items
-/// will have their contents truncated. Defaults to `false`.
-String fromMap(Map map, {bool showAllChildren}) {
-  var buffer = new StringBuffer();
-  _draw(buffer, "", null, map, showAllChildren: showAllChildren);
-  return buffer.toString();
-}
-
-void _drawLine(StringBuffer buffer, String prefix, bool isLastChild,
-               String name) {
-  // Print lines.
-  buffer.write(prefix);
-  if (name != null) {
-    if (isLastChild) {
-      buffer.write(log.gray("'-- "));
-    } else {
-      buffer.write(log.gray("|-- "));
-    }
-  }
-
-  // Print name.
-  buffer.writeln(name);
-}
-
-String _getPrefix(bool isRoot, bool isLast) {
-  if (isRoot) return "";
-  if (isLast) return "    ";
-  return log.gray("|   ");
-}
-
-void _draw(StringBuffer buffer, String prefix, String name, Map children,
-           {bool showAllChildren, bool isLast: false}) {
-  if (showAllChildren == null) showAllChildren = false;
-
-  // Don't draw a line for the root node.
-  if (name != null) _drawLine(buffer, prefix, isLast, name);
-
-  // Recurse to the children.
-  var childNames = ordered(children.keys);
-
-  drawChild(bool isLastChild, String child) {
-    var childPrefix = _getPrefix(name == null, isLast);
-    _draw(buffer, '$prefix$childPrefix', child, children[child],
-        showAllChildren: showAllChildren, isLast: isLastChild);
-  }
-
-  if (name == null || showAllChildren || childNames.length <= 10) {
-    // Not too many, so show all the children.
-    for (var i = 0; i < childNames.length; i++) {
-      drawChild(i == childNames.length - 1, childNames[i]);
-    }
-  } else {
-    // Show the first few.
-    drawChild(false, childNames[0]);
-    drawChild(false, childNames[1]);
-    drawChild(false, childNames[2]);
-
-    // Elide the middle ones.
-    buffer.write(prefix);
-    buffer.write(_getPrefix(name == null, isLast));
-    buffer.writeln(log.gray('| (${childNames.length - 6} more...)'));
-
-    // Show the last few.
-    drawChild(false, childNames[childNames.length - 3]);
-    drawChild(false, childNames[childNames.length - 2]);
-    drawChild(true, childNames[childNames.length - 1]);
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback.dart b/sdk/lib/_internal/pub/lib/src/barback.dart
deleted file mode 100644
index 33c7754..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback.dart
+++ /dev/null
@@ -1,89 +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 pub.barback;
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as p;
-import 'package:pub_semver/pub_semver.dart';
-
-/// The currently supported versions of packages that this version of pub works
-/// with.
-///
-/// Pub implicitly constrains these packages to these versions as long as
-/// barback is a dependency.
-///
-/// Users' transformers are loaded in an isolate that uses the entrypoint
-/// package's dependency versions. However, that isolate also loads code
-/// provided by pub (`asset/dart/transformer_isolate.dart` and associated
-/// files). This code uses these packages as well, so these constraints exist to
-/// ensure that its usage of the packages remains valid.
-///
-/// Most constraints here are like normal version constraints in that their
-/// upper bound is the next major version of the package (or minor version for
-/// pre-1.0.0 packages). If a new major version of the package is released,
-/// these *must* be incremented to synchronize with that.
-///
-/// The constraint on barback is different. Its upper bound is the next *patch*
-/// version of barback—that is, the next version with new features. This is
-/// because most barback features need additional serialization code to be fully
-/// supported in pub, even if they're otherwise backwards-compatible.
-///
-/// Whenever a new minor or patch version of barback is published, this *must*
-/// be incremented to synchronize with that. See the barback [compatibility
-/// documentation][compat] for details on the relationship between this
-/// constraint and barback's version.
-///
-/// [compat]: https://gist.github.com/nex3/10942218
-final pubConstraints = {
-  "barback": new VersionConstraint.parse(">=0.13.0 <0.15.3"),
-  "source_span": new VersionConstraint.parse(">=1.0.0 <2.0.0"),
-  "stack_trace": new VersionConstraint.parse(">=0.9.1 <2.0.0")
-};
-
-/// Converts [id] to a "package:" URI.
-///
-/// This will throw an [ArgumentError] if [id] doesn't represent a library in
-/// `lib/`.
-Uri idToPackageUri(AssetId id) {
-  if (!id.path.startsWith('lib/')) {
-    throw new ArgumentError("Asset id $id doesn't identify a library.");
-  }
-
-  return new Uri(scheme: 'package',
-      path: p.url.join(id.package, id.path.replaceFirst('lib/', '')));
-}
-
-/// Converts [uri] into an [AssetId] if its path is within "packages".
-///
-/// If the URL contains a special directory, but lacks a following package name,
-/// throws a [FormatException].
-///
-/// If the URI doesn't contain one of those special directories, returns null.
-AssetId packagesUrlToId(Uri url) {
-  var parts = p.url.split(url.path);
-
-  // Strip the leading "/" from the URL.
-  if (parts.isNotEmpty && parts.first == "/") parts = parts.skip(1).toList();
-
-  if (parts.isEmpty) return null;
-
-  // Check for "packages" in the URL.
-  // TODO(rnystrom): If we rewrite "package:" imports to relative imports that
-  // point to a canonical "packages" directory, we can limit "packages" to the
-  // root of the URL as well. See: #16649.
-  var index = parts.indexOf("packages");
-  if (index == -1) return null;
-
-  // There should be a package name after "packages".
-  if (parts.length <= index + 1) {
-    throw new FormatException(
-        'Invalid URL path "${url.path}". Expected package name '
-        'after "packages".');
-  }
-
-  var package = parts[index + 1];
-  var assetPath = p.url.join("lib", p.url.joinAll(parts.skip(index + 2)));
-  return new AssetId(package, assetPath);
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/admin_server.dart b/sdk/lib/_internal/pub/lib/src/barback/admin_server.dart
deleted file mode 100644
index 057a588..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/admin_server.dart
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.barback.admin_server;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:http_parser/http_parser.dart';
-import 'package:shelf/shelf.dart' as shelf;
-import 'package:shelf_web_socket/shelf_web_socket.dart';
-
-import '../io.dart';
-import '../log.dart' as log;
-import 'asset_environment.dart';
-import 'base_server.dart';
-import 'web_socket_api.dart';
-
-/// The web admin interface to pub serve.
-// TODO(rnystrom): Currently this just provides access to the Web Socket API.
-// See #16954.
-class AdminServer extends BaseServer {
-  /// All currently open [WebSocket] connections.
-  final _webSockets = new Set<CompatibleWebSocket>();
-
-  shelf.Handler _handler;
-
-  /// Creates a new server and binds it to [port] of [host].
-  static Future<AdminServer> bind(AssetEnvironment environment,
-      String host, int port) {
-    return bindServer(host, port).then((server) {
-      log.fine('Bound admin server to $host:$port.');
-      return new AdminServer._(environment, server);
-    });
-  }
-
-  AdminServer._(AssetEnvironment environment, HttpServer server)
-      : super(environment, server) {
-    _handler = new shelf.Cascade()
-        .add(webSocketHandler(_handleWebSocket))
-        .add(_handleHttp).handler;
-  }
-
-  /// Closes the server and all Web Socket connections.
-  Future close() {
-    var futures = [super.close()];
-    futures.addAll(_webSockets.map((socket) => socket.close()));
-    return Future.wait(futures);
-  }
-
-  handleRequest(shelf.Request request) => _handler(request);
-
-  /// Handles an HTTP request.
-  _handleHttp(shelf.Request request) {
-    // TODO(rnystrom): Actually respond to requests once there is an admin
-    // interface. See #16954.
-    logRequest(request, "501 Not Implemented");
-    return new shelf.Response(501,
-        body: "Currently this server only accepts Web Socket connections.");
-  }
-
-  /// Creates a web socket for [request] which should be an upgrade request.
-  void _handleWebSocket(CompatibleWebSocket socket) {
-    _webSockets.add(socket);
-    var api = new WebSocketApi(socket, environment);
-    api.listen()
-        .whenComplete(() => _webSockets.remove(api))
-        .catchError(addError);
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart b/sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart
deleted file mode 100644
index a8a56f0..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart
+++ /dev/null
@@ -1,799 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.barback.asset_environment;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as path;
-import 'package:watcher/watcher.dart';
-
-import '../cached_package.dart';
-import '../entrypoint.dart';
-import '../exceptions.dart';
-import '../io.dart';
-import '../log.dart' as log;
-import '../package.dart';
-import '../package_graph.dart';
-import '../source/cached.dart';
-import '../utils.dart';
-import 'admin_server.dart';
-import 'barback_server.dart';
-import 'dart_forwarding_transformer.dart';
-import 'dart2js_transformer.dart';
-import 'load_all_transformers.dart';
-import 'pub_package_provider.dart';
-import 'source_directory.dart';
-
-/// The entire "visible" state of the assets of a package and all of its
-/// dependencies, taking into account the user's configuration when running pub.
-///
-/// Where [PackageGraph] just describes the entrypoint's dependencies as
-/// specified by pubspecs, this includes "transient" information like the mode
-/// that the user is running pub in, or which directories they want to
-/// transform.
-class AssetEnvironment {
-  /// Creates a new build environment for working with the assets used by
-  /// [entrypoint] and its dependencies.
-  ///
-  /// HTTP servers that serve directories from this environment will be bound
-  /// to [hostname] and have ports based on [basePort]. If omitted, they
-  /// default to "localhost" and "0" (use ephemeral ports), respectively.
-  ///
-  /// Loads all used transformers using [mode] (including dart2js if
-  /// [useDart2JS] is true).
-  ///
-  /// This will only add the root package's "lib" directory to the environment.
-  /// Other directories can be added to the environment using [serveDirectory].
-  ///
-  /// If [watcherType] is not [WatcherType.NONE] (the default), watches source
-  /// assets for modification.
-  ///
-  /// If [packages] is passed, only those packages' assets are loaded and
-  /// served.
-  ///
-  /// If [entrypoints] is passed, only transformers necessary to run those
-  /// entrypoints are loaded. Each entrypoint is expected to refer to a Dart
-  /// library.
-  ///
-  /// If [environmentConstants] is passed, the constants it defines are passed
-  /// on to the built-in dart2js transformer.
-  ///
-  /// Returns a [Future] that completes to the environment once the inputs,
-  /// transformers, and server are loaded and ready.
-  static Future<AssetEnvironment> create(Entrypoint entrypoint,
-      BarbackMode mode, {WatcherType watcherType, String hostname, int basePort,
-      Iterable<String> packages, Iterable<AssetId> entrypoints,
-      Map<String, String> environmentConstants, bool useDart2JS: true}) {
-    if (watcherType == null) watcherType = WatcherType.NONE;
-    if (hostname == null) hostname = "localhost";
-    if (basePort == null) basePort = 0;
-    if (environmentConstants == null) environmentConstants = {};
-
-    return log.progress("Loading asset environment", () async {
-      var graph = await entrypoint.loadPackageGraph();
-      graph = _adjustPackageGraph(graph, mode, packages);
-      var barback = new Barback(new PubPackageProvider(graph));
-      barback.log.listen(_log);
-
-      var environment = new AssetEnvironment._(graph, barback, mode,
-          watcherType, hostname, basePort, environmentConstants);
-
-      await environment._load(entrypoints: entrypoints, useDart2JS: useDart2JS);
-      return environment;
-    }, fine: true);
-  }
-
-  /// Return a version of [graph] that's restricted to [packages] (if passed)
-  /// and loads cached packages (if [mode] is [BarbackMode.DEBUG]).
-  static PackageGraph _adjustPackageGraph(PackageGraph graph,
-      BarbackMode mode, Iterable<String> packages) {
-    if (mode != BarbackMode.DEBUG && packages == null) return graph;
-    packages = (packages == null ? graph.packages.keys : packages).toSet();
-
-    return new PackageGraph(graph.entrypoint, graph.lockFile,
-        new Map.fromIterable(packages, value: (packageName) {
-      var package = graph.packages[packageName];
-      if (mode != BarbackMode.DEBUG) return package;
-      var cache = path.join('.pub/deps/debug', packageName);
-      if (!dirExists(cache)) return package;
-      return new CachedPackage(package, cache);
-    }));
-  }
-
-  /// The server for the Web Socket API and admin interface.
-  AdminServer _adminServer;
-
-  /// The public directories in the root package that are included in the asset
-  /// environment, keyed by their root directory.
-  final _directories = new Map<String, SourceDirectory>();
-
-  /// The [Barback] instance used to process assets in this environment.
-  final Barback barback;
-
-  /// The root package being built.
-  Package get rootPackage => graph.entrypoint.root;
-
-  /// The graph of packages whose assets and transformers are loaded in this
-  /// environment.
-  ///
-  /// This isn't necessarily identical to the graph that's passed in to the
-  /// environment. It may expose fewer packages if some packages' assets don't
-  /// need to be loaded, and it may expose some [CachedPackage]s.
-  final PackageGraph graph;
-
-  /// The mode to run the transformers in.
-  final BarbackMode mode;
-
-  /// Constants to passed to the built-in dart2js transformer.
-  final Map<String, String> environmentConstants;
-
-  /// The [Transformer]s that should be appended by default to the root
-  /// package's transformer cascade. Will be empty if there are none.
-  final _builtInTransformers = <Transformer>[];
-
-  /// How source files should be watched.
-  final WatcherType _watcherType;
-
-  /// The hostname that servers are bound to.
-  final String _hostname;
-
-  /// The starting number for ports that servers will be bound to.
-  ///
-  /// Servers will be bound to ports starting at this number and then
-  /// incrementing from there. However, if this is zero, then ephemeral port
-  /// numbers will be selected for each server.
-  final int _basePort;
-
-  /// The modified source assets that have not been sent to barback yet.
-  ///
-  /// The build environment can be paused (by calling [pauseUpdates]) and
-  /// resumed ([resumeUpdates]). While paused, all source asset updates that
-  /// come from watching or adding new directories are not sent to barback.
-  /// When resumed, all pending source updates are sent to barback.
-  ///
-  /// This lets pub serve and pub build create an environment and bind several
-  /// servers before barback starts building and producing results
-  /// asynchronously.
-  ///
-  /// If this is `null`, then the environment is "live" and all updates will
-  /// go to barback immediately.
-  Set<AssetId> _modifiedSources;
-
-  AssetEnvironment._(this.graph, this.barback, this.mode,
-        this._watcherType, this._hostname, this._basePort,
-        this.environmentConstants);
-
-  /// Gets the built-in [Transformer]s that should be added to [package].
-  ///
-  /// Returns `null` if there are none.
-  Iterable<Transformer> getBuiltInTransformers(Package package) {
-    // Built-in transformers only apply to the root package.
-    if (package.name != rootPackage.name) return null;
-
-    // The built-in transformers are for dart2js and forwarding assets around
-    // dart2js.
-    if (_builtInTransformers.isEmpty) return null;
-
-    return _builtInTransformers;
-  }
-
-  /// Starts up the admin server on an appropriate port and returns it.
-  ///
-  /// This may only be called once on the build environment.
-  Future<AdminServer> startAdminServer(int port) {
-    // Can only start once.
-    assert(_adminServer == null);
-
-    return AdminServer.bind(this, _hostname, port)
-        .then((server) => _adminServer = server);
-  }
-
-  /// Binds a new port to serve assets from within [rootDirectory] in the
-  /// entrypoint package.
-  ///
-  /// Adds and watches the sources within that directory. Returns a [Future]
-  /// that completes to the bound server.
-  ///
-  /// If [rootDirectory] is already being served, returns that existing server.
-  Future<BarbackServer> serveDirectory(String rootDirectory) {
-    // See if there is already a server bound to the directory.
-    var directory = _directories[rootDirectory];
-    if (directory != null) {
-      return directory.server.then((server) {
-        log.fine('Already serving $rootDirectory on ${server.url}.');
-        return server;
-      });
-    }
-
-    // See if the new directory overlaps any existing servers.
-    var overlapping = _directories.keys.where((directory) =>
-        path.isWithin(directory, rootDirectory) ||
-        path.isWithin(rootDirectory, directory)).toList();
-
-    if (overlapping.isNotEmpty) {
-      return new Future.error(
-          new OverlappingSourceDirectoryException(overlapping));
-    }
-
-    var port = _basePort;
-
-    // If not using an ephemeral port, find the lowest-numbered available one.
-    if (port != 0) {
-      var boundPorts = _directories.values.map((directory) => directory.port)
-          .toSet();
-      while (boundPorts.contains(port)) {
-        port++;
-      }
-    }
-
-    var sourceDirectory = new SourceDirectory(
-        this, rootDirectory, _hostname, port);
-    _directories[rootDirectory] = sourceDirectory;
-
-    return _provideDirectorySources(rootPackage, rootDirectory)
-        .then((subscription) {
-      sourceDirectory.watchSubscription = subscription;
-      return sourceDirectory.serve();
-    });
-  }
-
-  /// Binds a new port to serve assets from within the "bin" directory of
-  /// [package].
-  ///
-  /// Adds the sources within that directory and then binds a server to it.
-  /// Unlike [serveDirectory], this works with packages that are not the
-  /// entrypoint.
-  ///
-  /// Returns a [Future] that completes to the bound server.
-  Future<BarbackServer> servePackageBinDirectory(String package) {
-    return _provideDirectorySources(graph.packages[package], "bin").then(
-        (_) => BarbackServer.bind(this, _hostname, 0, package: package,
-            rootDirectory: "bin"));
-  }
-
-  /// Precompiles all of [packageName]'s executables to snapshots in
-  /// [directory].
-  ///
-  /// If [executableIds] is passed, only those executables are precompiled.
-  ///
-  /// Returns a map from executable name to path for the snapshots that were
-  /// successfully precompiled.
-  Future<Map<String, String>> precompileExecutables(String packageName,
-      String directory, {Iterable<AssetId> executableIds}) async {
-    if (executableIds == null) {
-      executableIds = graph.packages[packageName].executableIds;
-    }
-
-    log.fine("Executables for $packageName: $executableIds");
-    if (executableIds.isEmpty) return {};
-
-    var server = await servePackageBinDirectory(packageName);
-    try {
-      var precompiled = {};
-      await waitAndPrintErrors(executableIds.map((id) async {
-        var basename = path.url.basename(id.path);
-        var snapshotPath = path.join(directory, "$basename.snapshot");
-        var result = await runProcess(Platform.executable, [
-          '--snapshot=$snapshotPath',
-          server.url.resolve(basename).toString()
-        ]);
-        if (result.success) {
-          log.message("Precompiled ${_formatExecutable(id)}.");
-          precompiled[path.withoutExtension(basename)] = snapshotPath;
-        } else {
-          throw new ApplicationException(
-              log.yellow("Failed to precompile ${_formatExecutable(id)}:\n") +
-              result.stderr.join('\n'));
-        }
-      }));
-
-      return precompiled;
-    } finally {
-      // Don't await this future, since we have no need to wait for the server
-      // to fully shut down.
-      server.close();
-    }
-  }
-
-  /// Returns the executable name for [id].
-  ///
-  /// [id] is assumed to be an executable in a bin directory. The return value
-  /// is intended for log output and may contain formatting.
-  String _formatExecutable(AssetId id) =>
-      log.bold("${id.package}:${path.basenameWithoutExtension(id.path)}");
-
-  /// Stops the server bound to [rootDirectory].
-  ///
-  /// Also removes any source files within that directory from barback. Returns
-  /// the URL of the unbound server, of `null` if [rootDirectory] was not
-  /// bound to a server.
-  Future<Uri> unserveDirectory(String rootDirectory) {
-    log.fine("Unserving $rootDirectory.");
-    var directory = _directories.remove(rootDirectory);
-    if (directory == null) return new Future.value();
-
-    return directory.server.then((server) {
-      var url = server.url;
-      return directory.close().then((_) {
-        _removeDirectorySources(rootDirectory);
-        return url;
-      });
-    });
-  }
-
-  /// Gets the source directory that contains [assetPath] within the entrypoint
-  /// package.
-  ///
-  /// If [assetPath] is not contained within a source directory, this throws
-  /// an exception.
-  String getSourceDirectoryContaining(String assetPath) =>
-      _directories.values
-          .firstWhere((dir) => path.isWithin(dir.directory, assetPath))
-          .directory;
-
-  /// Return all URLs serving [assetPath] in this environment.
-  Future<List<Uri>> getUrlsForAssetPath(String assetPath) {
-    // Check the three (mutually-exclusive) places the path could be pointing.
-    return _lookUpPathInServerRoot(assetPath).then((urls) {
-      if (urls.isNotEmpty) return urls;
-      return _lookUpPathInPackagesDirectory(assetPath);
-    }).then((urls) {
-      if (urls.isNotEmpty) return urls;
-      return _lookUpPathInDependency(assetPath);
-    });
-  }
-
-  /// Look up [assetPath] in the root directories of servers running in the
-  /// entrypoint package.
-  Future<List<Uri>> _lookUpPathInServerRoot(String assetPath) {
-    // Find all of the servers whose root directories contain the asset and
-    // generate appropriate URLs for each.
-    return Future.wait(_directories.values
-        .where((dir) => path.isWithin(dir.directory, assetPath))
-        .map((dir) {
-      var relativePath = path.relative(assetPath, from: dir.directory);
-      return dir.server.then((server) =>
-          server.url.resolveUri(path.toUri(relativePath)));
-    }));
-  }
-
-  /// Look up [assetPath] in the "packages" directory in the entrypoint package.
-  Future<List<Uri>> _lookUpPathInPackagesDirectory(String assetPath) {
-    var components = path.split(path.relative(assetPath));
-    if (components.first != "packages") return new Future.value([]);
-    if (!graph.packages.containsKey(components[1])) return new Future.value([]);
-    return Future.wait(_directories.values.map((dir) {
-      return dir.server.then((server) =>
-          server.url.resolveUri(path.toUri(assetPath)));
-    }));
-  }
-
-  /// Look up [assetPath] in the "lib" or "asset" directory of a dependency
-  /// package.
-  Future<List<Uri>> _lookUpPathInDependency(String assetPath) {
-    for (var packageName in graph.packages.keys) {
-      var package = graph.packages[packageName];
-      var libDir = package.path('lib');
-      var assetDir = package.path('asset');
-
-      var uri;
-      if (path.isWithin(libDir, assetPath)) {
-        uri = path.toUri(path.join('packages', package.name,
-            path.relative(assetPath, from: libDir)));
-      } else if (path.isWithin(assetDir, assetPath)) {
-        uri = path.toUri(path.join('assets', package.name,
-            path.relative(assetPath, from: assetDir)));
-      } else {
-        continue;
-      }
-
-      return Future.wait(_directories.values.map((dir) {
-        return dir.server.then((server) => server.url.resolveUri(uri));
-      }));
-    }
-
-    return new Future.value([]);
-  }
-
-  /// Given a URL to an asset served by this environment, returns the ID of the
-  /// asset that would be accessed by that URL.
-  ///
-  /// If no server can serve [url], completes to `null`.
-  Future<AssetId> getAssetIdForUrl(Uri url) {
-    return Future.wait(_directories.values.map((dir) => dir.server))
-        .then((servers) {
-      var server = servers.firstWhere((server) {
-        if (server.port != url.port) return false;
-        return isLoopback(server.address.host) == isLoopback(url.host) ||
-            server.address.host == url.host;
-      }, orElse: () => null);
-      if (server == null) return null;
-      return server.urlToId(url);
-    });
-  }
-
-  /// Determines if [sourcePath] is contained within any of the directories in
-  /// the root package that are visible to this build environment.
-  bool containsPath(String sourcePath) {
-    var directories = ["lib"];
-    directories.addAll(_directories.keys);
-    return directories.any((dir) => path.isWithin(dir, sourcePath));
-  }
-
-  /// Pauses sending source asset updates to barback.
-  void pauseUpdates() {
-    // Cannot pause while already paused.
-    assert(_modifiedSources == null);
-
-    _modifiedSources = new Set<AssetId>();
-  }
-
-  /// Sends any pending source updates to barback and begins the asynchronous
-  /// build process.
-  void resumeUpdates() {
-    // Cannot resume while not paused.
-    assert(_modifiedSources != null);
-
-    barback.updateSources(_modifiedSources);
-    _modifiedSources = null;
-  }
-
-  /// Loads the assets and transformers for this environment.
-  ///
-  /// This transforms and serves all library and asset files in all packages in
-  /// the environment's package graph. It loads any transformer plugins defined
-  /// in packages in [graph] and re-runs them as necessary when any input files
-  /// change.
-  ///
-  /// If [useDart2JS] is `true`, then the [Dart2JSTransformer] is implicitly
-  /// added to end of the root package's transformer phases.
-  ///
-  /// If [entrypoints] is passed, only transformers necessary to run those
-  /// entrypoints will be loaded.
-  ///
-  /// Returns a [Future] that completes once all inputs and transformers are
-  /// loaded.
-  Future _load({Iterable<AssetId> entrypoints, bool useDart2JS}) {
-    return log.progress("Initializing barback", () async {
-      // If the entrypoint package manually configures the dart2js
-      // transformer, don't include it in the built-in transformer list.
-      //
-      // TODO(nweiz): if/when we support more built-in transformers, make
-      // this more general.
-      var containsDart2JS = graph.entrypoint.root.pubspec.transformers
-          .any((transformers) =>
-              transformers.any((config) => config.id.package == '\$dart2js'));
-
-      if (!containsDart2JS && useDart2JS) {
-        _builtInTransformers.addAll([
-          new Dart2JSTransformer(this, mode),
-          new DartForwardingTransformer()
-        ]);
-      }
-
-      // Bind a server that we can use to load the transformers.
-      var transformerServer = await BarbackServer.bind(this, _hostname, 0);
-
-      var errorStream = barback.errors.map((error) {
-        // Even most normally non-fatal barback errors should take down pub if
-        // they happen during the initial load process.
-        if (error is! AssetLoadException) throw error;
-
-        log.error(log.red(error.message));
-        log.fine(error.stackTrace.terse);
-      });
-
-      await _withStreamErrors(() {
-        return log.progress("Loading source assets", _provideSources);
-      }, [errorStream, barback.results]);
-
-      log.fine("Provided sources.");
-
-      errorStream = barback.errors.map((error) {
-        // Now that we're loading transformers, errors they log shouldn't be
-        // fatal, since we're starting to run them on real user assets which
-        // may have e.g. syntax errors. If an error would cause a transformer
-        // to fail to load, the load failure will cause us to exit.
-        if (error is! TransformerException) throw error;
-
-        var message = error.error.toString();
-        if (error.stackTrace != null) {
-          message += "\n" + error.stackTrace.terse.toString();
-        }
-
-        _log(new LogEntry(error.transform, error.transform.primaryId,
-                LogLevel.ERROR, message, null));
-      });
-
-      await _withStreamErrors(() async {
-        return log.progress("Loading transformers", () async {
-          await loadAllTransformers(this, transformerServer,
-              entrypoints: entrypoints);
-          transformerServer.close();
-        }, fine: true);
-      }, [errorStream, barback.results, transformerServer.results]);
-    }, fine: true);
-  }
-
-  /// Provides the public source assets in the environment to barback.
-  ///
-  /// If [watcherType] is not [WatcherType.NONE], enables watching on them.
-  Future _provideSources() async {
-    // Just include the "lib" directory from each package. We'll add the
-    // other build directories in the root package by calling
-    // [serveDirectory].
-    await Future.wait(graph.packages.values.map((package) async {
-      if (graph.isPackageStatic(package.name)) return;
-      await _provideDirectorySources(package, "lib");
-    }));
-  }
-
-  /// Provides all of the source assets within [dir] in [package] to barback.
-  ///
-  /// If [watcherType] is not [WatcherType.NONE], enables watching on them.
-  /// Returns the subscription to the watcher, or `null` if none was created.
-  Future<StreamSubscription<WatchEvent>> _provideDirectorySources(
-      Package package, String dir) {
-    log.fine("Providing sources for ${package.name}|$dir.");
-    // TODO(rnystrom): Handle overlapping directories. If two served
-    // directories overlap like so:
-    //
-    // $ pub serve example example/subdir
-    //
-    // Then the sources of the subdirectory will be updated and watched twice.
-    // See: #17454
-    if (_watcherType == WatcherType.NONE) {
-      _updateDirectorySources(package, dir);
-      return new Future.value();
-    }
-
-    // Watch the directory before listing is so we don't miss files that
-    // are added between the initial list and registering the watcher.
-    return _watchDirectorySources(package, dir).then((_) {
-      _updateDirectorySources(package, dir);
-    });
-  }
-
-  /// Updates barback with all of the files in [dir] inside [package].
-  void _updateDirectorySources(Package package, String dir) {
-    var ids = _listDirectorySources(package, dir);
-    if (_modifiedSources == null) {
-      barback.updateSources(ids);
-    } else {
-      _modifiedSources.addAll(ids);
-    }
-  }
-
-  /// Removes all of the files in [dir] in the root package from barback.
-  void _removeDirectorySources(String dir) {
-    var ids = _listDirectorySources(rootPackage, dir);
-    if (_modifiedSources == null) {
-      barback.removeSources(ids);
-    } else {
-      _modifiedSources.removeAll(ids);
-    }
-  }
-
-  /// Lists all of the source assets in [dir] inside [package].
-  ///
-  /// For large packages, listing the contents is a performance bottleneck, so
-  /// this is optimized for our needs in here instead of using the more general
-  /// but slower [listDir].
-  Iterable<AssetId> _listDirectorySources(Package package, String dir) {
-    // This is used in some performance-sensitive paths and can list many, many
-    // files. As such, it leans more havily towards optimization as opposed to
-    // readability than most code in pub. In particular, it avoids using the
-    // path package, since re-parsing a path is very expensive relative to
-    // string operations.
-    return package.listFiles(beneath: dir).map((file) {
-      // From profiling, path.relative here is just as fast as a raw substring
-      // and is correct in the case where package.dir has a trailing slash.
-      var relative = package.relative(file);
-
-      if (Platform.operatingSystem == 'windows') {
-        relative = relative.replaceAll("\\", "/");
-      }
-
-      var uri = new Uri(pathSegments: relative.split("/"));
-      return new AssetId(package.name, uri.toString());
-    });
-  }
-
-  /// Adds a file watcher for [dir] within [package], if the directory exists
-  /// and the package needs watching.
-  Future<StreamSubscription<WatchEvent>> _watchDirectorySources(
-      Package package, String dir) {
-    // If this package comes from a cached source, its contents won't change so
-    // we don't need to monitor it. `packageId` will be null for the
-    // application package, since that's not locked.
-    var packageId = graph.lockFile.packages[package.name];
-    if (packageId != null &&
-        graph.entrypoint.cache.sources[packageId.source] is CachedSource) {
-      return new Future.value();
-    }
-
-    var subdirectory = package.path(dir);
-    if (!dirExists(subdirectory)) return new Future.value();
-
-    // TODO(nweiz): close this watcher when [barback] is closed.
-    var watcher = _watcherType.create(subdirectory);
-    var subscription = watcher.events.listen((event) {
-      // Don't watch files symlinked into these directories.
-      // TODO(rnystrom): If pub gets rid of symlinks, remove this.
-      var parts = path.split(event.path);
-      if (parts.contains("packages")) return;
-
-      // Skip files that were (most likely) compiled from nearby ".dart"
-      // files. These are created by the Editor's "Run as JavaScript"
-      // command and are written directly into the package's directory.
-      // When pub's dart2js transformer then tries to create the same file
-      // name, we get a build error. To avoid that, just don't consider
-      // that file to be a source.
-      // TODO(rnystrom): Remove these when the Editor no longer generates
-      // .js files and users have had enough time that they no longer have
-      // these files laying around. See #15859.
-      if (event.path.endsWith(".dart.js")) return;
-      if (event.path.endsWith(".dart.js.map")) return;
-      if (event.path.endsWith(".dart.precompiled.js")) return;
-
-      var idPath = package.relative(event.path);
-      var id = new AssetId(package.name, path.toUri(idPath).toString());
-      if (event.type == ChangeType.REMOVE) {
-        if (_modifiedSources != null) {
-          _modifiedSources.remove(id);
-        } else {
-          barback.removeSources([id]);
-        }
-      } else if (_modifiedSources != null) {
-        _modifiedSources.add(id);
-      } else {
-        barback.updateSources([id]);
-      }
-    });
-
-    return watcher.ready.then((_) => subscription);
-  }
-
-  /// Returns the result of [futureCallback] unless any stream in [streams]
-  /// emits an error before it's done.
-  ///
-  /// If a stream does emit an error, that error is thrown instead.
-  /// [futureCallback] is a callback rather than a plain future to ensure that
-  /// [streams] are listened to before any code that might cause an error starts
-  /// running.
-  Future _withStreamErrors(Future futureCallback(), List<Stream> streams) {
-    var completer = new Completer.sync();
-    var subscriptions = streams.map((stream) =>
-        stream.listen((_) {}, onError: completer.completeError)).toList();
-
-    new Future.sync(futureCallback).then((_) {
-      if (!completer.isCompleted) completer.complete();
-    }).catchError((error, stackTrace) {
-      if (!completer.isCompleted) completer.completeError(error, stackTrace);
-    });
-
-    return completer.future.whenComplete(() {
-      for (var subscription in subscriptions) {
-        subscription.cancel();
-      }
-    });
-  }
-}
-
-/// Log [entry] using Pub's logging infrastructure.
-///
-/// Since both [LogEntry] objects and the message itself often redundantly
-/// show the same context like the file where an error occurred, this tries
-/// to avoid showing redundant data in the entry.
-void _log(LogEntry entry) {
-  messageMentions(text) =>
-      entry.message.toLowerCase().contains(text.toLowerCase());
-
-  messageMentionsAsset(id) =>
-      messageMentions(id.toString()) ||
-      messageMentions(path.fromUri(entry.assetId.path));
-
-  var prefixParts = [];
-
-  // Show the level (unless the message mentions it).
-  if (!messageMentions(entry.level.name)) {
-    prefixParts.add("${entry.level} from");
-  }
-
-  // Show the transformer.
-  prefixParts.add(entry.transform.transformer);
-
-  // Mention the primary input of the transform unless the message seems to.
-  if (!messageMentionsAsset(entry.transform.primaryId)) {
-    prefixParts.add("on ${entry.transform.primaryId}");
-  }
-
-  // If the relevant asset isn't the primary input, mention it unless the
-  // message already does.
-  if (entry.assetId != entry.transform.primaryId &&
-      !messageMentionsAsset(entry.assetId)) {
-    prefixParts.add("with input ${entry.assetId}");
-  }
-
-  var prefix = "[${prefixParts.join(' ')}]:";
-  var message = entry.message;
-  if (entry.span != null) {
-    message = entry.span.message(entry.message);
-  }
-
-  switch (entry.level) {
-    case LogLevel.ERROR:
-      log.error("${log.red(prefix)}\n$message");
-      break;
-
-    case LogLevel.WARNING:
-      log.warning("${log.yellow(prefix)}\n$message");
-      break;
-
-    case LogLevel.INFO:
-      log.message("${log.cyan(prefix)}\n$message");
-      break;
-
-    case LogLevel.FINE:
-      log.fine("${log.gray(prefix)}\n$message");
-      break;
-  }
-}
-
-/// Exception thrown when trying to serve a new directory that overlaps one or
-/// more directories already being served.
-class OverlappingSourceDirectoryException implements Exception {
-  /// The relative paths of the directories that overlap the one that could not
-  /// be served.
-  final List<String> overlappingDirectories;
-
-  OverlappingSourceDirectoryException(this.overlappingDirectories);
-}
-
-/// An enum describing different modes of constructing a [DirectoryWatcher].
-abstract class WatcherType {
-  /// A watcher that automatically chooses its type based on the operating
-  /// system.
-  static const AUTO = const _AutoWatcherType();
-
-  /// A watcher that always polls the filesystem for changes.
-  static const POLLING = const _PollingWatcherType();
-
-  /// No directory watcher at all.
-  static const NONE = const _NoneWatcherType();
-
-  /// Creates a new DirectoryWatcher.
-  DirectoryWatcher create(String directory);
-
-  String toString();
-}
-
-class _AutoWatcherType implements WatcherType {
-  const _AutoWatcherType();
-
-  DirectoryWatcher create(String directory) =>
-    new DirectoryWatcher(directory);
-
-  String toString() => "auto";
-}
-
-class _PollingWatcherType implements WatcherType {
-  const _PollingWatcherType();
-
-  DirectoryWatcher create(String directory) =>
-    new PollingDirectoryWatcher(directory);
-
-  String toString() => "polling";
-}
-
-class _NoneWatcherType implements WatcherType {
-  const _NoneWatcherType();
-
-  DirectoryWatcher create(String directory) => null;
-
-  String toString() => "none";
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/barback_server.dart b/sdk/lib/_internal/pub/lib/src/barback/barback_server.dart
deleted file mode 100644
index f825bd8..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/barback_server.dart
+++ /dev/null
@@ -1,209 +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 pub.barback.server;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:barback/barback.dart';
-import 'package:mime/mime.dart';
-import 'package:path/path.dart' as path;
-import 'package:shelf/shelf.dart' as shelf;
-import 'package:stack_trace/stack_trace.dart';
-
-import '../barback.dart';
-import '../io.dart';
-import '../log.dart' as log;
-import '../utils.dart';
-import 'base_server.dart';
-import 'asset_environment.dart';
-
-/// Callback for determining if an asset with [id] should be served or not.
-typedef bool AllowAsset(AssetId id);
-
-/// A server that serves assets transformed by barback.
-class BarbackServer extends BaseServer<BarbackServerResult> {
-  /// The package whose assets are being served.
-  final String package;
-
-  /// The directory in the root which will serve as the root of this server as
-  /// a native platform path.
-  ///
-  /// This may be `null` in which case no files in the root package can be
-  /// served and only assets in "lib" directories are available.
-  final String rootDirectory;
-
-  /// Optional callback to determine if an asset should be served.
-  ///
-  /// This can be set to allow outside code to filter out assets. Pub serve
-  /// uses this after plug-ins are loaded to avoid serving ".dart" files in
-  /// release mode.
-  ///
-  /// If this is `null`, all assets may be served.
-  AllowAsset allowAsset;
-
-  /// Creates a new server and binds it to [port] of [host].
-  ///
-  /// This server serves assets from [barback], and uses [rootDirectory]
-  /// (which is relative to the root directory of [package]) as the root
-  /// directory. If [rootDirectory] is omitted, the bound server can only be
-  /// used to serve assets from packages' lib directories (i.e. "packages/..."
-  /// URLs). If [package] is omitted, it defaults to the entrypoint package.
-  static Future<BarbackServer> bind(AssetEnvironment environment,
-      String host, int port, {String package, String rootDirectory}) {
-    if (package == null) package = environment.rootPackage.name;
-    return bindServer(host, port).then((server) {
-      if (rootDirectory == null) {
-        log.fine('Serving packages on $host:$port.');
-      } else {
-        log.fine('Bound "$rootDirectory" to $host:$port.');
-      }
-      return new BarbackServer._(environment, server, package, rootDirectory);
-    });
-  }
-
-  BarbackServer._(AssetEnvironment environment, HttpServer server,
-      this.package, this.rootDirectory)
-      : super(environment, server);
-
-  /// Converts a [url] served by this server into an [AssetId] that can be
-  /// requested from barback.
-  AssetId urlToId(Uri url) {
-    // See if it's a URL to a public directory in a dependency.
-    var id = packagesUrlToId(url);
-    if (id != null) return id;
-
-    if (rootDirectory == null) {
-      throw new FormatException(
-          "This server cannot serve out of the root directory. Got $url.");
-    }
-
-    // Otherwise, it's a path in current package's [rootDirectory].
-    var parts = path.url.split(url.path);
-
-    // Strip the leading "/" from the URL.
-    if (parts.isNotEmpty && parts.first == "/") parts = parts.skip(1);
-
-    var relativePath = path.url.join(rootDirectory, path.url.joinAll(parts));
-    return new AssetId(package, relativePath);
-  }
-
-  /// Handles an HTTP request.
-  handleRequest(shelf.Request request) {
-    if (request.method != "GET" && request.method != "HEAD") {
-      return methodNotAllowed(request);
-    }
-
-    var id;
-    try {
-      id = urlToId(request.url);
-    } on FormatException catch (ex) {
-      // If we got here, we had a path like "/packages" which is a special
-      // directory, but not a valid path since it lacks a following package
-      // name.
-      return notFound(request, error: ex.message);
-    }
-
-    // See if the asset should be blocked.
-    if (allowAsset != null && !allowAsset(id)) {
-      return notFound(request,
-          error: "Asset $id is not available in this configuration.",
-          asset: id);
-    }
-
-    return environment.barback.getAssetById(id).then((result) {
-      return result;
-    }).then((asset) => _serveAsset(request, asset)).catchError((error, trace) {
-      if (error is! AssetNotFoundException) throw error;
-      return environment.barback.getAssetById(id.addExtension("/index.html"))
-          .then((asset) {
-        if (request.url.path.endsWith('/')) return _serveAsset(request, asset);
-
-        // We only want to serve index.html if the URL explicitly ends in a
-        // slash. For other URLs, we redirect to one with the slash added to
-        // implicitly support that too. This follows Apache's behavior.
-        logRequest(request, "302 Redirect to ${request.url}/");
-        return new shelf.Response.found('${request.url}/');
-      }).catchError((newError, newTrace) {
-        // If we find neither the original file or the index, we should report
-        // the error about the original to the user.
-        throw newError is AssetNotFoundException ? error : newError;
-      });
-    }).catchError((error, trace) {
-      if (error is! AssetNotFoundException) {
-        trace = new Chain.forTrace(trace);
-        logRequest(request, "$error\n$trace");
-
-        addError(error, trace);
-        close();
-        return new shelf.Response.internalServerError();
-      }
-
-      addResult(new BarbackServerResult._failure(request.url, id, error));
-      return notFound(request, asset: id);
-    }).then((response) {
-      // Allow requests of any origin to access "pub serve". This is useful for
-      // running "pub serve" in parallel with another development server. Since
-      // "pub serve" is only used as a development server and doesn't require
-      // any sort of credentials anyway, this is secure.
-      return response.change(
-          headers: const {"Access-Control-Allow-Origin": "*"});
-    });
-  }
-
-  /// Returns the body of [asset] as a response to [request].
-  Future<shelf.Response> _serveAsset(shelf.Request request, Asset asset) {
-    return validateStream(asset.read()).then((stream) {
-      addResult(new BarbackServerResult._success(request.url, asset.id));
-      var headers = {};
-      var mimeType = lookupMimeType(asset.id.path);
-      if (mimeType != null) headers['Content-Type'] = mimeType;
-      return new shelf.Response.ok(stream, headers: headers);
-    }).catchError((error, trace) {
-      addResult(new BarbackServerResult._failure(request.url, asset.id, error));
-
-      // If we couldn't read the asset, handle the error gracefully.
-      if (error is FileSystemException) {
-        // Assume this means the asset was a file-backed source asset
-        // and we couldn't read it, so treat it like a missing asset.
-        return notFound(request, error: error.toString(), asset: asset.id);
-      }
-
-      trace = new Chain.forTrace(trace);
-      logRequest(request, "$error\n$trace");
-
-      // Otherwise, it's some internal error.
-      return new shelf.Response.internalServerError(body: error.toString());
-    });
-  }
-}
-
-/// The result of the server handling a URL.
-///
-/// Only requests for which an asset was requested from barback will emit a
-/// result. Malformed requests will be handled internally.
-class BarbackServerResult {
-  /// The requested url.
-  final Uri url;
-
-  /// The id that [url] identifies.
-  final AssetId id;
-
-  /// The error thrown by barback.
-  ///
-  /// If the request was served successfully, this will be null.
-  final error;
-
-  /// Whether the request was served successfully.
-  bool get isSuccess => error == null;
-
-  /// Whether the request was served unsuccessfully.
-  bool get isFailure => !isSuccess;
-
-  BarbackServerResult._success(this.url, this.id)
-      : error = null;
-
-  BarbackServerResult._failure(this.url, this.id, this.error);
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/base_server.dart b/sdk/lib/_internal/pub/lib/src/barback/base_server.dart
deleted file mode 100644
index a47b362..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/base_server.dart
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.barback.base_server;
-
-import 'dart:async';
-import 'dart:convert';
-import 'dart:io';
-
-import 'package:barback/barback.dart';
-import 'package:shelf/shelf.dart' as shelf;
-import 'package:shelf/shelf_io.dart' as shelf_io;
-
-import '../log.dart' as log;
-import '../utils.dart';
-import 'asset_environment.dart';
-
-/// Base class for a pub-controlled server.
-abstract class BaseServer<T> {
-  /// The [BuildEnvironment] being served.
-  final AssetEnvironment environment;
-
-  /// The underlying HTTP server.
-  final HttpServer _server;
-
-  /// The server's port.
-  int get port => _server.port;
-
-  /// The servers's address.
-  InternetAddress get address => _server.address;
-
-  /// The server's base URL.
-  Uri get url => baseUrlForAddress(_server.address, port);
-
-  /// The results of requests handled by the server.
-  ///
-  /// These can be used to provide visual feedback for the server's processing.
-  /// This stream is also used to emit any programmatic errors that occur in the
-  /// server.
-  Stream<T> get results => _resultsController.stream;
-  final _resultsController = new StreamController<T>.broadcast();
-
-  BaseServer(this.environment, this._server) {
-    shelf_io.serveRequests(_server, const shelf.Pipeline()
-        .addMiddleware(shelf.createMiddleware(errorHandler: _handleError))
-        .addHandler(handleRequest));
-  }
-
-  /// Closes this server.
-  Future close() {
-    return Future.wait([_server.close(), _resultsController.close()]);
-  }
-
-  /// Handles an HTTP request.
-  handleRequest(shelf.Request request);
-
-  /// Returns a 405 response to [request].
-  shelf.Response methodNotAllowed(shelf.Request request) {
-    logRequest(request, "405 Method Not Allowed");
-    return new shelf.Response(405,
-        body: "The ${request.method} method is not allowed for ${request.url}.",
-        headers: {'Allow': 'GET, HEAD'});
-  }
-
-  /// Returns a 404 response to [request].
-  ///
-  /// If [asset] is given, it is the ID of the asset that couldn't be found.
-  shelf.Response notFound(shelf.Request request, {String error,
-      AssetId asset}) {
-    logRequest(request, "Not Found");
-
-    // TODO(rnystrom): Apply some styling to make it visually clear that this
-    // error is coming from pub serve itself.
-    var body = new StringBuffer();
-    body.writeln("""
-        <!DOCTYPE html>
-        <head>
-        <title>404 Not Found</title>
-        </head>
-        <body>
-        <h1>404 Not Found</h1>""");
-
-    if (asset != null) {
-      body.writeln("<p>Could not find asset "
-          "<code>${HTML_ESCAPE.convert(asset.path)}</code> in package "
-          "<code>${HTML_ESCAPE.convert(asset.package)}</code>.</p>");
-    }
-
-    if (error != null) {
-      body.writeln("<p>Error: ${HTML_ESCAPE.convert(error)}</p>");
-    }
-
-    body.writeln("""
-        </body>""");
-
-    // Force a UTF-8 encoding so that error messages in non-English locales are
-    // sent correctly.
-    return new shelf.Response.notFound(body.toString(),
-        headers: {'Content-Type': 'text/html; charset=utf-8'});
-  }
-
-  /// Log [message] at [log.Level.FINE] with metadata about [request].
-  void logRequest(shelf.Request request, String message) =>
-    log.fine("$this ${request.method} ${request.url}\n$message");
-
-  /// Adds [result] to the server's [results] stream.
-  void addResult(T result) {
-    _resultsController.add(result);
-  }
-
-  /// Adds [error] as an error to the server's [results] stream.
-  void addError(error, [stackTrace]) {
-    _resultsController.addError(error, stackTrace);
-  }
-
-  /// Handles an error thrown by [handleRequest].
-  _handleError(error, StackTrace stackTrace) {
-    _resultsController.addError(error, stackTrace);
-    close();
-    return new shelf.Response.internalServerError();
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/cycle_exception.dart b/sdk/lib/_internal/pub/lib/src/barback/cycle_exception.dart
deleted file mode 100644
index 8fdd047..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/cycle_exception.dart
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub.barback.cycle_exception;
-
-import '../exceptions.dart';
-
-/// An exception thrown when a transformer dependency cycle is detected.
-///
-/// A cycle exception is usually produced within a deeply-nested series of
-/// calls. The API is designed to make it easy for each of these calls to add to
-/// the message so that the full reasoning for the cycle is made visible to the
-/// user.
-///
-/// Each call's individual message is called a "step". A [CycleException] is
-/// represented internally as a linked list of steps.
-class CycleException implements ApplicationException {
-  /// The step for this exception.
-  final String _step;
-
-  /// The next exception in the linked list.
-  ///
-  /// [_next]'s steps come after [_step].
-  final CycleException _next;
-
-  /// A list of all steps in the cycle.
-  List<String> get steps {
-    if (_step == null) return [];
-
-    var exception = this;
-    var steps = [];
-    while (exception != null) {
-      steps.add(exception._step);
-      exception = exception._next;
-    }
-    return steps;
-  }
-
-  String get message {
-    var steps = this.steps;
-    if (steps.isEmpty) return "Transformer cycle detected.";
-    return "Transformer cycle detected:\n" +
-        steps.map((step) => "  $step").join("\n");
-  }
-
-  /// Creates a new [CycleException] with zero or one steps.
-  CycleException([this._step])
-      : _next = null;
-
-  CycleException._(this._step, this._next);
-
-  /// Returns a copy of [this] with [step] added to the beginning of [steps].
-  CycleException prependStep(String step) {
-    if (_step == null) return new CycleException(step);
-    return new CycleException._(step, this);
-  }
-
-  String toString() => message;
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart b/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart
deleted file mode 100644
index 8bb1527..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart
+++ /dev/null
@@ -1,419 +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 pub.dart2js_transformer;
-
-import 'dart:async';
-import 'dart:convert';
-
-import 'package:analyzer/analyzer.dart';
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as path;
-import 'package:pool/pool.dart';
-
-import 'package:compiler/compiler.dart' as compiler;
-import 'package:compiler/src/dart2js.dart'
-    show AbortLeg;
-import 'package:compiler/src/io/source_file.dart';
-import '../barback.dart';
-import '../dart.dart' as dart;
-import '../utils.dart';
-import 'asset_environment.dart';
-
-/// The set of all valid configuration options for this transformer.
-final _validOptions = new Set<String>.from([
-  'commandLineOptions', 'checked', 'csp', 'minify', 'verbose', 'environment',
-  'preserveUris', 'suppressWarnings', 'suppressHints',
-  'suppressPackageWarnings', 'terse', 'sourceMaps'
-]);
-
-/// A [Transformer] that uses dart2js's library API to transform Dart
-/// entrypoints in "web" to JavaScript.
-class Dart2JSTransformer extends Transformer implements LazyTransformer {
-  /// We use this to ensure that only one compilation is in progress at a time.
-  ///
-  /// Dart2js uses lots of memory, so if we try to actually run compiles in
-  /// parallel, it takes down the VM. The tracking bug to do something better
-  /// is here: https://code.google.com/p/dart/issues/detail?id=14730.
-  static final _pool = new Pool(1);
-
-  final AssetEnvironment _environment;
-  final BarbackSettings _settings;
-
-  /// Whether source maps should be generated for the compiled JS.
-  bool get _generateSourceMaps => _configBool('sourceMaps',
-      defaultsTo: _settings.mode != BarbackMode.RELEASE);
-
-  Dart2JSTransformer.withSettings(this._environment, this._settings) {
-    var invalidOptions = _settings.configuration.keys.toSet()
-        .difference(_validOptions);
-    if (invalidOptions.isEmpty) return;
-
-    throw new FormatException("Unrecognized dart2js "
-        "${pluralize('option', invalidOptions.length)} "
-        "${toSentence(invalidOptions.map((option) => '"$option"'))}.");
-  }
-
-  Dart2JSTransformer(AssetEnvironment environment, BarbackMode mode)
-      : this.withSettings(environment, new BarbackSettings({}, mode));
-
-  /// Only ".dart" entrypoint files within a buildable directory are processed.
-  bool isPrimary(AssetId id) {
-    if (id.extension != ".dart") return false;
-
-    // "lib" should only contain libraries. For efficiency's sake, we don't
-    // look for entrypoints in there.
-    return !id.path.startsWith("lib/");
-  }
-
-  Future apply(Transform transform) {
-    // TODO(nweiz): If/when barback starts reporting what assets were modified,
-    // don't re-run the entrypoint detection logic unless the primary input was
-    // actually modified. See issue 16817.
-    return _isEntrypoint(transform.primaryInput).then((isEntrypoint) {
-      if (!isEntrypoint) return null;
-
-      // Wait for any ongoing apply to finish first.
-      return _pool.withResource(() {
-        transform.logger.info("Compiling ${transform.primaryInput.id}...");
-        var stopwatch = new Stopwatch()..start();
-        return _doCompilation(transform).then((_) {
-          stopwatch.stop();
-          transform.logger.info("Took ${stopwatch.elapsed} to compile "
-              "${transform.primaryInput.id}.");
-        });
-      });
-    });
-  }
-
-  void declareOutputs(DeclaringTransform transform) {
-    var primaryId = transform.primaryId;
-    transform.declareOutput(primaryId.addExtension(".js"));
-    if (_generateSourceMaps) {
-      transform.declareOutput(primaryId.addExtension(".js.map"));
-    }
-  }
-
-  /// Returns whether or not [asset] might be an entrypoint.
-  Future<bool> _isEntrypoint(Asset asset) {
-    return asset.readAsString().then((code) {
-      try {
-        var name = asset.id.path;
-        if (asset.id.package != _environment.rootPackage.name) {
-          name += " in ${asset.id.package}";
-        }
-
-        var parsed = parseCompilationUnit(code, name: name);
-        return dart.isEntrypoint(parsed);
-      } on AnalyzerErrorGroup {
-        // If we get a parse error, consider the asset primary so we report
-        // dart2js's more detailed error message instead.
-        return true;
-      }
-    });
-  }
-
-  /// Run the dart2js compiler.
-  Future _doCompilation(Transform transform) {
-    var provider = new _BarbackCompilerProvider(_environment, transform,
-        generateSourceMaps: _generateSourceMaps);
-
-    // Create a "path" to the entrypoint script. The entrypoint may not actually
-    // be on disk, but this gives dart2js a root to resolve relative paths
-    // against.
-    var id = transform.primaryInput.id;
-
-    var entrypoint = _environment.graph.packages[id.package].path(id.path);
-
-    // TODO(rnystrom): Should have more sophisticated error-handling here. Need
-    // to report compile errors to the user in an easily visible way. Need to
-    // make sure paths in errors are mapped to the original source path so they
-    // can understand them.
-    return dart.compile(
-        entrypoint, provider,
-        commandLineOptions: _configCommandLineOptions,
-        csp: _configBool('csp'),
-        checked: _configBool('checked'),
-        minify: _configBool(
-            'minify', defaultsTo: _settings.mode == BarbackMode.RELEASE),
-        verbose: _configBool('verbose'),
-        environment: _configEnvironment,
-        packageRoot: _environment.rootPackage.path("packages"),
-        analyzeAll: _configBool('analyzeAll'),
-        preserveUris: _configBool('preserveUris'),
-        suppressWarnings: _configBool('suppressWarnings'),
-        suppressHints: _configBool('suppressHints'),
-        suppressPackageWarnings: _configBool(
-            'suppressPackageWarnings', defaultsTo: true),
-        terse: _configBool('terse'),
-        includeSourceMapUrls: _generateSourceMaps);
-  }
-
-  /// Parses and returns the "commandLineOptions" configuration option.
-  List<String> get _configCommandLineOptions {
-    if (!_settings.configuration.containsKey('commandLineOptions')) return null;
-
-    var options = _settings.configuration['commandLineOptions'];
-    if (options is List && options.every((option) => option is String)) {
-      return options;
-    }
-
-    throw new FormatException('Invalid value for '
-        '\$dart2js.commandLineOptions: ${JSON.encode(options)} (expected list '
-        'of strings).');
-  }
-
-  /// Parses and returns the "environment" configuration option.
-  Map<String, String> get _configEnvironment {
-    if (!_settings.configuration.containsKey('environment')) {
-      return _environment.environmentConstants;
-    }
-
-    var environment = _settings.configuration['environment'];
-    if (environment is Map &&
-        environment.keys.every((key) => key is String) &&
-        environment.values.every((key) => key is String)) {
-      return mergeMaps(environment, _environment.environmentConstants);
-    }
-
-    throw new FormatException('Invalid value for \$dart2js.environment: '
-        '${JSON.encode(environment)} (expected map from strings to strings).');
-  }
-
-  /// Parses and returns a boolean configuration option.
-  ///
-  /// [defaultsTo] is the default value of the option.
-  bool _configBool(String name, {bool defaultsTo: false}) {
-    if (!_settings.configuration.containsKey(name)) return defaultsTo;
-    var value = _settings.configuration[name];
-    if (value is bool) return value;
-    throw new FormatException('Invalid value for \$dart2js.$name: '
-        '${JSON.encode(value)} (expected true or false).');
-  }
-}
-
-/// Defines an interface for dart2js to communicate with barback and pub.
-///
-/// Note that most of the implementation of diagnostic handling here was
-/// copied from [FormattingDiagnosticHandler] in dart2js. The primary
-/// difference is that it uses barback's logging code and, more importantly, it
-/// handles missing source files more gracefully.
-class _BarbackCompilerProvider implements dart.CompilerProvider {
-  Uri get libraryRoot => Uri.parse("${path.toUri(_libraryRootPath)}/");
-
-  final AssetEnvironment _environment;
-  final Transform _transform;
-  String _libraryRootPath;
-
-  /// The map of previously loaded files.
-  ///
-  /// Used to show where an error occurred in a source file.
-  final _sourceFiles = new Map<String, SourceFile>();
-
-  // TODO(rnystrom): Make these configurable.
-  /// Whether or not warnings should be logged.
-  var _showWarnings = true;
-
-  /// Whether or not hints should be logged.
-  var _showHints = true;
-
-  /// Whether or not verbose info messages should be logged.
-  var _verbose = false;
-
-  /// Whether an exception should be thrown on an error to stop compilation.
-  var _throwOnError = false;
-
-  /// This gets set after a fatal error is reported to quash any subsequent
-  /// errors.
-  var _isAborting = false;
-
-  final bool generateSourceMaps;
-
-  compiler.Diagnostic _lastKind = null;
-
-  static final int _FATAL =
-      compiler.Diagnostic.CRASH.ordinal |
-      compiler.Diagnostic.ERROR.ordinal;
-  static final int _INFO =
-      compiler.Diagnostic.INFO.ordinal |
-      compiler.Diagnostic.VERBOSE_INFO.ordinal;
-
-  _BarbackCompilerProvider(this._environment, this._transform,
-      {this.generateSourceMaps: true}) {
-    // Dart2js outputs source maps that reference the Dart SDK sources. For
-    // that to work, those sources need to be inside the build environment. We
-    // do that by placing them in a special "$sdk" pseudo-package. In order for
-    // dart2js to generate the right URLs to point to that package, we give it
-    // a library root that corresponds to where that package can be found
-    // relative to the public source directory containing that entrypoint.
-    //
-    // For example, say the package being compiled is "/dev/myapp", the
-    // entrypoint is "web/sub/foo/bar.dart", and the source directory is
-    // "web/sub". This means the SDK sources will be (conceptually) at:
-    //
-    //     /dev/myapp/web/sub/packages/$sdk/lib/
-    //
-    // This implies that the asset path for a file in the SDK is:
-    //
-    //     $sdk|lib/lib/...
-    //
-    // TODO(rnystrom): Fix this if #17751 is fixed.
-    var buildDir = _environment.getSourceDirectoryContaining(
-        _transform.primaryInput.id.path);
-    _libraryRootPath = _environment.rootPackage.path(
-        buildDir, "packages", r"$sdk");
-  }
-
-  /// A [CompilerInputProvider] for dart2js.
-  Future<String> provideInput(Uri resourceUri) {
-    // We only expect to get absolute "file:" URLs from dart2js.
-    assert(resourceUri.isAbsolute);
-    assert(resourceUri.scheme == "file");
-
-    var sourcePath = path.fromUri(resourceUri);
-    return _readResource(resourceUri).then((source) {
-      _sourceFiles[resourceUri.toString()] =
-          new StringSourceFile(resourceUri, path.relative(sourcePath), source);
-      return source;
-    });
-  }
-
-  /// A [CompilerOutputProvider] for dart2js.
-  EventSink<String> provideOutput(String name, String extension) {
-    // TODO(rnystrom): Do this more cleanly. See: #17403.
-    if (!generateSourceMaps && extension.endsWith(".map")) {
-      return new NullSink<String>();
-    }
-
-    // TODO(nweiz): remove this special case when dart2js stops generating these
-    // files.
-    if (extension.endsWith(".precompiled.js")) return new NullSink<String>();
-
-    var primaryId = _transform.primaryInput.id;
-
-    // Dart2js uses an empty string for the name of the entrypoint library.
-    // Otherwise, it's the name of a deferred library.
-    var outPath;
-    if (name == "") {
-      outPath = _transform.primaryInput.id.path;
-    } else {
-      var dirname = path.url.dirname(_transform.primaryInput.id.path);
-      outPath = path.url.join(dirname, name);
-    }
-
-    var id = new AssetId(primaryId.package, "$outPath.$extension");
-
-    // Make a sink that dart2js can write to.
-    var sink = new StreamController<String>();
-
-    // dart2js gives us strings, but stream assets expect byte lists.
-    var stream = UTF8.encoder.bind(sink.stream);
-
-    // And give it to barback as a stream it can read from.
-    _transform.addOutput(new Asset.fromStream(id, stream));
-
-    return sink;
-  }
-
-  /// A [DiagnosticHandler] for dart2js, loosely based on
-  /// [FormattingDiagnosticHandler].
-  void handleDiagnostic(Uri uri, int begin, int end,
-                        String message, compiler.Diagnostic kind) {
-    // TODO(ahe): Remove this when source map is handled differently.
-    if (kind.name == "source map") return;
-
-    if (_isAborting) return;
-    _isAborting = (kind == compiler.Diagnostic.CRASH);
-
-    var isInfo = (kind.ordinal & _INFO) != 0;
-    if (isInfo && uri == null && kind != compiler.Diagnostic.INFO) {
-      if (!_verbose && kind == compiler.Diagnostic.VERBOSE_INFO) return;
-      _transform.logger.info(message);
-      return;
-    }
-
-    // [_lastKind] records the previous non-INFO kind we saw.
-    // This is used to suppress info about a warning when warnings are
-    // suppressed, and similar for hints.
-    if (kind != compiler.Diagnostic.INFO) _lastKind = kind;
-
-    var logFn;
-    if (kind == compiler.Diagnostic.ERROR) {
-      logFn = _transform.logger.error;
-    } else if (kind == compiler.Diagnostic.WARNING) {
-      if (!_showWarnings) return;
-      logFn = _transform.logger.warning;
-    } else if (kind == compiler.Diagnostic.HINT) {
-      if (!_showHints) return;
-      logFn = _transform.logger.warning;
-    } else if (kind == compiler.Diagnostic.CRASH) {
-      logFn = _transform.logger.error;
-    } else if (kind == compiler.Diagnostic.INFO) {
-      if (_lastKind == compiler.Diagnostic.WARNING && !_showWarnings) return;
-      if (_lastKind == compiler.Diagnostic.HINT && !_showHints) return;
-      logFn = _transform.logger.info;
-    } else {
-      throw new Exception('Unknown kind: $kind (${kind.ordinal})');
-    }
-
-    var fatal = (kind.ordinal & _FATAL) != 0;
-    if (uri == null) {
-      logFn(message);
-    } else {
-      SourceFile file = _sourceFiles[uri.toString()];
-      if (file == null) {
-        // We got a message before loading the file, so just report the message
-        // itself.
-        logFn('$uri: $message');
-      } else {
-        logFn(file.getLocationMessage(message, begin, end));
-      }
-    }
-
-    if (fatal && _throwOnError) {
-      _isAborting = true;
-      throw new AbortLeg(message);
-    }
-  }
-
-  Future<String> _readResource(Uri url) {
-    return new Future.sync(() {
-      // Find the corresponding asset in barback.
-      var id = _sourceUrlToId(url);
-      if (id != null) return _transform.readInputAsString(id);
-
-      // Don't allow arbitrary file paths that point to things not in packages.
-      // Doing so won't work in Dartium.
-      throw new Exception(
-          "Cannot read $url because it is outside of the build environment.");
-    });
-  }
-
-  AssetId _sourceUrlToId(Uri url) {
-    // See if it's a package path.
-    var id = packagesUrlToId(url);
-    if (id != null) return id;
-
-    // See if it's a path to a "public" asset within the root package. All
-    // other files in the root package are not visible to transformers, so
-    // should be loaded directly from disk.
-    var sourcePath = path.fromUri(url);
-    if (_environment.containsPath(sourcePath)) {
-      var relative = path.toUri(_environment.rootPackage.relative(sourcePath))
-          .toString();
-
-      return new AssetId(_environment.rootPackage.name, relative);
-    }
-
-    return null;
-  }
-}
-
-/// An [EventSink] that discards all data. Provided to dart2js when we don't
-/// want an actual output.
-class NullSink<T> implements EventSink<T> {
-  void add(T event) {}
-  void addError(errorEvent, [StackTrace stackTrace]) {}
-  void close() {}
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/dart_forwarding_transformer.dart b/sdk/lib/_internal/pub/lib/src/barback/dart_forwarding_transformer.dart
deleted file mode 100644
index 210f882..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/dart_forwarding_transformer.dart
+++ /dev/null
@@ -1,29 +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 pub.dart_forwarding_transformer;
-
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-import '../utils.dart';
-
-/// A single transformer that just forwards any ".dart" file as an output when
-/// not in release mode.
-///
-/// Since the [Dart2JSTransformer] consumes its inputs, this is used in
-/// parallel to make sure the original Dart file is still available for use by
-/// Dartium.
-class DartForwardingTransformer extends Transformer {
-  DartForwardingTransformer();
-
-  String get allowedExtensions => ".dart";
-
-  Future apply(Transform transform) {
-    return newFuture(() {
-      transform.addOutput(transform.primaryInput);
-    });
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/dependency_computer.dart b/sdk/lib/_internal/pub/lib/src/barback/dependency_computer.dart
deleted file mode 100644
index facf140..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/dependency_computer.dart
+++ /dev/null
@@ -1,446 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.barback.dependency_computer;
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as p;
-
-import '../dart.dart';
-import '../io.dart';
-import '../package.dart';
-import '../package_graph.dart';
-import '../pubspec.dart';
-import '../utils.dart';
-import 'cycle_exception.dart';
-import 'transformer_config.dart';
-import 'transformer_id.dart';
-
-/// A class for determining dependencies between transformers and from Dart
-/// libraries onto transformers.
-class DependencyComputer {
-  /// The package graph being analyzed.
-  final PackageGraph _graph;
-
-  /// The names of packages for which [_PackageDependencyComputer]s are
-  /// currently loading.
-  ///
-  /// This is used to detect transformer cycles. If a package's libraries or
-  /// transformers are referenced while the transformers that apply to it are
-  /// being processed, that indicates an unresolvable cycle.
-  final _loadingPackageComputers = new Set<String>();
-
-  /// [_PackageDependencyComputer]s that have been loaded.
-  final _packageComputers = new Map<String, _PackageDependencyComputer>();
-
-  /// A cache of the results of [transformersNeededByPackage].
-  final _transformersNeededByPackages = new Map<String, Set<TransformerId>>();
-
-  /// The set of all packages that neither use transformers themselves nor
-  /// import packages that use transformers.
-  ///
-  /// This is precomputed before any package computers are loaded.
-  final _untransformedPackages = new Set<String>();
-
-  DependencyComputer(this._graph) {
-    for (var package in ordered(_graph.packages.keys)) {
-      if (_graph.transitiveDependencies(package).every((dependency) =>
-            dependency.pubspec.transformers.isEmpty)) {
-        _untransformedPackages.add(package);
-      }
-    }
-
-    ordered(_graph.packages.keys).forEach(_loadPackageComputer);
-  }
-
-  /// Returns a dependency graph for [transformers], or for all transformers if
-  /// [transformers] is `null`.
-  ///
-  /// This graph is represented by a map whose keys are the vertices and whose
-  /// values are sets representing edges from the given vertex. Each vertex is a
-  /// [TransformerId]. If there's an edge from `T1` to `T2`, then `T2` must be
-  /// loaded before `T1` can be loaded.
-  ///
-  /// The returned graph is transitively closed. That is, if there's an edge
-  /// from `T1` to `T2` and an edge from `T2` to `T3`, there's also an edge from
-  /// `T1` to `T2`.
-  Map<TransformerId, Set<TransformerId>> transformersNeededByTransformers(
-      [Iterable<TransformerId> transformers]) {
-    var result = {};
-
-    if (transformers == null) {
-      transformers = ordered(_graph.packages.keys).expand((packageName) {
-        var package = _graph.packages[packageName];
-        return package.pubspec.transformers.expand((phase) {
-          return phase.expand((config) {
-            var id = config.id;
-            if (id.isBuiltInTransformer) return [];
-            if (package.name != _graph.entrypoint.root.name &&
-                !config.canTransformPublicFiles) {
-              return [];
-            }
-            return [id];
-          });
-        });
-      });
-    }
-
-    for (var id in transformers) {
-      result[id] = _transformersNeededByTransformer(id);
-    }
-    return result;
-  }
-
-  /// Returns the set of all transformers needed to load the library identified
-  /// by [id].
-  Set<TransformerId> transformersNeededByLibrary(AssetId id) {
-    var library = _graph.packages[id.package].path(p.fromUri(id.path));
-    _loadPackageComputer(id.package);
-    return _packageComputers[id.package].transformersNeededByLibrary(library)
-        .where((id) => !id.isBuiltInTransformer).toSet();
-  }
-
-  /// Returns the set of all transformers that need to be loaded before [id] is
-  /// loaded.
-  Set<TransformerId> _transformersNeededByTransformer(TransformerId id) {
-    if (id.isBuiltInTransformer) return new Set();
-
-    if (!_graph.packages.containsKey(id.package)) {
-      // Throw this here rather than during pubspec parsing because by the time
-      // we're here, we're sure that the package is actually transforming public
-      // assets and that being unable to load it will be a problem.
-      throw new PubspecException(
-          'Error loading transformer "$id": package "${id.package}" is not '
-              'a dependency.',
-          id.span);
-    }
-
-    _loadPackageComputer(id.package);
-    return _packageComputers[id.package]._transformersNeededByTransformer(id);
-  }
-
-  /// Returns the set of all transformers that need to be loaded before
-  /// [packageUri] (a "package:" URI) can be safely imported from an external
-  /// package.
-  Set<TransformerId> _transformersNeededByPackageUri(Uri packageUri) {
-    var components = p.split(p.fromUri(packageUri.path));
-    var packageName = components.first;
-    if (_untransformedPackages.contains(packageName)) return new Set();
-
-    var package = _graph.packages[packageName];
-    if (package == null) {
-      // TODO(nweiz): include source range information here.
-      fail('A transformer imported unknown package "$packageName" (in '
-          '"$packageUri").');
-    }
-
-    var library = package.path('lib', p.joinAll(components.skip(1)));
-
-    _loadPackageComputer(packageName);
-    return _packageComputers[packageName].transformersNeededByLibrary(library);
-  }
-
-  /// Returns the set of all transformers that need to be loaded before
-  /// everything in [rootPackage] can be used.
-  ///
-  /// This is conservative in that it returns all transformers that could
-  /// theoretically affect [rootPackage]. It only looks at which transformers
-  /// packages use and which packages they depend on; it ignores imports
-  /// entirely.
-  ///
-  /// We fall back on this conservative analysis when a transformer
-  /// (transitively) imports a transformed library. The result of the
-  /// transformation may import any dependency or hit any transformer, so we
-  /// have to assume that it will.
-  Set<TransformerId> _transformersNeededByPackage(String rootPackage) {
-    if (_untransformedPackages.contains(rootPackage)) return new Set();
-
-    if (_transformersNeededByPackages.containsKey(rootPackage)) {
-      return _transformersNeededByPackages[rootPackage];
-    }
-
-    var results = new Set();
-    var seen = new Set();
-
-    traversePackage(packageName) {
-      if (seen.contains(packageName)) return;
-      seen.add(packageName);
-
-      var package = _graph.packages[packageName];
-      for (var phase in package.pubspec.transformers) {
-        for (var config in phase) {
-          var id = config.id;
-          if (id.isBuiltInTransformer) continue;
-          if (_loadingPackageComputers.contains(id.package)) {
-            throw new CycleException("$packageName is transformed by $id");
-          }
-          results.add(id);
-        }
-      }
-
-      var dependencies = packageName == _graph.entrypoint.root.name ?
-          package.immediateDependencies : package.dependencies;
-      for (var dep in dependencies) {
-        try {
-          traversePackage(dep.name);
-        } on CycleException catch (error) {
-          throw error.prependStep("$packageName depends on ${dep.name}");
-        }
-      }
-    }
-
-    traversePackage(rootPackage);
-    _transformersNeededByPackages[rootPackage] = results;
-    return results;
-  }
-
-
-  /// Ensure that a [_PackageDependencyComputer] for [packageName] is loaded.
-  ///
-  /// If the computer has already been loaded, this does nothing. If the
-  /// computer is in the process of being loaded, this throws a
-  /// [CycleException].
-  void _loadPackageComputer(String packageName) {
-    if (_loadingPackageComputers.contains(packageName)) {
-      throw new CycleException();
-    }
-    if (_packageComputers.containsKey(packageName)) return;
-    _loadingPackageComputers.add(packageName);
-    _packageComputers[packageName] =
-        new _PackageDependencyComputer(this, packageName);
-    _loadingPackageComputers.remove(packageName);
-  }
-}
-
-/// A helper class for [computeTransformersNeededByTransformers] that keeps
-/// package-specific state and caches over the course of the computation.
-class _PackageDependencyComputer {
-  /// The parent [DependencyComputer].
-  final DependencyComputer _dependencyComputer;
-
-  /// The package whose dependencies [this] is computing.
-  final Package _package;
-
-  /// The set of transformers that currently apply to [this].
-  ///
-  /// This is added to phase-by-phase while [this] is being initialized. This is
-  /// necessary to model the dependencies of a transformer that's applied to its
-  /// own package.
-  final _applicableTransformers = new Set<TransformerConfig>();
-
-  /// A cache of imports and exports parsed from libraries in this package.
-  final _directives = new Map<Uri, Set<Uri>>();
-
-  /// The set of libraries for which there are currently active
-  /// [transformersNeededByLibrary] calls.
-  ///
-  /// This is used to guard against infinite loops caused by libraries in
-  /// different packages importing one another circularly.
-  /// [transformersNeededByLibrary] will return an empty set for any active
-  /// libraries.
-  final _activeLibraries = new Set<String>();
-
-  /// A cache of the results of [_transformersNeededByTransformer].
-  final _transformersNeededByTransformers =
-      new Map<TransformerId, Set<TransformerId>>();
-
-  /// A cache of the results of [_getTransitiveExternalDirectives].
-  ///
-  /// This is invalidated whenever [_applicableTransformers] changes.
-  final _transitiveExternalDirectives = new Map<String, Set<Uri>>();
-
-  _PackageDependencyComputer(DependencyComputer dependencyComputer,
-          String packageName)
-      : _dependencyComputer = dependencyComputer,
-        _package = dependencyComputer._graph.packages[packageName] {
-    var isRootPackage =
-        packageName == _dependencyComputer._graph.entrypoint.root.name;
-
-    // If [_package] uses its own transformers, there will be fewer transformers
-    // running on [_package] while its own transformers are loading than there
-    // will be once all its transformers are finished loading. To handle this,
-    // we run [_transformersNeededByTransformer] to pre-populate
-    // [_transformersNeededByLibraries] while [_applicableTransformers] is
-    // smaller.
-    for (var phase in _package.pubspec.transformers) {
-      for (var config in phase) {
-        // Ignore non-root transformers on non-public files.
-        if (!isRootPackage && !config.canTransformPublicFiles) continue;
-
-        var id = config.id;
-        try {
-          if (id.package != _package.name) {
-            // Probe [id]'s transformer dependencies to ensure that it doesn't
-            // depend on this package. If it does, a CycleError will be thrown.
-            _dependencyComputer._transformersNeededByTransformer(id);
-          } else {
-            // Store the transformers needed specifically with the current set
-            // of [_applicableTransformers]. When reporting this transformer's
-            // dependencies, [computeTransformersNeededByTransformers] will use
-            // this stored set of dependencies rather than the potentially wider
-            // set that would be recomputed if [transformersNeededByLibrary]
-            // were called anew.
-            _transformersNeededByTransformers[id] =
-                transformersNeededByLibrary(_package.transformerPath(id));
-          }
-        } on CycleException catch (error) {
-          throw error.prependStep("$packageName is transformed by $id");
-        }
-      }
-
-      // Clear the cached imports and exports because the new transformers may
-      // start transforming a library whose directives were previously
-      // statically analyzable.
-      _transitiveExternalDirectives.clear();
-      _applicableTransformers.addAll(phase);
-    }
-  }
-
-  /// Returns the set of all transformers that need to be loaded before [id] is
-  /// loaded.
-  ///
-  /// [id] must refer to a transformer in [_package].
-  Set<TransformerId> _transformersNeededByTransformer(TransformerId id) {
-    assert(id.package == _package.name);
-    if (_transformersNeededByTransformers.containsKey(id)) {
-      return _transformersNeededByTransformers[id];
-    }
-
-    _transformersNeededByTransformers[id] =
-        transformersNeededByLibrary(_package.transformerPath(id));
-    return _transformersNeededByTransformers[id];
-  }
-
-  /// Returns the set of all transformers that need to be loaded before
-  /// [library] is imported.
-  ///
-  /// If [library] or anything it imports/exports within this package is
-  /// transformed by [_applicableTransformers], this will return a conservative
-  /// set of transformers (see also
-  /// [DependencyComputer._transformersNeededByPackage]).
-  Set<TransformerId> transformersNeededByLibrary(String library) {
-    library = p.normalize(library);
-    if (_activeLibraries.contains(library)) return new Set();
-    _activeLibraries.add(library);
-
-    try {
-      var externalDirectives = _getTransitiveExternalDirectives(library);
-      if (externalDirectives == null) {
-        var rootName = _dependencyComputer._graph.entrypoint.root.name;
-        var dependencies = _package.name == rootName ?
-            _package.immediateDependencies : _package.dependencies;
-
-        // If anything transitively imported/exported by [library] within this
-        // package is modified by a transformer, we don't know what it will
-        // load, so we take the conservative approach and say it depends on
-        // everything.
-        return _applicableTransformers.map((config) => config.id).toSet().union(
-            unionAll(dependencies.map((dep) {
-          try {
-            return _dependencyComputer._transformersNeededByPackage(dep.name);
-          } on CycleException catch (error) {
-            throw error.prependStep("${_package.name} depends on ${dep.name}");
-          }
-        })));
-      } else {
-        // If nothing's transformed, then we only depend on the transformers
-        // used by the external packages' libraries that we import or export.
-        return unionAll(externalDirectives.map((uri) {
-          try {
-            return _dependencyComputer._transformersNeededByPackageUri(uri);
-          } on CycleException catch (error) {
-            var packageName = p.url.split(uri.path).first;
-            throw error.prependStep("${_package.name} depends on $packageName");
-          }
-        }));
-      }
-    } finally {
-      _activeLibraries.remove(library);
-    }
-  }
-
-  /// Returns the set of all external package libraries transitively imported or
-  /// exported by [rootLibrary].
-  ///
-  /// All of the returned URIs will have the "package:" scheme. None of them
-  /// will be URIs for this package.
-  ///
-  /// If [rootLibrary] transitively imports or exports a library that's modified
-  /// by a transformer, this will return `null`.
-  Set<Uri> _getTransitiveExternalDirectives(String rootLibrary) {
-    rootLibrary = p.normalize(rootLibrary);
-    if (_transitiveExternalDirectives.containsKey(rootLibrary)) {
-      return _transitiveExternalDirectives[rootLibrary];
-    }
-
-    var results = new Set();
-    var seen = new Set();
-
-    traverseLibrary(library) {
-      library = p.normalize(library);
-      if (seen.contains(library)) return true;
-      seen.add(library);
-
-      var directives = _getDirectives(library);
-      if (directives == null) return false;
-
-      for (var uri in directives) {
-        var path;
-        if (uri.scheme == 'package') {
-          var components = p.split(p.fromUri(uri.path));
-          if (components.first != _package.name) {
-            results.add(uri);
-            continue;
-          }
-
-          path = _package.path('lib', p.joinAll(components.skip(1)));
-        } else if (uri.scheme == '' || uri.scheme == 'file') {
-          path = p.join(p.dirname(library), p.fromUri(uri));
-        } else {
-          // Ignore "dart:" URIs and theoretically-possible "http:" URIs.
-          continue;
-        }
-
-        if (!traverseLibrary(path)) return false;
-      }
-
-      return true;
-    }
-
-    _transitiveExternalDirectives[rootLibrary] =
-        traverseLibrary(rootLibrary) ? results : null;
-    return _transitiveExternalDirectives[rootLibrary];
-  }
-
-  /// Returns the set of all imports or exports in [library].
-  ///
-  /// If [library] is modified by a transformer, this will return `null`.
-  Set<Uri> _getDirectives(String library) {
-    var libraryUri = p.toUri(p.normalize(library));
-    var relative = p.toUri(_package.relative(library)).path;
-    if (_applicableTransformers.any((config) =>
-            config.canTransform(relative))) {
-      _directives[libraryUri] = null;
-      return null;
-    }
-
-    // Check the cache *after* checking [_applicableTransformers] because
-    // [_applicableTransformers] changes over time so the directives may be
-    // invalidated.
-    if (_directives.containsKey(libraryUri)) return _directives[libraryUri];
-
-    // If a nonexistent library is imported, it will probably be generated by a
-    // transformer.
-    if (!fileExists(library)) {
-      _directives[libraryUri] = null;
-      return null;
-    }
-
-    _directives[libraryUri] =
-        parseImportsAndExports(readTextFile(library), name: library)
-        .map((directive) => Uri.parse(directive.uri.stringValue))
-        .toSet();
-    return _directives[libraryUri];
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/excluding_aggregate_transformer.dart b/sdk/lib/_internal/pub/lib/src/barback/excluding_aggregate_transformer.dart
deleted file mode 100644
index beed5ce..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/excluding_aggregate_transformer.dart
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.excluding_aggregate_transformer;
-
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-import 'transformer_config.dart';
-
-/// Decorates an inner [AggregateTransformer] and handles including and
-/// excluding primary inputs.
-class ExcludingAggregateTransformer extends AggregateTransformer {
-  /// If [config] defines includes or excludes, wraps [inner] in an
-  /// [ExcludingAggregateTransformer] that handles those.
-  ///
-  /// Otherwise, just returns [inner] unmodified.
-  static AggregateTransformer wrap(AggregateTransformer inner,
-      TransformerConfig config) {
-    if (!config.hasExclusions) return inner;
-
-    if (inner is LazyAggregateTransformer) {
-      return new _LazyExcludingAggregateTransformer(
-          inner as LazyAggregateTransformer, config);
-    } else if (inner is DeclaringAggregateTransformer) {
-      return new _DeclaringExcludingAggregateTransformer(
-          inner as DeclaringAggregateTransformer, config);
-    } else {
-      return new ExcludingAggregateTransformer._(inner, config);
-    }
-  }
-
-  final AggregateTransformer _inner;
-
-  /// The config containing rules for which assets to include or exclude.
-  final TransformerConfig _config;
-
-  ExcludingAggregateTransformer._(this._inner, this._config);
-
-  classifyPrimary(AssetId id) {
-    if (!_config.canTransform(id.path)) return null;
-    return _inner.classifyPrimary(id);
-  }
-
-  Future apply(AggregateTransform transform) => _inner.apply(transform);
-
-  String toString() => _inner.toString();
-}
-
-class _DeclaringExcludingAggregateTransformer
-    extends ExcludingAggregateTransformer
-    implements DeclaringAggregateTransformer {
-  _DeclaringExcludingAggregateTransformer(DeclaringAggregateTransformer inner,
-        TransformerConfig config)
-      : super._(inner as AggregateTransformer, config);
-
-  Future declareOutputs(DeclaringAggregateTransform transform) =>
-      (_inner as DeclaringAggregateTransformer).declareOutputs(transform);
-}
-
-class _LazyExcludingAggregateTransformer
-    extends _DeclaringExcludingAggregateTransformer
-    implements LazyAggregateTransformer {
-  _LazyExcludingAggregateTransformer(DeclaringAggregateTransformer inner,
-        TransformerConfig config)
-      : super(inner, config);
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/excluding_transformer.dart b/sdk/lib/_internal/pub/lib/src/barback/excluding_transformer.dart
deleted file mode 100644
index 90b4e51..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/excluding_transformer.dart
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.excluding_transformer;
-
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-import 'transformer_config.dart';
-
-/// Decorates an inner [Transformer] and handles including and excluding
-/// primary inputs.
-class ExcludingTransformer extends Transformer {
-  /// If [config] defines includes or excludes, wraps [inner] in an
-  /// [ExcludingTransformer] that handles those.
-  ///
-  /// Otherwise, just returns [inner] unmodified.
-  static Transformer wrap(Transformer inner, TransformerConfig config) {
-    if (!config.hasExclusions) return inner;
-
-    if (inner is LazyTransformer) {
-      // TODO(nweiz): Remove these unnecessary "as"es when issue 19046 is fixed.
-      return new _LazyExcludingTransformer(inner as LazyTransformer, config);
-    } else if (inner is DeclaringTransformer) {
-      return new _DeclaringExcludingTransformer(
-          inner as DeclaringTransformer, config);
-    } else {
-      return new ExcludingTransformer._(inner, config);
-    }
-  }
-
-  final Transformer _inner;
-
-  /// The config containing rules for which assets to include or exclude.
-  final TransformerConfig _config;
-
-  ExcludingTransformer._(this._inner, this._config);
-
-  isPrimary(AssetId id) {
-    if (!_config.canTransform(id.path)) return false;
-    return _inner.isPrimary(id);
-  }
-
-  Future apply(Transform transform) => _inner.apply(transform);
-
-  String toString() => _inner.toString();
-}
-
-class _DeclaringExcludingTransformer extends ExcludingTransformer
-    implements DeclaringTransformer {
-  _DeclaringExcludingTransformer(DeclaringTransformer inner,
-          TransformerConfig config)
-      : super._(inner as Transformer, config);
-
-  Future declareOutputs(DeclaringTransform transform) =>
-      (_inner as DeclaringTransformer).declareOutputs(transform);
-}
-
-class _LazyExcludingTransformer extends _DeclaringExcludingTransformer
-    implements LazyTransformer {
-  _LazyExcludingTransformer(DeclaringTransformer inner,
-          TransformerConfig config)
-      : super(inner, config);
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/foreign_transformer.dart b/sdk/lib/_internal/pub/lib/src/barback/foreign_transformer.dart
deleted file mode 100644
index 7816a98..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/foreign_transformer.dart
+++ /dev/null
@@ -1,170 +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 pub.foreign_transformer;
-
-import 'dart:async';
-import 'dart:isolate';
-
-import 'package:barback/barback.dart';
-
-import '../../../asset/dart/serialize.dart';
-import 'excluding_transformer.dart';
-import 'excluding_aggregate_transformer.dart';
-import 'transformer_config.dart';
-
-/// A wrapper for a transformer that's in a different isolate.
-class _ForeignTransformer extends Transformer {
-  /// The port with which we communicate with the child isolate.
-  ///
-  /// This port and all messages sent across it are specific to this
-  /// transformer.
-  final SendPort _port;
-
-  /// The result of calling [toString] on the transformer in the isolate.
-  final String _toString;
-
-  _ForeignTransformer(Map map)
-      : _port = map['port'],
-        _toString = map['toString'];
-
-  Future<bool> isPrimary(AssetId id) {
-    return call(_port, {
-      'type': 'isPrimary',
-      'id': serializeId(id)
-    });
-  }
-
-  Future apply(Transform transform) {
-    return call(_port, {
-      'type': 'apply',
-      'transform': serializeTransform(transform)
-    });
-  }
-
-  String toString() => _toString;
-}
-
-class _ForeignDeclaringTransformer extends _ForeignTransformer
-    implements DeclaringTransformer {
-  _ForeignDeclaringTransformer(Map map)
-      : super(map);
-
-  Future declareOutputs(DeclaringTransform transform) {
-    return call(_port, {
-      'type': 'declareOutputs',
-      'transform': serializeDeclaringTransform(transform)
-    });
-  }
-}
-
-class _ForeignLazyTransformer extends _ForeignDeclaringTransformer
-    implements LazyTransformer {
-  _ForeignLazyTransformer(Map map)
-      : super(map);
-}
-
-/// A wrapper for an aggregate transformer that's in a different isolate.
-class _ForeignAggregateTransformer extends AggregateTransformer {
-  /// The port with which we communicate with the child isolate.
-  ///
-  /// This port and all messages sent across it are specific to this
-  /// transformer.
-  final SendPort _port;
-
-  /// The result of calling [toString] on the transformer in the isolate.
-  final String _toString;
-
-  _ForeignAggregateTransformer(Map map)
-      : _port = map['port'],
-        _toString = map['toString'];
-
-  Future<String> classifyPrimary(AssetId id) {
-    return call(_port, {
-      'type': 'classifyPrimary',
-      'id': serializeId(id)
-    });
-  }
-
-  Future apply(AggregateTransform transform) {
-    return call(_port, {
-      'type': 'apply',
-      'transform': serializeAggregateTransform(transform)
-    });
-  }
-
-  String toString() => _toString;
-}
-
-class _ForeignDeclaringAggregateTransformer extends _ForeignAggregateTransformer
-    implements DeclaringAggregateTransformer {
-  _ForeignDeclaringAggregateTransformer(Map map)
-      : super(map);
-
-  Future declareOutputs(DeclaringAggregateTransform transform) {
-    return call(_port, {
-      'type': 'declareOutputs',
-      'transform': serializeDeclaringAggregateTransform(transform)
-    });
-  }
-}
-
-class _ForeignLazyAggregateTransformer
-    extends _ForeignDeclaringAggregateTransformer
-    implements LazyAggregateTransformer {
-  _ForeignLazyAggregateTransformer(Map map)
-      : super(map);
-}
-
-/// A wrapper for a transformer group that's in a different isolate.
-class _ForeignGroup implements TransformerGroup {
-  final Iterable<Iterable> phases;
-
-  /// The result of calling [toString] on the transformer group in the isolate.
-  final String _toString;
-
-  _ForeignGroup(TransformerConfig config, Map map)
-      : phases = map['phases'].map((phase) {
-          return phase.map((transformer) => deserializeTransformerLike(
-              transformer, config)).toList();
-        }).toList(),
-        _toString = map['toString'];
-
-  String toString() => _toString;
-}
-
-/// Converts a serializable map into a [Transformer], an [AggregateTransformer],
-/// or a [TransformerGroup].
-deserializeTransformerLike(Map map, TransformerConfig config) {
-  var transformer;
-  switch(map['type']) {
-    case 'TransformerGroup': return new _ForeignGroup(config, map);
-    case 'Transformer':
-      transformer = new _ForeignTransformer(map);
-      break;
-    case 'DeclaringTransformer':
-      transformer = new _ForeignDeclaringTransformer(map);
-      break;
-    case 'LazyTransformer':
-      transformer = new _ForeignLazyTransformer(map);
-      break;
-    case 'AggregateTransformer':
-      transformer = new _ForeignAggregateTransformer(map);
-      break;
-    case 'DeclaringAggregateTransformer':
-      transformer = new _ForeignDeclaringAggregateTransformer(map);
-      break;
-    case 'LazyAggregateTransformer':
-      transformer = new _ForeignLazyAggregateTransformer(map);
-      break;
-    default: assert(false);
-  }
-
-  if (transformer is Transformer) {
-    return ExcludingTransformer.wrap(transformer, config);
-  } else {
-    assert(transformer is AggregateTransformer);
-    return ExcludingAggregateTransformer.wrap(transformer, config);
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/load_all_transformers.dart b/sdk/lib/_internal/pub/lib/src/barback/load_all_transformers.dart
deleted file mode 100644
index 99fdad5..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/load_all_transformers.dart
+++ /dev/null
@@ -1,169 +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 pub.load_all_transformers;
-
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-import '../log.dart' as log;
-import '../package_graph.dart';
-import '../utils.dart';
-import 'asset_environment.dart';
-import 'barback_server.dart';
-import 'dependency_computer.dart';
-import 'transformer_id.dart';
-import 'transformer_loader.dart';
-
-/// Loads all transformers depended on by packages in [environment].
-///
-/// This uses [environment]'s primary server to serve the Dart files from which
-/// transformers are loaded, then adds the transformers to
-/// `environment.barback`.
-///
-/// Any built-in transformers that are provided by the environment will
-/// automatically be added to the end of the root package's cascade.
-///
-/// If [entrypoints] is passed, only transformers necessary to run those
-/// entrypoints will be loaded.
-Future loadAllTransformers(AssetEnvironment environment,
-    BarbackServer transformerServer, {Iterable<AssetId> entrypoints}) async {
-  var dependencyComputer = new DependencyComputer(environment.graph);
-
-  // If we only need to load transformers for a specific set of entrypoints,
-  // remove any other transformers from [transformersNeededByTransformers].
-  var necessaryTransformers;
-  if (entrypoints != null) {
-    if (entrypoints.isEmpty) return;
-
-    necessaryTransformers = unionAll(entrypoints.map(
-        dependencyComputer.transformersNeededByLibrary));
-
-    if (necessaryTransformers.isEmpty) {
-      log.fine("No transformers are needed for ${toSentence(entrypoints)}.");
-      return;
-    }
-  }
-
-  var transformersNeededByTransformers = dependencyComputer
-      .transformersNeededByTransformers(necessaryTransformers);
-
-  var buffer = new StringBuffer();
-  buffer.writeln("Transformer dependencies:");
-  transformersNeededByTransformers.forEach((id, dependencies) {
-    if (dependencies.isEmpty) {
-      buffer.writeln("$id: -");
-    } else {
-      buffer.writeln("$id: ${toSentence(dependencies)}");
-    }
-  });
-  log.fine(buffer);
-
-  var stagedTransformers = _stageTransformers(transformersNeededByTransformers);
-
-  var packagesThatUseTransformers =
-      _packagesThatUseTransformers(environment.graph);
-
-  var loader = new TransformerLoader(environment, transformerServer);
-
-  // Only save compiled snapshots when a physical entrypoint package is being
-  // used. There's no physical entrypoint when e.g. globally activating a cached
-  // package.
-  var cache = environment.rootPackage.dir == null ? null :
-      environment.graph.loadTransformerCache();
-
-  var first = true;
-  for (var stage in stagedTransformers) {
-    // Only cache the first stage, since its contents aren't based on other
-    // transformers and thus is independent of the current mode.
-    var snapshotPath = cache == null || !first ? null :
-        cache.snapshotPath(stage);
-    first = false;
-
-    /// Load all the transformers in [stage], then add them to the appropriate
-    /// locations in the transformer graphs of the packages that use them.
-    await loader.load(stage, snapshot: snapshotPath);
-
-    // Only update packages that use transformers in [stage].
-    var packagesToUpdate = unionAll(stage.map((id) =>
-        packagesThatUseTransformers[id]));
-    await Future.wait(packagesToUpdate.map((packageName) async {
-      var package = environment.graph.packages[packageName];
-      var phases = await loader.transformersForPhases(
-          package.pubspec.transformers);
-      environment.barback.updateTransformers(packageName, phases);
-    }));
-  }
-
-  if (cache != null) cache.save();
-
-  /// Add built-in transformers for the packages that need them.
-  await Future.wait(environment.graph.packages.values.map((package) async {
-    var phases = await loader.transformersForPhases(
-        package.pubspec.transformers);
-    var transformers = environment.getBuiltInTransformers(package);
-    if (transformers != null) phases.add(transformers);
-    if (phases.isEmpty) return;
-
-    // TODO(nweiz): remove the [newFuture] here when issue 17305 is fixed.
-    // If no transformer in [phases] applies to a source input,
-    // [updateTransformers] may cause a [BuildResult] to be scheduled for
-    // immediate emission. Issue 17305 means that the caller will be unable
-    // to receive this result unless we delay the update to after this
-    // function returns.
-    newFuture(() =>
-        environment.barback.updateTransformers(package.name, phases));
-  }));
-}
-
-/// Given [transformerDependencies], a directed acyclic graph, returns a list of
-/// "stages" (sets of transformers).
-///
-/// Each stage must be fully loaded and passed to barback before the next stage
-/// can be safely loaded. However, transformers within a stage can be safely
-/// loaded in parallel.
-List<Set<TransformerId>> _stageTransformers(
-    Map<TransformerId, Set<TransformerId>> transformerDependencies) {
-  // A map from transformer ids to the indices of the stages that those
-  // transformer ids should end up in. Populated by [stageNumberFor].
-  var stageNumbers = {};
-  var stages = [];
-
-  stageNumberFor(id) {
-    // Built-in transformers don't have to be loaded in stages, since they're
-    // run from pub's source. Return -1 so that the "next stage" is 0.
-    if (id.isBuiltInTransformer) return -1;
-
-    if (stageNumbers.containsKey(id)) return stageNumbers[id];
-    var dependencies = transformerDependencies[id];
-    stageNumbers[id] = dependencies.isEmpty ?
-        0 : maxAll(dependencies.map(stageNumberFor)) + 1;
-    return stageNumbers[id];
-  }
-
-  for (var id in transformerDependencies.keys) {
-    var stageNumber = stageNumberFor(id);
-    if (stages.length <= stageNumber) stages.length = stageNumber + 1;
-    if (stages[stageNumber] == null) stages[stageNumber] = new Set();
-    stages[stageNumber].add(id);
-  }
-
-  return stages;
-}
-
-/// Returns a map from transformer ids to all packages in [graph] that use each
-/// transformer.
-Map<TransformerId, Set<String>> _packagesThatUseTransformers(
-    PackageGraph graph) {
-  var results = {};
-  for (var package in graph.packages.values) {
-    for (var phase in package.pubspec.transformers) {
-      for (var config in phase) {
-        results.putIfAbsent(config.id, () => new Set()).add(package.name);
-      }
-    }
-  }
-  return results;
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/pub_package_provider.dart b/sdk/lib/_internal/pub/lib/src/barback/pub_package_provider.dart
deleted file mode 100644
index 5e77cb3..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/pub_package_provider.dart
+++ /dev/null
@@ -1,119 +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 pub.pub_package_provider;
-
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as path;
-
-import '../io.dart';
-import '../package_graph.dart';
-import '../preprocess.dart';
-import '../sdk.dart' as sdk;
-import '../utils.dart';
-
-/// An implementation of barback's [PackageProvider] interface so that barback
-/// can find assets within pub packages.
-class PubPackageProvider implements StaticPackageProvider {
-  final PackageGraph _graph;
-  final List<String> staticPackages;
-
-  Iterable<String> get packages =>
-      _graph.packages.keys.toSet().difference(staticPackages.toSet());
-
-  PubPackageProvider(PackageGraph graph)
-      : _graph = graph,
-        staticPackages = [r"$pub", r"$sdk"]..addAll(
-            graph.packages.keys.where(graph.isPackageStatic));
-
-  Future<Asset> getAsset(AssetId id) async {
-    // "$pub" is a psuedo-package that allows pub's transformer-loading
-    // infrastructure to share code with pub proper.
-    if (id.package == r'$pub') {
-      var components = path.url.split(id.path);
-      assert(components.isNotEmpty);
-      assert(components.first == 'lib');
-      components[0] = 'dart';
-      var file = assetPath(path.joinAll(components));
-      _assertExists(file, id);
-
-      // Barback may not be in the package graph if there are no user-defined
-      // transformers being used at all. The "$pub" sources are still provided,
-      // but will never be loaded.
-      if (!_graph.packages.containsKey("barback")) {
-        return new Asset.fromPath(id, file);
-      }
-
-      var versions = mapMap(_graph.packages,
-          value: (_, package) => package.version);
-      var contents = readTextFile(file);
-      contents = preprocess(contents, versions, path.toUri(file));
-      return new Asset.fromString(id, contents);
-    }
-
-    // "$sdk" is a pseudo-package that provides access to the Dart library
-    // sources in the SDK. The dart2js transformer uses this to locate the Dart
-    // sources for "dart:" libraries.
-    if (id.package == r'$sdk') {
-      // The asset path contains two "lib" entries. The first represent's pub's
-      // concept that all public assets are in "lib". The second comes from the
-      // organization of the SDK itself. Strip off the first. Leave the second
-      // since dart2js adds it and expects it to be there.
-      var parts = path.split(path.fromUri(id.path));
-      assert(parts.isNotEmpty && parts[0] == 'lib');
-      parts = parts.skip(1);
-
-      var file = path.join(sdk.rootDirectory, path.joinAll(parts));
-      _assertExists(file, id);
-      return new Asset.fromPath(id, file);
-    }
-
-    var nativePath = path.fromUri(id.path);
-    var file = _graph.packages[id.package].path(nativePath);
-    _assertExists(file, id);
-    return new Asset.fromPath(id, file);
-  }
-
-  /// Throw an [AssetNotFoundException] for [id] if [path] doesn't exist.
-  void _assertExists(String path, AssetId id) {
-    if (!fileExists(path)) throw new AssetNotFoundException(id);
-  }
-
-  Stream<AssetId> getAllAssetIds(String packageName) {
-    if (packageName == r'$pub') {
-      // "$pub" is a pseudo-package that allows pub's transformer-loading
-      // infrastructure to share code with pub proper. We provide it only during
-      // the initial transformer loading process.
-      var dartPath = assetPath('dart');
-      return new Stream.fromIterable(listDir(dartPath, recursive: true)
-          // Don't include directories.
-          .where((file) => path.extension(file) == ".dart")
-          .map((library) {
-        var idPath = path.join('lib', path.relative(library, from: dartPath));
-        return new AssetId('\$pub', path.toUri(idPath).toString());
-      }));
-    } else if (packageName == r'$sdk') {
-      // "$sdk" is a pseudo-package that allows the dart2js transformer to find
-      // the Dart core libraries without hitting the file system directly. This
-      // ensures they work with source maps.
-      var libPath = path.join(sdk.rootDirectory, "lib");
-      return new Stream.fromIterable(listDir(libPath, recursive: true)
-          .where((file) => path.extension(file) == ".dart")
-          .map((file) {
-        var idPath = path.join("lib",
-            path.relative(file, from: sdk.rootDirectory));
-        return new AssetId('\$sdk', path.toUri(idPath).toString());
-      }));
-    } else {
-      var package = _graph.packages[packageName];
-      return new Stream.fromIterable(
-          package.listFiles(beneath: 'lib').map((file) {
-        return new AssetId(packageName,
-            path.toUri(package.relative(file)).toString());
-      }));
-    }
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/source_directory.dart b/sdk/lib/_internal/pub/lib/src/barback/source_directory.dart
deleted file mode 100644
index fbb7468..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/source_directory.dart
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.barback.source_directory;
-
-import 'dart:async';
-
-import 'package:watcher/watcher.dart';
-
-import 'asset_environment.dart';
-import 'barback_server.dart';
-
-/// A directory in the entrypoint package whose contents have been made
-/// available to barback and that are bound to a server.
-class SourceDirectory {
-  final AssetEnvironment _environment;
-
-  /// The relative directory path within the package.
-  final String directory;
-
-  /// The hostname to serve this directory on.
-  final String hostname;
-
-  /// The port to serve this directory on.
-  final int port;
-
-  /// The server bound to this directory.
-  ///
-  /// This is a future that will complete once [serve] has been called and the
-  /// server has been successfully spun up.
-  Future<BarbackServer> get server => _serverCompleter.future;
-  final _serverCompleter = new Completer<BarbackServer>();
-
-  /// The subscription to the [DirectoryWatcher] used to watch this directory
-  /// for changes.
-  ///
-  /// If the directory is not being watched, this will be `null`.
-  StreamSubscription<WatchEvent> watchSubscription;
-
-  SourceDirectory(this._environment, this.directory, this.hostname, this.port);
-
-  /// Binds a server running on [hostname]:[port] to this directory.
-  Future<BarbackServer> serve() {
-    return BarbackServer.bind(_environment, hostname, port,
-        rootDirectory: directory).then((server) {
-      _serverCompleter.complete(server);
-      return server;
-    });
-  }
-
-  /// Removes the source directory from the build environment.
-  ///
-  /// Closes the server, removes the assets from barback, and stops watching it.
-  Future close() {
-    return server.then((server) {
-      var futures = [server.close()];
-
-      // Stop watching the directory.
-      if (watchSubscription != null) {
-        var cancel = watchSubscription.cancel();
-        if (cancel != null) futures.add(cancel);
-      }
-
-      return Future.wait(futures);
-    });
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/transformer_cache.dart b/sdk/lib/_internal/pub/lib/src/barback/transformer_cache.dart
deleted file mode 100644
index e6c9a53..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/transformer_cache.dart
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.barback.transformer_cache;
-
-import 'package:path/path.dart' as p;
-
-import '../io.dart';
-import '../log.dart' as log;
-import '../package_graph.dart';
-import '../sdk.dart' as sdk;
-import '../utils.dart';
-import 'transformer_id.dart';
-
-/// A cache for managing a snapshot of the first "stage" of transformers to
-/// load.
-///
-/// This uses the [_stageTransformers] notion of a stage. Transformers are
-/// divided into stages for loading based on which transformers are needed to
-/// load one another. For example, if a transformer T1 produces a file that's
-/// imported by another transformer T2, T2 must be put in a stage after T1.
-///
-/// We only cache the first stage because it's the only stage whose contents are
-/// independent of any configuration. Since most transformers don't import the
-/// output of other transformers, many packages will only have one stage.
-class TransformerCache {
-  final PackageGraph _graph;
-
-  /// The set of transformer ids that were previously cached.
-  ///
-  /// If there was no previous cache, this will be empty.
-  Set<TransformerId> _oldTransformers;
-
-  /// The set of transformer ids that are newly cached or re-used from the
-  /// previous cache.
-  Set<TransformerId> _newTransformers;
-
-  /// The directory in which transformers are cached.
-  ///
-  /// This may be `null` if there's no physical entrypoint directory.
-  String _dir;
-
-  /// The directory of the manifest listing which transformers were cached.
-  String get _manifestPath => p.join(_dir, "manifest.txt");
-
-  /// Loads the transformer cache for [environment].
-  ///
-  /// This may modify the cache.
-  TransformerCache.load(PackageGraph graph)
-      : _graph = graph,
-        _dir = graph.entrypoint.root.path(".pub/transformers") {
-    _oldTransformers = _parseManifest();
-  }
-
-  /// Clear the cache if it depends on any package in [changedPackages].
-  void clearIfOutdated(Set<String> changedPackages) {
-    var snapshotDependencies = unionAll(_oldTransformers.map((id) {
-      // If the transformer cache contains transformers we don't know about,
-      // that's fine; we just won't load them.
-      if (!_graph.packages.containsKey(id.package)) return new Set();
-
-      return _graph.transitiveDependencies(id.package)
-          .map((package) => package.name).toSet();
-    }));
-
-    // If none of the snapshot's dependencies have changed, then we can reuse
-    // it.
-    if (!overlaps(changedPackages, snapshotDependencies)) return;
-
-    // Otherwise, delete it.
-    deleteEntry(_dir);
-    _oldTransformers = new Set();
-  }
-
-  /// Returns the path for the transformer snapshot for [transformers], or
-  /// `null` if the transformers shouldn't be cached.
-  ///
-  /// There may or may not exist a file at the returned path. If one does exist,
-  /// it can safely be used to load the stage. Otherwise, a snapshot of the
-  /// stage should be written there.
-  String snapshotPath(Set<TransformerId> transformers) {
-    var path = p.join(_dir, "transformers.snapshot");
-    if (_newTransformers != null) return path;
-
-    if (transformers.any((id) => _graph.isPackageMutable(id.package))) {
-      log.fine("Not caching mutable transformers.");
-      deleteEntry(_dir);
-      return null;
-    }
-
-    if (!_oldTransformers.containsAll(transformers)) {
-      log.fine("Cached transformer snapshot is out-of-date, deleting.");
-      deleteEntry(path);
-    } else {
-      log.fine("Using cached transformer snapshot.");
-    }
-
-    _newTransformers = transformers;
-    return path;
-  }
-
-  /// Saves the manifest to the transformer cache.
-  void save() {
-    // If we didn't write any snapshots, there's no need to write a manifest.
-    if (_newTransformers == null) {
-      if (_dir != null) deleteEntry(_dir);
-      return;
-    }
-
-    // We only need to rewrite the manifest if we created a new snapshot.
-    if (_oldTransformers.containsAll(_newTransformers)) return;
-
-    ensureDir(_dir);
-    writeTextFile(_manifestPath,
-        "${sdk.version}\n" +
-        ordered(_newTransformers.map((id) => id.serialize())).join(","));
-  }
-
-  /// Parses the cache manifest and returns the set of previously-cached
-  /// transformers.
-  ///
-  /// If the manifest indicates that the SDK version is out-of-date, this
-  /// deletes the existing cache. Otherwise, 
-  Set<TransformerId> _parseManifest() {
-    if (!fileExists(_manifestPath)) return new Set();
-
-    var manifest = readTextFile(_manifestPath).split("\n");
-
-    // The first line of the manifest is the SDK version. We want to clear out
-    // the snapshots even if they're VM-compatible, since pub's transformer
-    // isolate scaffolding may have changed.
-    if (manifest.removeAt(0) != sdk.version.toString()) {
-      deleteEntry(_dir);
-      return new Set();
-    }
-
-    /// The second line of the manifest is a list of transformer ids used to
-    /// create the existing snapshot.
-    return manifest.single.split(",")
-        .map((id) => new TransformerId.parse(id, null))
-        .toSet();
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/transformer_config.dart b/sdk/lib/_internal/pub/lib/src/barback/transformer_config.dart
deleted file mode 100644
index c6906dd..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/transformer_config.dart
+++ /dev/null
@@ -1,160 +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 pub.barback.transformer_config;
-
-import 'package:glob/glob.dart';
-import 'package:path/path.dart' as p;
-import 'package:source_span/source_span.dart';
-import 'package:yaml/yaml.dart';
-
-import 'transformer_id.dart';
-
-/// The configuration for a transformer.
-///
-/// This corresponds to the transformers listed in a pubspec, which have both an
-/// [id] indicating the location of the transformer and configuration specific
-/// to that use of the transformer.
-class TransformerConfig {
-  /// The [id] of the transformer [this] is configuring.
-  final TransformerId id;
-
-  /// The configuration to pass to the transformer.
-  ///
-  /// Any pub-specific configuration (i.e. keys starting with "$") will have
-  /// been stripped out of this and handled separately. This will be an empty
-  /// map if no configuration was provided.
-  final Map configuration;
-
-  /// The source span from which this configuration was parsed.
-  final SourceSpan span;
-
-  /// The primary input inclusions.
-  ///
-  /// Each inclusion is an asset path. If this set is non-empty, then *only*
-  /// matching assets are allowed as a primary input by this transformer. If
-  /// `null`, all assets are included.
-  ///
-  /// This is processed before [excludes]. If a transformer has both includes
-  /// and excludes, then the set of included assets is determined and assets
-  /// are excluded from that resulting set.
-  final Set<Glob> includes;
-
-  /// The primary input exclusions.
-  ///
-  /// Any asset whose pach is in this is not allowed as a primary input by
-  /// this transformer.
-  ///
-  /// This is processed after [includes]. If a transformer has both includes
-  /// and excludes, then the set of included assets is determined and assets
-  /// are excluded from that resulting set.
-  final Set<Glob> excludes;
-
-  /// Returns whether this config excludes certain asset ids from being
-  /// processed.
-  bool get hasExclusions => includes != null || excludes != null;
-
-  /// Returns whether this transformer might transform a file that's visible to
-  /// the package's dependers.
-  bool get canTransformPublicFiles {
-    if (includes == null) return true;
-    return includes.any((glob) {
-      // Check whether the first path component of the glob is "lib", "bin", or
-      // contains wildcards that may cause it to match "lib" or "bin".
-      var first = p.posix.split(glob.toString()).first;
-      if (first.contains('{') || first.contains('*') || first.contains('[') ||
-          first.contains('?')) {
-        return true;
-      }
-
-      return first == 'lib' || first == 'bin';
-    });
-  }
-
-  /// Parses [identifier] as a [TransformerId] with [configuration].
-  ///
-  /// [identifierSpan] is the source span for [identifier].
-  factory TransformerConfig.parse(String identifier, SourceSpan identifierSpan,
-        YamlMap configuration) =>
-      new TransformerConfig(new TransformerId.parse(identifier, identifierSpan),
-          configuration);
-
-  factory TransformerConfig(TransformerId id, YamlMap configurationNode) {
-    parseField(key) {
-      if (!configurationNode.containsKey(key)) return null;
-      var fieldNode = configurationNode.nodes[key];
-      var field = fieldNode.value;
-
-      if (field is String) {
-        return new Set.from([new Glob(field, context: p.url, recursive: true)]);
-      }
-
-      if (field is! List) {
-        throw new SourceSpanFormatException(
-            '"$key" field must be a string or list.', fieldNode.span);
-      }
-
-      return new Set.from(field.nodes.map((node) {
-        if (node.value is String) {
-          return new Glob(node.value, context: p.url, recursive: true);
-        }
-
-        throw new SourceSpanFormatException(
-            '"$key" field may contain only strings.', node.span);
-      }));
-    }
-
-    var includes = null;
-    var excludes = null;
-
-    var configuration;
-    var span;
-    if (configurationNode == null) {
-      configuration = {};
-      span = id.span;
-    } else {
-      // Don't write to the immutable YAML map.
-      configuration = new Map.from(configurationNode);
-      span = configurationNode.span;
-
-      // Pull out the exclusions/inclusions.
-      includes = parseField("\$include");
-      configuration.remove("\$include");
-      excludes = parseField("\$exclude");
-      configuration.remove("\$exclude");
-
-      // All other keys starting with "$" are unexpected.
-      for (var key in configuration.keys) {
-        if (key is! String || !key.startsWith(r'$')) continue;
-        throw new SourceSpanFormatException(
-            'Unknown reserved field.', configurationNode.nodes[key].span);
-      }
-    }
-
-    return new TransformerConfig._(id, configuration, span, includes, excludes);
-  }
-
-  TransformerConfig._(
-      this.id, this.configuration, this.span, this.includes, this.excludes);
-
-  String toString() => id.toString();
-
-  /// Returns whether the include/exclude rules allow the transformer to run on
-  /// [pathWithinPackage].
-  ///
-  /// [pathWithinPackage] must be a URL-style path relative to the containing
-  /// package's root directory.
-  bool canTransform(String pathWithinPackage) {
-    if (excludes != null) {
-      // If there are any excludes, it must not match any of them.
-      for (var exclude in excludes) {
-        if (exclude.matches(pathWithinPackage)) return false;
-      }
-    }
-
-    // If there are any includes, it must match one of them.
-    return includes == null ||
-        includes.any((include) => include.matches(pathWithinPackage));
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/transformer_id.dart b/sdk/lib/_internal/pub/lib/src/barback/transformer_id.dart
deleted file mode 100644
index c36d4ae..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/transformer_id.dart
+++ /dev/null
@@ -1,95 +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 pub.barback.transformer_id;
-
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-import 'package:source_span/source_span.dart';
-
-import '../utils.dart';
-
-/// A list of the names of all built-in transformers that pub exposes.
-const _BUILT_IN_TRANSFORMERS = const ['\$dart2js'];
-
-/// An identifier that indicates the library that contains a transformer.
-///
-/// It's possible that the library identified by [this] defines multiple
-/// transformers. If so, they're all always loaded in the same phase.
-class TransformerId {
-  /// The package containing the library where the transformer is defined.
-  final String package;
-
-  /// The `/`-separated path to the library that contains this transformer.
-  ///
-  /// This is relative to the `lib/` directory in [package], and doesn't end in
-  /// `.dart`.
-  ///
-  /// This can be null; if so, it indicates that the transformer(s) should be
-  /// loaded from `lib/transformer.dart` if that exists, and `lib/$package.dart`
-  /// otherwise.
-  final String path;
-
-  /// The source span from which this id was parsed.
-  final SourceSpan span;
-
-  /// Whether this ID points to a built-in transformer exposed by pub.
-  bool get isBuiltInTransformer => package.startsWith('\$');
-
-  /// Parses a transformer identifier.
-  ///
-  /// A transformer identifier is a string of the form "package_name" or
-  /// "package_name/path/to/library". It does not have a trailing extension. If
-  /// it just has a package name, it expands to lib/transformer.dart if that
-  /// exists, or lib/${package}.dart otherwise. Otherwise, it expands to
-  /// lib/${path}.dart. In either case it's located in the given package.
-  factory TransformerId.parse(String identifier, SourceSpan span) {
-    if (identifier.isEmpty) {
-      throw new FormatException('Invalid library identifier: "".');
-    }
-
-    var parts = split1(identifier, "/");
-    if (parts.length == 1) {
-      return new TransformerId(parts.single, null, span);
-    }
-
-    return new TransformerId(parts.first, parts.last, span);
-  }
-
-  TransformerId(this.package, this.path, this.span) {
-    if (!package.startsWith('\$')) return;
-    if (_BUILT_IN_TRANSFORMERS.contains(package)) return;
-    throw new SourceSpanFormatException(
-        'Unsupported built-in transformer $package.', span);
-  }
-
-  bool operator==(other) =>
-      other is TransformerId && other.package == package && other.path == path;
-
-  int get hashCode => package.hashCode ^ path.hashCode;
-
-  /// Returns a serialized form of [this] that can be passed to
-  /// [new TransformerId.parse].
-  String serialize() => path == null ? package : '$package/$path';
-
-  String toString() => serialize();
-
-  /// Returns the asset id for the library identified by this transformer id.
-  ///
-  /// If `path` is null, this will determine which library to load. Unlike
-  /// [getAssetId], this doesn't take generated assets into account; it's used
-  /// to determine transformers' dependencies, which requires looking at files
-  /// on disk.
-  Future<AssetId> getAssetId(Barback barback) {
-    if (path != null) {
-      return new Future.value(new AssetId(package, 'lib/$path.dart'));
-    }
-
-    var transformerAsset = new AssetId(package, 'lib/transformer.dart');
-    return barback.getAssetById(transformerAsset).then((_) => transformerAsset)
-        .catchError((e) => new AssetId(package, 'lib/$package.dart'),
-            test: (e) => e is AssetNotFoundException);
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/transformer_isolate.dart b/sdk/lib/_internal/pub/lib/src/barback/transformer_isolate.dart
deleted file mode 100644
index e969279..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/transformer_isolate.dart
+++ /dev/null
@@ -1,144 +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 pub.transformer_isolate;
-
-import 'dart:async';
-import 'dart:convert';
-import 'dart:isolate';
-
-import 'package:barback/barback.dart';
-import 'package:source_span/source_span.dart';
-import 'package:stack_trace/stack_trace.dart';
-
-import '../../../asset/dart/serialize.dart';
-import '../barback.dart';
-import '../exceptions.dart';
-import '../dart.dart' as dart;
-import '../log.dart' as log;
-import '../utils.dart';
-import 'asset_environment.dart';
-import 'barback_server.dart';
-import 'foreign_transformer.dart';
-import 'transformer_config.dart';
-import 'transformer_id.dart';
-
-/// A wrapper for an isolate from which transformer plugins can be instantiated.
-class TransformerIsolate {
-  /// The port used to communicate with the wrapped isolate.
-  final SendPort _port;
-
-  /// A map indicating the barback server URLs for each [TransformerId] that's
-  /// loaded in the wrapped isolate.
-  ///
-  /// A barback server URL is the URL for the library that the given id
-  /// identifies. For example, the URL for "polymer/src/mirrors_remover" might
-  /// be "http://localhost:56234/packages/polymer/src/mirrors_remover.dart".
-  final Map<TransformerId, Uri> _idsToUrls;
-
-  /// The barback mode for this run of pub.
-  final BarbackMode _mode;
-
-  /// Spawns an isolate that loads all transformer libraries defined by [ids].
-  ///
-  /// This doesn't actually instantiate any transformers, since a
-  /// [TransformerId] doesn't define the transformers' configuration. The
-  /// transformers can be constructed using [create].
-  ///
-  /// If [snapshot] is passed, the isolate will be loaded from that path if it
-  /// exists. Otherwise, a snapshot of the isolate's code will be saved to that
-  /// path once the isolate is loaded.
-  static Future<TransformerIsolate> spawn(AssetEnvironment environment,
-      BarbackServer transformerServer, List<TransformerId> ids,
-      {String snapshot}) {
-    return mapFromIterableAsync(ids, value: (id) {
-      return id.getAssetId(environment.barback);
-    }).then((idsToAssetIds) {
-      var baseUrl = transformerServer.url;
-      var idsToUrls = mapMap(idsToAssetIds, value: (id, assetId) {
-        var path = assetId.path.replaceFirst('lib/', '');
-        return Uri.parse('package:${id.package}/$path');
-      });
-
-      var code = new StringBuffer();
-      code.writeln("import 'dart:isolate';");
-
-      for (var url in idsToUrls.values) {
-        code.writeln("import '$url';");
-      }
-
-      code.writeln("import r'package:\$pub/transformer_isolate.dart';");
-      code.writeln(
-          "void main(_, SendPort replyTo) => loadTransformers(replyTo);");
-
-      log.fine("Loading transformers from $ids");
-
-      var port = new ReceivePort();
-      return dart.runInIsolate(code.toString(), port.sendPort,
-              packageRoot: baseUrl.resolve('packages'),
-              snapshot: snapshot)
-          .then((_) => port.first)
-          .then((sendPort) {
-        return new TransformerIsolate._(sendPort, environment.mode, idsToUrls);
-      }).catchError((error, stackTrace) {
-        if (error is! CrossIsolateException) throw error;
-        if (error.type != 'IsolateSpawnException') throw error;
-
-        // TODO(nweiz): don't parse this as a string once issues 12617 and 12689
-        // are fixed.
-        var firstErrorLine = error.message.split('\n')[1];
-
-        // The isolate error message contains the fully expanded path, not the
-        // "package:" URI, so we have to be liberal in what we look for in the
-        // error message.
-        var missingTransformer = idsToUrls.keys.firstWhere((id) =>
-            firstErrorLine.startsWith(
-                "Load Error for") &&
-            firstErrorLine.contains(idsToUrls[id].path),
-            orElse: () => throw error);
-        var packageUri = idToPackageUri(idsToAssetIds[missingTransformer]);
-
-        // If there was an IsolateSpawnException and the import that actually
-        // failed was the one we were loading transformers from, throw an
-        // application exception with a more user-friendly message.
-        fail('Transformer library "$packageUri" not found.',
-            error, stackTrace);
-      });
-    });
-  }
-
-  TransformerIsolate._(this._port, this._mode, this._idsToUrls);
-
-  /// Instantiate the transformers in the [config.id] with
-  /// [config.configuration].
-  ///
-  /// If there are no transformers defined in the given library, this will
-  /// return an empty set.
-  Future<Set<Transformer>> create(TransformerConfig config) {
-    return call(_port, {
-      'library': _idsToUrls[config.id].toString(),
-      'mode': _mode.name,
-      'configuration': JSON.encode(config.configuration)
-    }).then((transformers) {
-      transformers = transformers.map(
-          (transformer) => deserializeTransformerLike(transformer, config))
-          .toSet();
-      log.fine("Transformers from $config: $transformers");
-      return transformers;
-    }).catchError((error, stackTrace) {
-      throw new TransformerLoadError(error, config.span);
-    });
-  }
-}
-
-/// An error thrown when a transformer fails to load.
-class TransformerLoadError extends SourceSpanException
-    implements WrappedException {
-  final CrossIsolateException innerError;
-  Chain get innerChain => innerError.stackTrace;
-
-  TransformerLoadError(CrossIsolateException error, SourceSpan span)
-      : innerError = error,
-        super("Error loading transformer: ${error.message}", span);
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/transformer_loader.dart b/sdk/lib/_internal/pub/lib/src/barback/transformer_loader.dart
deleted file mode 100644
index 031c384..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/transformer_loader.dart
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.barback.transformer_loader;
-
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-import '../log.dart' as log;
-import '../utils.dart';
-import 'asset_environment.dart';
-import 'barback_server.dart';
-import 'dart2js_transformer.dart';
-import 'excluding_transformer.dart';
-import 'transformer_config.dart';
-import 'transformer_id.dart';
-import 'transformer_isolate.dart';
-
-/// A class that loads transformers defined in specific files.
-class TransformerLoader {
-  final AssetEnvironment _environment;
-
-  final BarbackServer _transformerServer;
-
-  final _isolates = new Map<TransformerId, TransformerIsolate>();
-
-  final _transformers = new Map<TransformerConfig, Set<Transformer>>();
-
-  /// The packages that use each transformer id.
-  ///
-  /// Used for error reporting.
-  final _transformerUsers = new Map<TransformerId, Set<String>>();
-
-  TransformerLoader(this._environment, this._transformerServer) {
-    for (var package in _environment.graph.packages.values) {
-      for (var config in unionAll(package.pubspec.transformers)) {
-        _transformerUsers.putIfAbsent(config.id, () => new Set<String>())
-            .add(package.name);
-      }
-    }
-  }
-
-  /// Loads a transformer plugin isolate that imports the transformer libraries
-  /// indicated by [ids].
-  ///
-  /// Once the returned future completes, transformer instances from this
-  /// isolate can be created using [transformersFor] or [transformersForPhase].
-  ///
-  /// This skips any ids that have already been loaded.
-  Future load(Iterable<TransformerId> ids, {String snapshot}) async {
-    ids = ids.where((id) => !_isolates.containsKey(id)).toList();
-    if (ids.isEmpty) return;
-
-    var isolate = await log.progress("Loading ${toSentence(ids)} transformers",
-        () => TransformerIsolate.spawn(_environment, _transformerServer, ids,
-                  snapshot: snapshot));
-
-    for (var id in ids) {
-      _isolates[id] = isolate;
-    }
-  }
-
-  /// Instantiates and returns all transformers in the library indicated by
-  /// [config] with the given configuration.
-  ///
-  /// If this is called before the library has been loaded into an isolate via
-  /// [load], it will return an empty set.
-  Future<Set<Transformer>> transformersFor(TransformerConfig config) async {
-    if (_transformers.containsKey(config)) return _transformers[config];
-
-    if (_isolates.containsKey(config.id)) {
-      var transformers = await _isolates[config.id].create(config);
-      if (transformers.isNotEmpty) {
-        _transformers[config] = transformers;
-        return transformers;
-      }
-
-      var message = "No transformers";
-      if (config.configuration.isNotEmpty) {
-        message += " that accept configuration";
-      }
-
-      var location;
-      if (config.id.path == null) {
-        location = 'package:${config.id.package}/transformer.dart or '
-          'package:${config.id.package}/${config.id.package}.dart';
-      } else {
-        location = 'package:$config.dart';
-      }
-
-      var users = toSentence(ordered(_transformerUsers[config.id]));
-      fail("$message were defined in $location,\n"
-          "required by $users.");
-    } else if (config.id.package != '\$dart2js') {
-      return new Future.value(new Set());
-    }
-
-    var transformer;
-    try {
-      transformer = new Dart2JSTransformer.withSettings(_environment,
-          new BarbackSettings(config.configuration, _environment.mode));
-    } on FormatException catch (error, stackTrace) {
-      fail(error.message, error, stackTrace);
-    }
-
-    // Handle any exclusions.
-    _transformers[config] = new Set.from(
-        [ExcludingTransformer.wrap(transformer, config)]);
-    return _transformers[config];
-  }
-
-  /// Loads all transformers defined in each phase of [phases].
-  ///
-  /// If any library hasn't yet been loaded via [load], it will be ignored.
-  Future<List<Set<Transformer>>> transformersForPhases(
-      Iterable<Set<TransformerConfig>> phases) async {
-    var result = await Future.wait(phases.map((phase) async {
-      var transformers = await waitAndPrintErrors(phase.map(transformersFor));
-      return unionAll(transformers);
-    }));
-
-    // Return a growable list so that callers can add phases.
-    return result.toList();
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/web_socket_api.dart b/sdk/lib/_internal/pub/lib/src/barback/web_socket_api.dart
deleted file mode 100644
index a580a2c..0000000
--- a/sdk/lib/_internal/pub/lib/src/barback/web_socket_api.dart
+++ /dev/null
@@ -1,309 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.barback.web_socket_api;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:http_parser/http_parser.dart';
-import 'package:path/path.dart' as path;
-import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
-
-import '../exit_codes.dart' as exit_codes;
-import '../io.dart';
-import '../log.dart' as log;
-import '../utils.dart';
-import 'asset_environment.dart';
-
-/// Implements the [WebSocket] API for communicating with a running pub serve
-/// process, mainly for use by the Editor.
-///
-/// This is a [JSON-RPC 2.0](http://www.jsonrpc.org/specification) server. Its
-/// methods are described in the method-level documentation below.
-class WebSocketApi {
-  final AssetEnvironment _environment;
-  final json_rpc.Server _server;
-
-  /// Whether the application should exit when this connection closes.
-  bool _exitOnClose = false;
-
-  WebSocketApi(CompatibleWebSocket socket, this._environment)
-      : _server = new json_rpc.Server(socket) {
-    _server.registerMethod("urlToAssetId", _urlToAssetId);
-    _server.registerMethod("pathToUrls", _pathToUrls);
-    _server.registerMethod("serveDirectory", _serveDirectory);
-    _server.registerMethod("unserveDirectory", _unserveDirectory);
-
-    /// Tells the server to exit as soon as this WebSocket connection is closed.
-    ///
-    /// This takes no arguments and returns no results. It can safely be called
-    /// as a JSON-RPC notification.
-    _server.registerMethod("exitOnClose", () {
-      _exitOnClose = true;
-    });
-  }
-
-  /// Listens on the socket.
-  ///
-  /// Returns a future that completes when the socket has closed. It will
-  /// complete with an error if the socket had an error, otherwise it will
-  /// complete to `null`.
-  Future listen() {
-    return _server.listen().then((_) {
-      if (!_exitOnClose) return;
-      log.message("WebSocket connection closed, terminating.");
-      flushThenExit(exit_codes.SUCCESS);
-    });
-  }
-
-  /// Given a URL to an asset that is served by pub, returns the ID of the
-  /// asset that would be accessed by that URL.
-  ///
-  /// The method name is "urlToAssetId" and it takes a "url" parameter for the
-  /// URL being mapped:
-  ///
-  ///     "params": {
-  ///       "url": "http://localhost:8080/index.html"
-  ///     }
-  ///
-  /// If successful, it returns a map containing the asset ID's package and
-  /// path:
-  ///
-  ///     "result": {
-  ///       "package": "myapp",
-  ///       "path": "web/index.html"
-  ///     }
-  ///
-  /// The "path" key in the result is a URL path that's relative to the root
-  /// directory of the package identified by "package". The location of this
-  /// package may vary depending on which source it was installed from.
-  ///
-  /// An optional "line" key may be provided whose value must be an integer. If
-  /// given, the result will also include a "line" key that maps the line in
-  /// the served final file back to the corresponding source line in the asset
-  /// that was used to generate that file.
-  ///
-  /// Examples (where "myapp" is the root package and pub serve is being run
-  /// normally with "web" bound to port 8080 and "test" to 8081):
-  ///
-  ///     http://localhost:8080/index.html    -> myapp|web/index.html
-  ///     http://localhost:8081/sub/main.dart -> myapp|test/sub/main.dart
-  ///
-  /// If the URL is not a domain being served by pub, this returns an error:
-  ///
-  ///     http://localhost:1234/index.html    -> NOT_SERVED error
-  ///
-  /// This does *not* currently support the implicit index.html behavior that
-  /// pub serve provides for user-friendliness:
-  ///
-  ///     http://localhost:1234 -> NOT_SERVED error
-  ///
-  /// This does *not* currently check to ensure the asset actually exists. It
-  /// only maps what the corresponding asset *should* be for that URL.
-  Future<Map> _urlToAssetId(json_rpc.Parameters params) {
-    var url = params["url"].asUri;
-
-    // If a line number was given, map it to the output line.
-    var line = params["line"].asIntOr(null);
-
-    return _environment.getAssetIdForUrl(url).then((id) {
-      if (id == null) {
-        throw new json_rpc.RpcException(_Error.NOT_SERVED,
-            '"${url.host}:${url.port}" is not being served by pub.');
-      }
-
-      // TODO(rnystrom): When this is hooked up to actually talk to barback to
-      // see if assets exist, consider supporting implicit index.html at that
-      // point.
-
-      var result = {"package": id.package, "path": id.path};
-
-      // Map the line.
-      // TODO(rnystrom): Right now, source maps are not supported and it just
-      // passes through the original line. This lets the editor start using
-      // this API before we've fully implemented it. See #12339 and #16061.
-      if (line != null) result["line"] = line;
-
-      return result;
-    });
-  }
-
-  /// Given a path on the filesystem, returns the URLs served by pub that can be
-  /// used to access asset found at that path.
-  ///
-  /// The method name is "pathToUrls" and it takes a "path" key (a native OS
-  /// path which may be absolute or relative to the root directory of the
-  /// entrypoint package) for the path being mapped:
-  ///
-  ///     "params": {
-  ///       "path": "web/index.html"
-  ///     }
-  ///
-  /// If successful, it returns a map containing the list of URLs that can be
-  /// used to access that asset.
-  ///
-  ///     "result": {
-  ///       "urls": ["http://localhost:8080/index.html"]
-  ///     }
-  ///
-  /// The "path" key may refer to a path in another package, either by referring
-  /// to its location within the top-level "packages" directory or by referring
-  /// to its location on disk. Only the "lib" directory is visible in other
-  /// packages:
-  ///
-  ///     "params": {
-  ///       "path": "packages/http/http.dart"
-  ///     }
-  ///
-  /// Assets in the "lib" directory will usually have one URL for each server:
-  ///
-  ///     "result": {
-  ///       "urls": [
-  ///         "http://localhost:8080/packages/http/http.dart",
-  ///         "http://localhost:8081/packages/http/http.dart"
-  ///       ]
-  ///     }
-  ///
-  /// An optional "line" key may be provided whose value must be an integer. If
-  /// given, the result will also include a "line" key that maps the line in
-  /// the source file to the corresponding output line in the resulting asset
-  /// served at the URL.
-  ///
-  /// Examples (where "myapp" is the root package and pub serve is being run
-  /// normally with "web" bound to port 8080 and "test" to 8081):
-  ///
-  ///     web/index.html      -> http://localhost:8080/index.html
-  ///     test/sub/main.dart  -> http://localhost:8081/sub/main.dart
-  ///
-  /// If the asset is not in a directory being served by pub, returns an error:
-  ///
-  ///     example/index.html  -> NOT_SERVED error
-  Future<Map> _pathToUrls(json_rpc.Parameters params) {
-    var assetPath = params["path"].asString;
-    var line = params["line"].asIntOr(null);
-
-    return _environment.getUrlsForAssetPath(assetPath).then((urls) {
-      if (urls.isEmpty) {
-        throw new json_rpc.RpcException(_Error.NOT_SERVED,
-            'Asset path "$assetPath" is not currently being served.');
-      }
-
-      var result = {"urls": urls.map((url) => url.toString()).toList()};
-
-      // Map the line.
-      // TODO(rnystrom): Right now, source maps are not supported and it just
-      // passes through the original line. This lets the editor start using
-      // this API before we've fully implemented it. See #12339 and #16061.
-      if (line != null) result["line"] = line;
-
-      return result;
-    });
-  }
-
-  /// Given a relative directory path within the entrypoint package, binds a
-  /// new port to serve from that path and returns its URL.
-  ///
-  /// The method name is "serveDirectory" and it takes a "path" key (a native
-  /// OS path relative to the root of the entrypoint package) for the directory
-  /// being served:
-  ///
-  ///     "params": {
-  ///       "path": "example/awesome"
-  ///     }
-  ///
-  /// If successful, it returns a map containing the URL that can be used to
-  /// access the directory.
-  ///
-  ///     "result": {
-  ///       "url": "http://localhost:8083"
-  ///     }
-  ///
-  /// If the directory is already being served, returns the previous URL.
-  Future<Map> _serveDirectory(json_rpc.Parameters params) {
-    var rootDirectory = _validateRelativePath(params, "path");
-    return _environment.serveDirectory(rootDirectory).then((server) {
-      return {
-        "url": server.url.toString()
-      };
-    }).catchError((error) {
-      if (error is! OverlappingSourceDirectoryException) throw error;
-
-      var dir = pluralize("directory", error.overlappingDirectories.length,
-          plural: "directories");
-      var overlapping = toSentence(error.overlappingDirectories.map(
-          (dir) => '"$dir"'));
-      print("data: ${error.overlappingDirectories}");
-      throw new json_rpc.RpcException(_Error.OVERLAPPING,
-          'Path "$rootDirectory" overlaps already served $dir $overlapping.',
-          data: {
-            "directories": error.overlappingDirectories
-          });
-    });
-  }
-
-  /// Given a relative directory path within the entrypoint package, unbinds
-  /// the server previously bound to that directory and returns its (now
-  /// unreachable) URL.
-  ///
-  /// The method name is "unserveDirectory" and it takes a "path" key (a
-  /// native OS path relative to the root of the entrypoint package) for the
-  /// directory being unserved:
-  ///
-  ///     "params": {
-  ///       "path": "example/awesome"
-  ///     }
-  ///
-  /// If successful, it returns a map containing the URL that used to be used
-  /// to access the directory.
-  ///
-  ///     "result": {
-  ///       "url": "http://localhost:8083"
-  ///     }
-  ///
-  /// If no server is bound to that directory, it returns a `NOT_SERVED` error.
-  Future<Map> _unserveDirectory(json_rpc.Parameters params) {
-    var rootDirectory = _validateRelativePath(params, "path");
-    return _environment.unserveDirectory(rootDirectory).then((url) {
-      if (url == null) {
-        throw new json_rpc.RpcException(_Error.NOT_SERVED,
-            'Directory "$rootDirectory" is not bound to a server.');
-      }
-
-      return {"url": url.toString()};
-    });
-  }
-
-  /// Validates that [command] has a field named [key] whose value is a string
-  /// containing a relative path that doesn't reach out of the entrypoint
-  /// package's root directory.
-  ///
-  /// Returns the path if found, or throws a [_WebSocketException] if
-  /// validation failed.
-  String _validateRelativePath(json_rpc.Parameters params, String key) {
-    var pathString = params[key].asString;
-
-    if (!path.isRelative(pathString)) {
-      throw new json_rpc.RpcException.invalidParams(
-          '"$key" must be a relative path. Got "$pathString".');
-    }
-
-    if (!path.isWithin(".", pathString)) {
-      throw new json_rpc.RpcException.invalidParams(
-          '"$key" cannot reach out of its containing directory. '
-          'Got "$pathString".');
-    }
-
-    return pathString;
-  }
-}
-
-/// The pub-specific JSON RPC error codes.
-class _Error {
-  /// The specified directory is not being served.
-  static const NOT_SERVED = 1;
-
-  /// The specified directory overlaps one or more ones already being served.
-  static const OVERLAPPING = 2;
-}
diff --git a/sdk/lib/_internal/pub/lib/src/cached_package.dart b/sdk/lib/_internal/pub/lib/src/cached_package.dart
deleted file mode 100644
index 94a500ed..0000000
--- a/sdk/lib/_internal/pub/lib/src/cached_package.dart
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.cached_package;
-
-import 'package:path/path.dart' as p;
-import 'package:pub_semver/pub_semver.dart';
-import 'package:yaml/yaml.dart';
-
-import 'barback/transformer_config.dart';
-import 'io.dart';
-import 'package.dart';
-import 'pubspec.dart';
-
-/// A [Package] whose `lib` directory has been precompiled and cached.
-///
-/// When users of this class request path information about files that are
-/// cached, this returns the cached information. It also wraps the package's
-/// pubspec to report no transformers, since the transformations have all been
-/// applied already.
-class CachedPackage extends Package {
-  /// The directory contianing the cached assets from this package.
-  ///
-  /// Although only `lib` is cached, this directory corresponds to the root of
-  /// the package. The actual cached assets exist in `$_cacheDir/lib`.
-  final String _cacheDir;
-
-  /// Creates a new cached package wrapping [inner] with the cache at
-  /// [_cacheDir].
-  CachedPackage(Package inner, this._cacheDir)
-      : super(new _CachedPubspec(inner.pubspec), inner.dir);
-
-  String path(String part1, [String part2, String part3, String part4,
-      String part5, String part6, String part7]) {
-    if (_pathInCache(part1)) {
-      return p.join(_cacheDir, part1, part2, part3, part4, part5, part6, part7);
-    } else {
-      return super.path(part1, part2, part3, part4, part5, part6, part7);
-    }
-  }
-
-  String relative(String path) {
-    if (p.isWithin(path, _cacheDir)) return p.relative(path, from: _cacheDir);
-    return super.relative(path);
-  }
-
-  /// This will include the cached, transformed versions of files if [beneath]
-  /// is within a cached directory, but not otherwise.
-  List<String> listFiles({String beneath, recursive: true,
-      bool useGitIgnore: false}) {
-    if (beneath == null) {
-      return super.listFiles(recursive: recursive, useGitIgnore: useGitIgnore);
-    }
-
-    if (_pathInCache(beneath)) return listDir(p.join(_cacheDir, beneath));
-    return super.listFiles(beneath: beneath, recursive: recursive,
-        useGitIgnore: useGitIgnore);
-  }
-
-  /// Returns whether [relativePath], a path relative to the package's root,
-  /// is in a cached directory.
-  bool _pathInCache(String relativePath) => p.isWithin('lib', relativePath);
-}
-
-/// A pubspec wrapper that reports no transformers.
-class _CachedPubspec implements Pubspec {
-  final Pubspec _inner;
-
-  YamlMap get fields => _inner.fields;
-  String get name => _inner.name;
-  Version get version => _inner.version;
-  List<PackageDep> get dependencies => _inner.dependencies;
-  List<PackageDep> get devDependencies => _inner.devDependencies;
-  List<PackageDep> get dependencyOverrides => _inner.dependencyOverrides;
-  PubspecEnvironment get environment => _inner.environment;
-  String get publishTo => _inner.publishTo;
-  Map<String, String> get executables => _inner.executables;
-  bool get isPrivate => _inner.isPrivate;
-  bool get isEmpty => _inner.isEmpty;
-  List<PubspecException> get allErrors => _inner.allErrors;
-
-  List<Set<TransformerConfig>> get transformers => const [];
-
-  _CachedPubspec(this._inner);
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command.dart b/sdk/lib/_internal/pub/lib/src/command.dart
deleted file mode 100644
index 3a16471..0000000
--- a/sdk/lib/_internal/pub/lib/src/command.dart
+++ /dev/null
@@ -1,94 +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 pub.command;
-
-import 'package:args/args.dart';
-import 'package:args/command_runner.dart';
-import 'package:path/path.dart' as path;
-
-import 'entrypoint.dart';
-import 'log.dart' as log;
-import 'global_packages.dart';
-import 'system_cache.dart';
-
-/// The base class for commands for the pub executable.
-///
-/// A command may either be a "leaf" command or it may be a parent for a set
-/// of subcommands. Only leaf commands are ever actually invoked. If a command
-/// has subcommands, then one of those must always be chosen.
-abstract class PubCommand extends Command {
-  SystemCache get cache {
-    if (_cache == null) {
-      _cache = new SystemCache.withSources(isOffline: isOffline);
-    }
-    return _cache;
-  }
-  SystemCache _cache;
-
-  GlobalPackages get globals {
-    if (_globals == null) {
-      _globals = new GlobalPackages(cache);
-    }
-    return _globals;
-  }
-  GlobalPackages _globals;
-
-  /// Gets the [Entrypoint] package for the current working directory.
-  ///
-  /// This will load the pubspec and fail with an error if the current directory
-  /// is not a package.
-  Entrypoint get entrypoint {
-    // Lazy load it.
-    if (_entrypoint == null) {
-      _entrypoint = new Entrypoint(path.current, cache,
-          packageSymlinks: globalResults['package-symlinks']);
-    }
-    return _entrypoint;
-  }
-  Entrypoint _entrypoint;
-
-  /// The URL for web documentation for this command.
-  String get docUrl => null;
-
-  /// Override this and return `false` to disallow trailing options from being
-  /// parsed after a non-option argument is parsed.
-  bool get allowTrailingOptions => true;
-
-  ArgParser get argParser {
-    // Lazily initialize the parser because the superclass constructor requires
-    // it but we want to initialize it based on [allowTrailingOptions].
-    if (_argParser == null) {
-      _argParser = new ArgParser(allowTrailingOptions: allowTrailingOptions);
-    }
-    return _argParser;
-  }
-  ArgParser _argParser;
-
-  /// Override this to use offline-only sources instead of hitting the network.
-  ///
-  /// This will only be called before the [SystemCache] is created. After that,
-  /// it has no effect. This only needs to be set in leaf commands.
-  bool get isOffline => false;
-
-  String get usageFooter {
-    if (docUrl == null) return null;
-    return "See $docUrl for detailed documentation.";
-  }
-
-  void printUsage() {
-    log.message(usage);
-  }
-
-  /// Parses a user-supplied integer [intString] named [name].
-  ///
-  /// If the parsing fails, prints a usage message and exits.
-  int parseInt(String intString, String name) {
-    try {
-      return int.parse(intString);
-    } on FormatException catch (_) {
-      usageException('Could not parse $name "$intString".');
-    }
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/barback.dart b/sdk/lib/_internal/pub/lib/src/command/barback.dart
deleted file mode 100644
index 8175e8f..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/barback.dart
+++ /dev/null
@@ -1,198 +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 pub.command.barback;
-
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as path;
-
-import '../command.dart';
-import '../io.dart';
-import '../log.dart' as log;
-import '../utils.dart';
-
-final _arrow = getSpecial('\u2192', '=>');
-
-/// The set of top level directories in the entrypoint package that are built
-/// when the user does "--all".
-final _allSourceDirectories = new Set<String>.from([
-  "benchmark", "bin", "example", "test", "web"
-]);
-
-/// Shared base class for [BuildCommand] and [ServeCommand].
-abstract class BarbackCommand extends PubCommand {
-  /// The build mode.
-  BarbackMode get mode => new BarbackMode(argResults["mode"]);
-
-  /// The directories in the entrypoint package that should be added to the
-  /// build environment.
-  final sourceDirectories = new Set<String>();
-
-  /// The default build mode.
-  BarbackMode get defaultMode => BarbackMode.RELEASE;
-
-  /// Override this to specify the default source directories if none are
-  /// provided on the command line.
-  List<String> get defaultSourceDirectories;
-
-  BarbackCommand() {
-    argParser.addOption("mode", defaultsTo: defaultMode.toString(),
-        help: "Mode to run transformers in.");
-
-    argParser.addFlag("all",
-        help: "Use all default source directories.",
-        defaultsTo: false, negatable: false);
-  }
-
-  Future run() {
-    // Switch to JSON output if specified. We need to do this before parsing
-    // the source directories so an error will be correctly reported in JSON
-    // format.
-    log.json.enabled = argResults.options.contains("format") &&
-        argResults["format"] == "json";
-
-    _parseSourceDirectories();
-    return onRunTransformerCommand();
-  }
-
-  /// Override this to run the actual command.
-  Future onRunTransformerCommand();
-
-  /// Parses the command-line arguments to determine the set of source
-  /// directories to add to the build environment.
-  ///
-  /// If there are no arguments, this will just be [defaultSourceDirectories].
-  ///
-  /// If the `--all` flag is set, then it will be all default directories
-  /// that exist.
-  ///
-  /// Otherwise, all arguments should be the paths of directories to include.
-  ///
-  /// Throws an exception if the arguments are invalid.
-  void _parseSourceDirectories() {
-    if (argResults["all"]) {
-      _addAllDefaultSources();
-      return;
-    }
-
-    // If no directories were specified, use the defaults.
-    if (argResults.rest.isEmpty) {
-      _addDefaultSources();
-      return;
-    }
-
-    sourceDirectories.addAll(argResults.rest);
-
-    // Prohibit "lib".
-    var disallowed = sourceDirectories.where((dir) {
-      var parts = path.split(path.normalize(dir));
-      return parts.isNotEmpty && parts.first == "lib";
-    });
-
-    if (disallowed.isNotEmpty) {
-      usageException(_directorySentence(disallowed, "is", "are", "not allowed"));
-    }
-
-    // Make sure the source directories don't reach out of the package.
-    var invalid = sourceDirectories.where((dir) => !path.isWithin('.', dir));
-    if (invalid.isNotEmpty) {
-      usageException(_directorySentence(invalid, "isn't", "aren't",
-          "in this package"));
-    }
-
-    // Make sure all of the source directories exist.
-    var missing = sourceDirectories.where(
-        (dir) => !dirExists(entrypoint.root.path(dir)));
-
-    if (missing.isNotEmpty) {
-      dataError(_directorySentence(missing, "does", "do", "not exist"));
-    }
-
-    // Make sure the directories don't overlap.
-    var sources = sourceDirectories.toList();
-    var overlapping = new Set();
-    for (var i = 0; i < sources.length; i++) {
-      for (var j = i + 1; j < sources.length; j++) {
-        if (path.isWithin(sources[i], sources[j]) ||
-            path.isWithin(sources[j], sources[i])) {
-          overlapping.add(sources[i]);
-          overlapping.add(sources[j]);
-        }
-      }
-    }
-
-    if (overlapping.isNotEmpty) {
-      usageException(_directorySentence(overlapping, "cannot", "cannot",
-          "overlap"));
-    }
-  }
-
-  /// Handles "--all" by adding all default source directories that are
-  /// present.
-  void _addAllDefaultSources() {
-    if (argResults.rest.isNotEmpty) {
-      usageException(
-          'Directory names are not allowed if "--all" is passed.');
-    }
-
-    // Include every build directory that exists in the package.
-    var dirs = _allSourceDirectories.where(
-        (dir) => dirExists(entrypoint.root.path(dir)));
-
-    if (dirs.isEmpty) {
-      var defaultDirs = toSentence(_allSourceDirectories.map(
-          (name) => '"$name"'));
-      dataError('There are no source directories present.\n'
-          'The default directories are $defaultDirs.');
-    }
-
-    sourceDirectories.addAll(dirs);
-  }
-
-  /// Adds the default sources that should be used if no directories are passed
-  /// on the command line.
-  void _addDefaultSources() {
-    sourceDirectories.addAll(defaultSourceDirectories.where(
-        (dir) => dirExists(entrypoint.root.path(dir))));
-
-    // TODO(rnystrom): Hackish. Assumes there will only be one or two
-    // default sources. That's true for pub build and serve, but isn't as
-    // general as it could be.
-    if (sourceDirectories.isEmpty) {
-      var defaults;
-      if (defaultSourceDirectories.length == 1) {
-        defaults = 'a "${defaultSourceDirectories.first}" directory';
-      } else {
-        defaults = '"${defaultSourceDirectories[0]}" and/or '
-            '"${defaultSourceDirectories[1]}" directories';
-      }
-
-      dataError("Your package must have $defaults,\n"
-          "or you must specify the source directories.");
-    }
-  }
-
-  /// Converts a list of [directoryNames] to a sentence.
-  ///
-  /// After the list of directories, [singularVerb] will be used if there is
-  /// only one directory and [pluralVerb] will be used if there are more than
-  /// one. Then [suffix] is added to the end of the sentence, and, finally, a
-  /// period is added.
-  String _directorySentence(Iterable<String> directoryNames,
-      String singularVerb, String pluralVerb, String suffix) {
-    var directories = pluralize('Directory', directoryNames.length,
-        plural: 'Directories');
-    var names = toSentence(directoryNames.map((dir) => '"$dir"'));
-    var verb = pluralize(singularVerb, directoryNames.length,
-        plural: pluralVerb);
-
-    var result = "$directories $names $verb";
-    if (suffix != null) result += " $suffix";
-    result += ".";
-
-    return result;
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/build.dart b/sdk/lib/_internal/pub/lib/src/command/build.dart
deleted file mode 100644
index b07cd95..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/build.dart
+++ /dev/null
@@ -1,268 +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 pub.command.build;
-
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as path;
-
-import '../barback/asset_environment.dart';
-import '../exit_codes.dart' as exit_codes;
-import '../io.dart';
-import '../log.dart' as log;
-import '../utils.dart';
-import 'barback.dart';
-
-final _arrow = getSpecial('\u2192', '=>');
-
-/// Handles the `build` pub command.
-class BuildCommand extends BarbackCommand {
-  String get name => "build";
-  String get description => "Apply transformers to build a package.";
-  String get invocation => "pub build [options] [directories...]";
-  String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-build.html";
-  List<String> get aliases => const ["deploy", "settle-up"];
-
-  /// The path to the application's build output directory.
-  String get outputDirectory => argResults["output"];
-
-  List<String> get defaultSourceDirectories => ["web"];
-
-  /// The number of files that have been built and written to disc so far.
-  int builtFiles = 0;
-
-  BuildCommand() {
-    argParser.addOption("define", abbr: "D",
-        help: "Defines an environment constant for dart2js.",
-        allowMultiple: true, splitCommas: false);
-
-    argParser.addOption("format",
-        help: "How output should be displayed.",
-        allowed: ["text", "json"], defaultsTo: "text");
-
-    argParser.addOption("output", abbr: "o",
-        help: "Directory to write build outputs to.",
-        defaultsTo: "build");
-  }
-
-  Future onRunTransformerCommand() async {
-    cleanDir(outputDirectory);
-
-    var errorsJson = [];
-    var logJson = [];
-
-    var environmentConstants = new Map.fromIterable(argResults["define"],
-        key: (pair) => pair.split("=").first,
-        value: (pair) => pair.split("=").last);
-
-    // Since this server will only be hit by the transformer loader and isn't
-    // user-facing, just use an IPv4 address to avoid a weird bug on the
-    // OS X buildbots.
-    return AssetEnvironment.create(entrypoint, mode,
-            environmentConstants: environmentConstants,
-            useDart2JS: true)
-        .then((environment) {
-      // Show in-progress errors, but not results. Those get handled
-      // implicitly by getAllAssets().
-      environment.barback.errors.listen((error) {
-        log.error(log.red("Build error:\n$error"));
-
-        if (log.json.enabled) {
-          // Wrap the error in a map in case we end up decorating it with
-          // more properties later.
-          errorsJson.add({
-            "error": error.toString()
-          });
-        }
-      });
-
-      // If we're using JSON output, the regular server logging is disabled.
-      // Instead, we collect it here to include in the final JSON result.
-      if (log.json.enabled) {
-        environment.barback.log.listen(
-            (entry) => logJson.add(_logEntryToJson(entry)));
-      }
-
-      return log.progress("Building ${entrypoint.root.name}", () {
-        // Register all of the build directories.
-        // TODO(rnystrom): We don't actually need to bind servers for these, we
-        // just need to add them to barback's sources. Add support to
-        // BuildEnvironment for going the latter without the former.
-        return Future.wait(sourceDirectories.map(
-            (dir) => environment.serveDirectory(dir))).then((_) {
-
-          return environment.barback.getAllAssets();
-        });
-      }).then((assets) {
-        // Find all of the JS entrypoints we built.
-        var dart2JSEntrypoints = assets
-            .where((asset) => asset.id.path.endsWith(".dart.js"))
-            .map((asset) => asset.id);
-
-        return Future.wait(assets.map(_writeAsset)).then((_) {
-          return _copyBrowserJsFiles(dart2JSEntrypoints, assets);
-        }).then((_) {
-          log.message('Built $builtFiles ${pluralize('file', builtFiles)} '
-              'to "$outputDirectory".');
-
-          log.json.message({
-            "buildResult": "success",
-            "outputDirectory": outputDirectory,
-            "numFiles": builtFiles,
-            "log": logJson
-          });
-        });
-      });
-    }).catchError((error) {
-      // If [getAllAssets()] throws a BarbackException, the error has already
-      // been reported.
-      if (error is! BarbackException) throw error;
-
-      log.error(log.red("Build failed."));
-      log.json.message({
-        "buildResult": "failure",
-        "errors": errorsJson,
-        "log": logJson
-      });
-
-      return flushThenExit(exit_codes.DATA);
-    });
-  }
-
-  /// Writes [asset] to the appropriate build directory.
-  ///
-  /// If [asset] is in the special "packages" directory, writes it to every
-  /// build directory.
-  Future _writeAsset(Asset asset) async {
-    // In release mode, strip out .dart files since all relevant ones have been
-    // compiled to JavaScript already.
-    if (mode == BarbackMode.RELEASE && asset.id.extension == ".dart") {
-      return null;
-    }
-
-    var destPath = _idToPath(asset.id);
-
-    // If the asset is from a public directory, copy it into all of the
-    // top-level build directories.
-    if (path.isWithin("packages", destPath)) {
-      return Future.wait(sourceDirectories.map((buildDir) =>
-          _writeOutputFile(asset, path.join(buildDir, destPath))));
-    }
-
-    return _writeOutputFile(asset, destPath);
-  }
-
-  /// Converts [id] to a relative path in the output directory for that asset.
-  ///
-  /// This corresponds to the URL that could be used to request that asset from
-  /// pub serve.
-  ///
-  /// Examples (where entrypoint is "myapp"):
-  ///
-  ///     myapp|web/index.html   -> web/index.html
-  ///     myapp|lib/lib.dart     -> packages/myapp/lib.dart
-  ///     foo|lib/foo.dart       -> packages/foo/foo.dart
-  ///     myapp|test/main.dart   -> test/main.dart
-  ///     foo|test/main.dart     -> ERROR
-  ///
-  /// Throws a [FormatException] if [id] is not a valid public asset.
-  String _idToPath(AssetId id) {
-    var parts = path.split(path.fromUri(id.path));
-
-    if (parts.length < 2) {
-      throw new FormatException(
-          "Can not build assets from top-level directory.");
-    }
-
-    // Map "lib" to the "packages" directory.
-    if (parts[0] == "lib") {
-      return path.join("packages", id.package, path.joinAll(parts.skip(1)));
-    }
-
-    // Shouldn't be trying to access non-public directories of other packages.
-    assert(id.package == entrypoint.root.name);
-
-    // Allow any path in the entrypoint package.
-    return path.joinAll(parts);
-  }
-
-  /// Writes the contents of [asset] to [relativePath] within the build
-  /// directory.
-  Future _writeOutputFile(Asset asset, String relativePath) {
-    builtFiles++;
-    var destPath = path.join(outputDirectory, relativePath);
-    ensureDir(path.dirname(destPath));
-    return createFileFromStream(asset.read(), destPath);
-  }
-
-  /// If this package depends directly on the `browser` package, this ensures
-  /// that the JavaScript bootstrap files are copied into `packages/browser/`
-  /// directories next to each entrypoint in [entrypoints].
-  Future _copyBrowserJsFiles(Iterable<AssetId> entrypoints, AssetSet assets) {
-    // Must depend on the browser package.
-    if (!entrypoint.root.immediateDependencies.any(
-        (dep) => dep.name == 'browser' && dep.source == 'hosted')) {
-      return new Future.value();
-    }
-
-    // Get all of the subdirectories that contain Dart entrypoints.
-    var entrypointDirs = entrypoints
-        // Convert the asset path to a native-separated one and get the
-        // directory containing the entrypoint.
-        .map((id) => path.dirname(path.fromUri(id.path)))
-        // Don't copy files to the top levels of the build directories since
-        // the normal lib asset copying will take care of that.
-        .where((dir) => path.split(dir).length > 1)
-        .toSet();
-
-    var jsAssets = assets.where((asset) =>
-        asset.id.package == 'browser' && asset.id.extension == '.js');
-    return Future.wait(entrypointDirs.expand((dir) {
-      // TODO(nweiz): we should put browser JS files next to any HTML file
-      // rather than any entrypoint. An HTML file could import an entrypoint
-      // that's not adjacent.
-      return jsAssets.map((asset) {
-        var jsPath = path.join(dir, _idToPath(asset.id));
-        return _writeOutputFile(asset, jsPath);
-      });
-    }));
-  }
-
-  /// Converts [entry] to a JSON object for use with JSON-formatted output.
-  Map _logEntryToJson(LogEntry entry) {
-    var data = {
-      "level": entry.level.name,
-      "transformer": {
-        "name": entry.transform.transformer.toString(),
-        "primaryInput": {
-          "package": entry.transform.primaryId.package,
-          "path": entry.transform.primaryId.path
-        },
-      },
-      "assetId": {
-        "package": entry.assetId.package,
-        "path": entry.assetId.path
-      },
-      "message": entry.message
-    };
-
-    if (entry.span != null) {
-      data["span"] = {
-        "url": entry.span.sourceUrl,
-        "start": {
-          "line": entry.span.start.line,
-          "column": entry.span.start.column
-        },
-        "end": {
-          "line": entry.span.end.line,
-          "column": entry.span.end.column
-        },
-      };
-    }
-
-    return data;
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/cache.dart b/sdk/lib/_internal/pub/lib/src/command/cache.dart
deleted file mode 100644
index 432f096..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/cache.dart
+++ /dev/null
@@ -1,24 +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 pub.command.cache;
-
-import '../command.dart';
-import 'cache_add.dart';
-import 'cache_list.dart';
-import 'cache_repair.dart';
-
-/// Handles the `cache` pub command.
-class CacheCommand extends PubCommand {
-  String get name => "cache";
-  String get description => "Work with the system cache.";
-  String get invocation => "pub cache <subcommand>";
-  String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-cache.html";
-
-  CacheCommand() {
-    addSubcommand(new CacheAddCommand());
-    addSubcommand(new CacheListCommand());
-    addSubcommand(new CacheRepairCommand());
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/cache_add.dart b/sdk/lib/_internal/pub/lib/src/command/cache_add.dart
deleted file mode 100644
index ae5c1da..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/cache_add.dart
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.cache_add;
-
-import 'dart:async';
-
-import 'package:pub_semver/pub_semver.dart';
-
-import '../command.dart';
-import '../log.dart' as log;
-import '../package.dart';
-import '../utils.dart';
-
-/// Handles the `cache add` pub command.
-class CacheAddCommand extends PubCommand {
-  String get name => "add";
-  String get description => "Install a package.";
-  String get invocation =>
-      "pub cache add <package> [--version <constraint>] [--all]";
-  String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-cache.html";
-
-  CacheAddCommand() {
-    argParser.addFlag("all",
-        help: "Install all matching versions.",
-        negatable: false);
-
-    argParser.addOption("version", abbr: "v",
-        help: "Version constraint.");
-  }
-
-  Future run() async {
-    // Make sure there is a package.
-    if (argResults.rest.isEmpty) {
-      usageException("No package to add given.");
-    }
-
-    // Don't allow extra arguments.
-    if (argResults.rest.length > 1) {
-      var unexpected = argResults.rest.skip(1).map((arg) => '"$arg"');
-      var arguments = pluralize("argument", unexpected.length);
-      usageException("Unexpected $arguments ${toSentence(unexpected)}.");
-    }
-
-    var package = argResults.rest.single;
-
-    // Parse the version constraint, if there is one.
-    var constraint = VersionConstraint.any;
-    if (argResults["version"] != null) {
-      try {
-        constraint = new VersionConstraint.parse(argResults["version"]);
-      } on FormatException catch (error) {
-        usageException(error.message);
-      }
-    }
-
-    // TODO(rnystrom): Support installing from git too.
-    var source = cache.sources["hosted"];
-
-    // TODO(rnystrom): Allow specifying the server.
-    var pubspecs = await source.getVersions(package, package);
-    var versions = pubspecs.map((pubspec) => pubspec.version)
-        .where(constraint.allows).toList();
-
-    if (versions.isEmpty) {
-      // TODO(rnystrom): Show most recent unmatching version?
-      fail("Package $package has no versions that match $constraint.");
-    }
-
-    downloadVersion(version) async {
-      var id = new PackageId(package, source.name, version, package);
-      if (await cache.contains(id)) {
-        // TODO(rnystrom): Include source and description if not hosted.
-        // See solve_report.dart for code to harvest.
-        log.message("Already cached ${id.name} ${id.version}.");
-        return null;
-      }
-
-      // Download it.
-      await source.downloadToSystemCache(id);
-    }
-
-    if (argResults["all"]) {
-      // Install them in ascending order.
-      versions.sort();
-      await Future.forEach(versions, downloadVersion);
-    } else {
-      // Pick the best matching version.
-      versions.sort(Version.prioritize);
-      await downloadVersion(versions.last);
-    }
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/cache_list.dart b/sdk/lib/_internal/pub/lib/src/command/cache_list.dart
deleted file mode 100644
index a9fa470..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/cache_list.dart
+++ /dev/null
@@ -1,35 +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 pub.command.cache_list;
-
-import 'dart:convert';
-
-import '../command.dart';
-import '../log.dart' as log;
-import '../source/cached.dart';
-
-/// Handles the `cache list` pub command.
-class CacheListCommand extends PubCommand {
-  String get name => "list";
-  String get description => "List packages in the system cache.";
-  String get invocation => "pub cache list";
-  bool get hidden => true;
-  bool get takesArguments => false;
-
-  void run() {
-    // TODO(keertip): Add flag to list packages from non default sources.
-    var packagesObj = <String, Map>{};
-
-    var source = cache.sources.defaultSource as CachedSource;
-    for (var package in source.getCachedPackages()) {
-      var packageInfo = packagesObj.putIfAbsent(package.name, () => {});
-      packageInfo[package.version.toString()] = {'location': package.dir};
-    }
-
-    // TODO(keertip): Add support for non-JSON format and check for --format
-    // flag.
-    log.message(JSON.encode({'packages': packagesObj}));
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/cache_repair.dart b/sdk/lib/_internal/pub/lib/src/command/cache_repair.dart
deleted file mode 100644
index 3e130e9..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/cache_repair.dart
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.cache_repair;
-
-import 'dart:async';
-
-import '../command.dart';
-import '../exit_codes.dart' as exit_codes;
-import '../io.dart';
-import '../log.dart' as log;
-import '../source/cached.dart';
-import '../utils.dart';
-
-/// Handles the `cache repair` pub command.
-class CacheRepairCommand extends PubCommand {
-  String get name => "repair";
-  String get description => "Reinstall cached packages.";
-  String get invocation => "pub cache repair";
-  String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-cache.html";
-  bool get takesArguments => false;
-
-  Future run() async {
-    var successes = 0;
-    var failures = 0;
-
-    // Repair every cached source.
-    for (var source in cache.sources) {
-      if (source is! CachedSource) continue;
-
-      var results = await source.repairCachedPackages();
-      successes += results.first;
-      failures += results.last;
-    }
-
-    if (successes > 0) {
-      var packages = pluralize("package", successes);
-      log.message("Reinstalled ${log.green(successes)} $packages.");
-    }
-
-    if (failures > 0) {
-      var packages = pluralize("package", failures);
-      log.message("Failed to reinstall ${log.red(failures)} $packages.");
-    }
-
-    var results = await globals.repairActivatedPackages();
-    if (results.first > 0) {
-      var packages = pluralize("package", results.first);
-      log.message("Reactivated ${log.green(results.first)} $packages.");
-    }
-
-    if (results.last > 0) {
-      var packages = pluralize("package", results.last);
-      log.message("Failed to reactivate ${log.red(results.last)} $packages.");
-    }
-
-    if (successes == 0 && failures == 0) {
-      log.message("No packages in cache, so nothing to repair.");
-    }
-
-    if (failures > 0) await flushThenExit(exit_codes.UNAVAILABLE);
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/deps.dart b/sdk/lib/_internal/pub/lib/src/command/deps.dart
deleted file mode 100644
index 7b1bafc..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/deps.dart
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.list;
-
-import 'dart:async';
-import 'dart:collection';
-
-import '../ascii_tree.dart' as tree;
-import '../command.dart';
-import '../log.dart' as log;
-import '../package.dart';
-import '../package_graph.dart';
-import '../utils.dart';
-
-/// Handles the `deps` pub command.
-class DepsCommand extends PubCommand {
-  String get name => "deps";
-  String get description => "Print package dependencies.";
-  List<String> get aliases => const ["dependencies", "tab"];
-  String get invocation => "pub deps";
-  String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-deps.html";
-  bool get takesArguments => false;
-
-  /// The loaded package graph.
-  PackageGraph _graph;
-
-  /// The [StringBuffer] used to accumulate the output.
-  StringBuffer _buffer;
-
-  DepsCommand() {
-    argParser.addOption("style", abbr: "s",
-        help: "How output should be displayed.",
-        allowed: ["compact", "tree", "list"],
-        defaultsTo: "tree");
-  }
-
-  Future run() {
-    return entrypoint.loadPackageGraph().then((graph) {
-      _graph = graph;
-      _buffer = new StringBuffer();
-
-      _buffer.writeln(_labelPackage(entrypoint.root));
-
-      switch (argResults["style"]) {
-        case "compact": _outputCompact(); break;
-        case "list": _outputList(); break;
-        case "tree": _outputTree(); break;
-      }
-
-      log.message(_buffer);
-    });
-  }
-
-  /// Outputs a list of all of the package's immediate, dev, override, and
-  /// transitive dependencies.
-  ///
-  /// For each dependency listed, *that* package's immediate dependencies are
-  /// shown. Unlike [_outputList], this prints all of these dependencies on one
-  /// line.
-  void _outputCompact() {
-    var root = entrypoint.root;
-    _outputCompactPackages("dependencies",
-        root.dependencies.map((dep) => dep.name));
-    _outputCompactPackages("dev dependencies",
-        root.devDependencies.map((dep) => dep.name));
-    _outputCompactPackages("dependency overrides",
-        root.dependencyOverrides.map((dep) => dep.name));
-
-    var transitive = _getTransitiveDependencies();
-    _outputCompactPackages("transitive dependencies", transitive);
-  }
-
-  /// Outputs one section of packages in the compact output.
-  _outputCompactPackages(String section, Iterable<String> names) {
-    if (names.isEmpty) return;
-
-    _buffer.writeln();
-    _buffer.writeln("$section:");
-    for (var name in ordered(names)) {
-      var package = _graph.packages[name];
-
-      _buffer.write("- ${_labelPackage(package)}");
-      if (package.dependencies.isEmpty) {
-        _buffer.writeln();
-      } else {
-        var depNames = package.dependencies.map((dep) => dep.name);
-        var depsList = "[${depNames.join(' ')}]";
-        _buffer.writeln(" ${log.gray(depsList)}");
-      }
-    }
-  }
-
-  /// Outputs a list of all of the package's immediate, dev, override, and
-  /// transitive dependencies.
-  ///
-  /// For each dependency listed, *that* package's immediate dependencies are
-  /// shown.
-  void _outputList() {
-    var root = entrypoint.root;
-    _outputListSection("dependencies",
-        root.dependencies.map((dep) => dep.name));
-    _outputListSection("dev dependencies",
-        root.devDependencies.map((dep) => dep.name));
-    _outputListSection("dependency overrides",
-        root.dependencyOverrides.map((dep) => dep.name));
-
-    var transitive = _getTransitiveDependencies();
-    if (transitive.isEmpty) return;
-
-    _outputListSection("transitive dependencies", ordered(transitive));
-  }
-
-  /// Outputs one section of packages in the list output.
-  _outputListSection(String name, Iterable<String> deps) {
-    if (deps.isEmpty) return;
-
-    _buffer.writeln();
-    _buffer.writeln("$name:");
-
-    for (var name in deps) {
-      var package = _graph.packages[name];
-      _buffer.writeln("- ${_labelPackage(package)}");
-
-      for (var dep in package.dependencies) {
-        _buffer.writeln(
-            "  - ${log.bold(dep.name)} ${log.gray(dep.constraint)}");
-      }
-    }
-  }
-
-  /// Generates a dependency tree for the root package.
-  ///
-  /// If a package is encountered more than once (i.e. a shared or circular
-  /// dependency), later ones are not traversed. This is done in breadth-first
-  /// fashion so that a package will always be expanded at the shallowest
-  /// depth that it appears at.
-  void _outputTree() {
-    // The work list for the breadth-first traversal. It contains the package
-    // being added to the tree, and the parent map that will receive that
-    // package.
-    var toWalk = new Queue<Pair<Package, Map>>();
-    var visited = new Set<String>();
-
-    // Start with the root dependencies.
-    var packageTree = {};
-    for (var dep in entrypoint.root.immediateDependencies) {
-      toWalk.add(new Pair(_graph.packages[dep.name], packageTree));
-    }
-
-    // Do a breadth-first walk to the dependency graph.
-    while (toWalk.isNotEmpty) {
-      var pair = toWalk.removeFirst();
-      var package = pair.first;
-      var map = pair.last;
-
-      if (visited.contains(package.name)) {
-        map[log.gray('${package.name}...')] = {};
-        continue;
-      }
-
-      visited.add(package.name);
-
-      // Populate the map with this package's dependencies.
-      var childMap = {};
-      map[_labelPackage(package)] = childMap;
-
-      for (var dep in package.dependencies) {
-        toWalk.add(new Pair(_graph.packages[dep.name], childMap));
-      }
-    }
-
-    _buffer.write(tree.fromMap(packageTree, showAllChildren: true));
-  }
-
-  String _labelPackage(Package package) =>
-      "${log.bold(package.name)} ${package.version}";
-
-  /// Gets the names of the non-immediate dependencies of the root package.
-  Set<String> _getTransitiveDependencies() {
-    var transitive = _graph.packages.keys.toSet();
-    var root = entrypoint.root;
-    transitive.remove(root.name);
-    transitive.removeAll(root.dependencies.map((dep) => dep.name));
-    transitive.removeAll(root.devDependencies.map((dep) => dep.name));
-    transitive.removeAll(root.dependencyOverrides.map((dep) => dep.name));
-    return transitive;
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/downgrade.dart b/sdk/lib/_internal/pub/lib/src/command/downgrade.dart
deleted file mode 100644
index c48c1f0..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/downgrade.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.downgrade;
-
-import 'dart:async';
-
-import '../command.dart';
-import '../log.dart' as log;
-import '../solver/version_solver.dart';
-
-/// Handles the `downgrade` pub command.
-class DowngradeCommand extends PubCommand {
-  String get name => "downgrade";
-  String get description =>
-      "Downgrade the current package's dependencies to oldest versions.\n\n"
-      "This doesn't modify the lockfile, so it can be reset with \"pub get\".";
-  String get invocation => "pub downgrade [dependencies...]";
-
-  bool get isOffline => argResults['offline'];
-
-  DowngradeCommand() {
-    argParser.addFlag('offline',
-        help: 'Use cached packages instead of accessing the network.');
-
-    argParser.addFlag('dry-run', abbr: 'n', negatable: false,
-        help: "Report what dependencies would change but don't change any.");
-  }
-
-  Future run() async {
-    var dryRun = argResults['dry-run'];
-    await entrypoint.acquireDependencies(SolveType.DOWNGRADE,
-        useLatest: argResults.rest, dryRun: dryRun);
-    if (isOffline) {
-      log.warning("Warning: Downgrading when offline may not update you to "
-          "the oldest versions of your dependencies.");
-    }
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/get.dart b/sdk/lib/_internal/pub/lib/src/command/get.dart
deleted file mode 100644
index d2fc513..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/get.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.get;
-
-import 'dart:async';
-
-import '../command.dart';
-import '../solver/version_solver.dart';
-
-/// Handles the `get` pub command.
-class GetCommand extends PubCommand {
-  String get name => "get";
-  String get description => "Get the current package's dependencies.";
-  String get invocation => "pub get";
-  String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-get.html";
-  List<String> get aliases => const ["install"];
-  bool get isOffline => argResults["offline"];
-
-  GetCommand() {
-    argParser.addFlag('offline',
-        help: 'Use cached packages instead of accessing the network.');
-
-    argParser.addFlag('dry-run', abbr: 'n', negatable: false,
-        help: "Report what dependencies would change but don't change any.");
-  }
-
-  Future run() {
-    return entrypoint.acquireDependencies(SolveType.GET,
-        dryRun: argResults['dry-run']);
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/global.dart b/sdk/lib/_internal/pub/lib/src/command/global.dart
deleted file mode 100644
index c2ddfd8..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/global.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.global;
-
-import '../command.dart';
-import 'global_activate.dart';
-import 'global_deactivate.dart';
-import 'global_list.dart';
-import 'global_run.dart';
-
-/// Handles the `global` pub command.
-class GlobalCommand extends PubCommand {
-  String get name => "global";
-  String get description => "Work with global packages.";
-  String get invocation => "pub global <subcommand>";
-
-  GlobalCommand() {
-    addSubcommand(new GlobalActivateCommand());
-    addSubcommand(new GlobalDeactivateCommand());
-    addSubcommand(new GlobalListCommand());
-    addSubcommand(new GlobalRunCommand());
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/global_activate.dart b/sdk/lib/_internal/pub/lib/src/command/global_activate.dart
deleted file mode 100644
index d4335c2..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/global_activate.dart
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.global_activate;
-
-import 'dart:async';
-
-import 'package:pub_semver/pub_semver.dart';
-
-import '../command.dart';
-import '../utils.dart';
-
-/// Handles the `global activate` pub command.
-class GlobalActivateCommand extends PubCommand {
-  String get name => "activate";
-  String get description => "Make a package's executables globally available.";
-  String get invocation => "pub global activate <package...>";
-
-  GlobalActivateCommand() {
-    argParser.addOption("source",
-        abbr: "s",
-        help: "The source used to find the package.",
-        allowed: ["git", "hosted", "path"],
-        defaultsTo: "hosted");
-
-    argParser.addFlag("no-executables", negatable: false,
-        help: "Do not put executables on PATH.");
-
-    argParser.addOption("executable", abbr: "x",
-        help: "Executable(s) to place on PATH.",
-        allowMultiple: true);
-
-    argParser.addFlag("overwrite", negatable: false,
-        help: "Overwrite executables from other packages with the same name.");
-  }
-
-  Future run() {
-    // Default to `null`, which means all executables.
-    var executables;
-    if (argResults.wasParsed("executable")) {
-      if (argResults.wasParsed("no-executables")) {
-        usageException("Cannot pass both --no-executables and --executable.");
-      }
-
-      executables = argResults["executable"];
-    } else if (argResults["no-executables"]) {
-      // An empty list means no executables.
-      executables = [];
-    }
-
-    var overwrite = argResults["overwrite"];
-    var args = argResults.rest;
-
-    readArg([String error]) {
-      if (args.isEmpty) usageException(error);
-      var arg = args.first;
-      args = args.skip(1);
-      return arg;
-    }
-
-    validateNoExtraArgs() {
-      if (args.isEmpty) return;
-      var unexpected = args.map((arg) => '"$arg"');
-      var arguments = pluralize("argument", unexpected.length);
-      usageException("Unexpected $arguments ${toSentence(unexpected)}.");
-    }
-
-    switch (argResults["source"]) {
-      case "git":
-        var repo = readArg("No Git repository given.");
-        // TODO(rnystrom): Allow passing in a Git ref too.
-        validateNoExtraArgs();
-        return globals.activateGit(repo, executables,
-            overwriteBinStubs: overwrite);
-
-      case "hosted":
-        var package = readArg("No package to activate given.");
-
-        // Parse the version constraint, if there is one.
-        var constraint = VersionConstraint.any;
-        if (args.isNotEmpty) {
-          try {
-            constraint = new VersionConstraint.parse(readArg());
-          } on FormatException catch (error) {
-            usageException(error.message);
-          }
-        }
-
-        validateNoExtraArgs();
-        return globals.activateHosted(package, constraint, executables,
-            overwriteBinStubs: overwrite);
-
-      case "path":
-        var path = readArg("No package to activate given.");
-        validateNoExtraArgs();
-        return globals.activatePath(path, executables,
-            overwriteBinStubs: overwrite);
-    }
-
-    throw "unreachable";
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/global_deactivate.dart b/sdk/lib/_internal/pub/lib/src/command/global_deactivate.dart
deleted file mode 100644
index e64f722..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/global_deactivate.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.global_deactivate;
-
-import '../command.dart';
-import '../log.dart' as log;
-import '../utils.dart';
-
-/// Handles the `global deactivate` pub command.
-class GlobalDeactivateCommand extends PubCommand {
-  String get name => "deactivate";
-  String get description => "Remove a previously activated package.";
-  String get invocation => "pub global deactivate <package>";
-
-  void run() {
-    // Make sure there is a package.
-    if (argResults.rest.isEmpty) {
-      usageException("No package to deactivate given.");
-    }
-
-    // Don't allow extra arguments.
-    if (argResults.rest.length > 1) {
-      var unexpected = argResults.rest.skip(1).map((arg) => '"$arg"');
-      var arguments = pluralize("argument", unexpected.length);
-      usageException("Unexpected $arguments ${toSentence(unexpected)}.");
-    }
-
-    if (!globals.deactivate(argResults.rest.first)) {
-      dataError("No active package ${log.bold(argResults.rest.first)}.");
-    }
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/global_list.dart b/sdk/lib/_internal/pub/lib/src/command/global_list.dart
deleted file mode 100644
index 7a05bb0..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/global_list.dart
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.global_list;
-
-import '../command.dart';
-
-/// Handles the `global list` pub command.
-class GlobalListCommand extends PubCommand {
-  String get name => "list";
-  String get description => 'List globally activated packages.';
-  String get invocation => 'pub global list';
-  bool get allowTrailingOptions => false;
-  bool get takesArguments => false;
-
-  void run() {
-    globals.listActivePackages();
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/global_run.dart b/sdk/lib/_internal/pub/lib/src/command/global_run.dart
deleted file mode 100644
index 7fc07a7..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/global_run.dart
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.global_run;
-
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as p;
-
-import '../command.dart';
-import '../io.dart';
-import '../utils.dart';
-
-/// Handles the `global run` pub command.
-class GlobalRunCommand extends PubCommand {
-  String get name => "run";
-  String get description =>
-      "Run an executable from a globally activated package.\n"
-      "NOTE: We are currently optimizing this command's startup time.";
-  String get invocation => "pub global run <package>:<executable> [args...]";
-  bool get allowTrailingOptions => false;
-
-  /// The mode for barback transformers.
-  BarbackMode get mode => new BarbackMode(argResults["mode"]);
-
-  GlobalRunCommand() {
-    argParser.addOption("mode", defaultsTo: "release",
-        help: 'Mode to run transformers in.');
-  }
-
-  Future run() async {
-    if (argResults.rest.isEmpty) {
-      usageException("Must specify an executable to run.");
-    }
-
-    var package;
-    var executable = argResults.rest[0];
-    if (executable.contains(":")) {
-      var parts = split1(executable, ":");
-      package = parts[0];
-      executable = parts[1];
-    } else {
-      // If the package name is omitted, use the same name for both.
-      package = executable;
-    }
-
-    var args = argResults.rest.skip(1).toList();
-    if (p.split(executable).length > 1) {
-      // TODO(nweiz): Use adjacent strings when the new async/await compiler
-      // lands.
-      usageException('Cannot run an executable in a subdirectory of a global ' +
-          'package.');
-    }
-
-    var exitCode = await globals.runExecutable(package, executable, args,
-        mode: mode);
-    await flushThenExit(exitCode);
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/lish.dart b/sdk/lib/_internal/pub/lib/src/command/lish.dart
deleted file mode 100644
index 6783604..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/lish.dart
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.lish;
-
-import 'dart:async';
-
-import 'package:http/http.dart' as http;
-
-import '../command.dart';
-import '../ascii_tree.dart' as tree;
-import '../http.dart';
-import '../io.dart';
-import '../log.dart' as log;
-import '../oauth2.dart' as oauth2;
-import '../source/hosted.dart';
-import '../utils.dart';
-import '../validator.dart';
-
-/// Handles the `lish` and `publish` pub commands.
-class LishCommand extends PubCommand {
-  String get name => "publish";
-  String get description => "Publish the current package to pub.dartlang.org.";
-  String get invocation => "pub publish [options]";
-  String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-lish.html";
-  List<String> get aliases => const ["lish", "lush"];
-  bool get takesArguments => false;
-
-  /// The URL of the server to which to upload the package.
-  Uri get server {
-    // An explicit argument takes precedence.
-    if (argResults.wasParsed('server')) {
-      return Uri.parse(argResults['server']);
-    }
-
-    // Otherwise, use the one specified in the pubspec.
-    if (entrypoint.root.pubspec.publishTo != null) {
-      return Uri.parse(entrypoint.root.pubspec.publishTo);
-    }
-
-    // Otherwise, use the default.
-    return Uri.parse(HostedSource.defaultUrl);
-  }
-
-  /// Whether the publish is just a preview.
-  bool get dryRun => argResults['dry-run'];
-
-  /// Whether the publish requires confirmation.
-  bool get force => argResults['force'];
-
-  LishCommand() {
-    argParser.addFlag('dry-run', abbr: 'n', negatable: false,
-        help: 'Validate but do not publish the package.');
-    argParser.addFlag('force', abbr: 'f', negatable: false,
-        help: 'Publish without confirmation if there are no errors.');
-    argParser.addOption('server', defaultsTo: HostedSource.defaultUrl,
-        help: 'The package server to which to upload this package.');
-  }
-
-  Future _publish(packageBytes) {
-    var cloudStorageUrl;
-    return oauth2.withClient(cache, (client) {
-      return log.progress('Uploading', () {
-        // TODO(nweiz): Cloud Storage can provide an XML-formatted error. We
-        // should report that error and exit.
-        var newUri = server.resolve("/api/packages/versions/new");
-        return client.get(newUri, headers: PUB_API_HEADERS).then((response) {
-          var parameters = parseJsonResponse(response);
-
-          var url = _expectField(parameters, 'url', response);
-          if (url is! String) invalidServerResponse(response);
-          cloudStorageUrl = Uri.parse(url);
-          var request = new http.MultipartRequest('POST', cloudStorageUrl);
-          request.headers['Pub-Request-Timeout'] = 'None';
-
-          var fields = _expectField(parameters, 'fields', response);
-          if (fields is! Map) invalidServerResponse(response);
-          fields.forEach((key, value) {
-            if (value is! String) invalidServerResponse(response);
-            request.fields[key] = value;
-          });
-
-          request.followRedirects = false;
-          request.files.add(new http.MultipartFile.fromBytes(
-              'file', packageBytes, filename: 'package.tar.gz'));
-          return client.send(request);
-        }).then(http.Response.fromStream).then((response) {
-          var location = response.headers['location'];
-          if (location == null) throw new PubHttpException(response);
-          return location;
-        }).then((location) => client.get(location, headers: PUB_API_HEADERS))
-          .then(handleJsonSuccess);
-      });
-    }).catchError((error) {
-      if (error is! PubHttpException) throw error;
-      var url = error.response.request.url;
-      if (urisEqual(url, cloudStorageUrl)) {
-        // TODO(nweiz): the response may have XML-formatted information about
-        // the error. Try to parse that out once we have an easily-accessible
-        // XML parser.
-        fail('Failed to upload the package.');
-      } else if (urisEqual(Uri.parse(url.origin), Uri.parse(server.origin))) {
-        handleJsonError(error.response);
-      } else {
-        throw error;
-      }
-    });
-  }
-
-  Future run() {
-    if (force && dryRun) {
-      usageException('Cannot use both --force and --dry-run.');
-    }
-
-    if (entrypoint.root.pubspec.isPrivate) {
-      dataError('A private package cannot be published.\n'
-          'You can enable this by changing the "publish_to" field in your '
-              'pubspec.');
-    }
-
-    var files = entrypoint.root.listFiles(useGitIgnore: true);
-    log.fine('Archiving and publishing ${entrypoint.root}.');
-
-    // Show the package contents so the user can verify they look OK.
-    var package = entrypoint.root;
-    log.message(
-        'Publishing ${package.name} ${package.version} to $server:\n'
-        '${tree.fromFiles(files, baseDir: entrypoint.root.dir)}');
-
-    var packageBytesFuture = createTarGz(files, baseDir: entrypoint.root.dir)
-        .toBytes();
-
-    // Validate the package.
-    return _validate(packageBytesFuture.then((bytes) => bytes.length))
-        .then((isValid) {
-       if (isValid) return packageBytesFuture.then(_publish);
-    });
-  }
-
-  /// Returns the value associated with [key] in [map]. Throws a user-friendly
-  /// error if [map] doens't contain [key].
-  _expectField(Map map, String key, http.Response response) {
-    if (map.containsKey(key)) return map[key];
-    invalidServerResponse(response);
-  }
-
-  /// Validates the package. Completes to false if the upload should not
-  /// proceed.
-  Future<bool> _validate(Future<int> packageSize) {
-    return Validator.runAll(entrypoint, packageSize).then((pair) {
-      var errors = pair.first;
-      var warnings = pair.last;
-
-      if (!errors.isEmpty) {
-        log.error("Sorry, your package is missing "
-            "${(errors.length > 1) ? 'some requirements' : 'a requirement'} "
-            "and can't be published yet.\nFor more information, see: "
-            "http://pub.dartlang.org/doc/pub-lish.html.\n");
-        return false;
-      }
-
-      if (force) return true;
-
-      if (dryRun) {
-        var s = warnings.length == 1 ? '' : 's';
-        log.warning("\nPackage has ${warnings.length} warning$s.");
-        return false;
-      }
-
-      var message = '\nLooks great! Are you ready to upload your package';
-
-      if (!warnings.isEmpty) {
-        var s = warnings.length == 1 ? '' : 's';
-        message = "\nPackage has ${warnings.length} warning$s. Upload anyway";
-      }
-
-      return confirm(message).then((confirmed) {
-        if (!confirmed) {
-          log.error("Package upload canceled.");
-          return false;
-        }
-        return true;
-      });
-    });
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/list_package_dirs.dart b/sdk/lib/_internal/pub/lib/src/command/list_package_dirs.dart
deleted file mode 100644
index 9f6a1e2..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/list_package_dirs.dart
+++ /dev/null
@@ -1,65 +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 pub.command.list_package_dirs;
-
-import 'dart:async';
-
-import 'package:path/path.dart' as path;
-
-import '../command.dart';
-import '../log.dart' as log;
-import '../utils.dart';
-
-/// Handles the `list-package-dirs` pub command.
-class ListPackageDirsCommand extends PubCommand {
-  String get name => "list-package-dirs";
-  String get description => "Print local paths to dependencies.";
-  String get invocation => "pub list-package-dirs";
-  bool get takesArguments => false;
-  bool get hidden => true;
-
-  ListPackageDirsCommand() {
-    argParser.addOption("format",
-        help: "How output should be displayed.",
-        allowed: ["json"]);
-  }
-
-  Future run() {
-    log.json.enabled = true;
-
-    if (!entrypoint.lockFileExists) {
-      dataError('Package "myapp" has no lockfile. Please run "pub get" first.');
-    }
-
-    var output = {};
-
-    // Include the local paths to all locked packages.
-    var packages = {};
-    var futures = [];
-    entrypoint.lockFile.packages.forEach((name, package) {
-      var source = entrypoint.cache.sources[package.source];
-      futures.add(source.getDirectory(package).then((packageDir) {
-        packages[name] = path.join(packageDir, "lib");
-      }));
-    });
-
-    output["packages"] = packages;
-
-    // Include the self link.
-    packages[entrypoint.root.name] = entrypoint.root.path("lib");
-
-    // Include the file(s) which when modified will affect the results. For pub,
-    // that's just the pubspec and lockfile.
-    output["input_files"] = [
-      entrypoint.lockFilePath,
-      entrypoint.pubspecPath
-    ];
-
-    return Future.wait(futures).then((_) {
-      log.json.message(output);
-    });
-  }
-}
-
diff --git a/sdk/lib/_internal/pub/lib/src/command/run.dart b/sdk/lib/_internal/pub/lib/src/command/run.dart
deleted file mode 100644
index 55cc957..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/run.dart
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.run;
-
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as p;
-
-import '../command.dart';
-import '../executable.dart';
-import '../io.dart';
-import '../log.dart' as log;
-import '../utils.dart';
-
-/// Handles the `run` pub command.
-class RunCommand extends PubCommand {
-  String get name => "run";
-  String get description => "Run an executable from a package.\n"
-      "NOTE: We are currently optimizing this command's startup time.";
-  String get invocation => "pub run <executable> [args...]";
-  bool get allowTrailingOptions => false;
-
-  RunCommand() {
-    argParser.addOption("mode",
-        help: 'Mode to run transformers in.\n'
-              '(defaults to "release" for dependencies, "debug" for '
-                'entrypoint)');
-  }
-
-  Future run() async {
-    if (argResults.rest.isEmpty) {
-      usageException("Must specify an executable to run.");
-    }
-
-    var package = entrypoint.root.name;
-    var executable = argResults.rest[0];
-    var args = argResults.rest.skip(1).toList();
-
-    // A command like "foo:bar" runs the "bar" script from the "foo" package.
-    // If there is no colon prefix, default to the root package.
-    if (executable.contains(":")) {
-      var components = split1(executable, ":");
-      package = components[0];
-      executable = components[1];
-
-      if (p.split(executable).length > 1) {
-      // TODO(nweiz): Use adjacent strings when the new async/await compiler
-      // lands.
-        usageException("Cannot run an executable in a subdirectory of a " +
-            "dependency.");
-      }
-    } else if (onlyIdentifierRegExp.hasMatch(executable)) {
-      // "pub run foo" means the same thing as "pub run foo:foo" as long as
-      // "foo" is a valid Dart identifier (and thus package name).
-
-      // TODO(nweiz): Remove this after Dart 1.10 ships.
-      var localPath = p.join("bin", "$executable.dart");
-      if (fileExists(localPath) && executable != entrypoint.root.name) {
-        log.warning(
-            'In future releases, "pub run $executable" will mean the same '
-                'thing as "pub run $executable:$executable".\n'
-            'Run "pub run ${p.join("bin", executable)}" explicitly to run the '
-                'local executable.');
-      } else {
-        package = executable;
-      }
-    }
-
-    var mode;
-    if (argResults['mode'] != null) {
-      mode = new BarbackMode(argResults['mode']);
-    } else if (package == entrypoint.root.name) {
-      mode = BarbackMode.DEBUG;
-    } else {
-      mode = BarbackMode.RELEASE;
-    }
-
-    var exitCode = await runExecutable(entrypoint, package, executable, args,
-        mode: mode);
-    await flushThenExit(exitCode);
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/serve.dart b/sdk/lib/_internal/pub/lib/src/command/serve.dart
deleted file mode 100644
index e43a9fc..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/serve.dart
+++ /dev/null
@@ -1,185 +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 pub.command.serve;
-
-import 'dart:async';
-import 'dart:math' as math;
-
-import 'package:barback/barback.dart';
-
-import '../barback/asset_environment.dart';
-import '../log.dart' as log;
-import '../utils.dart';
-import 'barback.dart';
-
-final _arrow = getSpecial('\u2192', '=>');
-
-/// Handles the `serve` pub command.
-class ServeCommand extends BarbackCommand {
-  String get name => "serve";
-  String get description =>
-      'Run a local web development server.\n\n'
-      'By default, this serves "web/" and "test/", but an explicit list of \n'
-      'directories to serve can be provided as well.';
-  String get invocation => "pub serve [directories...]";
-  String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-serve.html";
-
-  String get hostname => argResults['hostname'];
-
-  /// The base port for the servers.
-  ///
-  /// This will print a usage error and exit if the specified port is invalid.
-  int get port => parseInt(argResults['port'], 'port');
-
-  /// The port for the admin UI.
-  ///
-  /// This will print a usage error and exit if the specified port is invalid.
-  int get adminPort {
-    var adminPort = argResults['admin-port'];
-    return adminPort == null ? null : parseInt(adminPort, 'admin port');
-  }
-
-  /// `true` if Dart entrypoints should be compiled to JavaScript.
-  bool get useDart2JS => argResults['dart2js'];
-
-  /// `true` if the admin server URL should be displayed on startup.
-  bool get logAdminUrl => argResults['log-admin-url'];
-
-  BarbackMode get defaultMode => BarbackMode.DEBUG;
-
-  List<String> get defaultSourceDirectories => ["web", "test"];
-
-  /// This completer is used to keep pub running (by not completing) and to
-  /// pipe fatal errors to pub's top-level error-handling machinery.
-  final _completer = new Completer();
-
-  ServeCommand() {
-    argParser.addOption("define", abbr: "D",
-        help: "Defines an environment constant for dart2js.",
-        allowMultiple: true, splitCommas: false);
-    argParser.addOption('hostname', defaultsTo: 'localhost',
-        help: 'The hostname to listen on.');
-    argParser.addOption('port', defaultsTo: '8080',
-        help: 'The base port to listen on.');
-
-    // TODO(rnystrom): A hidden option to print the URL that the admin server
-    // is bound to on startup. Since this is currently only used for the Web
-    // Socket interface, we don't want to show it to users, but the tests and
-    // Editor need this logged to know what port to bind to.
-    // Remove this (and always log) when #16954 is fixed.
-    argParser.addFlag('log-admin-url', defaultsTo: false, hide: true);
-
-    // TODO(nweiz): Make this public when issue 16954 is fixed.
-    argParser.addOption('admin-port', hide: true);
-
-    argParser.addFlag('dart2js', defaultsTo: true,
-        help: 'Compile Dart to JavaScript.');
-    argParser.addFlag('force-poll', defaultsTo: false,
-        help: 'Force the use of a polling filesystem watcher.');
-  }
-
-  Future onRunTransformerCommand() async {
-    var port = parseInt(argResults['port'], 'port');
-    var adminPort = argResults['admin-port'] == null ? null :
-        parseInt(argResults['admin-port'], 'admin port');
-
-    var watcherType = argResults['force-poll'] ?
-        WatcherType.POLLING : WatcherType.AUTO;
-
-    var environmentConstants = new Map.fromIterable(argResults["define"],
-        key: (pair) => pair.split("=").first,
-        value: (pair) => pair.split("=").last);
-
-    var environment = await AssetEnvironment.create(entrypoint, mode,
-        watcherType: watcherType, hostname: hostname, basePort: port,
-        useDart2JS: useDart2JS, environmentConstants: environmentConstants);
-    var directoryLength = sourceDirectories.map((dir) => dir.length)
-        .reduce(math.max);
-
-    if (adminPort != null) {
-      var server = await environment.startAdminServer(adminPort);
-      server.results.listen((_) {
-        // The admin server produces no result values.
-        assert(false);
-      }, onError: _fatalError);
-
-      if (logAdminUrl) {
-        log.message("Running admin server on "
-                    "${log.bold('http://$hostname:${server.port}')}");
-      }
-    }
-
-    // Start up the servers. We pause updates while this is happening so
-    // that we don't log spurious build results in the middle of listing
-    // out the bound servers.
-    environment.pauseUpdates();
-    for (var directory in sourceDirectories) {
-      await _startServer(environment, directory, directoryLength);
-    }
-
-    // Now that the servers are up and logged, send them to barback.
-    environment.barback.errors.listen((error) {
-      log.error(log.red("Build error:\n$error"));
-    });
-
-    environment.barback.results.listen((result) {
-      if (result.succeeded) {
-        // TODO(rnystrom): Report using growl/inotify-send where available.
-        log.message("Build completed ${log.green('successfully')}");
-      } else {
-        log.message("Build completed with "
-            "${log.red(result.errors.length)} errors.");
-      }
-    }, onError: _fatalError);
-
-    environment.resumeUpdates();
-    await _completer.future;
-  }
-
-  Future _startServer(AssetEnvironment environment, String rootDirectory,
-      int directoryLength) async {
-    var server = await environment.serveDirectory(rootDirectory);
-    // In release mode, strip out .dart files since all relevant ones have
-    // been compiled to JavaScript already.
-    if (mode == BarbackMode.RELEASE) {
-      server.allowAsset = (url) => !url.path.endsWith(".dart");
-    }
-
-    // Add two characters to account for "[" and "]".
-    var prefix = log.gray(
-        padRight("[${server.rootDirectory}]", directoryLength + 2));
-
-    server.results.listen((result) {
-      var buffer = new StringBuffer();
-      buffer.write("$prefix ");
-
-      if (result.isSuccess) {
-        buffer.write(
-            "${log.green('GET')} ${result.url.path} $_arrow ${result.id}");
-      } else {
-        buffer.write("${log.red('GET')} ${result.url.path} $_arrow");
-
-        var error = result.error.toString();
-        if (error.contains("\n")) {
-          buffer.write("\n${prefixLines(error)}");
-        } else {
-          buffer.write(" $error");
-        }
-      }
-
-      log.message(buffer);
-    }, onError: _fatalError);
-
-    log.message("Serving ${entrypoint.root.name} "
-        "${padRight(server.rootDirectory, directoryLength)} "
-        "on ${log.bold('http://$hostname:${server.port}')}");
-  }
-
-  /// Reports [error] and exits the server.
-  void _fatalError(error, [stackTrace]) {
-    if (_completer.isCompleted) return;
-    _completer.completeError(error, stackTrace);
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/upgrade.dart b/sdk/lib/_internal/pub/lib/src/command/upgrade.dart
deleted file mode 100644
index bd2389d..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/upgrade.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.upgrade;
-
-import 'dart:async';
-
-import '../command.dart';
-import '../log.dart' as log;
-import '../solver/version_solver.dart';
-
-/// Handles the `upgrade` pub command.
-class UpgradeCommand extends PubCommand {
-  String get name => "upgrade";
-  String get description =>
-      "Upgrade the current package's dependencies to latest versions.";
-  String get invocation => "pub upgrade [dependencies...]";
-  String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-upgrade.html";
-  List<String> get aliases => const ["update"];
-
-  bool get isOffline => argResults['offline'];
-
-  UpgradeCommand() {
-    argParser.addFlag('offline',
-        help: 'Use cached packages instead of accessing the network.');
-
-    argParser.addFlag('dry-run', abbr: 'n', negatable: false,
-        help: "Report what dependencies would change but don't change any.");
-  }
-
-  Future run() async {
-    var dryRun = argResults['dry-run'];
-    await entrypoint.acquireDependencies(SolveType.UPGRADE,
-        useLatest: argResults.rest, dryRun: dryRun);
-    if (isOffline) {
-      log.warning("Warning: Upgrading when offline may not update you to the "
-                  "latest versions of your dependencies.");
-    }
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/uploader.dart b/sdk/lib/_internal/pub/lib/src/command/uploader.dart
deleted file mode 100644
index b66d7cc..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/uploader.dart
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.uploader;
-
-import 'dart:async';
-
-import 'package:path/path.dart' as path;
-
-import '../command.dart';
-import '../entrypoint.dart';
-import '../exit_codes.dart' as exit_codes;
-import '../http.dart';
-import '../io.dart';
-import '../log.dart' as log;
-import '../oauth2.dart' as oauth2;
-import '../source/hosted.dart';
-
-/// Handles the `uploader` pub command.
-class UploaderCommand extends PubCommand {
-  String get name => "uploader";
-  String get description =>
-      "Manage uploaders for a package on pub.dartlang.org.";
-  String get invocation => "pub uploader [options] {add/remove} <email>";
-  String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-uploader.html";
-
-  /// The URL of the package hosting server.
-  Uri get server => Uri.parse(argResults['server']);
-
-  UploaderCommand() {
-    argParser.addOption('server', defaultsTo: HostedSource.defaultUrl,
-        help: 'The package server on which the package is hosted.');
-    argParser.addOption('package',
-        help: 'The package whose uploaders will be modified.\n'
-              '(defaults to the current package)');
-  }
-
-  Future run() {
-    if (argResults.rest.isEmpty) {
-      log.error('No uploader command given.');
-      this.printUsage();
-      return flushThenExit(exit_codes.USAGE);
-    }
-
-    var rest = argResults.rest.toList();
-
-    // TODO(rnystrom): Use subcommands for these.
-    var command = rest.removeAt(0);
-    if (!['add', 'remove'].contains(command)) {
-      log.error('Unknown uploader command "$command".');
-      this.printUsage();
-      return flushThenExit(exit_codes.USAGE);
-    } else if (rest.isEmpty) {
-      log.error('No uploader given for "pub uploader $command".');
-      this.printUsage();
-      return flushThenExit(exit_codes.USAGE);
-    }
-
-    return new Future.sync(() {
-      var package = argResults['package'];
-      if (package != null) return package;
-      return new Entrypoint(path.current, cache).root.name;
-    }).then((package) {
-      var uploader = rest[0];
-      return oauth2.withClient(cache, (client) {
-        if (command == 'add') {
-          var url = server.resolve("/api/packages/"
-              "${Uri.encodeComponent(package)}/uploaders");
-          return client.post(url,
-              headers: PUB_API_HEADERS,
-              body: {"email": uploader});
-        } else { // command == 'remove'
-          var url = server.resolve("/api/packages/"
-              "${Uri.encodeComponent(package)}/uploaders/"
-              "${Uri.encodeComponent(uploader)}");
-          return client.delete(url, headers: PUB_API_HEADERS);
-        }
-      });
-    }).then(handleJsonSuccess)
-      .catchError((error) => handleJsonError(error.response),
-                  test: (e) => e is PubHttpException);
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command/version.dart b/sdk/lib/_internal/pub/lib/src/command/version.dart
deleted file mode 100644
index de40572..0000000
--- a/sdk/lib/_internal/pub/lib/src/command/version.dart
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command.version;
-
-import '../command.dart';
-import '../log.dart' as log;
-import '../sdk.dart' as sdk;
-
-/// Handles the `version` pub command.
-class VersionCommand extends PubCommand {
-  String get name => "version";
-  String get description => "Print pub version.";
-  String get invocation => "pub version";
-
-  void run() {
-    log.message("Pub ${sdk.version}");
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/command_runner.dart b/sdk/lib/_internal/pub/lib/src/command_runner.dart
deleted file mode 100644
index ce0645d..0000000
--- a/sdk/lib/_internal/pub/lib/src/command_runner.dart
+++ /dev/null
@@ -1,183 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.command_runner;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:args/args.dart';
-import 'package:args/command_runner.dart';
-import 'package:http/http.dart' as http;
-
-import 'command/build.dart';
-import 'command/cache.dart';
-import 'command/deps.dart';
-import 'command/downgrade.dart';
-import 'command/get.dart';
-import 'command/global.dart';
-import 'command/lish.dart';
-import 'command/list_package_dirs.dart';
-import 'command/run.dart';
-import 'command/serve.dart';
-import 'command/upgrade.dart';
-import 'command/uploader.dart';
-import 'command/version.dart';
-import 'exceptions.dart';
-import 'exit_codes.dart' as exit_codes;
-import 'http.dart';
-import 'io.dart';
-import 'log.dart' as log;
-import 'sdk.dart' as sdk;
-import 'solver/version_solver.dart';
-import 'utils.dart';
-
-class PubCommandRunner extends CommandRunner {
-  String get usageFooter => "See http://dartlang.org/tools/pub for detailed "
-      "documentation.";
-
-  PubCommandRunner()
-      : super("pub", "Pub is a package manager for Dart.") {
-    argParser.addFlag('version', negatable: false,
-        help: 'Print pub version.');
-    argParser.addFlag('trace',
-         help: 'Print debugging information when an error occurs.');
-    argParser.addOption('verbosity',
-        help: 'Control output verbosity.',
-        allowed: ['normal', 'io', 'solver', 'all'],
-        allowedHelp: {
-          'normal': 'Show errors, warnings, and user messages.',
-          'io':     'Also show IO operations.',
-          'solver': 'Show steps during version resolution.',
-          'all':    'Show all output including internal tracing messages.'
-        });
-    argParser.addFlag('verbose', abbr: 'v', negatable: false,
-        help: 'Shortcut for "--verbosity=all".');
-    argParser.addFlag('with-prejudice', hide: !isAprilFools,
-        negatable: false, help: 'Execute commands with prejudice.');
-    argParser.addFlag('package-symlinks', hide: true, negatable: true,
-        defaultsTo: true);
-
-    addCommand(new BuildCommand());
-    addCommand(new CacheCommand());
-    addCommand(new DepsCommand());
-    addCommand(new DowngradeCommand());
-    addCommand(new GlobalCommand());
-    addCommand(new GetCommand());
-    addCommand(new ListPackageDirsCommand());
-    addCommand(new LishCommand());
-    addCommand(new RunCommand());
-    addCommand(new ServeCommand());
-    addCommand(new UpgradeCommand());
-    addCommand(new UploaderCommand());
-    addCommand(new VersionCommand());
-  }
-
-  Future run(List<String> arguments) async {
-    var options;
-    try {
-      options = super.parse(arguments);
-    } on UsageException catch (error) {
-      log.error(error.message);
-      await flushThenExit(exit_codes.USAGE);
-    }
-    await runCommand(options);
-  }
-
-  Future runCommand(ArgResults options) async {
-    log.withPrejudice = options['with-prejudice'];
-
-    if (options['version']) {
-      log.message('Pub ${sdk.version}');
-      return;
-    }
-
-    if (options['trace']) {
-      log.recordTranscript();
-    }
-
-    switch (options['verbosity']) {
-      case 'normal': log.verbosity = log.Verbosity.NORMAL; break;
-      case 'io':     log.verbosity = log.Verbosity.IO; break;
-      case 'solver': log.verbosity = log.Verbosity.SOLVER; break;
-      case 'all':    log.verbosity = log.Verbosity.ALL; break;
-      default:
-        // No specific verbosity given, so check for the shortcut.
-        if (options['verbose']) log.verbosity = log.Verbosity.ALL;
-        break;
-    }
-
-    log.fine('Pub ${sdk.version}');
-
-    await _validatePlatform();
-
-    var captureStackChains =
-        options['trace'] ||
-        options['verbose'] ||
-        options['verbosity'] == 'all';
-
-    try {
-      await captureErrors(() => super.runCommand(options),
-          captureStackChains: captureStackChains);
-
-      // Explicitly exit on success to ensure that any dangling dart:io handles
-      // don't cause the process to never terminate.
-      await flushThenExit(exit_codes.SUCCESS);
-    } catch (error, chain) {
-      log.exception(error, chain);
-
-      if (options['trace']) {
-        log.dumpTranscript();
-      } else if (!isUserFacingException(error)) {
-        // TODO(23505): Implement proper shell escaping, not a partial hack.
-        protectArgument(String x) => x.contains(' ') ? '"$x"' : x;
-        log.error("""
-This is an unexpected error. Please run
-
-    pub --trace ${options.arguments.map(protectArgument).join(' ')}
-
-and include the results in a bug report on http://dartbug.com/new.
-""");
-      }
-
-      await flushThenExit(_chooseExitCode(error));
-    }
-  }
-
-  void printUsage() {
-    log.message(usage);
-  }
-
-  /// Returns the appropriate exit code for [exception], falling back on 1 if no
-  /// appropriate exit code could be found.
-  int _chooseExitCode(exception) {
-    while (exception is WrappedException) exception = exception.innerError;
-
-    if (exception is HttpException || exception is http.ClientException ||
-        exception is SocketException || exception is PubHttpException ||
-        exception is DependencyNotFoundException) {
-      return exit_codes.UNAVAILABLE;
-    } else if (exception is FormatException || exception is DataException) {
-      return exit_codes.DATA;
-    } else if (exception is UsageException) {
-      return exit_codes.USAGE;
-    } else {
-      return 1;
-    }
-  }
-
-  /// Checks that pub is running on a supported platform.
-  ///
-  /// If it isn't, it prints an error message and exits. Completes when the
-  /// validation is done.
-  Future _validatePlatform() async {
-    if (Platform.operatingSystem != 'windows') return;
-
-    var result = await runProcess('ver', []);
-    if (result.stdout.join('\n').contains('XP')) {
-      log.error('Sorry, but pub is not supported on Windows XP.');
-      await flushThenExit(exit_codes.USAGE);
-    }
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/dart.dart b/sdk/lib/_internal/pub/lib/src/dart.dart
deleted file mode 100644
index f5210f1..0000000
--- a/sdk/lib/_internal/pub/lib/src/dart.dart
+++ /dev/null
@@ -1,225 +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.
-
-/// A library for compiling Dart code and manipulating analyzer parse trees.
-library pub.dart;
-
-import 'dart:async';
-import 'dart:io';
-import 'dart:isolate';
-
-import 'package:analyzer/analyzer.dart';
-import 'package:path/path.dart' as path;
-
-import 'package:compiler/compiler.dart' as compiler;
-import 'package:compiler/src/filenames.dart'
-    show appendSlash;
-
-import '../../asset/dart/serialize.dart';
-import 'io.dart';
-import 'log.dart' as log;
-
-/// Interface to communicate with dart2js.
-///
-/// This is basically an amalgamation of dart2js's
-/// [compiler.CompilerInputProvider], [compiler.CompilerOutputProvider], and
-/// [compiler.DiagnosticHandler] function types so that we can provide them
-/// as a single unit.
-abstract class CompilerProvider {
-  /// The URI to the root directory where "dart:" libraries can be found.
-  ///
-  /// This is used as the base URL to generate library URLs that are then sent
-  /// back to [provideInput].
-  Uri get libraryRoot;
-
-  /// Given [uri], responds with a future that completes to the contents of
-  /// the input file at that URI.
-  ///
-  /// The future can complete to a string or a list of bytes.
-  Future/*<String | List<int>>*/ provideInput(Uri uri);
-
-  /// Reports a diagnostic message from dart2js to the user.
-  void handleDiagnostic(Uri uri, int begin, int end, String message,
-                        compiler.Diagnostic kind);
-
-  /// Given a [name] (which will be "" for the entrypoint) and a file extension,
-  /// returns an [EventSink] that dart2js can write to to emit an output file.
-  EventSink<String> provideOutput(String name, String extension);
-}
-
-/// Compiles [entrypoint] to JavaScript (or to Dart if [toDart] is true) as
-/// well as any ancillary outputs dart2js creates.
-///
-/// Uses [provider] to communcate between dart2js and the caller. Returns a
-/// future that completes when compilation is done.
-///
-/// By default, the package root is assumed to be adjacent to [entrypoint], but
-/// if [packageRoot] is passed that will be used instead.
-Future compile(String entrypoint, CompilerProvider provider, {
-    Iterable<String> commandLineOptions,
-    bool checked: false,
-    bool csp: false,
-    bool minify: true,
-    bool verbose: false,
-    Map<String, String> environment,
-    String packageRoot,
-    bool analyzeAll: false,
-    bool preserveUris: false,
-    bool suppressWarnings: false,
-    bool suppressHints: false,
-    bool suppressPackageWarnings: true,
-    bool terse: false,
-    bool includeSourceMapUrls: false,
-    bool toDart: false}) {
-  return new Future.sync(() {
-    var options = <String>['--categories=Client,Server'];
-    if (checked) options.add('--enable-checked-mode');
-    if (csp) options.add('--csp');
-    if (minify) options.add('--minify');
-    if (verbose) options.add('--verbose');
-    if (analyzeAll) options.add('--analyze-all');
-    if (preserveUris) options.add('--preserve-uris');
-    if (suppressWarnings) options.add('--suppress-warnings');
-    if (suppressHints) options.add('--suppress-hints');
-    if (!suppressPackageWarnings) options.add('--show-package-warnings');
-    if (terse) options.add('--terse');
-    if (toDart) options.add('--output-type=dart');
-
-    var sourceUrl = path.toUri(entrypoint);
-    options.add("--out=$sourceUrl.js");
-
-    // Add the source map URLs.
-    if (includeSourceMapUrls) {
-      options.add("--source-map=$sourceUrl.js.map");
-    }
-
-    if (environment == null) environment = {};
-    if (commandLineOptions != null) options.addAll(commandLineOptions);
-
-    if (packageRoot == null) {
-      packageRoot = path.join(path.dirname(entrypoint), 'packages');
-    }
-
-    return compiler.compile(
-        path.toUri(entrypoint),
-        provider.libraryRoot,
-        path.toUri(appendSlash(packageRoot)),
-        provider.provideInput,
-        provider.handleDiagnostic,
-        options,
-        provider.provideOutput,
-        environment);
-  });
-}
-
-/// Returns whether [dart] looks like an entrypoint file.
-bool isEntrypoint(CompilationUnit dart) {
-  // Allow two or fewer arguments so that entrypoints intended for use with
-  // [spawnUri] get counted.
-  //
-  // TODO(nweiz): this misses the case where a Dart file doesn't contain main(),
-  // but it parts in another file that does.
-  return dart.declarations.any((node) {
-    return node is FunctionDeclaration && node.name.name == "main" &&
-        node.functionExpression.parameters.parameters.length <= 2;
-  });
-}
-
-/// Efficiently parses the import and export directives in [contents].
-///
-/// If [name] is passed, it's used as the filename for error reporting.
-List<UriBasedDirective> parseImportsAndExports(String contents, {String name}) {
-  var collector = new _DirectiveCollector();
-  parseDirectives(contents, name: name).accept(collector);
-  return collector.directives;
-}
-
-/// A simple visitor that collects import and export nodes.
-class _DirectiveCollector extends GeneralizingAstVisitor {
-  final directives = <UriBasedDirective>[];
-
-  visitUriBasedDirective(UriBasedDirective node) => directives.add(node);
-}
-
-/// Runs [code] in an isolate.
-///
-/// [code] should be the contents of a Dart entrypoint. It may contain imports;
-/// they will be resolved in the same context as the host isolate. [message] is
-/// passed to the [main] method of the code being run; the caller is responsible
-/// for using this to establish communication with the isolate.
-///
-/// [packageRoot] controls the package root of the isolate. It may be either a
-/// [String] or a [Uri].
-///
-/// If [snapshot] is passed, the isolate will be loaded from that path if it
-/// exists. Otherwise, a snapshot of the isolate's code will be saved to that
-/// path once the isolate is loaded.
-Future runInIsolate(String code, message, {packageRoot, String snapshot})
-    async {
-  if (snapshot != null && fileExists(snapshot)) {
-    log.fine("Spawning isolate from $snapshot.");
-    if (packageRoot != null) packageRoot = packageRoot.toString();
-    try {
-      await Isolate.spawnUri(path.toUri(snapshot), [], message,
-          packageRoot: packageRoot);
-      return;
-    } on IsolateSpawnException catch (error) {
-      log.fine("Couldn't load existing snapshot $snapshot:\n$error");
-      // Do nothing, we will regenerate the snapshot below.
-    }
-  }
-
-  await withTempDir((dir) async {
-    var dartPath = path.join(dir, 'runInIsolate.dart');
-    writeTextFile(dartPath, code, dontLogContents: true);
-    var port = new ReceivePort();
-    await Isolate.spawn(_isolateBuffer, {
-      'replyTo': port.sendPort,
-      'uri': path.toUri(dartPath).toString(),
-      'packageRoot': packageRoot == null ? null : packageRoot.toString(),
-      'message': message
-    });
-
-    var response = await port.first;
-    if (response['type'] == 'error') {
-      throw new CrossIsolateException.deserialize(response['error']);
-    }
-
-    if (snapshot == null) return;
-
-    ensureDir(path.dirname(snapshot));
-    var snapshotArgs = [];
-    if (packageRoot != null) snapshotArgs.add('--package-root=$packageRoot');
-    snapshotArgs.addAll(['--snapshot=$snapshot', dartPath]);
-    var result = await runProcess(Platform.executable, snapshotArgs);
-
-    if (result.success) return;
-
-    // Don't emit a fatal error here, since we don't want to crash the
-    // otherwise successful isolate load.
-    log.warning("Failed to compile a snapshot to "
-        "${path.relative(snapshot)}:\n" + result.stderr.join("\n"));
-  });
-}
-
-// TODO(nweiz): remove this when issue 12617 is fixed.
-/// A function used as a buffer between the host isolate and [spawnUri].
-///
-/// [spawnUri] synchronously loads the file and its imports, which can deadlock
-/// the host isolate if there's an HTTP import pointing at a server in the host.
-/// Adding an additional isolate in the middle works around this.
-void _isolateBuffer(message) {
-  var replyTo = message['replyTo'];
-  var packageRoot = message['packageRoot'];
-  if (packageRoot != null) packageRoot = Uri.parse(packageRoot);
-  Isolate.spawnUri(Uri.parse(message['uri']), [], message['message'],
-          packageRoot: packageRoot)
-      .then((_) => replyTo.send({'type': 'success'}))
-      .catchError((e, stack) {
-    replyTo.send({
-      'type': 'error',
-      'error': CrossIsolateException.serialize(e, stack)
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/lib/src/entrypoint.dart b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
deleted file mode 100644
index e97f688..0000000
--- a/sdk/lib/_internal/pub/lib/src/entrypoint.dart
+++ /dev/null
@@ -1,564 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.entrypoint;
-
-import 'dart:async';
-
-import 'package:path/path.dart' as path;
-import 'package:barback/barback.dart';
-
-import 'barback/asset_environment.dart';
-import 'io.dart';
-import 'lock_file.dart';
-import 'log.dart' as log;
-import 'package.dart';
-import 'package_graph.dart';
-import 'sdk.dart' as sdk;
-import 'solver/version_solver.dart';
-import 'source/cached.dart';
-import 'system_cache.dart';
-import 'utils.dart';
-
-/// The context surrounding the root package pub is operating on.
-///
-/// Pub operates over a directed graph of dependencies that starts at a root
-/// "entrypoint" package. This is typically the package where the current
-/// working directory is located. An entrypoint knows the [root] package it is
-/// associated with and is responsible for managing the "packages" directory
-/// for it.
-///
-/// That directory contains symlinks to all packages used by an app. These links
-/// point either to the [SystemCache] or to some other location on the local
-/// filesystem.
-///
-/// While entrypoints are typically applications, a pure library package may end
-/// up being used as an entrypoint. Also, a single package may be used as an
-/// entrypoint in one context but not in another. For example, a package that
-/// contains a reusable library may not be the entrypoint when used by an app,
-/// but may be the entrypoint when you're running its tests.
-class Entrypoint {
-  /// The root package this entrypoint is associated with.
-  final Package root;
-
-  /// The system-wide cache which caches packages that need to be fetched over
-  /// the network.
-  final SystemCache cache;
-
-  /// Whether to create and symlink a "packages" directory containing links to
-  /// the installed packages.
-  final bool _packageSymlinks;
-
-  /// The lockfile for the entrypoint.
-  ///
-  /// If not provided to the entrypoint, it will be laoded lazily from disc.
-  LockFile _lockFile;
-
-  /// The graph of all packages reachable from the entrypoint.
-  PackageGraph _packageGraph;
-
-  /// Loads the entrypoint from a package at [rootDir].
-  ///
-  /// If [packageSymlinks] is `true`, this will create a "packages" directory
-  /// with symlinks to the installed packages. This directory will be symlinked
-  /// into any directory that might contain an entrypoint.
-  Entrypoint(String rootDir, SystemCache cache, {bool packageSymlinks: true})
-      : root = new Package.load(null, rootDir, cache.sources),
-        cache = cache,
-        _packageSymlinks = packageSymlinks;
-
-  /// Creates an entrypoint given package and lockfile objects.
-  Entrypoint.inMemory(this.root, this._lockFile, this.cache)
-      : _packageSymlinks = false;
-
-  /// The path to the entrypoint's "packages" directory.
-  String get packagesDir => root.path('packages');
-
-  /// `true` if the entrypoint package currently has a lock file.
-  bool get lockFileExists => _lockFile != null || entryExists(lockFilePath);
-
-  LockFile get lockFile {
-    if (_lockFile != null) return _lockFile;
-
-    if (!lockFileExists) {
-      _lockFile = new LockFile.empty();
-    } else {
-      _lockFile = new LockFile.load(lockFilePath, cache.sources);
-    }
-
-    return _lockFile;
-  }
-
-  /// The path to the entrypoint package's pubspec.
-  String get pubspecPath => root.path('pubspec.yaml');
-
-  /// The path to the entrypoint package's lockfile.
-  String get lockFilePath => root.path('pubspec.lock');
-
-  /// Gets all dependencies of the [root] package.
-  ///
-  /// Performs version resolution according to [SolveType].
-  ///
-  /// [useLatest], if provided, defines a list of packages that will be
-  /// unlocked and forced to their latest versions. If [upgradeAll] is
-  /// true, the previous lockfile is ignored and all packages are re-resolved
-  /// from scratch. Otherwise, it will attempt to preserve the versions of all
-  /// previously locked packages.
-  ///
-  /// Shows a report of the changes made relative to the previous lockfile. If
-  /// this is an upgrade or downgrade, all transitive dependencies are shown in
-  /// the report. Otherwise, only dependencies that were changed are shown. If
-  /// [dryRun] is `true`, no physical changes are made.
-  Future acquireDependencies(SolveType type, {List<String> useLatest,
-      bool dryRun: false}) async {
-    var result = await resolveVersions(type, cache.sources, root,
-        lockFile: lockFile, useLatest: useLatest);
-    if (!result.succeeded) throw result.error;
-
-    result.showReport(type);
-
-    if (dryRun) {
-      result.summarizeChanges(type, dryRun: dryRun);
-      return;
-    }
-
-    // Install the packages and maybe link them into the entrypoint.
-    if (_packageSymlinks) {
-      cleanDir(packagesDir);
-    } else {
-      deleteEntry(packagesDir);
-    }
-
-    var ids = await Future.wait(result.packages.map(_get));
-    _saveLockFile(ids);
-
-    if (_packageSymlinks) _linkSelf();
-    _linkOrDeleteSecondaryPackageDirs();
-
-    result.summarizeChanges(type, dryRun: dryRun);
-
-    /// Build a package graph from the version solver results so we don't
-    /// have to reload and reparse all the pubspecs.
-    var packageGraph = await loadPackageGraph(result);
-    packageGraph.loadTransformerCache().clearIfOutdated(result.changedPackages);
-
-    try {
-      await precompileDependencies(changed: result.changedPackages);
-      await precompileExecutables(changed: result.changedPackages);
-    } catch (error, stackTrace) {
-      // Just log exceptions here. Since the method is just about acquiring
-      // dependencies, it shouldn't fail unless that fails.
-      log.exception(error, stackTrace);
-    }
-  }
-
-  /// Precompile any transformed dependencies of the entrypoint.
-  ///
-  /// If [changed] is passed, only dependencies whose contents might be changed
-  /// if one of the given packages changes will be recompiled.
-  Future precompileDependencies({Iterable<String> changed}) async {
-    if (changed != null) changed = changed.toSet();
-
-    var graph = await loadPackageGraph();
-
-    // Just precompile the debug version of a package. We're mostly interested
-    // in improving speed for development iteration loops, which usually use
-    // debug mode.
-    var depsDir = path.join('.pub', 'deps', 'debug');
-
-    var dependenciesToPrecompile = graph.packages.values.where((package) {
-      if (package.pubspec.transformers.isEmpty) return false;
-      if (graph.isPackageMutable(package.name)) return false;
-      if (!dirExists(path.join(depsDir, package.name))) return true;
-      if (changed == null) return true;
-
-      /// Only recompile [package] if any of its transitive dependencies have
-      /// changed. We check all transitive dependencies because it's possible
-      /// that a transformer makes decisions based on their contents.
-      return overlaps(
-          graph.transitiveDependencies(package.name)
-            .map((package) => package.name).toSet(),
-          changed);
-    }).map((package) => package.name).toSet();
-
-    if (dirExists(depsDir)) {
-      // Delete any cached dependencies that are going to be recached.
-      for (var package in dependenciesToPrecompile) {
-        deleteEntry(path.join(depsDir, package));
-      }
-
-      // Also delete any cached dependencies that should no longer be cached.
-      for (var subdir in listDir(depsDir)) {
-        var package = graph.packages[path.basename(subdir)];
-        if (package == null || package.pubspec.transformers.isEmpty ||
-            graph.isPackageMutable(package.name)) {
-          deleteEntry(subdir);
-        }
-      }
-    }
-
-    if (dependenciesToPrecompile.isEmpty) return;
-
-    try {
-      await log.progress("Precompiling dependencies", () async {
-        var packagesToLoad =
-            unionAll(dependenciesToPrecompile.map(graph.transitiveDependencies))
-            .map((package) => package.name).toSet();
-
-        var environment = await AssetEnvironment.create(this, BarbackMode.DEBUG,
-            packages: packagesToLoad, useDart2JS: false);
-
-        /// Ignore barback errors since they'll be emitted via [getAllAssets]
-        /// below.
-        environment.barback.errors.listen((_) {});
-
-        // TODO(nweiz): only get assets from [dependenciesToPrecompile] so as
-        // not to trigger unnecessary lazy transformers.
-        var assets = await environment.barback.getAllAssets();
-        await waitAndPrintErrors(assets.map((asset) async {
-          if (!dependenciesToPrecompile.contains(asset.id.package)) return;
-
-          var destPath = path.join(
-              depsDir, asset.id.package, path.fromUri(asset.id.path));
-          ensureDir(path.dirname(destPath));
-          await createFileFromStream(asset.read(), destPath);
-        }));
-
-        log.message("Precompiled " +
-            toSentence(ordered(dependenciesToPrecompile).map(log.bold)) + ".");
-      });
-    } catch (_) {
-      // TODO(nweiz): When barback does a better job of associating errors with
-      // assets (issue 19491), catch and handle compilation errors on a
-      // per-package basis.
-      for (var package in dependenciesToPrecompile) {
-        deleteEntry(path.join(depsDir, package));
-      }
-      rethrow;
-    }
-  }
-
-  /// Precompiles all executables from dependencies that don't transitively
-  /// depend on [this] or on a path dependency.
-  Future precompileExecutables({Iterable<String> changed}) async {
-    if (changed != null) changed = changed.toSet();
-
-    var binDir = path.join('.pub', 'bin');
-    var sdkVersionPath = path.join(binDir, 'sdk-version');
-
-    // If the existing executable was compiled with a different SDK, we need to
-    // recompile regardless of what changed.
-    // TODO(nweiz): Use the VM to check this when issue 20802 is fixed.
-    var sdkMatches = fileExists(sdkVersionPath) &&
-        readTextFile(sdkVersionPath) == "${sdk.version}\n";
-    if (!sdkMatches) changed = null;
-
-    var graph = await loadPackageGraph();
-
-    // Clean out any outdated snapshots.
-    if (dirExists(binDir)) {
-      for (var entry in listDir(binDir)) {
-        if (!dirExists(entry)) continue;
-
-        var package = path.basename(entry);
-        if (!graph.packages.containsKey(package) ||
-            graph.isPackageMutable(package)) {
-          deleteEntry(entry);
-        }
-      }
-    }
-
-    var executables = new Map.fromIterable(root.immediateDependencies,
-        key: (dep) => dep.name,
-        value: (dep) => _executablesForPackage(graph, dep.name, changed));
-
-    for (var package in executables.keys.toList()) {
-      if (executables[package].isEmpty) executables.remove(package);
-    }
-
-    if (!sdkMatches) deleteEntry(binDir);
-    if (executables.isEmpty) return;
-
-    await log.progress("Precompiling executables", () async {
-      ensureDir(binDir);
-
-      // Make sure there's a trailing newline so our version file matches the
-      // SDK's.
-      writeTextFile(sdkVersionPath, "${sdk.version}\n");
-
-      var packagesToLoad =
-          unionAll(executables.keys.map(graph.transitiveDependencies))
-          .map((package) => package.name).toSet();
-      var executableIds = unionAll(
-          executables.values.map((ids) => ids.toSet()));
-      var environment = await AssetEnvironment.create(this, BarbackMode.RELEASE,
-          packages: packagesToLoad,
-          entrypoints: executableIds,
-          useDart2JS: false);
-      environment.barback.errors.listen((error) {
-        log.error(log.red("Build error:\n$error"));
-      });
-
-      await waitAndPrintErrors(executables.keys.map((package) async {
-        var dir = path.join(binDir, package);
-        cleanDir(dir);
-        await environment.precompileExecutables(package, dir,
-            executableIds: executables[package]);
-      }));
-    });
-  }
-
-  /// Returns the list of all executable assets for [packageName] that should be
-  /// precompiled.
-  ///
-  /// If [changed] isn't `null`, executables for [packageName] will only be
-  /// compiled if they might depend on a package in [changed].
-  List<AssetId> _executablesForPackage(PackageGraph graph, String packageName,
-      Set<String> changed) {
-    var package = graph.packages[packageName];
-    var binDir = package.path('bin');
-    if (!dirExists(binDir)) return [];
-    if (graph.isPackageMutable(packageName)) return [];
-
-    var executables = package.executableIds;
-
-    // If we don't know which packages were changed, always precompile the
-    // executables.
-    if (changed == null) return executables;
-
-    // If any of the package's dependencies changed, recompile the executables.
-    if (graph.transitiveDependencies(packageName)
-        .any((package) => changed.contains(package.name))) {
-      return executables;
-    }
-
-    // If any executables don't exist, precompile them regardless of what
-    // changed. Since we delete the bin directory before recompiling, we need to
-    // recompile all executables.
-    var executablesExist = executables.every((executable) =>
-        fileExists(path.join('.pub', 'bin', packageName,
-            "${path.url.basename(executable.path)}.snapshot")));
-    if (!executablesExist) return executables;
-
-    // Otherwise, we don't need to recompile.
-    return [];
-  }
-
-  /// Makes sure the package at [id] is locally available.
-  ///
-  /// This automatically downloads the package to the system-wide cache as well
-  /// if it requires network access to retrieve (specifically, if the package's
-  /// source is a [CachedSource]).
-  Future<PackageId> _get(PackageId id) {
-    if (id.isRoot) return new Future.value(id);
-
-    var source = cache.sources[id.source];
-    return new Future.sync(() {
-      if (!_packageSymlinks) {
-        if (source is! CachedSource) return null;
-        return source.downloadToSystemCache(id);
-      }
-
-      var packageDir = path.join(packagesDir, id.name);
-      if (entryExists(packageDir)) deleteEntry(packageDir);
-      return source.get(id, packageDir);
-    }).then((_) => source.resolveId(id));
-  }
-
-  /// Determines whether or not the lockfile is out of date with respect to the
-  /// pubspec.
-  ///
-  /// This will be `false` if there is no lockfile at all, or if the pubspec
-  /// contains dependencies that are not in the lockfile or that don't match
-  /// what's in there.
-  bool _isLockFileUpToDate(LockFile lockFile) {
-    /// If this is an entrypoint for an in-memory package, trust the in-memory
-    /// lockfile provided for it.
-    if (root.dir == null) return true;
-
-    return root.immediateDependencies.every((package) {
-      var locked = lockFile.packages[package.name];
-      if (locked == null) return false;
-
-      if (package.source != locked.source) return false;
-      if (!package.constraint.allows(locked.version)) return false;
-
-      var source = cache.sources[package.source];
-      if (source == null) return false;
-
-      return source.descriptionsEqual(package.description, locked.description);
-    });
-  }
-
-  /// Determines whether all of the packages in the lockfile are already
-  /// installed and available.
-  ///
-  /// Note: this assumes [isLockFileUpToDate] has already been called and
-  /// returned `true`.
-  Future<bool> _arePackagesAvailable(LockFile lockFile) {
-    return Future.wait(lockFile.packages.values.map((package) {
-      var source = cache.sources[package.source];
-
-      // This should only be called after [_isLockFileUpToDate] has returned
-      // `true`, which ensures all of the sources in the lock file are valid.
-      assert(source != null);
-
-      // We only care about cached sources. Uncached sources aren't "installed".
-      // If one of those is missing, we want to show the user the file not
-      // found error later since installing won't accomplish anything.
-      if (source is! CachedSource) return new Future.value(true);
-
-      // Get the directory.
-      return source.getDirectory(package).then((dir) {
-        // See if the directory is there and looks like a package.
-        return dirExists(dir) || fileExists(path.join(dir, "pubspec.yaml"));
-      });
-    })).then((results) {
-      // Make sure they are all true.
-      return results.every((result) => result);
-    });
-  }
-
-  /// Gets dependencies if the lockfile is out of date with respect to the
-  /// pubspec.
-  Future ensureLockFileIsUpToDate() {
-    return new Future.sync(() {
-      // If we don't have a current lock file, we definitely need to install.
-      if (!_isLockFileUpToDate(lockFile)) {
-        if (lockFileExists) {
-          log.message(
-              "Your pubspec has changed, so we need to update your lockfile:");
-        } else {
-          log.message(
-              "You don't have a lockfile, so we need to generate that:");
-        }
-
-        return false;
-      }
-
-      // If we do have a lock file, we still need to make sure the packages
-      // are actually installed. The user may have just gotten a package that
-      // includes a lockfile.
-      return _arePackagesAvailable(lockFile).then((available) {
-        if (!available) {
-          log.message(
-              "You are missing some dependencies, so we need to install them "
-              "first:");
-        }
-
-        return available;
-      });
-    }).then((upToDate) {
-      if (upToDate) return null;
-      return acquireDependencies(SolveType.GET);
-    });
-  }
-
-  /// Loads the package graph for the application and all of its transitive
-  /// dependencies.
-  ///
-  /// If [result] is passed, this loads the graph from it without re-parsing the
-  /// lockfile or any pubspecs. Otherwise, before loading, this makes sure the
-  /// lockfile and dependencies are installed and up to date.
-  Future<PackageGraph> loadPackageGraph([SolveResult result]) async {
-    if (_packageGraph != null) return _packageGraph;
-
-    var graph = await log.progress("Loading package graph", () async {
-      if (result != null) {
-        var packages = await Future.wait(result.packages.map((id) async {
-          var dir = await cache.sources[id.source].getDirectory(id);
-          return new Package(result.pubspecs[id.name], dir);
-        }));
-
-        return new PackageGraph(this, new LockFile(result.packages),
-            new Map.fromIterable(packages, key: (package) => package.name));
-      }
-
-      await ensureLockFileIsUpToDate();
-      var packages = await Future.wait(lockFile.packages.values.map((id) async {
-        var source = cache.sources[id.source];
-        var dir = await source.getDirectory(id);
-        return new Package.load(id.name, dir, cache.sources);
-      }));
-
-      var packageMap = new Map.fromIterable(packages, key: (p) => p.name);
-      packageMap[root.name] = root;
-      return new PackageGraph(this, lockFile, packageMap);
-    }, fine: true);
-
-    _packageGraph = graph;
-    return graph;
-  }
-
-  /// Saves a list of concrete package versions to the `pubspec.lock` file.
-  void _saveLockFile(List<PackageId> packageIds) {
-    _lockFile = new LockFile(packageIds);
-    var lockFilePath = root.path('pubspec.lock');
-    writeTextFile(lockFilePath, _lockFile.serialize(root.dir, cache.sources));
-  }
-
-  /// Creates a self-referential symlink in the `packages` directory that allows
-  /// a package to import its own files using `package:`.
-  void _linkSelf() {
-    var linkPath = path.join(packagesDir, root.name);
-    // Create the symlink if it doesn't exist.
-    if (entryExists(linkPath)) return;
-    ensureDir(packagesDir);
-    createPackageSymlink(root.name, root.dir, linkPath,
-        isSelfLink: true, relative: true);
-  }
-
-  /// If [packageSymlinks] is true, add "packages" directories to the whitelist
-  /// of directories that may contain Dart entrypoints.
-  ///
-  /// Otherwise, delete any "packages" directories in the whitelist of
-  /// directories that may contain Dart entrypoints.
-  void _linkOrDeleteSecondaryPackageDirs() {
-    // Only the main "bin" directory gets a "packages" directory, not its
-    // subdirectories.
-    var binDir = root.path('bin');
-    if (dirExists(binDir)) _linkOrDeleteSecondaryPackageDir(binDir);
-
-    // The others get "packages" directories in subdirectories too.
-    for (var dir in ['benchmark', 'example', 'test', 'tool', 'web']) {
-      _linkOrDeleteSecondaryPackageDirsRecursively(root.path(dir));
-    }
- }
-
-  /// If [packageSymlinks] is true, creates a symlink to the "packages"
-  /// directory in [dir] and all its subdirectories.
-  ///
-  /// Otherwise, deletes any "packages" directories in [dir] and all its
-  /// subdirectories.
-  void _linkOrDeleteSecondaryPackageDirsRecursively(String dir) {
-    if (!dirExists(dir)) return;
-    _linkOrDeleteSecondaryPackageDir(dir);
-    _listDirWithoutPackages(dir)
-        .where(dirExists)
-        .forEach(_linkOrDeleteSecondaryPackageDir);
-  }
-
-  // TODO(nweiz): roll this into [listDir] in io.dart once issue 4775 is fixed.
-  /// Recursively lists the contents of [dir], excluding hidden `.DS_Store`
-  /// files and `package` files.
-  List<String> _listDirWithoutPackages(dir) {
-    return flatten(listDir(dir).map((file) {
-      if (path.basename(file) == 'packages') return [];
-      if (!dirExists(file)) return [];
-      var fileAndSubfiles = [file];
-      fileAndSubfiles.addAll(_listDirWithoutPackages(file));
-      return fileAndSubfiles;
-    }));
-  }
-
-  /// If [packageSymlinks] is true, creates a symlink to the "packages"
-  /// directory in [dir].
-  ///
-  /// Otherwise, deletes a "packages" directories in [dir] if one exists.
-  void _linkOrDeleteSecondaryPackageDir(String dir) {
-    var symlink = path.join(dir, 'packages');
-    if (entryExists(symlink)) deleteEntry(symlink);
-    if (_packageSymlinks) createSymlink(packagesDir, symlink, relative: true);
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/error_group.dart b/sdk/lib/_internal/pub/lib/src/error_group.dart
deleted file mode 100644
index c479a24..0000000
--- a/sdk/lib/_internal/pub/lib/src/error_group.dart
+++ /dev/null
@@ -1,297 +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 pub.error_group;
-
-import 'dart:async';
-
-/// An [ErrorGroup] entangles the errors of multiple [Future]s and [Stream]s
-/// with one another.
-///
-/// This allows APIs to expose multiple [Future]s and [Stream]s that have
-/// identical error conditions without forcing API consumers to attach error
-/// handling to objects they don't care about.
-///
-/// To use an [ErrorGroup], register [Future]s and [Stream]s with it using
-/// [registerFuture] and [registerStream]. These methods return wrapped versions
-/// of the [Future]s and [Stream]s, which should then be used in place of the
-/// originals. For example:
-///
-///     var errorGroup = new ErrorGroup();
-///     future = errorGroup.registerFuture(future);
-///     stream = errorGroup.registerStream(stream);
-///
-/// An [ErrorGroup] has two major effects on its wrapped members:
-///
-/// * An error in any member of the group will be propagated to every member
-///   that hasn't already completed. If those members later complete, their
-///   values will be ignored.
-/// * If any member of this group has a listener, errors on members without
-///   listeners won't get passed to the top-level error handler.
-class ErrorGroup {
-  /// The [Future]s that are members of [this].
-  final _futures = <_ErrorGroupFuture>[];
-
-  /// The [Stream]s that are members of [this].
-  final _streams = <_ErrorGroupStream>[];
-
-  /// Whether [this] has completed, either successfully or with an error.
-  var _isDone = false;
-
-  /// The [Completer] for [done].
-  final _doneCompleter = new Completer();
-
-  /// The underlying [Future] for [done].
-  ///
-  /// We need to be able to access it internally as an [_ErrorGroupFuture] so
-  /// we can check if it has listeners and signal errors on it.
-  _ErrorGroupFuture _done;
-
-  /// Returns a [Future] that completes successully when all members of [this]
-  /// are complete, or with an error if any member receives an error.
-  ///
-  /// This [Future] is effectively in the group in that an error on it won't be
-  /// passed to the top-level error handler unless no members of the group have
-  /// listeners attached.
-  Future get done => _done;
-
-  /// Creates a new group with no members.
-  ErrorGroup() {
-    this._done = new _ErrorGroupFuture(this, _doneCompleter.future);
-  }
-
-  /// Registers a [Future] as a member of [this].
-  ///
-  /// Returns a wrapped version of [future] that should be used in its place.
-  ///
-  /// If all members of [this] have already completed successfully or with an
-  /// error, it's a [StateError] to try to register a new [Future].
-  Future registerFuture(Future future) {
-    if (_isDone) {
-      throw new StateError("Can't register new members on a complete "
-          "ErrorGroup.");
-    }
-
-    var wrapped = new _ErrorGroupFuture(this, future);
-    _futures.add(wrapped);
-    return wrapped;
-  }
-
-  /// Registers a [Stream] as a member of [this].
-  ///
-  /// Returns a wrapped version of [stream] that should be used in its place.
-  /// The returned [Stream] will be multi-subscription if and only if [stream]
-  /// is.
-  ///
-  /// Since all errors in a group are passed to all members, the returned
-  /// [Stream] will automatically unsubscribe all its listeners when it
-  /// encounters an error.
-  ///
-  /// If all members of [this] have already completed successfully or with an
-  /// error, it's a [StateError] to try to register a new [Stream].
-  Stream registerStream(Stream stream) {
-    if (_isDone) {
-      throw new StateError("Can't register new members on a complete "
-          "ErrorGroup.");
-    }
-
-    var wrapped = new _ErrorGroupStream(this, stream);
-    _streams.add(wrapped);
-    return wrapped;
-  }
-
-  /// Sends [error] to all members of [this].
-  ///
-  /// Like errors that come from members, this will only be passed to the
-  /// top-level error handler if no members have listeners.
-  ///
-  /// If all members of [this] have already completed successfully or with an
-  /// error, it's a [StateError] to try to signal an error.
-  void signalError(var error, [StackTrace stackTrace]) {
-    if (_isDone) {
-      throw new StateError("Can't signal errors on a complete ErrorGroup.");
-    }
-
-    _signalError(error, stackTrace);
-  }
-
-  /// Signal an error internally.
-  ///
-  /// This is just like [signalError], but instead of throwing an error if
-  /// [this] is complete, it just does nothing.
-  void _signalError(var error, [StackTrace stackTrace]) {
-    if (_isDone) return;
-
-    var caught = false;
-    for (var future in _futures) {
-      if (future._isDone || future._hasListeners) caught = true;
-      future._signalError(error, stackTrace);
-    }
-
-    for (var stream in _streams) {
-      if (stream._isDone || stream._hasListeners) caught = true;
-      stream._signalError(error, stackTrace);
-    }
-
-    _isDone = true;
-    _done._signalError(error, stackTrace);
-    if (!caught && !_done._hasListeners) scheduleMicrotask((){ throw error; });
-  }
-
-  /// Notifies [this] that one of its member [Future]s is complete.
-  void _signalFutureComplete(_ErrorGroupFuture future) {
-    if (_isDone) return;
-
-    _isDone = _futures.every((future) => future._isDone) &&
-        _streams.every((stream) => stream._isDone);
-    if (_isDone) _doneCompleter.complete();
-  }
-
-  /// Notifies [this] that one of its member [Stream]s is complete.
-  void _signalStreamComplete(_ErrorGroupStream stream) {
-    if (_isDone) return;
-
-    _isDone = _futures.every((future) => future._isDone) &&
-        _streams.every((stream) => stream._isDone);
-    if (_isDone) _doneCompleter.complete();
-  }
-}
-
-/// A [Future] wrapper that keeps track of whether it's been completed and
-/// whether it has any listeners.
-///
-/// It also notifies its parent [ErrorGroup] when it completes successfully or
-/// receives an error.
-class _ErrorGroupFuture implements Future {
-  /// The parent [ErrorGroup].
-  final ErrorGroup _group;
-
-  /// Whether [this] has completed, either successfully or with an error.
-  var _isDone = false;
-
-  /// The underlying [Completer] for [this].
-  final _completer = new Completer();
-
-  /// Whether [this] has any listeners.
-  bool _hasListeners = false;
-
-  /// Creates a new [_ErrorGroupFuture] that's a child of [_group] and wraps
-  /// [inner].
-  _ErrorGroupFuture(this._group, Future inner) {
-    inner.then((value) {
-      if (!_isDone) _completer.complete(value);
-      _isDone = true;
-      _group._signalFutureComplete(this);
-    }).catchError(_group._signalError);
-
-    // Make sure _completer.future doesn't automatically send errors to the
-    // top-level.
-    _completer.future.catchError((_) {});
-  }
-
-  Future then(onValue(value), {Function onError}) {
-    _hasListeners = true;
-    return _completer.future.then(onValue, onError: onError);
-  }
-
-  Future catchError(Function onError, {bool test(Object error)}) {
-    _hasListeners = true;
-    return _completer.future.catchError(onError, test: test);
-  }
-
-  Future whenComplete(void action()) {
-    _hasListeners = true;
-    return _completer.future.whenComplete(action);
-  }
-
-  Future timeout(Duration timeLimit, {void onTimeout()}) {
-    _hasListeners = true;
-    return _completer.future.timeout(timeLimit, onTimeout: onTimeout);
-  }
-
-  Stream asStream() {
-    _hasListeners = true;
-    return _completer.future.asStream();
-  }
-
-  /// Signal that an error from [_group] should be propagated through [this],
-  /// unless it's already complete.
-  void _signalError(var error, [StackTrace stackTrace]) {
-    if (!_isDone) _completer.completeError(error, stackTrace);
-    _isDone = true;
-  }
-}
-
-// TODO(nweiz): currently streams never top-level unhandled errors (issue 7843).
-// When this is fixed, this class will need to prevent such errors from being
-// top-leveled.
-/// A [Stream] wrapper that keeps track of whether it's been completed and
-/// whether it has any listeners.
-///
-/// It also notifies its parent [ErrorGroup] when it completes successfully or
-/// receives an error.
-class _ErrorGroupStream extends Stream {
-  /// The parent [ErrorGroup].
-  final ErrorGroup _group;
-
-  /// Whether [this] has completed, either successfully or with an error.
-  var _isDone = false;
-
-  /// The underlying [StreamController] for [this].
-  final StreamController _controller;
-
-  /// The controller's [Stream].
-  ///
-  /// May be different than `_controller.stream` if the wrapped stream is a
-  /// broadcasting stream.
-  Stream _stream;
-
-  /// The [StreamSubscription] that connects the wrapped [Stream] to
-  /// [_controller].
-  StreamSubscription _subscription;
-
-  /// Whether [this] has any listeners.
-  bool get _hasListeners => _controller.hasListener;
-
-  /// Creates a new [_ErrorGroupFuture] that's a child of [_group] and wraps
-  /// [inner].
-  _ErrorGroupStream(this._group, Stream inner)
-    : _controller = new StreamController(sync: true) {
-    // Use old-style asBroadcastStream behavior - cancel source _subscription
-    // the first time the stream has no listeners.
-    _stream = inner.isBroadcast
-        ? _controller.stream.asBroadcastStream(onCancel: (sub) => sub.cancel())
-        : _controller.stream;
-    _subscription = inner.listen((v) {
-      _controller.add(v);
-    }, onError: (e, [stackTrace]) {
-      _group._signalError(e, stackTrace);
-    }, onDone: () {
-      _isDone = true;
-      _group._signalStreamComplete(this);
-      _controller.close();
-    });
-  }
-
-  StreamSubscription listen(void onData(value),
-      {Function onError, void onDone(),
-       bool cancelOnError}) {
-    return _stream.listen(onData,
-        onError: onError,
-        onDone: onDone,
-        cancelOnError: true);
-  }
-
-  /// Signal that an error from [_group] should be propagated through [this],
-  /// unless it's already complete.
-  void _signalError(var e, [StackTrace stackTrace]) {
-    if (_isDone) return;
-    _subscription.cancel();
-    // Call these asynchronously to work around issue 7913.
-    new Future.value().then((_) {
-      _controller.addError(e, stackTrace);
-      _controller.close();
-    });
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/exceptions.dart b/sdk/lib/_internal/pub/lib/src/exceptions.dart
deleted file mode 100644
index 65dff3f..0000000
--- a/sdk/lib/_internal/pub/lib/src/exceptions.dart
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.exceptions;
-
-import 'dart:io';
-import 'dart:isolate';
-
-import "package:analyzer/analyzer.dart";
-import 'package:args/command_runner.dart';
-import "package:http/http.dart" as http;
-import "package:stack_trace/stack_trace.dart";
-import "package:yaml/yaml.dart";
-
-import '../../asset/dart/serialize.dart';
-
-/// An exception class for exceptions that are intended to be seen by the user.
-///
-/// These exceptions won't have any debugging information printed when they're
-/// thrown.
-class ApplicationException implements Exception {
-  final String message;
-
-  ApplicationException(this.message);
-
-  String toString() => message;
-}
-
-/// An exception class for exceptions that are intended to be seen by the user
-/// and are associated with a problem in a file at some path.
-class FileException implements ApplicationException {
-  final String message;
-
-  /// The path to the file that was missing or erroneous.
-  final String path;
-
-  FileException(this.message, this.path);
-
-  String toString() => message;
-}
-
-/// A class for exceptions that wrap other exceptions.
-class WrappedException extends ApplicationException {
-  /// The underlying exception that [this] is wrapping, if any.
-  final innerError;
-
-  /// The stack chain for [innerError] if it exists.
-  final Chain innerChain;
-
-  WrappedException(String message, this.innerError, [StackTrace innerTrace])
-      : innerChain = innerTrace == null ? null : new Chain.forTrace(innerTrace),
-        super(message);
-}
-
-/// A class for exceptions that shouldn't be printed at the top level.
-///
-/// This is usually used when an exception has already been printed using
-/// [log.exception].
-class SilentException extends WrappedException {
-  SilentException(innerError, [StackTrace innerTrace])
-      : super(innerError.toString(), innerError, innerTrace);
-}
-
-/// A class for errors in a command's input data.
-///
-/// This corresponds to the [exit_codes.DATA] exit code.
-class DataException extends ApplicationException {
-  DataException(String message)
-      : super(message);
-}
-
-/// An class for exceptions where a package could not be found in a [Source].
-///
-/// The source is responsible for wrapping its internal exceptions in this so
-/// that other code in pub can use this to show a more detailed explanation of
-/// why the package was being requested.
-class PackageNotFoundException extends WrappedException {
-  PackageNotFoundException(String message, [innerError, StackTrace innerTrace])
-      : super(message, innerError, innerTrace);
-}
-
-/// All the names of user-facing exceptions.
-final _userFacingExceptions = new Set<String>.from([
-  'ApplicationException', 'GitException',
-  // This refers to http.ClientException.
-  'ClientException',
-  // Errors coming from the Dart analyzer are probably caused by syntax errors
-  // in user code, so they're user-facing.
-  'AnalyzerError', 'AnalyzerErrorGroup',
-  // An error spawning an isolate probably indicates a transformer with an
-  // invalid import.
-  'IsolateSpawnException',
-  // IOException and subclasses.
-  'CertificateException', 'FileSystemException', 'HandshakeException',
-  'HttpException', 'IOException', 'ProcessException', 'RedirectException',
-  'SignalException', 'SocketException', 'StdoutException', 'TlsException',
-  'WebSocketException'
-]);
-
-/// Returns whether [error] is a user-facing error object.
-///
-/// This includes both [ApplicationException] and any dart:io errors.
-bool isUserFacingException(error) {
-  if (error is CrossIsolateException) {
-    return _userFacingExceptions.contains(error.type);
-  }
-
-  // TODO(nweiz): unify this list with _userFacingExceptions when issue 5897 is
-  // fixed.
-  return error is ApplicationException ||
-    error is AnalyzerError ||
-    error is AnalyzerErrorGroup ||
-    error is IsolateSpawnException ||
-    error is IOException ||
-    error is http.ClientException ||
-    error is YamlException ||
-    error is UsageException;
-}
diff --git a/sdk/lib/_internal/pub/lib/src/executable.dart b/sdk/lib/_internal/pub/lib/src/executable.dart
deleted file mode 100644
index 1b36468..0000000
--- a/sdk/lib/_internal/pub/lib/src/executable.dart
+++ /dev/null
@@ -1,240 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.executable;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as p;
-import 'package:stack_trace/stack_trace.dart';
-
-import 'barback/asset_environment.dart';
-import 'entrypoint.dart';
-import 'exit_codes.dart' as exit_codes;
-import 'io.dart';
-import 'log.dart' as log;
-import 'utils.dart';
-
-/// All signals that can be caught by a Dart process.
-///
-/// This intentionally omits SIGINT. SIGINT usually comes from a user pressing
-/// Control+C on the terminal, and the terminal automatically passes the signal
-/// to all processes in the process tree. If we forwarded it manually, the
-/// subprocess would see two instances, which could cause problems. Instead, we
-/// just ignore it and let the terminal pass it to the subprocess.
-final _catchableSignals = Platform.isWindows
-    ? [ProcessSignal.SIGHUP]
-    : [
-        ProcessSignal.SIGHUP,
-        ProcessSignal.SIGTERM,
-        ProcessSignal.SIGUSR1,
-        ProcessSignal.SIGUSR2,
-        ProcessSignal.SIGWINCH,
-      ];
-
-/// Runs [executable] from [package] reachable from [entrypoint].
-///
-/// The executable string is a relative Dart file path using native path
-/// separators with or without a trailing ".dart" extension. It is contained
-/// within [package], which should either be the entrypoint package or an
-/// immediate dependency of it.
-///
-/// Arguments from [args] will be passed to the spawned Dart application.
-///
-/// If [mode] is passed, it's used as the barback mode; it defaults to
-/// [BarbackMode.RELEASE].
-///
-/// Returns the exit code of the spawned app.
-Future<int> runExecutable(Entrypoint entrypoint, String package,
-    String executable, Iterable<String> args, {bool isGlobal: false,
-    BarbackMode mode}) async {
-  if (mode == null) mode = BarbackMode.RELEASE;
-
-  // Make sure the package is an immediate dependency of the entrypoint or the
-  // entrypoint itself.
-  if (entrypoint.root.name != package &&
-      !entrypoint.root.immediateDependencies
-          .any((dep) => dep.name == package)) {
-    var graph = await entrypoint.loadPackageGraph();
-    if (graph.packages.containsKey(package)) {
-      dataError('Package "$package" is not an immediate dependency.\n'
-          'Cannot run executables in transitive dependencies.');
-    } else {
-      dataError('Could not find package "$package". Did you forget to add a '
-          'dependency?');
-    }
-  }
-
-  // Unless the user overrides the verbosity, we want to filter out the
-  // normal pub output shown while loading the environment.
-  if (log.verbosity == log.Verbosity.NORMAL) {
-    log.verbosity = log.Verbosity.WARNING;
-  }
-
-  // Ignore a trailing extension.
-  if (p.extension(executable) == ".dart") {
-    executable = p.withoutExtension(executable);
-  }
-
-  var localSnapshotPath = p.join(".pub", "bin", package,
-      "$executable.dart.snapshot");
-  if (!isGlobal && fileExists(localSnapshotPath) &&
-      // Dependencies are only snapshotted in release mode, since that's the
-      // default mode for them to run. We can't run them in a different mode
-      // using the snapshot.
-      mode == BarbackMode.RELEASE) {
-    return _runCachedExecutable(entrypoint, localSnapshotPath, args);
-  }
-
-  // If the command has a path separator, then it's a path relative to the
-  // root of the package. Otherwise, it's implicitly understood to be in
-  // "bin".
-  var rootDir = "bin";
-  var parts = p.split(executable);
-  if (parts.length > 1) {
-    assert(!isGlobal && package == entrypoint.root.name);
-    rootDir = parts.first;
-  } else {
-    executable = p.join("bin", executable);
-  }
-
-  var assetPath = "${p.url.joinAll(p.split(executable))}.dart";
-  var id = new AssetId(package, assetPath);
-
-  // TODO(nweiz): Use [packages] to only load assets from packages that the
-  // executable might load.
-  var environment = await AssetEnvironment.create(entrypoint, mode,
-      useDart2JS: false, entrypoints: [id]);
-  environment.barback.errors.listen((error) {
-    log.error(log.red("Build error:\n$error"));
-  });
-
-  var server;
-  if (package == entrypoint.root.name) {
-    // Serve the entire root-most directory containing the entrypoint. That
-    // ensures that, for example, things like `import '../../utils.dart';`
-    // will work from within some deeply nested script.
-    server = await environment.serveDirectory(rootDir);
-  } else {
-    // For other packages, always use the "bin" directory.
-    server = await environment.servePackageBinDirectory(package);
-  }
-
-  try {
-    await environment.barback.getAssetById(id);
-  } on AssetNotFoundException catch (error, stackTrace) {
-    var message = "Could not find ${log.bold(executable + ".dart")}";
-    if (package != entrypoint.root.name) {
-      message += " in package ${log.bold(server.package)}";
-    }
-
-    log.error("$message.");
-    log.fine(new Chain.forTrace(stackTrace));
-    return exit_codes.NO_INPUT;
-  }
-
-  var vmArgs = [];
-
-  // Run in checked mode.
-  // TODO(rnystrom): Make this configurable.
-  vmArgs.add("--checked");
-
-  // Get the URL of the executable, relative to the server's root directory.
-  var relativePath = p.url.relative(assetPath,
-      from: p.url.joinAll(p.split(server.rootDirectory)));
-  vmArgs.add(server.url.resolve(relativePath).toString());
-  vmArgs.addAll(args);
-
-  var process = await Process.start(Platform.executable, vmArgs);
-
-  _forwardSignals(process);
-
-  // Note: we're not using process.std___.pipe(std___) here because
-  // that prevents pub from also writing to the output streams.
-  process.stderr.listen(stderr.add);
-  process.stdout.listen(stdout.add);
-  stdin.listen(process.stdin.add);
-
-  return process.exitCode;
-}
-
-/// Runs the snapshot at [path] with [args] and hooks its stdout, stderr, and
-/// sdtin to this process's.
-///
-/// If [recompile] is passed, it's called if the snapshot is out-of-date. It's
-/// expected to regenerate a snapshot at [path], after which the snapshot will
-/// be re-run. It may return a Future.
-///
-/// If [checked] is set, runs the snapshot in checked mode.
-///
-/// Returns the snapshot's exit code.
-///
-/// This doesn't do any validation of the snapshot's SDK version.
-Future<int> runSnapshot(String path, Iterable<String> args, {recompile(),
-    bool checked: false}) async {
-  var vmArgs = [path]..addAll(args);
-
-  // TODO(nweiz): pass a flag to silence the "Wrong full snapshot version"
-  // message when issue 20784 is fixed.
-  if (checked) vmArgs.insert(0, "--checked");
-
-  // We need to split stdin so that we can send the same input both to the
-  // first and second process, if we start more than one.
-  var stdin1;
-  var stdin2;
-  if (recompile == null) {
-    stdin1 = stdin;
-  } else {
-    var pair = tee(stdin);
-    stdin1 = pair.first;
-    stdin2 = pair.last;
-  }
-
-  runProcess(input) async {
-    var process = await Process.start(Platform.executable, vmArgs);
-
-    _forwardSignals(process);
-
-    // Note: we're not using process.std___.pipe(std___) here because
-    // that prevents pub from also writing to the output streams.
-    process.stderr.listen(stderr.add);
-    process.stdout.listen(stdout.add);
-    input.listen(process.stdin.add);
-
-    return process.exitCode;
-  }
-
-  var exitCode = await runProcess(stdin1);
-  if (recompile == null || exitCode != 253) return exitCode;
-
-  // Exit code 253 indicates that the snapshot version was out-of-date. If we
-  // can recompile, do so.
-  await recompile();
-  return runProcess(stdin2);
-}
-
-/// Forwards all catchable signals to [process].
-void _forwardSignals(Process process) {
-  // See [_catchableSignals].
-  ProcessSignal.SIGINT.watch().listen(
-      (_) => log.fine("Ignoring SIGINT in pub."));
-
-  for (var signal in _catchableSignals) {
-    signal.watch().listen((_) {
-      log.fine("Forwarding $signal to running process.");
-      process.kill(signal);
-    });
-  }
-}
-
-/// Runs the executable snapshot at [snapshotPath].
-Future<int> _runCachedExecutable(Entrypoint entrypoint, String snapshotPath,
-    List<String> args) {
-  return runSnapshot(snapshotPath, args, checked: true, recompile: () {
-    log.fine("Precompiled executable is out of date.");
-    return entrypoint.precompileExecutables();
-  });
-}
diff --git a/sdk/lib/_internal/pub/lib/src/exit_codes.dart b/sdk/lib/_internal/pub/lib/src/exit_codes.dart
deleted file mode 100644
index ebe8e8d..0000000
--- a/sdk/lib/_internal/pub/lib/src/exit_codes.dart
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// Exit code constants.
-///
-/// From [the BSD sysexits manpage][manpage]. Not every constant here is used,
-/// even though some of the unused ones may be appropriate for errors
-/// encountered by pub.
-///
-/// [manpage]: http://www.freebsd.org/cgi/man.cgi?query=sysexits
-library pub.exit_codes;
-
-/// The command completely successfully.
-const SUCCESS = 0;
-
-/// The command was used incorrectly.
-const USAGE = 64;
-
-/// The input data was incorrect.
-const DATA = 65;
-
-/// An input file did not exist or was unreadable.
-const NO_INPUT = 66;
-
-/// The user specified did not exist.
-const NO_USER = 67;
-
-/// The host specified did not exist.
-const NO_HOST = 68;
-
-/// A service is unavailable.
-const UNAVAILABLE = 69;
-
-/// An internal software error has been detected.
-const SOFTWARE = 70;
-
-/// An operating system error has been detected.
-const OS = 71;
-
-/// Some system file did not exist or was unreadable.
-const OS_FILE = 72;
-
-/// A user-specified output file cannot be created.
-const CANT_CREATE = 73;
-
-/// An error occurred while doing I/O on some file.
-const IO = 74;
-
-/// Temporary failure, indicating something that is not really an error.
-const TEMP_FAIL = 75;
-
-/// The remote system returned something invalid during a protocol exchange.
-const PROTOCOL = 76;
-
-/// The user did not have sufficient permissions.
-const NO_PERM = 77;
-
-/// Something was unconfigured or mis-configured.
-const CONFIG = 78;
diff --git a/sdk/lib/_internal/pub/lib/src/git.dart b/sdk/lib/_internal/pub/lib/src/git.dart
deleted file mode 100644
index 53d69d8..0000000
--- a/sdk/lib/_internal/pub/lib/src/git.dart
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// Helper functionality for invoking Git.
-library pub.git;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:stack_trace/stack_trace.dart';
-
-import 'exceptions.dart';
-import 'io.dart';
-import 'log.dart' as log;
-import 'utils.dart';
-
-/// An exception thrown because a git command failed.
-class GitException implements ApplicationException {
-  /// The arguments to the git command.
-  final List<String> args;
-
-  /// The standard error emitted by git.
-  final String stderr;
-
-  String get message => 'Git error. Command: git ${args.join(" ")}\n$stderr';
-
-  GitException(Iterable<String> args, this.stderr)
-      : args = args.toList();
-
-  String toString() => message;
-}
-
-/// Tests whether or not the git command-line app is available for use.
-bool get isInstalled {
-  if (_isInstalledCache != null) return _isInstalledCache;
-  _isInstalledCache = _gitCommand != null;
-  return _isInstalledCache;
-}
-bool _isInstalledCache;
-
-/// Run a git process with [args] from [workingDir].
-///
-/// Returns the stdout as a list of strings if it succeeded. Completes to an
-/// exception if it failed.
-Future<List<String>> run(List<String> args,
-    {String workingDir, Map<String, String> environment}) {
-  if (!isInstalled) {
-    fail("Cannot find a Git executable.\n"
-        "Please ensure Git is correctly installed.");
-  }
-
-  log.muteProgress();
-  return runProcess(_gitCommand, args, workingDir: workingDir,
-      environment: environment).then((result) {
-    if (!result.success) throw new GitException(args, result.stderr.join("\n"));
-
-    return result.stdout;
-  }).whenComplete(() {
-    log.unmuteProgress();
-  });
-}
-
-/// Like [run], but synchronous.
-List<String> runSync(List<String> args, {String workingDir,
-    Map<String, String> environment}) {
-  if (!isInstalled) {
-    fail("Cannot find a Git executable.\n"
-        "Please ensure Git is correctly installed.");
-  }
-
-  var result = runProcessSync(_gitCommand, args,
-      workingDir: workingDir,
-      environment: environment);
-  if (!result.success) throw new GitException(args, result.stderr.join("\n"));
-  return result.stdout;
-}
-
-/// Returns the name of the git command-line app, or null if Git could not be
-/// found on the user's PATH.
-String get _gitCommand {
-  if (_commandCache != null) return _commandCache;
-
-  var command;
-  if (_tryGitCommand("git")) {
-    _commandCache = "git";
-  } else if (_tryGitCommand("git.cmd")){
-    _commandCache = "git.cmd";
-  } else {
-    return null;
-  }
-
-  log.fine('Determined git command $command.');
-  return _commandCache;
-}
-String _commandCache;
-
-/// Checks whether [command] is the Git command for this computer.
-bool _tryGitCommand(String command) {
-  // If "git --version" prints something familiar, git is working.
-  try {
-    var result = runProcessSync(command, ["--version"]);
-    var regexp = new RegExp("^git version");
-    return result.stdout.length == 1 && regexp.hasMatch(result.stdout.single);
-  } on ProcessException catch (error, stackTrace) {
-    var chain = new Chain.forTrace(stackTrace);
-    // If the process failed, they probably don't have it.
-    log.message('Git command is not "$command": $error\n$chain');
-    return false;
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/global_packages.dart b/sdk/lib/_internal/pub/lib/src/global_packages.dart
deleted file mode 100644
index 335cf8e..0000000
--- a/sdk/lib/_internal/pub/lib/src/global_packages.dart
+++ /dev/null
@@ -1,783 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.global_packages;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:path/path.dart' as p;
-import 'package:barback/barback.dart';
-import 'package:pub_semver/pub_semver.dart';
-
-import 'barback/asset_environment.dart';
-import 'entrypoint.dart';
-import 'exceptions.dart';
-import 'executable.dart' as exe;
-import 'io.dart';
-import 'lock_file.dart';
-import 'log.dart' as log;
-import 'package.dart';
-import 'pubspec.dart';
-import 'sdk.dart' as sdk;
-import 'solver/version_solver.dart';
-import 'source/cached.dart';
-import 'source/git.dart';
-import 'source/path.dart';
-import 'system_cache.dart';
-import 'utils.dart';
-
-/// Maintains the set of packages that have been globally activated.
-///
-/// These have been hand-chosen by the user to make their executables in bin/
-/// available to the entire system. This lets them access them even when the
-/// current working directory is not inside another entrypoint package.
-///
-/// Only one version of a given package name can be globally activated at a
-/// time. Activating a different version of a package will deactivate the
-/// previous one.
-///
-/// This handles packages from uncached and cached sources a little differently.
-/// For a cached source, the package is physically in the user's pub cache and
-/// we don't want to mess with it by putting a lockfile in there. Instead, when
-/// we activate the package, we create a full lockfile and put it in the
-/// "global_packages" directory. It's named "<package>.lock". Unlike a normal
-/// lockfile, it also contains an entry for the root package itself, so that we
-/// know the version and description that was activated.
-///
-/// Uncached packages (i.e. "path" packages) are somewhere else on the user's
-/// local file system and can have a lockfile directly in place. (And, in fact,
-/// we want to ensure we honor the user's lockfile there.) To activate it, we
-/// just need to know where that package directory is. For that, we create a
-/// lockfile that *only* contains the root package's [PackageId] -- basically
-/// just the path to the directory where the real lockfile lives.
-class GlobalPackages {
-  /// The [SystemCache] containing the global packages.
-  final SystemCache cache;
-
-  /// The directory where the lockfiles for activated packages are stored.
-  String get _directory => p.join(cache.rootDir, "global_packages");
-
-  /// The directory where binstubs for global package executables are stored.
-  String get _binStubDir => p.join(cache.rootDir, "bin");
-
-  /// Creates a new global package registry backed by the given directory on
-  /// the user's file system.
-  ///
-  /// The directory may not physically exist yet. If not, this will create it
-  /// when needed.
-  GlobalPackages(this.cache);
-
-  /// Caches the package located in the Git repository [repo] and makes it the
-  /// active global version.
-  ///
-  /// [executables] is the names of the executables that should have binstubs.
-  /// If `null`, all executables in the package will get binstubs. If empty, no
-  /// binstubs will be created.
-  ///
-  /// if [overwriteBinStubs] is `true`, any binstubs that collide with
-  /// existing binstubs in other packages will be overwritten by this one's.
-  /// Otherwise, the previous ones will be preserved.
-  Future activateGit(String repo, List<String> executables,
-      {bool overwriteBinStubs}) async {
-    var source = cache.sources["git"] as GitSource;
-    var name = await source.getPackageNameFromRepo(repo);
-    // Call this just to log what the current active package is, if any.
-    _describeActive(name);
-
-    // TODO(nweiz): Add some special handling for git repos that contain path
-    // dependencies. Their executables shouldn't be cached, and there should
-    // be a mechanism for redoing dependency resolution if a path pubspec has
-    // changed (see also issue 20499).
-    await _installInCache(
-        new PackageDep(name, "git", VersionConstraint.any, repo),
-        executables, overwriteBinStubs: overwriteBinStubs);
-  }
-
-  /// Finds the latest version of the hosted package with [name] that matches
-  /// [constraint] and makes it the active global version.
-  ///
-  /// [executables] is the names of the executables that should have binstubs.
-  /// If `null`, all executables in the package will get binstubs. If empty, no
-  /// binstubs will be created.
-  ///
-  /// if [overwriteBinStubs] is `true`, any binstubs that collide with
-  /// existing binstubs in other packages will be overwritten by this one's.
-  /// Otherwise, the previous ones will be preserved.
-  Future activateHosted(String name, VersionConstraint constraint,
-      List<String> executables, {bool overwriteBinStubs}) async {
-    _describeActive(name);
-    await _installInCache(new PackageDep(name, "hosted", constraint, name),
-        executables, overwriteBinStubs: overwriteBinStubs);
-  }
-
-  /// Makes the local package at [path] globally active.
-  ///
-  /// [executables] is the names of the executables that should have binstubs.
-  /// If `null`, all executables in the package will get binstubs. If empty, no
-  /// binstubs will be created.
-  ///
-  /// if [overwriteBinStubs] is `true`, any binstubs that collide with
-  /// existing binstubs in other packages will be overwritten by this one's.
-  /// Otherwise, the previous ones will be preserved.
-  Future activatePath(String path, List<String> executables,
-      {bool overwriteBinStubs}) async {
-    var entrypoint = new Entrypoint(path, cache);
-
-    // Get the package's dependencies.
-    await entrypoint.ensureLockFileIsUpToDate();
-    var name = entrypoint.root.name;
-
-    // Call this just to log what the current active package is, if any.
-    _describeActive(name);
-
-    // Write a lockfile that points to the local package.
-    var fullPath = canonicalize(entrypoint.root.dir);
-    var id = new PackageId(name, "path", entrypoint.root.version,
-        PathSource.describePath(fullPath));
-
-    // TODO(rnystrom): Look in "bin" and display list of binaries that
-    // user can run.
-    _writeLockFile(name, new LockFile([id]));
-
-    var binDir = p.join(_directory, name, 'bin');
-    if (dirExists(binDir)) deleteEntry(binDir);
-
-    _updateBinStubs(entrypoint.root, executables,
-        overwriteBinStubs: overwriteBinStubs);
-  }
-
-  /// Installs the package [dep] and its dependencies into the system cache.
-  Future _installInCache(PackageDep dep, List<String> executables,
-      {bool overwriteBinStubs}) async {
-    // Create a dummy package with just [dep] so we can do resolution on it.
-    var root = new Package.inMemory(new Pubspec("pub global activate",
-        dependencies: [dep], sources: cache.sources));
-
-    // Resolve it and download its dependencies.
-    var result = await resolveVersions(SolveType.GET, cache.sources, root);
-    if (!result.succeeded) {
-      // If the package specified by the user doesn't exist, we want to
-      // surface that as a [DataError] with the associated exit code.
-      if (result.error.package != dep.name) throw result.error;
-      if (result.error is NoVersionException) dataError(result.error.message);
-      throw result.error;
-    }
-    result.showReport(SolveType.GET);
-
-    // Make sure all of the dependencies are locally installed.
-    var ids = await Future.wait(result.packages.map(_cacheDependency));
-    var lockFile = new LockFile(ids);
-
-    // Load the package graph from [result] so we don't need to re-parse all
-    // the pubspecs.
-    var graph = await new Entrypoint.inMemory(root, lockFile, cache)
-        .loadPackageGraph(result);
-    var snapshots = await _precompileExecutables(graph.entrypoint, dep.name);
-    _writeLockFile(dep.name, lockFile);
-
-    _updateBinStubs(graph.packages[dep.name], executables,
-        overwriteBinStubs: overwriteBinStubs, snapshots: snapshots);
-  }
-
-  /// Precompiles the executables for [package] and saves them in the global
-  /// cache.
-  ///
-  /// Returns a map from executable name to path for the snapshots that were
-  /// successfully precompiled.
-  Future<Map<String, String>> _precompileExecutables(Entrypoint entrypoint,
-      String package) {
-    return log.progress("Precompiling executables", () async {
-      var binDir = p.join(_directory, package, 'bin');
-      cleanDir(binDir);
-
-      var graph = await entrypoint.loadPackageGraph();
-      var environment = await AssetEnvironment.create(
-          entrypoint, BarbackMode.RELEASE,
-          entrypoints: graph.packages[package].executableIds,
-          useDart2JS: false);
-      environment.barback.errors.listen((error) {
-        log.error(log.red("Build error:\n$error"));
-      });
-
-      return environment.precompileExecutables(package, binDir);
-    });
-  }
-
-  /// Downloads [id] into the system cache if it's a cached package.
-  ///
-  /// Returns the resolved [PackageId] for [id].
-  Future<PackageId> _cacheDependency(PackageId id) async {
-    var source = cache.sources[id.source];
-
-    if (!id.isRoot && source is CachedSource) {
-      await source.downloadToSystemCache(id);
-    }
-
-    return source.resolveId(id);
-  }
-
-  /// Finishes activating package [package] by saving [lockFile] in the cache.
-  void _writeLockFile(String package, LockFile lockFile) {
-    ensureDir(p.join(_directory, package));
-
-    // TODO(nweiz): This cleans up Dart 1.6's old lockfile location. Remove it
-    // when Dart 1.6 is old enough that we don't think anyone will have these
-    // lockfiles anymore (issue 20703).
-    var oldPath = p.join(_directory, "$package.lock");
-    if (fileExists(oldPath)) deleteEntry(oldPath);
-
-    writeTextFile(_getLockFilePath(package),
-        lockFile.serialize(cache.rootDir, cache.sources));
-
-    var id = lockFile.packages[package];
-    log.message('Activated ${_formatPackage(id)}.');
-  }
-
-  /// Shows the user the currently active package with [name], if any.
-  void _describeActive(String name) {
-    try {
-      var lockFile = new LockFile.load(_getLockFilePath(name), cache.sources);
-      var id = lockFile.packages[name];
-
-      if (id.source == 'git') {
-        var url = GitSource.urlFromDescription(id.description);
-        log.message('Package ${log.bold(name)} is currently active from Git '
-            'repository "${url}".');
-      } else if (id.source == 'path') {
-        var path = PathSource.pathFromDescription(id.description);
-        log.message('Package ${log.bold(name)} is currently active at path '
-            '"$path".');
-      } else {
-        log.message('Package ${log.bold(name)} is currently active at version '
-            '${log.bold(id.version)}.');
-      }
-    } on IOException {
-      // If we couldn't read the lock file, it's not activated.
-      return null;
-    }
-  }
-
-  /// Deactivates a previously-activated package named [name].
-  ///
-  /// Returns `false` if no package with [name] was currently active.
-  bool deactivate(String name) {
-    var dir = p.join(_directory, name);
-    if (!dirExists(dir)) return false;
-
-    _deleteBinStubs(name);
-
-    var lockFile = new LockFile.load(_getLockFilePath(name), cache.sources);
-    var id = lockFile.packages[name];
-    log.message('Deactivated package ${_formatPackage(id)}.');
-
-    deleteEntry(dir);
-
-    return true;
-  }
-
-  /// Finds the active package with [name].
-  ///
-  /// Returns an [Entrypoint] loaded with the active package if found.
-  Future<Entrypoint> find(String name) async {
-    var lockFilePath = _getLockFilePath(name);
-    var lockFile;
-    try {
-      lockFile = new LockFile.load(lockFilePath, cache.sources);
-    } on IOException {
-      var oldLockFilePath = p.join(_directory, '$name.lock');
-      try {
-        // TODO(nweiz): This looks for Dart 1.6's old lockfile location.
-        // Remove it when Dart 1.6 is old enough that we don't think anyone
-        // will have these lockfiles anymore (issue 20703).
-        lockFile = new LockFile.load(oldLockFilePath, cache.sources);
-      } on IOException {
-        // If we couldn't read the lock file, it's not activated.
-        dataError("No active package ${log.bold(name)}.");
-      }
-
-      // Move the old lockfile to its new location.
-      ensureDir(p.dirname(lockFilePath));
-      new File(oldLockFilePath).renameSync(lockFilePath);
-    }
-
-    // Load the package from the cache.
-    var id = lockFile.packages[name];
-    lockFile.packages.remove(name);
-
-    var source = cache.sources[id.source];
-    if (source is CachedSource) {
-      // For cached sources, the package itself is in the cache and the
-      // lockfile is the one we just loaded.
-      var dir = await cache.sources[id.source].getDirectory(id);
-      var package = new Package.load(name, dir, cache.sources);
-      return new Entrypoint.inMemory(package, lockFile, cache);
-    }
-
-    // For uncached sources (i.e. path), the ID just points to the real
-    // directory for the package.
-    assert(id.source == "path");
-    return new Entrypoint(PathSource.pathFromDescription(id.description),
-        cache);
-  }
-
-  /// Runs [package]'s [executable] with [args].
-  ///
-  /// If [executable] is available in its precompiled form, that will be
-  /// recompiled if the SDK has been upgraded since it was first compiled and
-  /// then run. Otherwise, it will be run from source.
-  ///
-  /// If [mode] is passed, it's used as the barback mode; it defaults to
-  /// [BarbackMode.RELEASE].
-  ///
-  /// Returns the exit code from the executable.
-  Future<int> runExecutable(String package, String executable,
-      Iterable<String> args, {BarbackMode mode}) {
-    if (mode == null) mode = BarbackMode.RELEASE;
-
-    var binDir = p.join(_directory, package, 'bin');
-    if (mode != BarbackMode.RELEASE ||
-        !fileExists(p.join(binDir, '$executable.dart.snapshot'))) {
-      return find(package).then((entrypoint) {
-        return exe.runExecutable(entrypoint, package, executable, args,
-            mode: mode, isGlobal: true);
-      });
-    }
-
-    // Unless the user overrides the verbosity, we want to filter out the
-    // normal pub output shown while loading the environment.
-    if (log.verbosity == log.Verbosity.NORMAL) {
-      log.verbosity = log.Verbosity.WARNING;
-    }
-
-    var snapshotPath = p.join(binDir, '$executable.dart.snapshot');
-    return exe.runSnapshot(snapshotPath, args, recompile: () {
-      log.fine("$package:$executable is out of date and needs to be "
-          "recompiled.");
-      return find(package)
-          .then((entrypoint) => entrypoint.loadPackageGraph())
-          .then((graph) => _precompileExecutables(graph.entrypoint, package));
-    });
-  }
-
-  /// Gets the path to the lock file for an activated cached package with
-  /// [name].
-  String _getLockFilePath(String name) =>
-      p.join(_directory, name, "pubspec.lock");
-
-  /// Shows the user a formatted list of globally activated packages.
-  void listActivePackages() {
-    if (!dirExists(_directory)) return;
-
-    listDir(_directory).map(_loadPackageId).toList()
-        ..sort((id1, id2) => id1.name.compareTo(id2.name))
-        ..forEach((id) => log.message(_formatPackage(id)));
-  }
-
-  /// Returns the [PackageId] for the globally-activated package at [path].
-  ///
-  /// [path] should be a path within [_directory]. It can either be an old-style
-  /// path to a single lockfile or a new-style path to a directory containing a
-  /// lockfile.
-  PackageId _loadPackageId(String path) {
-    var name = p.basenameWithoutExtension(path);
-    if (!fileExists(path)) path = p.join(path, 'pubspec.lock');
-
-    var id = new LockFile.load(p.join(_directory, path), cache.sources)
-        .packages[name];
-
-    if (id == null) {
-      throw new FormatException("Pubspec for activated package $name didn't "
-          "contain an entry for itself.");
-    }
-
-    return id;
-  }
-
-  /// Returns formatted string representing the package [id].
-  String _formatPackage(PackageId id) {
-    if (id.source == 'git') {
-      var url = GitSource.urlFromDescription(id.description);
-      return '${log.bold(id.name)} ${id.version} from Git repository "$url"';
-    } else if (id.source == 'path') {
-      var path = PathSource.pathFromDescription(id.description);
-      return '${log.bold(id.name)} ${id.version} at path "$path"';
-    } else {
-      return '${log.bold(id.name)} ${id.version}';
-    }
-  }
-
-  /// Repairs any corrupted globally-activated packages and their binstubs.
-  ///
-  /// Returns a pair of two [int]s. The first indicates how many packages were
-  /// successfully re-activated; the second indicates how many failed.
-  Future<Pair<int, int>> repairActivatedPackages() async {
-    var executables = {};
-    if (dirExists(_binStubDir)) {
-      for (var entry in listDir(_binStubDir)) {
-        try {
-          var binstub = readTextFile(entry);
-          var package = _binStubProperty(binstub, "Package");
-          if (package == null) {
-            throw new ApplicationException("No 'Package' property.");
-          }
-
-          var executable = _binStubProperty(binstub, "Executable");
-          if (executable == null) {
-            throw new ApplicationException("No 'Executable' property.");
-          }
-
-          executables.putIfAbsent(package, () => []).add(executable);
-        } catch (error, stackTrace) {
-          log.error(
-              "Error reading binstub for "
-                  "\"${p.basenameWithoutExtension(entry)}\"",
-              error, stackTrace);
-
-          tryDeleteEntry(entry);
-        }
-      }
-    }
-
-    var successes = 0;
-    var failures = 0;
-    if (dirExists(_directory)) {
-      for (var entry in listDir(_directory)) {
-        var id;
-        try {
-          id = _loadPackageId(entry);
-          log.message("Reactivating ${log.bold(id.name)} ${id.version}...");
-
-          var entrypoint = await find(id.name);
-
-          var graph = await entrypoint.loadPackageGraph();
-          var snapshots = await _precompileExecutables(entrypoint, id.name);
-          var packageExecutables = executables.remove(id.name);
-          if (packageExecutables == null) packageExecutables = [];
-          _updateBinStubs(graph.packages[id.name], packageExecutables,
-              overwriteBinStubs: true, snapshots: snapshots,
-              suggestIfNotOnPath: false);
-          successes++;
-        } catch (error, stackTrace) {
-          var message = "Failed to reactivate "
-              "${log.bold(p.basenameWithoutExtension(entry))}";
-          if (id != null) {
-            message += " ${id.version}";
-            if (id.source != "hosted") message += " from ${id.source}";
-          }
-
-          log.error(message, error, stackTrace);
-          failures++;
-
-          tryDeleteEntry(entry);
-        }
-      }
-    }
-
-    if (executables.isNotEmpty) {
-      var message = new StringBuffer("Binstubs exist for non-activated "
-          "packages:\n");
-      executables.forEach((package, executableNames) {
-        // TODO(nweiz): Use a normal for loop here when
-        // https://github.com/dart-lang/async_await/issues/68 is fixed.
-        executableNames.forEach((executable) =>
-            deleteEntry(p.join(_binStubDir, executable)));
-
-        message.writeln("  From ${log.bold(package)}: "
-            "${toSentence(executableNames)}");
-      });
-      log.error(message);
-    }
-
-    return new Pair(successes, failures);
-  }
-
-  /// Updates the binstubs for [package].
-  ///
-  /// A binstub is a little shell script in `PUB_CACHE/bin` that runs an
-  /// executable from a globally activated package. This removes any old
-  /// binstubs from the previously activated version of the package and
-  /// (optionally) creates new ones for the executables listed in the package's
-  /// pubspec.
-  ///
-  /// [executables] is the names of the executables that should have binstubs.
-  /// If `null`, all executables in the package will get binstubs. If empty, no
-  /// binstubs will be created.
-  ///
-  /// If [overwriteBinStubs] is `true`, any binstubs that collide with
-  /// existing binstubs in other packages will be overwritten by this one's.
-  /// Otherwise, the previous ones will be preserved.
-  ///
-  /// If [snapshots] is given, it is a map of the names of executables whose
-  /// snapshots were precompiled to the paths of those snapshots. Binstubs for
-  /// those will run the snapshot directly and skip pub entirely.
-  ///
-  /// If [suggestIfNotOnPath] is `true` (the default), this will warn the user if
-  /// the bin directory isn't on their path.
-  void _updateBinStubs(Package package, List<String> executables,
-      {bool overwriteBinStubs, Map<String, String> snapshots,
-       bool suggestIfNotOnPath: true}) {
-    if (snapshots == null) snapshots = const {};
-
-    // Remove any previously activated binstubs for this package, in case the
-    // list of executables has changed.
-    _deleteBinStubs(package.name);
-
-    if ((executables != null && executables.isEmpty) ||
-        package.pubspec.executables.isEmpty) {
-      return;
-    }
-
-    ensureDir(_binStubDir);
-
-    var installed = [];
-    var collided = {};
-    var allExecutables = ordered(package.pubspec.executables.keys);
-    for (var executable in allExecutables) {
-      if (executables != null && !executables.contains(executable)) continue;
-
-      var script = package.pubspec.executables[executable];
-
-      var previousPackage = _createBinStub(package, executable, script,
-          overwrite: overwriteBinStubs, snapshot: snapshots[script]);
-      if (previousPackage != null) {
-        collided[executable] = previousPackage;
-
-        if (!overwriteBinStubs) continue;
-      }
-
-      installed.add(executable);
-    }
-
-    if (installed.isNotEmpty) {
-      var names = namedSequence("executable", installed.map(log.bold));
-      log.message("Installed $names.");
-    }
-
-    // Show errors for any collisions.
-    if (collided.isNotEmpty) {
-      for (var command in ordered(collided.keys)) {
-        if (overwriteBinStubs) {
-          log.warning("Replaced ${log.bold(command)} previously installed from "
-              "${log.bold(collided[command])}.");
-        } else {
-          log.warning("Executable ${log.bold(command)} was already installed "
-              "from ${log.bold(collided[command])}.");
-        }
-      }
-
-      if (!overwriteBinStubs) {
-        log.warning("Deactivate the other package(s) or activate "
-            "${log.bold(package.name)} using --overwrite.");
-      }
-    }
-
-    // Show errors for any unknown executables.
-    if (executables != null) {
-      var unknown = ordered(executables.where(
-          (exe) => !package.pubspec.executables.keys.contains(exe)));
-      if (unknown.isNotEmpty) {
-        dataError("Unknown ${namedSequence('executable', unknown)}.");
-      }
-    }
-
-    // Show errors for any missing scripts.
-    // TODO(rnystrom): This can print false positives since a script may be
-    // produced by a transformer. Do something better.
-    var binFiles = package.listFiles(beneath: "bin", recursive: false)
-        .map((path) => package.relative(path))
-        .toList();
-    for (var executable in installed) {
-      var script = package.pubspec.executables[executable];
-      var scriptPath = p.join("bin", "$script.dart");
-      if (!binFiles.contains(scriptPath)) {
-        log.warning('Warning: Executable "$executable" runs "$scriptPath", '
-            'which was not found in ${log.bold(package.name)}.');
-      }
-    }
-
-    if (suggestIfNotOnPath && installed.isNotEmpty) {
-      _suggestIfNotOnPath(installed.first);
-    }
-  }
-
-  /// Creates a binstub named [executable] that runs [script] from [package].
-  ///
-  /// If [overwrite] is `true`, this will replace an existing binstub with that
-  /// name for another package.
-  ///
-  /// If [snapshot] is non-null, it is a path to a snapshot file. The binstub
-  /// will invoke that directly. Otherwise, it will run `pub global run`.
-  ///
-  /// If a collision occurs, returns the name of the package that owns the
-  /// existing binstub. Otherwise returns `null`.
-  String _createBinStub(Package package, String executable, String script,
-      {bool overwrite, String snapshot}) {
-    var binStubPath = p.join(_binStubDir, executable);
-
-    if (Platform.operatingSystem == "windows") binStubPath += ".bat";
-
-    // See if the binstub already exists. If so, it's for another package
-    // since we already deleted all of this package's binstubs.
-    var previousPackage;
-    if (fileExists(binStubPath)) {
-      var contents = readTextFile(binStubPath);
-      previousPackage = _binStubProperty(contents, "Package");
-      if (previousPackage == null) {
-        log.fine("Could not parse binstub $binStubPath:\n$contents");
-      } else if (!overwrite) {
-        return previousPackage;
-      }
-    }
-
-    // If the script was precompiled to a snapshot, just invoke that directly
-    // and skip pub global run entirely.
-    var invocation;
-    if (snapshot != null) {
-      // We expect absolute paths from the precompiler since relative ones
-      // won't be relative to the right directory when the user runs this.
-      assert(p.isAbsolute(snapshot));
-      invocation = 'dart "$snapshot"';
-    } else {
-      invocation = "pub global run ${package.name}:$script";
-    }
-
-    if (Platform.operatingSystem == "windows") {
-      var batch = """
-@echo off
-rem This file was created by pub v${sdk.version}.
-rem Package: ${package.name}
-rem Version: ${package.version}
-rem Executable: ${executable}
-rem Script: ${script}
-$invocation %*
-""";
-
-      if (snapshot != null) {
-        batch += """
-
-rem The VM exits with code 253 if the snapshot version is out-of-date.
-rem If it is, we need to delete it and run "pub global" manually.
-if not errorlevel 253 (
-  exit /b %errorlevel%
-)
-
-pub global run ${package.name}:$script %*
-""";
-      }
-
-      writeTextFile(binStubPath, batch);
-    } else {
-      var bash = """
-#!/usr/bin/env sh
-# This file was created by pub v${sdk.version}.
-# Package: ${package.name}
-# Version: ${package.version}
-# Executable: ${executable}
-# Script: ${script}
-$invocation "\$@"
-""";
-
-      if (snapshot != null) {
-        bash += """
-
-# The VM exits with code 253 if the snapshot version is out-of-date.
-# If it is, we need to delete it and run "pub global" manually.
-exit_code=\$?
-if [ \$exit_code != 253 ]; then
-  exit \$exit_code
-fi
-
-pub global run ${package.name}:$script "\$@"
-""";
-      }
-
-      writeTextFile(binStubPath, bash);
-
-      // Make it executable.
-      var result = Process.runSync('chmod', ['+x', binStubPath]);
-      if (result.exitCode != 0) {
-        // Couldn't make it executable so don't leave it laying around.
-        try {
-          deleteEntry(binStubPath);
-        } on IOException catch (err) {
-          // Do nothing. We're going to fail below anyway.
-          log.fine("Could not delete binstub:\n$err");
-        }
-
-        fail('Could not make "$binStubPath" executable (exit code '
-            '${result.exitCode}):\n${result.stderr}');
-      }
-    }
-
-    return previousPackage;
-  }
-
-  /// Deletes all existing binstubs for [package].
-  void _deleteBinStubs(String package) {
-    if (!dirExists(_binStubDir)) return;
-
-    for (var file in listDir(_binStubDir, includeDirs: false)) {
-      var contents = readTextFile(file);
-      var binStubPackage = _binStubProperty(contents, "Package");
-      if (binStubPackage == null) {
-        log.fine("Could not parse binstub $file:\n$contents");
-        continue;
-      }
-
-      if (binStubPackage == package) {
-        log.fine("Deleting old binstub $file");
-        deleteEntry(file);
-      }
-    }
-  }
-
-  /// Checks to see if the binstubs are on the user's PATH and, if not, suggests
-  /// that the user add the directory to their PATH.
-  ///
-  /// [installed] should be the name of an installed executable that can be used
-  /// to test whether accessing it on the path works.
-  void _suggestIfNotOnPath(String installed) {
-    if (Platform.operatingSystem == "windows") {
-      // See if the shell can find one of the binstubs.
-      // "\q" means return exit code 0 if found or 1 if not.
-      var result = runProcessSync("where", [r"\q", installed + ".bat"]);
-      if (result.exitCode == 0) return;
-
-      log.warning(
-          "${log.yellow('Warning:')} Pub installs executables into "
-              "${log.bold(_binStubDir)}, which is not on your path.\n"
-          "You can fix that by adding that directory to your system's "
-              '"Path" environment variable.\n'
-          'A web search for "configure windows path" will show you how.');
-    } else {
-      // See if the shell can find one of the binstubs.
-      var result = runProcessSync("which", [installed]);
-      if (result.exitCode == 0) return;
-
-      var binDir = _binStubDir;
-      if (binDir.startsWith(Platform.environment['HOME'])) {
-        binDir = p.join("~", p.relative(binDir,
-            from: Platform.environment['HOME']));
-      }
-
-      log.warning(
-          "${log.yellow('Warning:')} Pub installs executables into "
-              "${log.bold(binDir)}, which is not on your path.\n"
-          "You can fix that by adding this to your shell's config file "
-              "(.bashrc, .bash_profile, etc.):\n"
-          "\n"
-          "  ${log.bold('export PATH="\$PATH":"$binDir"')}\n"
-          "\n");
-    }
-  }
-
-  /// Returns the value of the property named [name] in the bin stub script
-  /// [source].
-  String _binStubProperty(String source, String name) {
-    var pattern = new RegExp(quoteRegExp(name) + r": ([a-zA-Z0-9_-]+)");
-    var match = pattern.firstMatch(source);
-    return match == null ? null : match[1];
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/http.dart b/sdk/lib/_internal/pub/lib/src/http.dart
deleted file mode 100644
index 27e90a0..0000000
--- a/sdk/lib/_internal/pub/lib/src/http.dart
+++ /dev/null
@@ -1,258 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// Helpers for dealing with HTTP.
-library pub.http;
-
-import 'dart:async';
-import 'dart:convert';
-import 'dart:io';
-
-import 'package:http/http.dart' as http;
-import 'package:http_throttle/http_throttle.dart';
-import 'package:stack_trace/stack_trace.dart';
-
-import 'io.dart';
-import 'log.dart' as log;
-import 'oauth2.dart' as oauth2;
-import 'sdk.dart' as sdk;
-import 'utils.dart';
-
-// TODO(nweiz): make this configurable
-/// The amount of time in milliseconds to allow HTTP requests before assuming
-/// they've failed.
-final HTTP_TIMEOUT = 30 * 1000;
-
-/// Headers and field names that should be censored in the log output.
-final _CENSORED_FIELDS = const ['refresh_token', 'authorization'];
-
-/// Headers required for pub.dartlang.org API requests.
-///
-/// The Accept header tells pub.dartlang.org which version of the API we're
-/// expecting, so it can either serve that version or give us a 406 error if
-/// it's not supported.
-final PUB_API_HEADERS = const {'Accept': 'application/vnd.pub.v2+json'};
-
-/// An HTTP client that transforms 40* errors and socket exceptions into more
-/// user-friendly error messages.
-///
-/// This also adds a 30-second timeout to every request. This can be configured
-/// on a per-request basis by setting the 'Pub-Request-Timeout' header to the
-/// desired number of milliseconds, or to "None" to disable the timeout.
-class _PubHttpClient extends http.BaseClient {
-  final _requestStopwatches = new Map<http.BaseRequest, Stopwatch>();
-
-  http.Client _inner;
-
-  _PubHttpClient([http.Client inner])
-      : this._inner = inner == null ? new http.Client() : inner;
-
-  Future<http.StreamedResponse> send(http.BaseRequest request) {
-    _requestStopwatches[request] = new Stopwatch()..start();
-    request.headers[HttpHeaders.USER_AGENT] = "Dart pub ${sdk.version}";
-    _logRequest(request);
-
-    var timeoutLength = HTTP_TIMEOUT;
-    var timeoutString = request.headers.remove('Pub-Request-Timeout');
-    if (timeoutString == 'None') {
-      timeoutLength = null;
-    } else if (timeoutString != null) {
-      timeoutLength = int.parse(timeoutString);
-    }
-
-    var future = _inner.send(request).then((streamedResponse) {
-      _logResponse(streamedResponse);
-
-      var status = streamedResponse.statusCode;
-      // 401 responses should be handled by the OAuth2 client. It's very
-      // unlikely that they'll be returned by non-OAuth2 requests. We also want
-      // to pass along 400 responses from the token endpoint.
-      var tokenRequest = urisEqual(
-          streamedResponse.request.url, oauth2.tokenEndpoint);
-      if (status < 400 || status == 401 || (status == 400 && tokenRequest)) {
-        return streamedResponse;
-      }
-
-      if (status == 406 &&
-          request.headers['Accept'] == PUB_API_HEADERS['Accept']) {
-        fail("Pub ${sdk.version} is incompatible with the current version of "
-                 "${request.url.host}.\n"
-             "Upgrade pub to the latest version and try again.");
-      }
-
-      if (status == 500 &&
-          (request.url.host == "pub.dartlang.org" ||
-          request.url.host == "storage.googleapis.com")) {
-        var message = "HTTP error 500: Internal Server Error at "
-            "${request.url}.";
-
-        if (request.url.host == "pub.dartlang.org" ||
-            request.url.host == "storage.googleapis.com") {
-          message += "\nThis is likely a transient error. Please try again "
-              "later.";
-        }
-
-        fail(message);
-      }
-
-      return http.Response.fromStream(streamedResponse).then((response) {
-        throw new PubHttpException(response);
-      });
-    }).catchError((error, stackTrace) {
-      // Work around issue 23008.
-      if (stackTrace == null) stackTrace = new Chain.current();
-
-      if (error is SocketException &&
-          error.osError != null) {
-        if (error.osError.errorCode == 8 ||
-            error.osError.errorCode == -2 ||
-            error.osError.errorCode == -5 ||
-            error.osError.errorCode == 11001 ||
-            error.osError.errorCode == 11004) {
-          fail('Could not resolve URL "${request.url.origin}".',
-              error, stackTrace);
-        } else if (error.osError.errorCode == -12276) {
-          fail('Unable to validate SSL certificate for '
-              '"${request.url.origin}".',
-              error, stackTrace);
-        }
-      }
-      throw error;
-    });
-
-    if (timeoutLength == null) return future;
-    return timeout(future, timeoutLength, request.url,
-        'fetching URL "${request.url}"');
-  }
-
-  /// Logs the fact that [request] was sent, and information about it.
-  void _logRequest(http.BaseRequest request) {
-    var requestLog = new StringBuffer();
-    requestLog.writeln("HTTP ${request.method} ${request.url}");
-    request.headers.forEach((name, value) =>
-        requestLog.writeln(_logField(name, value)));
-
-    if (request.method == 'POST') {
-      var contentTypeString = request.headers[HttpHeaders.CONTENT_TYPE];
-      if (contentTypeString == null) contentTypeString = '';
-      var contentType = ContentType.parse(contentTypeString);
-      if (request is http.MultipartRequest) {
-        requestLog.writeln();
-        requestLog.writeln("Body fields:");
-        request.fields.forEach((name, value) =>
-            requestLog.writeln(_logField(name, value)));
-
-        // TODO(nweiz): make MultipartRequest.files readable, and log them?
-      } else if (request is http.Request) {
-        if (contentType.value == 'application/x-www-form-urlencoded') {
-          requestLog.writeln();
-          requestLog.writeln("Body fields:");
-          request.bodyFields.forEach((name, value) =>
-              requestLog.writeln(_logField(name, value)));
-        } else if (contentType.value == 'text/plain' ||
-            contentType.value == 'application/json') {
-          requestLog.write(request.body);
-        }
-      }
-    }
-
-    log.fine(requestLog.toString().trim());
-  }
-
-  /// Logs the fact that [response] was received, and information about it.
-  void _logResponse(http.StreamedResponse response) {
-    // TODO(nweiz): Fork the response stream and log the response body. Be
-    // careful not to log OAuth2 private data, though.
-
-    var responseLog = new StringBuffer();
-    var request = response.request;
-    var stopwatch = _requestStopwatches.remove(request)..stop();
-    responseLog.writeln("HTTP response ${response.statusCode} "
-        "${response.reasonPhrase} for ${request.method} ${request.url}");
-    responseLog.writeln("took ${stopwatch.elapsed}");
-    response.headers.forEach((name, value) =>
-        responseLog.writeln(_logField(name, value)));
-
-    log.fine(responseLog.toString().trim());
-  }
-
-  /// Returns a log-formatted string for the HTTP field or header with the given
-  /// [name] and [value].
-  String _logField(String name, String value) {
-    if (_CENSORED_FIELDS.contains(name.toLowerCase())) {
-      return "$name: <censored>";
-    } else {
-      return "$name: $value";
-    }
-  }
-}
-
-/// The [_PubHttpClient] wrapped by [httpClient].
-final _pubClient = new _PubHttpClient();
-
-/// The HTTP client to use for all HTTP requests.
-final httpClient = new ThrottleClient(16, _pubClient);
-
-/// The underlying HTTP client wrapped by [httpClient].
-http.Client get innerHttpClient => _pubClient._inner;
-set innerHttpClient(http.Client client) => _pubClient._inner = client;
-
-/// Handles a successful JSON-formatted response from pub.dartlang.org.
-///
-/// These responses are expected to be of the form `{"success": {"message":
-/// "some message"}}`. If the format is correct, the message will be printed;
-/// otherwise an error will be raised.
-void handleJsonSuccess(http.Response response) {
-  var parsed = parseJsonResponse(response);
-  if (parsed['success'] is! Map ||
-      !parsed['success'].containsKey('message') ||
-      parsed['success']['message'] is! String) {
-    invalidServerResponse(response);
-  }
-  log.message(parsed['success']['message']);
-}
-
-/// Handles an unsuccessful JSON-formatted response from pub.dartlang.org.
-///
-/// These responses are expected to be of the form `{"error": {"message": "some
-/// message"}}`. If the format is correct, the message will be raised as an
-/// error; otherwise an [invalidServerResponse] error will be raised.
-void handleJsonError(http.Response response) {
-  var errorMap = parseJsonResponse(response);
-  if (errorMap['error'] is! Map ||
-      !errorMap['error'].containsKey('message') ||
-      errorMap['error']['message'] is! String) {
-    invalidServerResponse(response);
-  }
-  fail(errorMap['error']['message']);
-}
-
-/// Parses a response body, assuming it's JSON-formatted.
-///
-/// Throws a user-friendly error if the response body is invalid JSON, or if
-/// it's not a map.
-Map parseJsonResponse(http.Response response) {
-  var value;
-  try {
-    value = JSON.decode(response.body);
-  } on FormatException {
-    invalidServerResponse(response);
-  }
-  if (value is! Map) invalidServerResponse(response);
-  return value;
-}
-
-/// Throws an error describing an invalid response from the server.
-void invalidServerResponse(http.Response response) =>
-  fail('Invalid server response:\n${response.body}');
-
-/// Exception thrown when an HTTP operation fails.
-class PubHttpException implements Exception {
-  final http.Response response;
-
-  const PubHttpException(this.response);
-
-  String toString() => 'HTTP error ${response.statusCode}: '
-      '${response.reasonPhrase}';
-}
diff --git a/sdk/lib/_internal/pub/lib/src/io.dart b/sdk/lib/_internal/pub/lib/src/io.dart
deleted file mode 100644
index 687157a..0000000
--- a/sdk/lib/_internal/pub/lib/src/io.dart
+++ /dev/null
@@ -1,1019 +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.
-
-/// Helper functionality to make working with IO easier.
-library pub.io;
-
-import 'dart:async';
-import 'dart:collection';
-import 'dart:convert';
-import 'dart:io';
-
-import 'package:path/path.dart' as path;
-import 'package:pool/pool.dart';
-import 'package:http/http.dart' show ByteStream;
-import 'package:http_multi_server/http_multi_server.dart';
-import 'package:stack_trace/stack_trace.dart';
-
-import 'exit_codes.dart' as exit_codes;
-import 'exceptions.dart';
-import 'error_group.dart';
-import 'log.dart' as log;
-import 'sdk.dart' as sdk;
-import 'utils.dart';
-
-export 'package:http/http.dart' show ByteStream;
-
-/// The pool used for restricting access to asynchronous operations that consume
-/// file descriptors.
-///
-/// The maximum number of allocated descriptors is based on empirical tests that
-/// indicate that beyond 32, additional file reads don't provide substantial
-/// additional throughput.
-final _descriptorPool = new Pool(32);
-
-/// Determines if a file or directory exists at [path].
-bool entryExists(String path) =>
-  dirExists(path) || fileExists(path) || linkExists(path);
-
-/// Returns whether [link] exists on the file system.
-///
-/// This returns `true` for any symlink, regardless of what it points at or
-/// whether it's broken.
-bool linkExists(String link) => new Link(link).existsSync();
-
-/// Returns whether [file] exists on the file system.
-///
-/// This returns `true` for a symlink only if that symlink is unbroken and
-/// points to a file.
-bool fileExists(String file) => new File(file).existsSync();
-
-/// Returns the canonical path for [pathString].
-///
-/// This is the normalized, absolute path, with symlinks resolved. As in
-/// [transitiveTarget], broken or recursive symlinks will not be fully resolved.
-///
-/// This doesn't require [pathString] to point to a path that exists on the
-/// filesystem; nonexistent or unreadable path entries are treated as normal
-/// directories.
-String canonicalize(String pathString) {
-  var seen = new Set<String>();
-  var components = new Queue<String>.from(
-      path.split(path.normalize(path.absolute(pathString))));
-
-  // The canonical path, built incrementally as we iterate through [components].
-  var newPath = components.removeFirst();
-
-  // Move through the components of the path, resolving each one's symlinks as
-  // necessary. A resolved component may also add new components that need to be
-  // resolved in turn.
-  while (!components.isEmpty) {
-    seen.add(path.join(newPath, path.joinAll(components)));
-    var resolvedPath = resolveLink(
-        path.join(newPath, components.removeFirst()));
-    var relative = path.relative(resolvedPath, from: newPath);
-
-    // If the resolved path of the component relative to `newPath` is just ".",
-    // that means component was a symlink pointing to its parent directory. We
-    // can safely ignore such components.
-    if (relative == '.') continue;
-
-    var relativeComponents = new Queue<String>.from(path.split(relative));
-
-    // If the resolved path is absolute relative to `newPath`, that means it's
-    // on a different drive. We need to canonicalize the entire target of that
-    // symlink again.
-    if (path.isAbsolute(relative)) {
-      // If we've already tried to canonicalize the new path, we've encountered
-      // a symlink loop. Avoid going infinite by treating the recursive symlink
-      // as the canonical path.
-      if (seen.contains(relative)) {
-        newPath = relative;
-      } else {
-        newPath = relativeComponents.removeFirst();
-        relativeComponents.addAll(components);
-        components = relativeComponents;
-      }
-      continue;
-    }
-
-    // Pop directories off `newPath` if the component links upwards in the
-    // directory hierarchy.
-    while (relativeComponents.first == '..') {
-      newPath = path.dirname(newPath);
-      relativeComponents.removeFirst();
-    }
-
-    // If there's only one component left, [resolveLink] guarantees that it's
-    // not a link (or is a broken link). We can just add it to `newPath` and
-    // continue resolving the remaining components.
-    if (relativeComponents.length == 1) {
-      newPath = path.join(newPath, relativeComponents.single);
-      continue;
-    }
-
-    // If we've already tried to canonicalize the new path, we've encountered a
-    // symlink loop. Avoid going infinite by treating the recursive symlink as
-    // the canonical path.
-    var newSubPath = path.join(newPath, path.joinAll(relativeComponents));
-    if (seen.contains(newSubPath)) {
-      newPath = newSubPath;
-      continue;
-    }
-
-    // If there are multiple new components to resolve, add them to the
-    // beginning of the queue.
-    relativeComponents.addAll(components);
-    components = relativeComponents;
-  }
-  return newPath;
-}
-
-/// Returns the transitive target of [link] (if A links to B which links to C,
-/// this will return C).
-///
-/// If [link] is part of a symlink loop (e.g. A links to B which links back to
-/// A), this returns the path to the first repeated link (so
-/// `transitiveTarget("A")` would return `"A"` and `transitiveTarget("A")` would
-/// return `"B"`).
-///
-/// This accepts paths to non-links or broken links, and returns them as-is.
-String resolveLink(String link) {
-  var seen = new Set<String>();
-  while (linkExists(link) && !seen.contains(link)) {
-    seen.add(link);
-    link = path.normalize(path.join(
-        path.dirname(link), new Link(link).targetSync()));
-  }
-  return link;
-}
-
-/// Reads the contents of the text file [file].
-String readTextFile(String file) =>
-    new File(file).readAsStringSync(encoding: UTF8);
-
-/// Reads the contents of the binary file [file].
-List<int> readBinaryFile(String file) {
-  log.io("Reading binary file $file.");
-  var contents = new File(file).readAsBytesSync();
-  log.io("Read ${contents.length} bytes from $file.");
-  return contents;
-}
-
-/// Creates [file] and writes [contents] to it.
-///
-/// If [dontLogContents] is true, the contents of the file will never be logged.
-String writeTextFile(String file, String contents,
-  {bool dontLogContents: false}) {
-  // Sanity check: don't spew a huge file.
-  log.io("Writing ${contents.length} characters to text file $file.");
-  if (!dontLogContents && contents.length < 1024 * 1024) {
-    log.fine("Contents:\n$contents");
-  }
-
-  new File(file).writeAsStringSync(contents);
-  return file;
-}
-
-/// Creates [file] and writes [contents] to it.
-String writeBinaryFile(String file, List<int> contents) {
-  log.io("Writing ${contents.length} bytes to binary file $file.");
-  new File(file).openSync(mode: FileMode.WRITE)
-      ..writeFromSync(contents)
-      ..closeSync();
-  log.fine("Wrote text file $file.");
-  return file;
-}
-
-/// Writes [stream] to a new file at path [file].
-///
-/// Replaces any file already at that path. Completes when the file is done
-/// being written.
-Future<String> createFileFromStream(Stream<List<int>> stream, String file) {
-  // TODO(nweiz): remove extra logging when we figure out the windows bot issue.
-  log.io("Creating $file from stream.");
-
-  return _descriptorPool.withResource(() {
-    return stream.pipe(new File(file).openWrite()).then((_) {
-      log.fine("Created $file from stream.");
-      return file;
-    });
-  });
-}
-
-/// Copies all files in [files] to the directory [destination].
-///
-/// Their locations in [destination] will be determined by their relative
-/// location to [baseDir]. Any existing files at those paths will be
-/// overwritten.
-void copyFiles(Iterable<String> files, String baseDir, String destination) {
-  for (var file in files) {
-    var newPath = path.join(destination, path.relative(file, from: baseDir));
-    ensureDir(path.dirname(newPath));
-    copyFile(file, newPath);
-  }
-}
-
-/// Copies a file from [source] to [destination].
-void copyFile(String source, String destination) {
-  writeBinaryFile(destination, readBinaryFile(source));
-}
-
-/// Creates a directory [dir].
-String createDir(String dir) {
-  new Directory(dir).createSync();
-  return dir;
-}
-
-/// Ensures that [dir] and all its parent directories exist.
-///
-/// If they don't exist, creates them.
-String ensureDir(String dir) {
-  new Directory(dir).createSync(recursive: true);
-  return dir;
-}
-
-/// Creates a temp directory in [dir], whose name will be [prefix] with
-/// characters appended to it to make a unique name.
-///
-/// Returns the path of the created directory.
-String createTempDir(String base, String prefix) {
-  var tempDir = new Directory(base).createTempSync(prefix);
-  log.io("Created temp directory ${tempDir.path}");
-  return tempDir.path;
-}
-
-/// Creates a temp directory in the system temp directory, whose name will be
-/// 'pub_' with characters appended to it to make a unique name.
-///
-/// Returns the path of the created directory.
-String createSystemTempDir() {
-  var tempDir = Directory.systemTemp.createTempSync('pub_');
-  log.io("Created temp directory ${tempDir.path}");
-  return tempDir.path;
-}
-
-/// Lists the contents of [dir].
-///
-/// If [recursive] is `true`, lists subdirectory contents (defaults to `false`).
-/// If [includeHidden] is `true`, includes files and directories beginning with
-/// `.` (defaults to `false`). If [includeDirs] is `true`, includes directories
-/// as well as files (defaults to `true`).
-///
-/// [whiteList] is a list of hidden filenames to include even when
-/// [includeHidden] is `false`.
-///
-/// Note that dart:io handles recursive symlinks in an unfortunate way. You
-/// end up with two copies of every entity that is within the recursive loop.
-/// We originally had our own directory list code that addressed that, but it
-/// had a noticeable performance impact. In the interest of speed, we'll just
-/// live with that annoying behavior.
-///
-/// The returned paths are guaranteed to begin with [dir]. Broken symlinks won't
-/// be returned.
-List<String> listDir(String dir, {bool recursive: false,
-    bool includeHidden: false, bool includeDirs: true,
-    Iterable<String> whitelist}) {
-  if (whitelist == null) whitelist = [];
-  var whitelistFilter = createFileFilter(whitelist);
-
-  // This is used in some performance-sensitive paths and can list many, many
-  // files. As such, it leans more havily towards optimization as opposed to
-  // readability than most code in pub. In particular, it avoids using the path
-  // package, since re-parsing a path is very expensive relative to string
-  // operations.
-  return new Directory(dir).listSync(
-      recursive: recursive, followLinks: true).where((entity) {
-    if (!includeDirs && entity is Directory) return false;
-    if (entity is Link) return false;
-    if (includeHidden) return true;
-
-    // Using substring here is generally problematic in cases where dir has one
-    // or more trailing slashes. If you do listDir("foo"), you'll get back
-    // paths like "foo/bar". If you do listDir("foo/"), you'll get "foo/bar"
-    // (note the trailing slash was dropped. If you do listDir("foo//"), you'll
-    // get "foo//bar".
-    //
-    // This means if you strip off the prefix, the resulting string may have a
-    // leading separator (if the prefix did not have a trailing one) or it may
-    // not. However, since we are only using the results of that to call
-    // contains() on, the leading separator is harmless.
-    assert(entity.path.startsWith(dir));
-    var pathInDir = entity.path.substring(dir.length);
-
-    // If the basename is whitelisted, don't count its "/." as making the file
-    // hidden.
-    var whitelistedBasename = whitelistFilter.firstWhere(pathInDir.contains,
-        orElse: () => null);
-    if (whitelistedBasename != null) {
-      pathInDir = pathInDir.substring(
-          0, pathInDir.length - whitelistedBasename.length);
-    }
-
-    if (pathInDir.contains("/.")) return false;
-    if (Platform.operatingSystem != "windows") return true;
-    return !pathInDir.contains("\\.");
-  }).map((entity) => entity.path).toList();
-}
-
-/// Returns whether [dir] exists on the file system.
-///
-/// This returns `true` for a symlink only if that symlink is unbroken and
-/// points to a directory.
-bool dirExists(String dir) => new Directory(dir).existsSync();
-
-/// Tries to resiliently perform [operation].
-///
-/// Some file system operations can intermittently fail on Windows because
-/// other processes are locking a file. We've seen this with virus scanners
-/// when we try to delete or move something while it's being scanned. To
-/// mitigate that, on Windows, this will retry the operation a few times if it
-/// fails.
-void _attempt(String description, void operation()) {
-  if (Platform.operatingSystem != 'windows') {
-    operation();
-    return;
-  }
-
-  getErrorReason(error) {
-    if (error.osError.errorCode == 5) {
-      return "access was denied";
-    }
-
-    if (error.osError.errorCode == 32) {
-      return "it was in use by another process";
-    }
-
-    return null;
-  }
-
-  for (var i = 0; i < 2; i++) {
-    try {
-      operation();
-      return;
-    } on FileSystemException catch (error) {
-      var reason = getErrorReason(error);
-      if (reason == null) rethrow;
-
-      log.io("Failed to $description because $reason. "
-          "Retrying in 50ms.");
-      sleep(new Duration(milliseconds: 50));
-    }
-  }
-
-  try {
-    operation();
-  } on FileSystemException catch (error) {
-    var reason = getErrorReason(error);
-    if (reason == null) rethrow;
-
-    fail("Failed to $description because $reason.\n"
-        "This may be caused by a virus scanner or having a file\n"
-        "in the directory open in another application.");
-  }
-}
-
-/// Deletes whatever's at [path], whether it's a file, directory, or symlink.
-///
-/// If it's a directory, it will be deleted recursively.
-void deleteEntry(String path) {
-  _attempt("delete entry", () {
-    if (linkExists(path)) {
-      log.io("Deleting link $path.");
-      new Link(path).deleteSync();
-    } else if (dirExists(path)) {
-      log.io("Deleting directory $path.");
-      new Directory(path).deleteSync(recursive: true);
-    } else if (fileExists(path)) {
-      log.io("Deleting file $path.");
-      new File(path).deleteSync();
-    }
-  });
-}
-
-/// Attempts to delete whatever's at [path], but doesn't throw an exception if
-/// the deletion fails.
-void tryDeleteEntry(String path) {
-  try {
-    deleteEntry(path);
-  } catch (error, stackTrace) {
-    log.fine("Failed to delete $path: $error\n"
-        "${new Chain.forTrace(stackTrace)}");
-  }
-}
-
-/// "Cleans" [dir].
-///
-/// If that directory already exists, it is deleted. Then a new empty directory
-/// is created.
-void cleanDir(String dir) {
-  if (entryExists(dir)) deleteEntry(dir);
-  ensureDir(dir);
-}
-
-/// Renames (i.e. moves) the directory [from] to [to].
-void renameDir(String from, String to) {
-  _attempt("rename directory", () {
-    log.io("Renaming directory $from to $to.");
-    try {
-      new Directory(from).renameSync(to);
-    } on IOException {
-      // Ensure that [to] isn't left in an inconsistent state. See issue 12436.
-      if (entryExists(to)) deleteEntry(to);
-      rethrow;
-    }
-  });
-}
-
-/// Creates a new symlink at path [symlink] that points to [target].
-///
-/// Returns a [Future] which completes to the path to the symlink file.
-///
-/// If [relative] is true, creates a symlink with a relative path from the
-/// symlink to the target. Otherwise, uses the [target] path unmodified.
-///
-/// Note that on Windows, only directories may be symlinked to.
-void createSymlink(String target, String symlink,
-    {bool relative: false}) {
-  if (relative) {
-    // Relative junction points are not supported on Windows. Instead, just
-    // make sure we have a clean absolute path because it will interpret a
-    // relative path to be relative to the cwd, not the symlink, and will be
-    // confused by forward slashes.
-    if (Platform.operatingSystem == 'windows') {
-      target = path.normalize(path.absolute(target));
-    } else {
-      // If the directory where we're creating the symlink was itself reached
-      // by traversing a symlink, we want the relative path to be relative to
-      // it's actual location, not the one we went through to get to it.
-      var symlinkDir = canonicalize(path.dirname(symlink));
-      target = path.normalize(path.relative(target, from: symlinkDir));
-    }
-  }
-
-  log.fine("Creating $symlink pointing to $target");
-  new Link(symlink).createSync(target);
-}
-
-/// Creates a new symlink that creates an alias at [symlink] that points to the
-/// `lib` directory of package [target].
-///
-/// If [target] does not have a `lib` directory, this shows a warning if
-/// appropriate and then does nothing.
-///
-/// If [relative] is true, creates a symlink with a relative path from the
-/// symlink to the target. Otherwise, uses the [target] path unmodified.
-void createPackageSymlink(String name, String target, String symlink,
-    {bool isSelfLink: false, bool relative: false}) {
-  // See if the package has a "lib" directory. If not, there's nothing to
-  // symlink to.
-  target = path.join(target, 'lib');
-  if (!dirExists(target)) return;
-
-  log.fine("Creating ${isSelfLink ? "self" : ""}link for package '$name'.");
-  createSymlink(target, symlink, relative: relative);
-}
-
-/// Whether pub is running from within the Dart SDK, as opposed to from the Dart
-/// source repository.
-final bool runningFromSdk = Platform.script.path.endsWith('.snapshot');
-
-/// Resolves [target] relative to the path to pub's `asset` directory.
-String assetPath(String target) {
-  if (runningFromSdk) {
-    return path.join(
-        sdk.rootDirectory, 'lib', '_internal', 'pub', 'asset', target);
-  } else {
-    return path.join(pubRoot, 'asset', target);
-  }
-}
-
-/// Returns the path to the root of pub's sources in the Dart repo.
-String get pubRoot => path.join(repoRoot, 'sdk', 'lib', '_internal', 'pub');
-
-/// Returns the path to the root of the Dart repository.
-///
-/// This throws a [StateError] if it's called when running pub from the SDK.
-String get repoRoot {
-  if (runningFromSdk) {
-    throw new StateError("Can't get the repo root from the SDK.");
-  }
-
-  // Get the path to the directory containing this very file.
-  var libDir = path.dirname(libraryPath('pub.io'));
-
-  // Assume we're running directly from the source location in the repo:
-  //
-  //      <repo>/sdk/lib/_internal/pub/lib/src
-  return path.normalize(path.join(libDir, '..', '..', '..', '..', '..', '..'));
-}
-
-/// A line-by-line stream of standard input.
-final Stream<String> stdinLines = streamToLines(
-    new ByteStream(stdin).toStringStream());
-
-/// Displays a message and reads a yes/no confirmation from the user.
-///
-/// Returns a [Future] that completes to `true` if the user confirms or `false`
-/// if they do not.
-///
-/// This will automatically append " (y/n)?" to the message, so [message]
-/// should just be a fragment like, "Are you sure you want to proceed".
-Future<bool> confirm(String message) {
-  log.fine('Showing confirm message: $message');
-  if (runningAsTest) {
-    log.message("$message (y/n)?");
-  } else {
-    stdout.write(log.format("$message (y/n)? "));
-  }
-  return streamFirst(stdinLines)
-      .then((line) => new RegExp(r"^[yY]").hasMatch(line));
-}
-
-/// Reads and discards all output from [stream].
-///
-/// Returns a [Future] that completes when the stream is closed.
-Future drainStream(Stream stream) {
-  return stream.fold(null, (x, y) {});
-}
-
-/// Flushes the stdout and stderr streams, then exits the program with the given
-/// status code.
-///
-/// This returns a Future that will never complete, since the program will have
-/// exited already. This is useful to prevent Future chains from proceeding
-/// after you've decided to exit.
-Future flushThenExit(int status) {
-  return Future.wait([
-    stdout.close(),
-    stderr.close()
-  ]).then((_) => exit(status));
-}
-
-/// Returns a [EventSink] that pipes all data to [consumer] and a [Future] that
-/// will succeed when [EventSink] is closed or fail with any errors that occur
-/// while writing.
-Pair<EventSink, Future> consumerToSink(StreamConsumer consumer) {
-  var controller = new StreamController(sync: true);
-  var done = controller.stream.pipe(consumer);
-  return new Pair<EventSink, Future>(controller.sink, done);
-}
-
-// TODO(nweiz): remove this when issue 7786 is fixed.
-/// Pipes all data and errors from [stream] into [sink].
-///
-/// When [stream] is done, the returned [Future] is completed and [sink] is
-/// closed if [closeSink] is true.
-///
-/// When an error occurs on [stream], that error is passed to [sink]. If
-/// [cancelOnError] is true, [Future] will be completed successfully and no
-/// more data or errors will be piped from [stream] to [sink]. If
-/// [cancelOnError] and [closeSink] are both true, [sink] will then be
-/// closed.
-Future store(Stream stream, EventSink sink,
-    {bool cancelOnError: true, bool closeSink: true}) {
-  var completer = new Completer();
-  stream.listen(sink.add, onError: (e, stackTrace) {
-    sink.addError(e, stackTrace);
-    if (cancelOnError) {
-      completer.complete();
-      if (closeSink) sink.close();
-    }
-  }, onDone: () {
-    if (closeSink) sink.close();
-    completer.complete();
-  }, cancelOnError: cancelOnError);
-  return completer.future;
-}
-
-/// Spawns and runs the process located at [executable], passing in [args].
-///
-/// Returns a [Future] that will complete with the results of the process after
-/// it has ended.
-///
-/// The spawned process will inherit its parent's environment variables. If
-/// [environment] is provided, that will be used to augment (not replace) the
-/// the inherited variables.
-Future<PubProcessResult> runProcess(String executable, List<String> args,
-    {workingDir, Map<String, String> environment}) {
-  return _descriptorPool.withResource(() {
-    return _doProcess(Process.run, executable, args, workingDir, environment)
-        .then((result) {
-      var pubResult = new PubProcessResult(
-          result.stdout, result.stderr, result.exitCode);
-      log.processResult(executable, pubResult);
-      return pubResult;
-    });
-  });
-}
-
-/// Spawns the process located at [executable], passing in [args].
-///
-/// Returns a [Future] that will complete with the [Process] once it's been
-/// started.
-///
-/// The spawned process will inherit its parent's environment variables. If
-/// [environment] is provided, that will be used to augment (not replace) the
-/// the inherited variables.
-Future<PubProcess> startProcess(String executable, List<String> args,
-    {workingDir, Map<String, String> environment}) {
-  return _descriptorPool.request().then((resource) {
-    return _doProcess(Process.start, executable, args, workingDir, environment)
-        .then((ioProcess) {
-      var process = new PubProcess(ioProcess);
-      process.exitCode.whenComplete(resource.release);
-      return process;
-    });
-  });
-}
-
-/// Like [runProcess], but synchronous.
-PubProcessResult runProcessSync(String executable, List<String> args,
-        {String workingDir, Map<String, String> environment}) {
-  var result = _doProcess(
-      Process.runSync, executable, args, workingDir, environment);
-  var pubResult = new PubProcessResult(
-      result.stdout, result.stderr, result.exitCode);
-  log.processResult(executable, pubResult);
-  return pubResult;
-}
-
-/// A wrapper around [Process] that exposes `dart:async`-style APIs.
-class PubProcess {
-  /// The underlying `dart:io` [Process].
-  final Process _process;
-
-  /// The mutable field for [stdin].
-  EventSink<List<int>> _stdin;
-
-  /// The mutable field for [stdinClosed].
-  Future _stdinClosed;
-
-  /// The mutable field for [stdout].
-  ByteStream _stdout;
-
-  /// The mutable field for [stderr].
-  ByteStream _stderr;
-
-  /// The mutable field for [exitCode].
-  Future<int> _exitCode;
-
-  /// The sink used for passing data to the process's standard input stream.
-  ///
-  /// Errors on this stream are surfaced through [stdinClosed], [stdout],
-  /// [stderr], and [exitCode], which are all members of an [ErrorGroup].
-  EventSink<List<int>> get stdin => _stdin;
-
-  // TODO(nweiz): write some more sophisticated Future machinery so that this
-  // doesn't surface errors from the other streams/futures, but still passes its
-  // unhandled errors to them. Right now it's impossible to recover from a stdin
-  // error and continue interacting with the process.
-  /// A [Future] that completes when [stdin] is closed, either by the user or by
-  /// the process itself.
-  ///
-  /// This is in an [ErrorGroup] with [stdout], [stderr], and [exitCode], so any
-  /// error in process will be passed to it, but won't reach the top-level error
-  /// handler unless nothing has handled it.
-  Future get stdinClosed => _stdinClosed;
-
-  /// The process's standard output stream.
-  ///
-  /// This is in an [ErrorGroup] with [stdinClosed], [stderr], and [exitCode],
-  /// so any error in process will be passed to it, but won't reach the
-  /// top-level error handler unless nothing has handled it.
-  ByteStream get stdout => _stdout;
-
-  /// The process's standard error stream.
-  ///
-  /// This is in an [ErrorGroup] with [stdinClosed], [stdout], and [exitCode],
-  /// so any error in process will be passed to it, but won't reach the
-  /// top-level error handler unless nothing has handled it.
-  ByteStream get stderr => _stderr;
-
-  /// A [Future] that will complete to the process's exit code once the process
-  /// has finished running.
-  ///
-  /// This is in an [ErrorGroup] with [stdinClosed], [stdout], and [stderr], so
-  /// any error in process will be passed to it, but won't reach the top-level
-  /// error handler unless nothing has handled it.
-  Future<int> get exitCode => _exitCode;
-
-  /// Creates a new [PubProcess] wrapping [process].
-  PubProcess(Process process)
-    : _process = process {
-    var errorGroup = new ErrorGroup();
-
-    var pair = consumerToSink(process.stdin);
-    _stdin = pair.first;
-    _stdinClosed = errorGroup.registerFuture(pair.last);
-
-    _stdout = new ByteStream(
-        errorGroup.registerStream(process.stdout));
-    _stderr = new ByteStream(
-        errorGroup.registerStream(process.stderr));
-
-    var exitCodeCompleter = new Completer();
-    _exitCode = errorGroup.registerFuture(exitCodeCompleter.future);
-    _process.exitCode.then((code) => exitCodeCompleter.complete(code));
-  }
-
-  /// Sends [signal] to the underlying process.
-  bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]) =>
-    _process.kill(signal);
-}
-
-/// Calls [fn] with appropriately modified arguments.
-///
-/// [fn] should have the same signature as [Process.start], except that the
-/// returned value may have any return type.
-_doProcess(Function fn, String executable, List<String> args,
-    String workingDir, Map<String, String> environment) {
-  // TODO(rnystrom): Should dart:io just handle this?
-  // Spawning a process on Windows will not look for the executable in the
-  // system path. So, if executable looks like it needs that (i.e. it doesn't
-  // have any path separators in it), then spawn it through a shell.
-  if ((Platform.operatingSystem == "windows") &&
-      (executable.indexOf('\\') == -1)) {
-    args = flatten(["/c", executable, args]);
-    executable = "cmd";
-  }
-
-  log.process(executable, args, workingDir == null ? '.' : workingDir);
-
-  return fn(executable, args,
-      workingDirectory: workingDir,
-      environment: environment);
-}
-
-/// Wraps [input], an asynchronous network operation to provide a timeout.
-///
-/// If [input] completes before [milliseconds] have passed, then the return
-/// value completes in the same way. However, if [milliseconds] pass before
-/// [input] has completed, it completes with a [TimeoutException] with
-/// [description] (which should be a fragment describing the action that timed
-/// out).
-///
-/// [url] is the URL being accessed asynchronously.
-///
-/// Note that timing out will not cancel the asynchronous operation behind
-/// [input].
-Future timeout(Future input, int milliseconds, Uri url, String description) {
-  // TODO(nwiez): Replace this with [Future.timeout].
-  var completer = new Completer();
-  var duration = new Duration(milliseconds: milliseconds);
-  var timer = new Timer(duration, () {
-    // Include the duration ourselves in the message instead of passing it to
-    // TimeoutException since we show nicer output.
-    var message = 'Timed out after ${niceDuration(duration)} while '
-                  '$description.';
-
-    if (url.host == "pub.dartlang.org" ||
-        url.host == "storage.googleapis.com") {
-      message += "\nThis is likely a transient error. Please try again later.";
-    }
-
-    completer.completeError(new TimeoutException(message), new Chain.current());
-  });
-  input.then((value) {
-    if (completer.isCompleted) return;
-    timer.cancel();
-    completer.complete(value);
-  }).catchError((e, stackTrace) {
-    if (completer.isCompleted) return;
-    timer.cancel();
-    completer.completeError(e, stackTrace);
-  });
-  return completer.future;
-}
-
-/// Creates a temporary directory and passes its path to [fn].
-///
-/// Once the [Future] returned by [fn] completes, the temporary directory and
-/// all its contents are deleted. [fn] can also return `null`, in which case
-/// the temporary directory is deleted immediately afterwards.
-///
-/// Returns a future that completes to the value that the future returned from
-/// [fn] completes to.
-Future withTempDir(Future fn(String path)) {
-  return new Future.sync(() {
-    var tempDir = createSystemTempDir();
-    return new Future.sync(() => fn(tempDir))
-        .whenComplete(() => deleteEntry(tempDir));
-  });
-}
-
-/// Binds an [HttpServer] to [host] and [port].
-///
-/// If [host] is "localhost", this will automatically listen on both the IPv4
-/// and IPv6 loopback addresses.
-Future<HttpServer> bindServer(String host, int port) {
-  if (host == 'localhost') return HttpMultiServer.loopback(port);
-  return HttpServer.bind(host, port);
-}
-
-/// Extracts a `.tar.gz` file from [stream] to [destination].
-///
-/// Returns whether or not the extraction was successful.
-Future<bool> extractTarGz(Stream<List<int>> stream, String destination) {
-  log.fine("Extracting .tar.gz stream to $destination.");
-
-  if (Platform.operatingSystem == "windows") {
-    return _extractTarGzWindows(stream, destination);
-  }
-
-  var args = ["--extract", "--gunzip", "--directory", destination];
-  if (_noUnknownKeyword) {
-    // BSD tar (the default on OS X) can insert strange headers to a tarfile
-    // that GNU tar (the default on Linux) is unable to understand. This will
-    // cause GNU tar to emit a number of harmless but scary-looking warnings
-    // which are silenced by this flag.
-    args.insert(0, "--warning=no-unknown-keyword");
-  }
-
-  return startProcess("tar", args).then((process) {
-    // Ignore errors on process.std{out,err}. They'll be passed to
-    // process.exitCode, and we don't want them being top-levelled by
-    // std{out,err}Sink.
-    store(process.stdout.handleError((_) {}), stdout, closeSink: false);
-    store(process.stderr.handleError((_) {}), stderr, closeSink: false);
-    return Future.wait([
-      store(stream, process.stdin),
-      process.exitCode
-    ]);
-  }).then((results) {
-    var exitCode = results[1];
-    if (exitCode != exit_codes.SUCCESS) {
-      throw new Exception("Failed to extract .tar.gz stream to $destination "
-          "(exit code $exitCode).");
-    }
-    log.fine("Extracted .tar.gz stream to $destination. Exit code $exitCode.");
-  });
-}
-
-/// Whether to include "--warning=no-unknown-keyword" when invoking tar.
-///
-/// This flag quiets warnings that come from opening OS X-generated tarballs on
-/// Linux, but only GNU tar >= 1.26 supports it.
-final bool _noUnknownKeyword = _computeNoUnknownKeyword();
-bool _computeNoUnknownKeyword() {
-  if (!Platform.isLinux) return false;
-  var result = Process.runSync("tar", ["--version"]);
-  if (result.exitCode != 0) {
-    throw new ApplicationException(
-        "Failed to run tar (exit code ${result.exitCode}):\n${result.stderr}");
-  }
-
-  var match = new RegExp(r"^tar \(GNU tar\) (\d+).(\d+)\n")
-      .firstMatch(result.stdout);
-  if (match == null) return false;
-
-  var major = int.parse(match[1]);
-  var minor = int.parse(match[2]);
-  return major >= 2 || (major == 1 && minor >= 23);
-}
-
-String get pathTo7zip {
-  if (runningFromSdk) return assetPath(path.join('7zip', '7za.exe'));
-  return path.join(repoRoot, 'third_party', '7zip', '7za.exe');
-}
-
-Future<bool> _extractTarGzWindows(Stream<List<int>> stream,
-    String destination) {
-  // TODO(rnystrom): In the repo's history, there is an older implementation of
-  // this that does everything in memory by piping streams directly together
-  // instead of writing out temp files. The code is simpler, but unfortunately,
-  // 7zip seems to periodically fail when we invoke it from Dart and tell it to
-  // read from stdin instead of a file. Consider resurrecting that version if
-  // we can figure out why it fails.
-
-  return withTempDir((tempDir) {
-    // Write the archive to a temp file.
-    var dataFile = path.join(tempDir, 'data.tar.gz');
-    return createFileFromStream(stream, dataFile).then((_) {
-      // 7zip can't unarchive from gzip -> tar -> destination all in one step
-      // first we un-gzip it to a tar file.
-      // Note: Setting the working directory instead of passing in a full file
-      // path because 7zip says "A full path is not allowed here."
-      return runProcess(pathTo7zip, ['e', 'data.tar.gz'], workingDir: tempDir);
-    }).then((result) {
-      if (result.exitCode != exit_codes.SUCCESS) {
-        throw new Exception('Could not un-gzip (exit code ${result.exitCode}). '
-                'Error:\n'
-            '${result.stdout.join("\n")}\n'
-            '${result.stderr.join("\n")}');
-      }
-
-      // Find the tar file we just created since we don't know its name.
-      var tarFile = listDir(tempDir).firstWhere(
-          (file) => path.extension(file) == '.tar',
-          orElse: () {
-        throw new FormatException('The gzip file did not contain a tar file.');
-      });
-
-      // Untar the archive into the destination directory.
-      return runProcess(pathTo7zip, ['x', tarFile], workingDir: destination);
-    }).then((result) {
-      if (result.exitCode != exit_codes.SUCCESS) {
-        throw new Exception('Could not un-tar (exit code ${result.exitCode}). '
-                'Error:\n'
-            '${result.stdout.join("\n")}\n'
-            '${result.stderr.join("\n")}');
-      }
-      return true;
-    });
-  });
-}
-
-/// Create a .tar.gz archive from a list of entries.
-///
-/// Each entry can be a [String], [Directory], or [File] object. The root of
-/// the archive is considered to be [baseDir], which defaults to the current
-/// working directory.
-///
-/// Returns a [ByteStream] that emits the contents of the archive.
-ByteStream createTarGz(List contents, {baseDir}) {
-  return new ByteStream(futureStream(new Future.sync(() async {
-    var buffer = new StringBuffer();
-    buffer.write('Creating .tag.gz stream containing:\n');
-    contents.forEach((file) => buffer.write('$file\n'));
-    log.fine(buffer.toString());
-
-    if (baseDir == null) baseDir = path.current;
-    baseDir = path.absolute(baseDir);
-    contents = contents.map((entry) {
-      entry = path.absolute(entry);
-      if (!path.isWithin(baseDir, entry)) {
-        throw new ArgumentError('Entry $entry is not inside $baseDir.');
-      }
-      return path.relative(entry, from: baseDir);
-    }).toList();
-
-    if (Platform.operatingSystem != "windows") {
-      var args = [
-        "--create",
-        "--gzip",
-        "--directory",
-        baseDir,
-        "--files-from",
-        "/dev/stdin"
-      ];
-
-      var process = await startProcess("tar", args);
-      process.stdin.add(UTF8.encode(contents.join("\n")));
-      process.stdin.close();
-      return process.stdout;
-    }
-
-    // Don't use [withTempDir] here because we don't want to delete the temp
-    // directory until the returned stream has closed.
-    var tempDir = createSystemTempDir();
-
-    try {
-      // Create the file containing the list of files to compress.
-      var contentsPath = path.join(tempDir, "files.txt");
-      writeTextFile(contentsPath, contents.join("\n"));
-
-      // Create the tar file.
-      var tarFile = path.join(tempDir, "intermediate.tar");
-      var args = ["a", "-w$baseDir", tarFile, "@$contentsPath"];
-
-      // We're passing 'baseDir' both as '-w' and setting it as the working
-      // directory explicitly here intentionally. The former ensures that the
-      // files added to the archive have the correct relative path in the
-      // archive. The latter enables relative paths in the "-i" args to be
-      // resolved.
-      await runProcess(pathTo7zip, args, workingDir: baseDir);
-
-      // GZIP it. 7zip doesn't support doing both as a single operation.
-      // Send the output to stdout.
-      args = ["a", "unused", "-tgzip", "-so", tarFile];
-      return (await startProcess(pathTo7zip, args))
-          .stdout
-          .transform(onDoneTransformer(() => deleteEntry(tempDir)));
-    } catch (_) {
-      deleteEntry(tempDir);
-      rethrow;
-    }
-  })));
-}
-
-/// Contains the results of invoking a [Process] and waiting for it to complete.
-class PubProcessResult {
-  final List<String> stdout;
-  final List<String> stderr;
-  final int exitCode;
-
-  PubProcessResult(String stdout, String stderr, this.exitCode)
-      : this.stdout = _toLines(stdout),
-        this.stderr = _toLines(stderr);
-
-  // TODO(rnystrom): Remove this and change to returning one string.
-  static List<String> _toLines(String output) {
-    var lines = splitLines(output);
-    if (!lines.isEmpty && lines.last == "") lines.removeLast();
-    return lines;
-  }
-
-  bool get success => exitCode == exit_codes.SUCCESS;
-}
diff --git a/sdk/lib/_internal/pub/lib/src/lock_file.dart b/sdk/lib/_internal/pub/lib/src/lock_file.dart
deleted file mode 100644
index 99b2332..0000000
--- a/sdk/lib/_internal/pub/lib/src/lock_file.dart
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.lock_file;
-
-import 'package:path/path.dart' as p;
-import 'package:pub_semver/pub_semver.dart';
-import 'package:source_span/source_span.dart';
-import 'package:yaml/yaml.dart';
-
-import 'io.dart';
-import 'package.dart';
-import 'source_registry.dart';
-import 'utils.dart';
-
-/// A parsed and validated `pubspec.lock` file.
-class LockFile {
-  /// The packages this lockfile pins.
-  Map<String, PackageId> packages;
-
-  /// Creates a new lockfile containing [ids].
-  factory LockFile(List<PackageId> ids) {
-    var lockFile = new LockFile.empty();
-    for (var id in ids) {
-      if (!id.isRoot) lockFile.packages[id.name] = id;
-    }
-
-    return lockFile;
-  }
-
-  LockFile._(this.packages);
-
-  LockFile.empty()
-    : packages = <String, PackageId>{};
-
-  /// Loads a lockfile from [filePath].
-  factory LockFile.load(String filePath, SourceRegistry sources) {
-    return LockFile._parse(filePath, readTextFile(filePath), sources);
-  }
-
-  /// Parses a lockfile whose text is [contents].
-  factory LockFile.parse(String contents, SourceRegistry sources) {
-    return LockFile._parse(null, contents, sources);
-  }
-
-  /// Parses the lockfile whose text is [contents].
-  ///
-  /// [filePath] is the system-native path to the lockfile on disc. It may be
-  /// `null`.
-  static LockFile _parse(String filePath, String contents,
-      SourceRegistry sources) {
-    var packages = <String, PackageId>{};
-
-    if (contents.trim() == '') return new LockFile.empty();
-
-    var sourceUrl;
-    if (filePath != null) sourceUrl = p.toUri(filePath);
-    var parsed = loadYamlNode(contents, sourceUrl: sourceUrl);
-
-    _validate(parsed is Map, 'The lockfile must be a YAML mapping.', parsed);
-
-    var packageEntries = parsed['packages'];
-    if (packageEntries != null) {
-      _validate(packageEntries is Map, 'The "packages" field must be a map.',
-          parsed.nodes['packages']);
-
-      packageEntries.forEach((name, spec) {
-        // Parse the version.
-        _validate(spec.containsKey('version'),
-            'Package $name is missing a version.', spec);
-        var version = new Version.parse(spec['version']);
-
-        // Parse the source.
-        _validate(spec.containsKey('source'),
-            'Package $name is missing a source.', spec);
-        var sourceName = spec['source'];
-
-        _validate(spec.containsKey('description'),
-            'Package $name is missing a description.', spec);
-        var description = spec['description'];
-
-        // Let the source parse the description.
-        var source = sources[sourceName];
-        try {
-          description = source.parseDescription(filePath, description,
-              fromLockFile: true);
-        } on FormatException catch (ex) {
-          throw new SourceSpanFormatException(ex.message,
-              spec.nodes['source'].span);
-        }
-
-        var id = new PackageId(name, sourceName, version, description);
-
-        // Validate the name.
-        _validate(name == id.name,
-            "Package name $name doesn't match ${id.name}.", spec);
-
-        packages[name] = id;
-      });
-    }
-
-    return new LockFile._(packages);
-  }
-
-  /// If [condition] is `false` throws a format error with [message] for [node].
-  static void _validate(bool condition, String message, YamlNode node) {
-    if (condition) return;
-    throw new SourceSpanFormatException(message, node.span);
-  }
-
-  /// Returns the serialized YAML text of the lock file.
-  ///
-  /// [packageDir] is the containing directory of the root package, used to
-  /// properly serialize package descriptions.
-  String serialize(String packageDir, SourceRegistry sources) {
-    // Convert the dependencies to a simple object.
-    var data = {};
-    packages.forEach((name, package) {
-      var description = sources[package.source].serializeDescription(packageDir,
-          package.description);
-
-      data[name] = {
-        'version': package.version.toString(),
-        'source': package.source,
-        'description': description
-      };
-    });
-
-    return """
-# Generated by pub
-# See http://pub.dartlang.org/doc/glossary.html#lockfile
-${yamlToString({'packages': data})}
-""";
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/log.dart b/sdk/lib/_internal/pub/lib/src/log.dart
deleted file mode 100644
index 0b14ab3..0000000
--- a/sdk/lib/_internal/pub/lib/src/log.dart
+++ /dev/null
@@ -1,547 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// Message logging.
-library pub.log;
-
-import 'dart:async';
-import 'dart:convert';
-import 'dart:io';
-
-import 'package:args/command_runner.dart';
-import 'package:path/path.dart' as p;
-import 'package:source_span/source_span.dart';
-import 'package:stack_trace/stack_trace.dart';
-
-import 'exceptions.dart';
-import 'io.dart';
-import 'progress.dart';
-import 'transcript.dart';
-import 'utils.dart';
-
-/// The singleton instance so that we can have a nice api like:
-///
-///     log.json.error(...);
-final json = new _JsonLogger();
-
-/// The current logging verbosity.
-Verbosity verbosity = Verbosity.NORMAL;
-
-/// Whether or not to log entries with prejudice.
-bool withPrejudice = false;
-
-/// In cases where there's a ton of log spew, make sure we don't eat infinite
-/// memory.
-///
-/// This can occur when the backtracking solver stumbles into a pathological
-/// dependency graph. It generally will find a solution, but it may log
-/// thousands and thousands of entries to get there.
-const _MAX_TRANSCRIPT = 10000;
-
-/// The list of recorded log messages. Will only be recorded if
-/// [recordTranscript()] is called.
-Transcript<Entry> _transcript;
-
-/// The currently-animated progress indicator, if any.
-///
-/// This will also be in [_progresses].
-Progress _animatedProgress;
-
-final _cyan = getSpecial('\u001b[36m');
-final _green = getSpecial('\u001b[32m');
-final _magenta = getSpecial('\u001b[35m');
-final _red = getSpecial('\u001b[31m');
-final _yellow = getSpecial('\u001b[33m');
-final _gray = getSpecial('\u001b[1;30m');
-final _none = getSpecial('\u001b[0m');
-final _noColor = getSpecial('\u001b[39m');
-final _bold = getSpecial('\u001b[1m');
-
-/// An enum type for defining the different logging levels a given message can
-/// be associated with.
-///
-/// By default, [ERROR] and [WARNING] messages are printed to sterr. [MESSAGE]
-/// messages are printed to stdout, and others are ignored.
-class Level {
-  /// An error occurred and an operation could not be completed.
-  ///
-  /// Usually shown to the user on stderr.
-  static const ERROR = const Level._("ERR ");
-
-  /// Something unexpected happened, but the program was able to continue,
-  /// though possibly in a degraded fashion.
-  static const WARNING = const Level._("WARN");
-
-  /// A message intended specifically to be shown to the user.
-  static const MESSAGE = const Level._("MSG ");
-
-  /// Some interaction with the external world occurred, such as a network
-  /// operation, process spawning, or file IO.
-  static const IO = const Level._("IO  ");
-
-  /// Incremental output during pub's version constraint solver.
-  static const SOLVER = const Level._("SLVR");
-
-  /// Fine-grained and verbose additional information.
-  ///
-  /// Used to provide program state context for other logs (such as what pub
-  /// was doing when an IO operation occurred) or just more detail for an
-  /// operation.
-  static const FINE = const Level._("FINE");
-
-  const Level._(this.name);
-  final String name;
-
-  String toString() => name;
-}
-
-typedef _LogFn(Entry entry);
-
-/// An enum type to control which log levels are displayed and how they are
-/// displayed.
-class Verbosity {
-  /// Silence all logging.
-  static const NONE = const Verbosity._("none", const {
-    Level.ERROR:   null,
-    Level.WARNING: null,
-    Level.MESSAGE: null,
-    Level.IO:      null,
-    Level.SOLVER:  null,
-    Level.FINE:    null
-  });
-
-  /// Shows only errors and warnings.
-  static const WARNING = const Verbosity._("warning", const {
-    Level.ERROR:   _logToStderr,
-    Level.WARNING: _logToStderr,
-    Level.MESSAGE: null,
-    Level.IO:      null,
-    Level.SOLVER:  null,
-    Level.FINE:    null
-  });
-
-  /// The default verbosity which shows errors, warnings, and messages.
-  static const NORMAL = const Verbosity._("normal", const {
-    Level.ERROR:   _logToStderr,
-    Level.WARNING: _logToStderr,
-    Level.MESSAGE: _logToStdout,
-    Level.IO:      null,
-    Level.SOLVER:  null,
-    Level.FINE:    null
-  });
-
-  /// Shows errors, warnings, messages, and IO event logs.
-  static const IO = const Verbosity._("io", const {
-    Level.ERROR:   _logToStderrWithLabel,
-    Level.WARNING: _logToStderrWithLabel,
-    Level.MESSAGE: _logToStdoutWithLabel,
-    Level.IO:      _logToStderrWithLabel,
-    Level.SOLVER:  null,
-    Level.FINE:    null
-  });
-
-  /// Shows errors, warnings, messages, and version solver logs.
-  static const SOLVER = const Verbosity._("solver", const {
-    Level.ERROR:   _logToStderr,
-    Level.WARNING: _logToStderr,
-    Level.MESSAGE: _logToStdout,
-    Level.IO:      null,
-    Level.SOLVER:  _logToStdout,
-    Level.FINE:    null
-  });
-
-  /// Shows all logs.
-  static const ALL = const Verbosity._("all", const {
-    Level.ERROR:   _logToStderrWithLabel,
-    Level.WARNING: _logToStderrWithLabel,
-    Level.MESSAGE: _logToStdoutWithLabel,
-    Level.IO:      _logToStderrWithLabel,
-    Level.SOLVER:  _logToStderrWithLabel,
-    Level.FINE:    _logToStderrWithLabel
-  });
-
-  const Verbosity._(this.name, this._loggers);
-  final String name;
-  final Map<Level, _LogFn> _loggers;
-
-  /// Returns whether or not logs at [level] will be printed.
-  bool isLevelVisible(Level level) => _loggers[level] != null;
-
-  String toString() => name;
-}
-
-/// A single log entry.
-class Entry {
-  final Level level;
-  final List<String> lines;
-
-  Entry(this.level, this.lines);
-}
-
-/// Logs [message] at [Level.ERROR].
-///
-/// If [error] is passed, it's appended to [message]. If [trace] is passed, it's
-/// printed at log level fine.
-void error(message, [error, StackTrace trace]) {
-  if (error != null) {
-    message = "$message: $error";
-    if (error is Error && trace == null) trace = error.stackTrace;
-  }
-  write(Level.ERROR, message);
-  if (trace != null) write(Level.FINE, new Chain.forTrace(trace));
-}
-
-/// Logs [message] at [Level.WARNING].
-void warning(message) => write(Level.WARNING, message);
-
-/// Logs [message] at [Level.MESSAGE].
-void message(message) => write(Level.MESSAGE, message);
-
-/// Logs [message] at [Level.IO].
-void io(message) => write(Level.IO, message);
-
-/// Logs [message] at [Level.SOLVER].
-void solver(message) => write(Level.SOLVER, message);
-
-/// Logs [message] at [Level.FINE].
-void fine(message) => write(Level.FINE, message);
-
-/// Logs [message] at [level].
-void write(Level level, message) {
-  message = message.toString();
-  var lines = splitLines(message);
-
-  // Discard a trailing newline. This is useful since StringBuffers often end
-  // up with an extra newline at the end from using [writeln].
-  if (lines.isNotEmpty && lines.last == "") {
-    lines.removeLast();
-  }
-
-  var entry = new Entry(level, lines.map(format).toList());
-
-  var logFn = verbosity._loggers[level];
-  if (logFn != null) logFn(entry);
-
-  if (_transcript != null) _transcript.add(entry);
-}
-
-final _capitalizedAnsiEscape = new RegExp(r'\u001b\[\d+(;\d+)?M');
-
-/// Returns [string] formatted as it would be if it were logged.
-String format(String string) {
-  if (!withPrejudice) return string;
-
-  // [toUpperCase] can corrupt terminal colorings, so fix them up using
-  // [replaceAllMapped].
-  string = string.toUpperCase().replaceAllMapped(_capitalizedAnsiEscape,
-      (match) => match[0].toLowerCase());
-
-  // Don't use [bold] because it's disabled under [withPrejudice].
-  return "$_bold$string$_none";
-}
-
-/// Logs an asynchronous IO operation.
-///
-/// Logs [startMessage] before the operation starts, then when [operation]
-/// completes, invokes [endMessage] with the completion value and logs the
-/// result of that. Returns a future that completes after the logging is done.
-///
-/// If [endMessage] is omitted, then logs "Begin [startMessage]" before the
-/// operation and "End [startMessage]" after it.
-Future ioAsync(String startMessage, Future operation,
-               [String endMessage(value)]) {
-  if (endMessage == null) {
-    io("Begin $startMessage.");
-  } else {
-    io(startMessage);
-  }
-
-  return operation.then((result) {
-    if (endMessage == null) {
-      io("End $startMessage.");
-    } else {
-      io(endMessage(result));
-    }
-    return result;
-  });
-}
-
-/// Logs the spawning of an [executable] process with [arguments] at [IO]
-/// level.
-void process(String executable, List<String> arguments,
-    String workingDirectory) {
-  io("Spawning \"$executable ${arguments.join(' ')}\" in "
-      "${p.absolute(workingDirectory)}");
-}
-
-/// Logs the results of running [executable].
-void processResult(String executable, PubProcessResult result) {
-  // Log it all as one message so that it shows up as a single unit in the logs.
-  var buffer = new StringBuffer();
-  buffer.writeln("Finished $executable. Exit code ${result.exitCode}.");
-
-  dumpOutput(String name, List<String> output) {
-    if (output.length == 0) {
-      buffer.writeln("Nothing output on $name.");
-    } else {
-      buffer.writeln("$name:");
-      var numLines = 0;
-      for (var line in output) {
-        if (++numLines > 1000) {
-          buffer.writeln('[${output.length - 1000}] more lines of output '
-              'truncated...]');
-          break;
-        }
-
-        buffer.writeln("| $line");
-      }
-    }
-  }
-
-  dumpOutput("stdout", result.stdout);
-  dumpOutput("stderr", result.stderr);
-
-  io(buffer.toString().trim());
-}
-
-/// Logs an exception.
-void exception(exception, [StackTrace trace]) {
-  if (exception is SilentException) return;
-
-  var chain = trace == null ? new Chain.current() : new Chain.forTrace(trace);
-
-  // This is basically the top-level exception handler so that we don't
-  // spew a stack trace on our users.
-  if (exception is SourceSpanException) {
-    error(exception.toString(color: canUseSpecialChars));
-  } else {
-    error(getErrorMessage(exception));
-  }
-  fine("Exception type: ${exception.runtimeType}");
-
-  if (json.enabled) {
-    if (exception is UsageException) {
-      // Don't print usage info in JSON output.
-      json.error(exception.message);
-    } else {
-      json.error(exception);
-    }
-  }
-
-  if (!isUserFacingException(exception)) {
-    error(chain.terse);
-  } else {
-    fine(chain.terse);
-  }
-
-  if (exception is WrappedException && exception.innerError != null) {
-    var message = "Wrapped exception: ${exception.innerError}";
-    if (exception.innerChain != null) {
-      message = "$message\n${exception.innerChain}";
-    }
-    fine(message);
-  }
-}
-
-/// Enables recording of log entries.
-void recordTranscript() {
-  _transcript = new Transcript<Entry>(_MAX_TRANSCRIPT);
-}
-
-/// If [recordTranscript()] was called, then prints the previously recorded log
-/// transcript to stderr.
-void dumpTranscript() {
-  if (_transcript == null) return;
-
-  stderr.writeln('---- Log transcript ----');
-  _transcript.forEach((entry) {
-    _printToStream(stderr, entry, showLabel: true);
-  }, (discarded) {
-    stderr.writeln('---- ($discarded discarded) ----');
-  });
-  stderr.writeln('---- End log transcript ----');
-}
-
-/// Prints [message] then displays an updated elapsed time until the future
-/// returned by [callback] completes.
-///
-/// If anything else is logged during this (including another call to
-/// [progress]) that cancels the progress animation, although the total time
-/// will still be printed once it finishes. If [fine] is passed, the progress
-/// information will only be visible at [Level.FINE].
-Future progress(String message, Future callback(), {bool fine: false}) {
-  _stopProgress();
-
-  var progress = new Progress(message, fine: fine);
-  _animatedProgress = progress;
-  return callback().whenComplete(progress.stop);
-}
-
-/// Stops animating the running progress indicator, if currently running.
-void _stopProgress() {
-  if (_animatedProgress != null) _animatedProgress.stopAnimating();
-  _animatedProgress = null;
-}
-
-/// The number of outstanding calls to [muteProgress] that have not been unmuted
-/// yet.
-int _numMutes = 0;
-
-/// Whether progress animation should be muted or not.
-bool get isMuted => _numMutes > 0;
-
-/// Stops animating any ongoing progress.
-///
-/// This is called before spawning Git since Git sometimes writes directly to
-/// the terminal to ask for login credentials, which would then get overwritten
-/// by the progress animation.
-///
-/// Each call to this must be paired with a call to [unmuteProgress].
-void muteProgress() {
-  _numMutes++;
-}
-
-/// Resumes animating any ongoing progress once all calls to [muteProgress]
-/// have made their matching [unmuteProgress].
-void unmuteProgress() {
-  assert(_numMutes > 0);
-  _numMutes--;
-}
-
-/// Wraps [text] in the ANSI escape codes to make it bold when on a platform
-/// that supports that.
-///
-/// Use this to highlight the most important piece of a long chunk of text.
-///
-/// This is disabled under [withPrejudice] since all text is bold with
-/// prejudice.
-String bold(text) => withPrejudice ? text : "$_bold$text$_none";
-
-/// Wraps [text] in the ANSI escape codes to make it gray when on a platform
-/// that supports that.
-///
-/// Use this for text that's less important than the text around it.
-///
-/// The gray marker also enables bold, so it needs to be handled specially with
-/// [withPrejudice] to avoid disabling bolding entirely.
-String gray(text) =>
-    withPrejudice ? "$_gray$text$_noColor" : "$_gray$text$_none";
-
-/// Wraps [text] in the ANSI escape codes to color it cyan when on a platform
-/// that supports that.
-///
-/// Use this to highlight something interesting but neither good nor bad.
-String cyan(text) => "$_cyan$text$_noColor";
-
-/// Wraps [text] in the ANSI escape codes to color it green when on a platform
-/// that supports that.
-///
-/// Use this to highlight something successful or otherwise positive.
-String green(text) => "$_green$text$_noColor";
-
-/// Wraps [text] in the ANSI escape codes to color it magenta when on a
-/// platform that supports that.
-///
-/// Use this to highlight something risky that the user should be aware of but
-/// may intend to do.
-String magenta(text) => "$_magenta$text$_noColor";
-
-/// Wraps [text] in the ANSI escape codes to color it red when on a platform
-/// that supports that.
-///
-/// Use this to highlight unequivocal errors, problems, or failures.
-String red(text) => "$_red$text$_noColor";
-
-/// Wraps [text] in the ANSI escape codes to color it yellow when on a platform
-/// that supports that.
-///
-/// Use this to highlight warnings, cautions or other things that are bad but
-/// do not prevent the user's goal from being reached.
-String yellow(text) => "$_yellow$text$_noColor";
-
-/// Log function that prints the message to stdout.
-void _logToStdout(Entry entry) {
-  _logToStream(stdout, entry, showLabel: false);
-}
-
-/// Log function that prints the message to stdout with the level name.
-void _logToStdoutWithLabel(Entry entry) {
-  _logToStream(stdout, entry, showLabel: true);
-}
-
-/// Log function that prints the message to stderr.
-void _logToStderr(Entry entry) {
-  _logToStream(stderr, entry, showLabel: false);
-}
-
-/// Log function that prints the message to stderr with the level name.
-void _logToStderrWithLabel(Entry entry) {
-  _logToStream(stderr, entry, showLabel: true);
-}
-
-void _logToStream(IOSink sink, Entry entry, {bool showLabel}) {
-  if (json.enabled) return;
-
-  _printToStream(sink, entry, showLabel: showLabel);
-}
-
-void _printToStream(IOSink sink, Entry entry, {bool showLabel}) {
-  _stopProgress();
-
-  bool firstLine = true;
-  for (var line in entry.lines) {
-    if (showLabel) {
-      if (firstLine) {
-        sink.write('${entry.level.name}: ');
-      } else {
-        sink.write('    | ');
-      }
-    }
-
-    sink.writeln(line);
-
-    firstLine = false;
-  }
-}
-
-/// Namespace-like class for collecting the methods for JSON logging.
-class _JsonLogger {
-  /// Whether logging should use machine-friendly JSON output or human-friendly
-  /// text.
-  ///
-  /// If set to `true`, then no regular logging is printed. Logged messages
-  /// will still be recorded and displayed if the transcript is printed.
-  bool enabled = false;
-
-  /// Creates an error JSON object for [error] and prints it if JSON output
-  /// is enabled.
-  ///
-  /// Always prints to stdout.
-  void error(error, [stackTrace]) {
-    var errorJson = {"error": error.toString()};
-
-    if (stackTrace == null && error is Error) stackTrace = error.stackTrace;
-    if (stackTrace != null) {
-      errorJson["stackTrace"] = new Chain.forTrace(stackTrace).toString();
-    }
-
-    // If the error came from a file, include the path.
-    if (error is SourceSpanException && error.span.sourceUrl != null) {
-      errorJson["path"] = p.fromUri(error.span.sourceUrl);
-    }
-
-    if (error is FileException) {
-      errorJson["path"] = error.path;
-    }
-
-    this.message(errorJson);
-  }
-
-  /// Encodes [message] to JSON and prints it if JSON output is enabled.
-  void message(message) {
-    if (!enabled) return;
-
-    print(JSON.encode(message));
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/oauth2.dart b/sdk/lib/_internal/pub/lib/src/oauth2.dart
deleted file mode 100644
index d9f068f..0000000
--- a/sdk/lib/_internal/pub/lib/src/oauth2.dart
+++ /dev/null
@@ -1,217 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.oauth2;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:oauth2/oauth2.dart';
-import 'package:path/path.dart' as path;
-import 'package:shelf/shelf.dart' as shelf;
-import 'package:shelf/shelf_io.dart' as shelf_io;
-
-import 'http.dart';
-import 'io.dart';
-import 'log.dart' as log;
-import 'system_cache.dart';
-import 'utils.dart';
-
-export 'package:oauth2/oauth2.dart';
-
-/// The pub client's OAuth2 identifier.
-final _identifier = '818368855108-8grd2eg9tj9f38os6f1urbcvsq399u8n.apps.'
-    'googleusercontent.com';
-
-/// The pub client's OAuth2 secret.
-///
-/// This isn't actually meant to be kept a secret.
-final _secret = 'SWeqj8seoJW0w7_CpEPFLX0K';
-
-/// The URL to which the user will be directed to authorize the pub client to
-/// get an OAuth2 access token.
-///
-/// `access_type=offline` and `approval_prompt=force` ensures that we always get
-/// a refresh token from the server. See the [Google OAuth2 documentation][].
-///
-/// [Google OAuth2 documentation]: https://developers.google.com/accounts/docs/OAuth2WebServer#offline
-final authorizationEndpoint = Uri.parse(
-    'https://accounts.google.com/o/oauth2/auth?access_type=offline'
-    '&approval_prompt=force');
-
-/// The URL from which the pub client will request an access token once it's
-/// been authorized by the user.
-///
-/// This can be controlled externally by setting the `_PUB_TEST_TOKEN_ENDPOINT`
-/// environment variable.
-Uri get tokenEndpoint {
-  var tokenEndpoint = Platform.environment['_PUB_TEST_TOKEN_ENDPOINT'];
-  if (tokenEndpoint != null) {
-    return Uri.parse(tokenEndpoint);
-  } else {
-    return _tokenEndpoint;
-  }
-}
-
-final _tokenEndpoint = Uri.parse('https://accounts.google.com/o/oauth2/token');
-
-/// The OAuth2 scopes that the pub client needs.
-///
-/// Currently the client only needs the user's email so that the server can
-/// verify their identity.
-final _scopes = ['https://www.googleapis.com/auth/userinfo.email'];
-
-/// An in-memory cache of the user's OAuth2 credentials.
-///
-/// This should always be the same as the credentials file stored in the system
-/// cache.
-Credentials _credentials;
-
-/// Delete the cached credentials, if they exist.
-void clearCredentials(SystemCache cache) {
-  _credentials = null;
-  var credentialsFile = _credentialsFile(cache);
-  if (entryExists(credentialsFile)) deleteEntry(credentialsFile);
-}
-
-/// Asynchronously passes an OAuth2 [Client] to [fn], and closes the client when
-/// the [Future] returned by [fn] completes.
-///
-/// This takes care of loading and saving the client's credentials, as well as
-/// prompting the user for their authorization. It will also re-authorize and
-/// re-run [fn] if a recoverable authorization error is detected.
-Future withClient(SystemCache cache, Future fn(Client client)) {
-  return _getClient(cache).then((client) {
-    return fn(client).whenComplete(() {
-      client.close();
-      // Be sure to save the credentials even when an error happens.
-      _saveCredentials(cache, client.credentials);
-    });
-  }).catchError((error) {
-    if (error is ExpirationException) {
-      log.error("Pub's authorization to upload packages has expired and "
-          "can't be automatically refreshed.");
-      return withClient(cache, fn);
-    } else if (error is AuthorizationException) {
-      var message = "OAuth2 authorization failed";
-      if (error.description != null) {
-        message = "$message (${error.description})";
-      }
-      log.error("$message.");
-      clearCredentials(cache);
-      return withClient(cache, fn);
-    } else {
-      throw error;
-    }
-  });
-}
-
-/// Gets a new OAuth2 client.
-///
-/// If saved credentials are available, those are used; otherwise, the user is
-/// prompted to authorize the pub client.
-Future<Client> _getClient(SystemCache cache) {
-  return new Future.sync(() {
-    var credentials = _loadCredentials(cache);
-    if (credentials == null) return _authorize();
-
-    var client = new Client(_identifier, _secret, credentials,
-        httpClient: httpClient);
-    _saveCredentials(cache, client.credentials);
-    return client;
-  });
-}
-
-/// Loads the user's OAuth2 credentials from the in-memory cache or the
-/// filesystem if possible.
-///
-/// If the credentials can't be loaded for any reason, the returned [Future]
-/// completes to `null`.
-Credentials _loadCredentials(SystemCache cache) {
-  log.fine('Loading OAuth2 credentials.');
-
-  try {
-    if (_credentials != null) return _credentials;
-
-    var path = _credentialsFile(cache);
-    if (!fileExists(path)) return null;
-
-    var credentials = new Credentials.fromJson(readTextFile(path));
-    if (credentials.isExpired && !credentials.canRefresh) {
-      log.error("Pub's authorization to upload packages has expired and "
-          "can't be automatically refreshed.");
-      return null; // null means re-authorize.
-    }
-
-    return credentials;
-  } catch (e) {
-    log.error('Warning: could not load the saved OAuth2 credentials: $e\n'
-        'Obtaining new credentials...');
-    return null; // null means re-authorize.
-  }
-}
-
-/// Save the user's OAuth2 credentials to the in-memory cache and the
-/// filesystem.
-void _saveCredentials(SystemCache cache, Credentials credentials) {
-  log.fine('Saving OAuth2 credentials.');
-  _credentials = credentials;
-  var credentialsPath = _credentialsFile(cache);
-  ensureDir(path.dirname(credentialsPath));
-  writeTextFile(credentialsPath, credentials.toJson(), dontLogContents: true);
-}
-
-/// The path to the file in which the user's OAuth2 credentials are stored.
-String _credentialsFile(SystemCache cache) =>
-    path.join(cache.rootDir, 'credentials.json');
-
-/// Gets the user to authorize pub as a client of pub.dartlang.org via oauth2.
-///
-/// Returns a Future that completes to a fully-authorized [Client].
-Future<Client> _authorize() {
-  var grant = new AuthorizationCodeGrant(
-      _identifier,
-      _secret,
-      authorizationEndpoint,
-      tokenEndpoint,
-      httpClient: httpClient);
-
-  // Spin up a one-shot HTTP server to receive the authorization code from the
-  // Google OAuth2 server via redirect. This server will close itself as soon as
-  // the code is received.
-  var completer = new Completer();
-  bindServer('localhost', 0).then((server) {
-    shelf_io.serveRequests(server, (request) {
-      if (request.url.path != "/") {
-        return new shelf.Response.notFound('Invalid URI.');
-      }
-
-      log.message('Authorization received, processing...');
-      var queryString = request.url.query;
-      if (queryString == null) queryString = '';
-
-      // Closing the server here is safe, since it will wait until the response
-      // is sent to actually shut down.
-      server.close();
-      chainToCompleter(grant.handleAuthorizationResponse(queryToMap(queryString)),
-          completer);
-
-      return new shelf.Response.found('http://pub.dartlang.org/authorized');
-    });
-
-    var authUrl = grant.getAuthorizationUrl(
-        Uri.parse('http://localhost:${server.port}'), scopes: _scopes);
-
-    log.message(
-        'Pub needs your authorization to upload packages on your behalf.\n'
-        'In a web browser, go to $authUrl\n'
-        'Then click "Allow access".\n\n'
-        'Waiting for your authorization...');
-  });
-
-  return completer.future.then((client) {
-    log.message('Successfully authorized.\n');
-    return client;
-  });
-}
diff --git a/sdk/lib/_internal/pub/lib/src/package.dart b/sdk/lib/_internal/pub/lib/src/package.dart
deleted file mode 100644
index fa111a4..0000000
--- a/sdk/lib/_internal/pub/lib/src/package.dart
+++ /dev/null
@@ -1,422 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.package;
-
-import 'dart:io';
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as p;
-import 'package:pub_semver/pub_semver.dart';
-
-import 'barback/transformer_id.dart';
-import 'io.dart';
-import 'git.dart' as git;
-import 'pubspec.dart';
-import 'source_registry.dart';
-import 'utils.dart';
-
-final _README_REGEXP = new RegExp(r"^README($|\.)", caseSensitive: false);
-
-/// A named, versioned, unit of code and resource reuse.
-class Package {
-  /// Compares [a] and [b] orders them by name then version number.
-  ///
-  /// This is normally used as a [Comparator] to pass to sort. This does not
-  /// take a package's description or root directory into account, so multiple
-  /// distinct packages may order the same.
-  static int orderByNameAndVersion(Package a, Package b) {
-    var name = a.name.compareTo(b.name);
-    if (name != 0) return name;
-
-    return a.version.compareTo(b.version);
-  }
-
-  /// The path to the directory containing the package.
-  final String dir;
-
-  /// The name of the package.
-  String get name {
-    if (pubspec.name != null) return pubspec.name;
-    if (dir != null) return p.basename(dir);
-    return null;
-  }
-
-  /// The package's version.
-  Version get version => pubspec.version;
-
-  /// The parsed pubspec associated with this package.
-  final Pubspec pubspec;
-
-  /// The immediate dependencies this package specifies in its pubspec.
-  List<PackageDep> get dependencies => pubspec.dependencies;
-
-  /// The immediate dev dependencies this package specifies in its pubspec.
-  List<PackageDep> get devDependencies => pubspec.devDependencies;
-
-  /// The dependency overrides this package specifies in its pubspec.
-  List<PackageDep> get dependencyOverrides => pubspec.dependencyOverrides;
-
-  /// All immediate dependencies this package specifies.
-  ///
-  /// This includes regular, dev dependencies, and overrides.
-  Set<PackageDep> get immediateDependencies {
-    var deps = {};
-
-    addToMap(dep) {
-      deps[dep.name] = dep;
-    }
-
-    dependencies.forEach(addToMap);
-    devDependencies.forEach(addToMap);
-
-    // Make sure to add these last so they replace normal dependencies.
-    dependencyOverrides.forEach(addToMap);
-
-    return deps.values.toSet();
-  }
-
-  /// Returns a list of asset ids for all Dart executables in this package's bin
-  /// directory.
-  List<AssetId> get executableIds {
-    return ordered(listFiles(beneath: "bin", recursive: false))
-        .where((executable) => p.extension(executable) == '.dart')
-        .map((executable) {
-      return new AssetId(
-          name, p.toUri(p.relative(executable, from: dir)).toString());
-    }).toList();
-  }
-
-  /// Returns the path to the README file at the root of the entrypoint, or null
-  /// if no README file is found.
-  ///
-  /// If multiple READMEs are found, this uses the same conventions as
-  /// pub.dartlang.org for choosing the primary one: the README with the fewest
-  /// extensions that is lexically ordered first is chosen.
-  String get readmePath {
-    var readmes = listFiles(recursive: false).map(p.basename).
-        where((entry) => entry.contains(_README_REGEXP));
-    if (readmes.isEmpty) return null;
-
-    return p.join(dir, readmes.reduce((readme1, readme2) {
-      var extensions1 = ".".allMatches(readme1).length;
-      var extensions2 = ".".allMatches(readme2).length;
-      var comparison = extensions1.compareTo(extensions2);
-      if (comparison == 0) comparison = readme1.compareTo(readme2);
-      return (comparison <= 0) ? readme1 : readme2;
-    }));
-  }
-
-  /// Loads the package whose root directory is [packageDir].
-  ///
-  /// [name] is the expected name of that package (e.g. the name given in the
-  /// dependency), or `null` if the package being loaded is the entrypoint
-  /// package.
-  Package.load(String name, String packageDir, SourceRegistry sources)
-      : dir = packageDir,
-        pubspec = new Pubspec.load(packageDir, sources, expectedName: name);
-
-  /// Constructs a package with the given pubspec.
-  ///
-  /// The package will have no directory associated with it.
-  Package.inMemory(this.pubspec)
-    : dir = null;
-
-  /// Creates a package with [pubspec] located at [dir].
-  Package(this.pubspec, this.dir);
-
-  /// Given a relative path within this package, returns its absolute path.
-  ///
-  /// This is similar to `p.join(dir, part1, ...)`, except that subclasses may
-  /// override it to report that certain paths exist elsewhere than within
-  /// [dir]. For example, a [CachedPackage]'s `lib` directory is in the
-  /// `.pub/deps` directory.
-  String path(String part1, [String part2, String part3, String part4,
-            String part5, String part6, String part7]) {
-    if (dir == null) {
-      throw new StateError("Package $name is in-memory and doesn't have paths "
-          "on disk.");
-    }
-    return p.join(dir, part1, part2, part3, part4, part5, part6, part7);
-  }
-
-  /// Given an absolute path within this package (such as that returned by
-  /// [path] or [listFiles]), returns it relative to the package root.
-  String relative(String path) {
-    if (dir == null) {
-      throw new StateError("Package $name is in-memory and doesn't have paths "
-          "on disk.");
-    }
-    return p.relative(path, from: dir);
-  }
-
-  /// Returns the path to the library identified by [id] within [this].
-  String transformerPath(TransformerId id) {
-    if (id.package != name) {
-      throw new ArgumentError("Transformer $id isn't in package $name.");
-    }
-
-    if (id.path != null) return path('lib', p.fromUri('${id.path}.dart'));
-
-    var transformerPath = path('lib/transformer.dart');
-    if (fileExists(transformerPath)) return transformerPath;
-    return path('lib/$name.dart');
-  }
-
-  /// The basenames of files that are included in [list] despite being hidden.
-  static final _WHITELISTED_FILES = const ['.htaccess'];
-
-  /// A set of patterns that match paths to blacklisted files.
-  static final _blacklistedFiles = createFileFilter(['pubspec.lock']);
-
-  /// A set of patterns that match paths to blacklisted directories.
-  static final _blacklistedDirs = createDirectoryFilter(['packages']);
-
-  /// Returns a list of files that are considered to be part of this package.
-  ///
-  /// If this is a Git repository, this will respect .gitignore; otherwise, it
-  /// will return all non-hidden, non-blacklisted files.
-  ///
-  /// If [beneath] is passed, this will only return files beneath that path,
-  /// which is expected to be relative to the package's root directory. If
-  /// [recursive] is true, this will return all files beneath that path;
-  /// otherwise, it will only return files one level beneath it.
-  ///
-  /// If [useGitIgnore] is passed, this will take the .gitignore rules into
-  /// account if the package's root directory is a Git repository.
-  ///
-  /// Note that the returned paths won't always be beneath [dir]. To safely
-  /// convert them to paths relative to the package root, use [relative].
-  List<String> listFiles({String beneath, bool recursive: true,
-      bool useGitIgnore: false}) {
-    if (beneath == null) {
-      beneath = dir;
-    } else {
-      beneath = p.join(dir, beneath);
-    }
-
-    if (!dirExists(beneath)) return [];
-
-    // This is used in some performance-sensitive paths and can list many, many
-    // files. As such, it leans more havily towards optimization as opposed to
-    // readability than most code in pub. In particular, it avoids using the
-    // path package, since re-parsing a path is very expensive relative to
-    // string operations.
-    var files;
-    if (useGitIgnore && git.isInstalled && dirExists(path('.git'))) {
-      // Later versions of git do not allow a path for ls-files that appears to
-      // be outside of the repo, so make sure we give it a relative path.
-      var relativeBeneath = p.relative(beneath, from: dir);
-
-      // List all files that aren't gitignored, including those not checked in
-      // to Git.
-      files = git.runSync(
-          ["ls-files", "--cached", "--others", "--exclude-standard",
-           relativeBeneath],
-          workingDir: dir);
-
-      // If we're not listing recursively, strip out paths that contain
-      // separators. Since git always prints forward slashes, we always detect
-      // them.
-      if (!recursive) {
-        // If we're listing a subdirectory, we only want to look for slashes
-        // after the subdirectory prefix.
-        var relativeStart = relativeBeneath == '.' ? 0 :
-            relativeBeneath.length + 1;
-        files = files.where((file) => !file.contains('/', relativeStart));
-      }
-
-      // Git always prints files relative to the repository root, but we want
-      // them relative to the working directory. It also prints forward slashes
-      // on Windows which we normalize away for easier testing.
-      files = files.map((file) {
-        if (Platform.operatingSystem != 'windows') return "$dir/$file";
-        return "$dir\\${file.replaceAll("/", "\\")}";
-      }).where((file) {
-        // Filter out broken symlinks, since git doesn't do so automatically.
-        return fileExists(file);
-      });
-    } else {
-      files = listDir(beneath, recursive: recursive, includeDirs: false,
-          whitelist: _WHITELISTED_FILES);
-    }
-
-    return files.where((file) {
-      // Using substring here is generally problematic in cases where dir has
-      // one or more trailing slashes. If you do listDir("foo"), you'll get back
-      // paths like "foo/bar". If you do listDir("foo/"), you'll get "foo/bar"
-      // (note the trailing slash was dropped. If you do listDir("foo//"),
-      // you'll get "foo//bar".
-      //
-      // This means if you strip off the prefix, the resulting string may have a
-      // leading separator (if the prefix did not have a trailing one) or it may
-      // not. However, since we are only using the results of that to call
-      // contains() on, the leading separator is harmless.
-      assert(file.startsWith(beneath));
-      file = file.substring(beneath.length);
-      return !_blacklistedFiles.any(file.endsWith) &&
-          !_blacklistedDirs.any(file.contains);
-    }).toList();
-  }
-
-  /// Returns a debug string for the package.
-  String toString() => '$name $version ($dir)';
-}
-
-/// This is the private base class of [PackageRef], [PackageID], and
-/// [PackageDep].
-///
-/// It contains functionality and state that those classes share but is private
-/// so that from outside of this library, there is no type relationship between
-/// those three types.
-class _PackageName {
-  _PackageName(this.name, this.source, this.description)
-      : isMagic = false;
-
-  _PackageName.magic(this.name)
-      : source = null,
-        description = null,
-        isMagic = true;
-
-  /// The name of the package being identified.
-  final String name;
-
-  /// The name of the [Source] used to look up this package given its
-  /// [description].
-  ///
-  /// If this is a root package, this will be `null`.
-  final String source;
-
-  /// The metadata used by the package's [source] to identify and locate it.
-  ///
-  /// It contains whatever [Source]-specific data it needs to be able to get
-  /// the package. For example, the description of a git sourced package might
-  /// by the URL "git://github.com/dart/uilib.git".
-  final description;
-
-  /// Whether this is a name for a magic package.
-  ///
-  /// Magic packages are unversioned pub constructs that have special semantics.
-  /// For example, a magic package named "pub itself" is inserted into the
-  /// dependency graph when any package depends on barback. This packages has
-  /// dependencies that represent the versions of barback and related packages
-  /// that pub is compatible with.
-  final bool isMagic;
-
-  /// Whether this package is the root package.
-  bool get isRoot => source == null && !isMagic;
-
-  String toString() {
-    if (isRoot) return "$name (root)";
-    if (isMagic) return name;
-    return "$name from $source";
-  }
-
-  /// Returns a [PackageRef] with this one's [name], [source], and
-  /// [description].
-  PackageRef toRef() => isMagic
-      ? new PackageRef.magic(name)
-      : new PackageRef(name, source, description);
-
-  /// Returns a [PackageId] for this package with the given concrete version.
-  PackageId atVersion(Version version) =>
-    new PackageId(name, source, version, description);
-
-  /// Returns a [PackageDep] for this package with the given version constraint.
-  PackageDep withConstraint(VersionConstraint constraint) =>
-    new PackageDep(name, source, constraint, description);
-}
-
-/// A reference to a [Package], but not any particular version(s) of it.
-class PackageRef extends _PackageName {
-  PackageRef(String name, String source, description)
-      : super(name, source, description);
-
-  /// Creates a reference to a magic package (see [isMagic]).
-  PackageRef.magic(String name)
-      : super.magic(name);
-
-  int get hashCode => name.hashCode ^ source.hashCode;
-
-  bool operator ==(other) {
-    // TODO(rnystrom): We're assuming here that we don't need to delve into the
-    // description.
-    return other is PackageRef &&
-           other.name == name &&
-           other.source == source;
-  }
-}
-
-/// A reference to a specific version of a package.
-///
-/// A package ID contains enough information to correctly get the package.
-///
-/// Note that it's possible for multiple distinct package IDs to point to
-/// different packages that have identical contents. For example, the same
-/// package may be available from multiple sources. As far as Pub is concerned,
-/// those packages are different.
-class PackageId extends _PackageName {
-  /// The package's version.
-  final Version version;
-
-  PackageId(String name, String source, this.version, description)
-      : super(name, source, description);
-
-  /// Creates an ID for a magic package (see [isMagic]).
-  PackageId.magic(String name)
-      : super.magic(name),
-        version = Version.none;
-
-  /// Creates an ID for the given root package.
-  PackageId.root(Package package)
-      : version = package.version,
-        super(package.name, null, package.name);
-
-  int get hashCode => name.hashCode ^ source.hashCode ^ version.hashCode;
-
-  bool operator ==(other) {
-    // TODO(rnystrom): We're assuming here that we don't need to delve into the
-    // description.
-    return other is PackageId &&
-           other.name == name &&
-           other.source == source &&
-           other.version == version;
-  }
-
-  String toString() {
-    if (isRoot) return "$name $version (root)";
-    if (isMagic) return name;
-    return "$name $version from $source";
-  }
-}
-
-/// A reference to a constrained range of versions of one package.
-class PackageDep extends _PackageName {
-  /// The allowed package versions.
-  final VersionConstraint constraint;
-
-  PackageDep(String name, String source, this.constraint, description)
-      : super(name, source, description);
-
-  PackageDep.magic(String name)
-      : super.magic(name),
-        constraint = Version.none;
-
-  String toString() {
-    if (isRoot) return "$name $constraint (root)";
-    if (isMagic) return name;
-    return "$name $constraint from $source ($description)";
-  }
-
-  int get hashCode => name.hashCode ^ source.hashCode;
-
-  bool operator ==(other) {
-    // TODO(rnystrom): We're assuming here that we don't need to delve into the
-    // description.
-    return other is PackageDep &&
-           other.name == name &&
-           other.source == source &&
-           other.constraint == constraint;
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/package_graph.dart b/sdk/lib/_internal/pub/lib/src/package_graph.dart
deleted file mode 100644
index 02ba973..0000000
--- a/sdk/lib/_internal/pub/lib/src/package_graph.dart
+++ /dev/null
@@ -1,116 +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 pub.package_graph;
-
-import 'barback/transformer_cache.dart';
-import 'entrypoint.dart';
-import 'lock_file.dart';
-import 'package.dart';
-import 'source/cached.dart';
-import 'utils.dart';
-
-/// A holistic view of the entire transitive dependency graph for an entrypoint.
-///
-/// A package graph can be loaded using [Entrypoint.loadPackageGraph].
-class PackageGraph {
-  /// The entrypoint.
-  final Entrypoint entrypoint;
-
-  /// The entrypoint's lockfile.
-  ///
-  /// This describes the sources and resolved descriptions of everything in
-  /// [packages].
-  final LockFile lockFile;
-
-  /// The transitive dependencies of the entrypoint (including itself).
-  ///
-  /// This may not include all transitive dependencies of the entrypoint if the
-  /// creator of the package graph knows only a subset of the packages are
-  /// relevant in the current context.
-  final Map<String, Package> packages;
-
-  /// A map of transitive dependencies for each package.
-  Map<String, Set<Package>> _transitiveDependencies;
-
-  /// The transformer cache, if it's been loaded.
-  TransformerCache _transformerCache;
-
-  PackageGraph(this.entrypoint, this.lockFile, this.packages);
-
-  /// Loads the transformer cache for this graph.
-  ///
-  /// This may only be called if [entrypoint] represents a physical package.
-  /// This may modify the cache.
-  TransformerCache loadTransformerCache() {
-    if (_transformerCache == null) {
-      if (entrypoint.root.dir == null) {
-        throw new StateError("Can't load the transformer cache for virtual "
-            "entrypoint ${entrypoint.root.name}.");
-      }
-      _transformerCache = new TransformerCache.load(this);
-    }
-    return _transformerCache;
-  }
-
-  /// Returns all transitive dependencies of [package].
-  ///
-  /// For the entrypoint this returns all packages in [packages], which includes
-  /// dev and override. For any other package, it ignores dev and override
-  /// dependencies.
-  Set<Package> transitiveDependencies(String package) {
-    if (package == entrypoint.root.name) return packages.values.toSet();
-
-    if (_transitiveDependencies == null) {
-      var closure = transitiveClosure(mapMap(packages,
-          value: (_, package) => package.dependencies.map((dep) => dep.name)));
-      _transitiveDependencies = mapMap(closure,
-          value: (_, names) => names.map((name) => packages[name]).toSet());
-    }
-
-    return _transitiveDependencies[package];
-  }
-
-  /// Returns whether [package] is mutable.
-  ///
-  /// A package is considered to be mutable if it or any of its dependencies
-  /// don't come from a cached source, since the user can change its contents
-  /// without modifying the pub cache. Information generated from mutable
-  /// packages is generally not safe to cache, since it may change frequently.
-  bool isPackageMutable(String package) {
-    var id = lockFile.packages[package];
-    if (id == null) return true;
-
-    var source = entrypoint.cache.sources[id.source];
-    if (source is! CachedSource) return true;
-
-    return transitiveDependencies(package).any((dep) {
-      var depId = lockFile.packages[dep.name];
-
-      // The entrypoint package doesn't have a lockfile entry. It's always
-      // mutable.
-      if (depId == null) return true;
-
-      return entrypoint.cache.sources[depId.source] is! CachedSource;
-    });
-  }
-
-  /// Returns whether [package] is static.
-  ///
-  /// A package is considered to be static if it's not transformed and it came
-  /// from a cached source. Static packages don't need to be fully processed by
-  /// barback.
-  ///
-  /// Note that a static package isn't the same as an immutable package (see
-  /// [isPackageMutable]).
-  bool isPackageStatic(String package) {
-    var id = lockFile.packages[package];
-    if (id == null) return false;
-
-    var source = entrypoint.cache.sources[id.source];
-    if (source is! CachedSource) return false;
-
-    return packages[package].pubspec.transformers.isEmpty;
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/preprocess.dart b/sdk/lib/_internal/pub/lib/src/preprocess.dart
deleted file mode 100644
index 738829f..0000000
--- a/sdk/lib/_internal/pub/lib/src/preprocess.dart
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.preprocess;
-
-import 'package:pub_semver/pub_semver.dart';
-import 'package:string_scanner/string_scanner.dart';
-
-import 'utils.dart';
-
-/// Runs a simple preprocessor over [input] to remove sections that are
-/// incompatible with the available barback version.
-///
-/// [versions] are the available versions of each installed package, and
-/// [sourceUrl] is a [String] or [Uri] indicating where [input] came from. It's
-/// used for error reporting.
-///
-/// For the most part, the preprocessor leaves text in the source document
-/// alone. However, it handles two types of lines specially. Lines that begin
-/// with `//>` are uncommented by the preprocessor, and lines that begin with
-/// `//#` are operators.
-///
-/// The preprocessor currently supports one top-level operator, "if":
-///
-///     //# if barback >=0.14.1
-///       ...
-///     //# else
-///       ...
-///     //# end
-///
-/// If can check against any package installed in the current package. It can
-/// check the version of the package, as above, or (if the version range is
-/// omitted) whether the package exists at all. If the condition is true,
-/// everything within the first block is included in the output and everything
-/// within the second block is removed; otherwise, the first block is removed
-/// and the second block is included. The `else` block is optional.
-///
-/// It's important that the preprocessor syntax also be valid Dart code, because
-/// pub loads the source files before preprocessing and runs them against the
-/// version of barback that was compiled into pub. This is why the `//>` syntax
-/// exists: so that code can be hidden from the running pub process but still be
-/// visible to the barback isolate. For example:
-///
-///     //# if barback >= 0.14.1
-///       ClassMirror get aggregateClass => reflectClass(AggregateTransformer);
-///     //# else
-///     //>   ClassMirror get aggregateClass => null;
-///     //# end
-String preprocess(String input, Map<String, Version> versions, sourceUrl) {
-  // Short-circuit if there are no preprocessor directives in the file.
-  if (!input.contains(new RegExp(r"^//[>#]", multiLine: true))) return input;
-  return new _Preprocessor(input, versions, sourceUrl).run();
-}
-
-/// The preprocessor class.
-class _Preprocessor {
-  /// The scanner over the input string.
-  final StringScanner _scanner;
-
-  final Map<String, Version> _versions;
-
-  /// The buffer to which the output is written.
-  final _buffer = new StringBuffer();
-
-  _Preprocessor(String input, this._versions, sourceUrl)
-      : _scanner = new StringScanner(input, sourceUrl: sourceUrl);
-
-  /// Run the preprocessor and return the processed output.
-  String run() {
-    while (!_scanner.isDone) {
-      if (_scanner.scan(new RegExp(r"//#[ \t]*"))) {
-        _if();
-      } else {
-        _emitText();
-      }
-    }
-
-    _scanner.expectDone();
-    return _buffer.toString();
-  }
-
-  /// Emit lines of the input document directly until an operator is
-  /// encountered.
-  void _emitText() {
-    while (!_scanner.isDone && !_scanner.matches("//#")) {
-      if (_scanner.scan("//>")) {
-        if (!_scanner.matches("\n")) _scanner.expect(" ");
-      }
-
-      _scanner.scan(new RegExp(r"[^\n]*\n?"));
-      _buffer.write(_scanner.lastMatch[0]);
-    }
-  }
-
-  /// Move through lines of the input document without emitting them until an
-  /// operator is encountered.
-  void _ignoreText() {
-    while (!_scanner.isDone && !_scanner.matches("//#")) {
-      _scanner.scan(new RegExp(r"[^\n]*\n?"));
-    }
-  }
-
-  /// Handle an `if` operator.
-  void _if() {
-    _scanner.expect(new RegExp(r"if[ \t]+"), name: "if statement");
-    _scanner.expect(identifierRegExp, name: "package name");
-    var package = _scanner.lastMatch[0];
-
-    _scanner.scan(new RegExp(r"[ \t]*"));
-    var constraint = VersionConstraint.any;
-    if (_scanner.scan(new RegExp(r"[^\n]+"))) {
-      try {
-        constraint = new VersionConstraint.parse(_scanner.lastMatch[0]);
-      } on FormatException catch (error) {
-        _scanner.error("Invalid version constraint: ${error.message}");
-      }
-    }
-    _scanner.expect("\n");
-
-    var allowed = _versions.containsKey(package) &&
-        constraint.allows(_versions[package]);
-    if (allowed) {
-      _emitText();
-    } else {
-      _ignoreText();
-    }
-
-    _scanner.expect("//#");
-    _scanner.scan(new RegExp(r"[ \t]*"));
-    if (_scanner.scan("else")) {
-      _scanner.expect("\n");
-      if (allowed) {
-        _ignoreText();
-      } else {
-        _emitText();
-      }
-      _scanner.expect("//#");
-      _scanner.scan(new RegExp(r"[ \t]*"));
-    }
-
-    _scanner.expect("end");
-    if (!_scanner.isDone) _scanner.expect("\n");
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/progress.dart b/sdk/lib/_internal/pub/lib/src/progress.dart
deleted file mode 100644
index 5029f61..0000000
--- a/sdk/lib/_internal/pub/lib/src/progress.dart
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.progress;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'log.dart' as log;
-import 'utils.dart';
-
-/// A live-updating progress indicator for long-running log entries.
-class Progress {
-  /// The timer used to write "..." during a progress log.
-  Timer _timer;
-
-  /// The [Stopwatch] used to track how long a progress log has been running.
-  final _stopwatch = new Stopwatch();
-
-  /// The progress message as it's being incrementally appended.
-  ///
-  /// When the progress is done, a single entry will be added to the log for it.
-  final String _message;
-
-  /// Gets the current progress time as a parenthesized, formatted string.
-  String get _time => "(${niceDuration(_stopwatch.elapsed)})";
-
-  /// Creates a new progress indicator.
-  ///
-  /// If [fine] is passed, this will log progress messages on [log.Level.FINE]
-  /// as opposed to [log.Level.MESSAGE].
-  Progress(this._message, {bool fine: false}) {
-    _stopwatch.start();
-
-    var level = fine ? log.Level.FINE : log.Level.MESSAGE;
-
-    // The animation is only shown when it would be meaningful to a human.
-    // That means we're writing a visible message to a TTY at normal log levels
-    // with non-JSON output.
-    if (stdioType(stdout) != StdioType.TERMINAL ||
-        !log.verbosity.isLevelVisible(level) ||
-        log.json.enabled || fine ||
-        log.verbosity.isLevelVisible(log.Level.FINE)) {
-      // Not animating, so just log the start and wait until the task is
-      // completed.
-      log.write(level, "$_message...");
-      return;
-    }
-
-    _timer = new Timer.periodic(new Duration(milliseconds: 100), (_) {
-      _update();
-    });
-
-    _update();
-  }
-
-  /// Stops the progress indicator.
-  void stop() {
-    _stopwatch.stop();
-
-    // Always log the final time as [log.fine] because for the most part normal
-    // users don't care about the precise time information beyond what's shown
-    // in the animation.
-    log.fine("$_message finished $_time.");
-
-    // If we were animating, print one final update to show the user the final
-    // time.
-    if (_timer == null) return;
-    _timer.cancel();
-    _timer = null;
-    _update();
-    stdout.writeln();
-  }
-
-  /// Stop animating the progress indicator.
-  ///
-  /// This will continue running the stopwatch so that the full time can be
-  /// logged in [stop].
-  void stopAnimating() {
-    if (_timer == null) return;
-
-    // Print a final message without a time indicator so that we don't leave a
-    // misleading half-complete time indicator on the console.
-    stdout.writeln(log.format("\r$_message..."));
-    _timer.cancel();
-    _timer = null;
-  }
-
-  /// Refreshes the progress line.
-  void _update() {
-    if (log.isMuted) return;
-
-    stdout.write(log.format("\r$_message... "));
-
-    // Show the time only once it gets noticeably long.
-    if (_stopwatch.elapsed.inSeconds > 0) stdout.write("${log.gray(_time)} ");
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/pubspec.dart b/sdk/lib/_internal/pub/lib/src/pubspec.dart
deleted file mode 100644
index 13cce16..0000000
--- a/sdk/lib/_internal/pub/lib/src/pubspec.dart
+++ /dev/null
@@ -1,583 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.pubspec;
-
-import 'package:path/path.dart' as path;
-import 'package:pub_semver/pub_semver.dart';
-import 'package:source_span/source_span.dart';
-import 'package:yaml/yaml.dart';
-
-import 'barback/transformer_config.dart';
-import 'exceptions.dart';
-import 'io.dart';
-import 'package.dart';
-import 'source_registry.dart';
-import 'utils.dart';
-
-/// The parsed contents of a pubspec file.
-///
-/// The fields of a pubspec are, for the most part, validated when they're first
-/// accessed. This allows a partially-invalid pubspec to be used if only the
-/// valid portions are relevant. To get a list of all errors in the pubspec, use
-/// [allErrors].
-class Pubspec {
-  // If a new lazily-initialized field is added to this class and the
-  // initialization can throw a [PubspecException], that error should also be
-  // exposed through [allErrors].
-
-  /// The registry of sources to use when parsing [dependencies] and
-  /// [devDependencies].
-  ///
-  /// This will be null if this was created using [new Pubspec] or [new
-  /// Pubspec.empty].
-  final SourceRegistry _sources;
-
-  /// The location from which the pubspec was loaded.
-  ///
-  /// This can be null if the pubspec was created in-memory or if its location
-  /// is unknown.
-  Uri get _location => fields.span.sourceUrl;
-
-  /// All pubspec fields.
-  ///
-  /// This includes the fields from which other properties are derived.
-  final YamlMap fields;
-
-  /// The package's name.
-  String get name {
-    if (_name != null) return _name;
-
-    var name = fields['name'];
-    if (name == null) {
-      throw new PubspecException(
-          'Missing the required "name" field.', fields.span);
-    } else if (name is! String) {
-      throw new PubspecException(
-          '"name" field must be a string.', fields.nodes['name'].span);
-    }
-
-    _name = name;
-    return _name;
-  }
-  String _name;
-
-  /// The package's version.
-  Version get version {
-    if (_version != null) return _version;
-
-    var version = fields['version'];
-    if (version == null) {
-      _version = Version.none;
-      return _version;
-    }
-
-    var span = fields.nodes['version'].span;
-    if (version is num) {
-      var fixed = '$version.0';
-      if (version is int) {
-        fixed = '$fixed.0';
-      }
-      _error('"version" field must have three numeric components: major, '
-          'minor, and patch. Instead of "$version", consider "$fixed".', span);
-    }
-    if (version is! String) {
-      _error('"version" field must be a string.', span);
-    }
-
-    _version = _wrapFormatException('version number', span,
-        () => new Version.parse(version));
-    return _version;
-  }
-  Version _version;
-
-  /// The additional packages this package depends on.
-  List<PackageDep> get dependencies {
-    if (_dependencies != null) return _dependencies;
-    _dependencies = _parseDependencies('dependencies');
-    _checkDependencyOverlap(_dependencies, _devDependencies);
-    return _dependencies;
-  }
-  List<PackageDep> _dependencies;
-
-  /// The packages this package depends on when it is the root package.
-  List<PackageDep> get devDependencies {
-    if (_devDependencies != null) return _devDependencies;
-    _devDependencies = _parseDependencies('dev_dependencies');
-    _checkDependencyOverlap(_dependencies, _devDependencies);
-    return _devDependencies;
-  }
-  List<PackageDep> _devDependencies;
-
-  /// The dependency constraints that this package overrides when it is the
-  /// root package.
-  ///
-  /// Dependencies here will replace any dependency on a package with the same
-  /// name anywhere in the dependency graph.
-  List<PackageDep> get dependencyOverrides {
-    if (_dependencyOverrides != null) return _dependencyOverrides;
-    _dependencyOverrides = _parseDependencies('dependency_overrides');
-    return _dependencyOverrides;
-  }
-  List<PackageDep> _dependencyOverrides;
-
-  /// The configurations of the transformers to use for this package.
-  List<Set<TransformerConfig>> get transformers {
-    if (_transformers != null) return _transformers;
-
-    var transformers = fields['transformers'];
-    if (transformers == null) {
-      _transformers = [];
-      return _transformers;
-    }
-
-    if (transformers is! List) {
-      _error('"transformers" field must be a list.',
-          fields.nodes['transformers'].span);
-    }
-
-    _transformers = transformers.nodes.map((phase) {
-      var phaseNodes = phase is YamlList ? phase.nodes : [phase];
-      return phaseNodes.map((transformerNode) {
-        var transformer = transformerNode.value;
-        if (transformer is! String && transformer is! Map) {
-          _error('A transformer must be a string or map.',
-                 transformerNode.span);
-        }
-
-        var libraryNode;
-        var configurationNode;
-        if (transformer is String) {
-          libraryNode = transformerNode;
-        } else {
-          if (transformer.length != 1) {
-            _error('A transformer map must have a single key: the transformer '
-                'identifier.', transformerNode.span);
-          } else if (transformer.keys.single is! String) {
-            _error('A transformer identifier must be a string.',
-                transformer.nodes.keys.single.span);
-          }
-
-          libraryNode = transformer.nodes.keys.single;
-          configurationNode = transformer.nodes.values.single;
-          if (configurationNode is! YamlMap) {
-            _error("A transformer's configuration must be a map.",
-                configurationNode.span);
-          }
-        }
-
-        var config = _wrapSpanFormatException('transformer config', () {
-          return new TransformerConfig.parse(
-            libraryNode.value, libraryNode.span,
-            configurationNode);
-        });
-
-        var package = config.id.package;
-        if (package != name &&
-            !config.id.isBuiltInTransformer &&
-            !dependencies.any((ref) => ref.name == package) &&
-            !devDependencies.any((ref) => ref.name == package) &&
-            !dependencyOverrides.any((ref) => ref.name == package)) {
-          _error('"$package" is not a dependency.',
-              libraryNode.span);
-        }
-
-        return config;
-      }).toSet();
-    }).toList();
-
-    return _transformers;
-  }
-  List<Set<TransformerConfig>> _transformers;
-
-  /// The environment-related metadata.
-  PubspecEnvironment get environment {
-    if (_environment != null) return _environment;
-
-    var yaml = fields['environment'];
-    if (yaml == null) {
-      _environment = new PubspecEnvironment(VersionConstraint.any);
-      return _environment;
-    }
-
-    if (yaml is! Map) {
-      _error('"environment" field must be a map.',
-             fields.nodes['environment'].span);
-    }
-
-    _environment = new PubspecEnvironment(
-        _parseVersionConstraint(yaml.nodes['sdk']));
-    return _environment;
-  }
-  PubspecEnvironment _environment;
-
-  /// The URL of the server that the package should default to being published
-  /// to, "none" if the package should not be published, or `null` if it should
-  /// be published to the default server.
-  ///
-  /// If this does return a URL string, it will be a valid parseable URL.
-  String get publishTo {
-    if (_parsedPublishTo) return _publishTo;
-
-    var publishTo = fields['publish_to'];
-    if (publishTo != null) {
-      var span = fields.nodes['publish_to'].span;
-
-      if (publishTo is! String) {
-        _error('"publish_to" field must be a string.', span);
-      }
-
-      // It must be "none" or a valid URL.
-      if (publishTo != "none") {
-        _wrapFormatException('"publish_to" field', span,
-            () => Uri.parse(publishTo));
-      }
-    }
-
-    _parsedPublishTo = true;
-    _publishTo = publishTo;
-    return _publishTo;
-  }
-  bool _parsedPublishTo = false;
-  String _publishTo;
-
-  /// The executables that should be placed on the user's PATH when this
-  /// package is globally activated.
-  ///
-  /// It is a map of strings to string. Each key is the name of the command
-  /// that will be placed on the user's PATH. The value is the name of the
-  /// .dart script (without extension) in the package's `bin` directory that
-  /// should be run for that command. Both key and value must be "simple"
-  /// strings: alphanumerics, underscores and hypens only. If a value is
-  /// omitted, it is inferred to use the same name as the key.
-  Map<String, String> get executables {
-    if (_executables != null) return _executables;
-
-    _executables = {};
-    var yaml = fields['executables'];
-    if (yaml == null) return _executables;
-
-    if (yaml is! Map) {
-      _error('"executables" field must be a map.',
-          fields.nodes['executables'].span);
-    }
-
-    yaml.nodes.forEach((key, value) {
-      if (key.value is! String) {
-        _error('"executables" keys must be strings.', key.span);
-      }
-
-      final keyPattern = new RegExp(r"^[a-zA-Z0-9_-]+$");
-      if (!keyPattern.hasMatch(key.value)) {
-        _error('"executables" keys may only contain letters, '
-            'numbers, hyphens and underscores.', key.span);
-      }
-
-      if (value.value == null) {
-        value = key;
-      } else if (value.value is! String) {
-        _error('"executables" values must be strings or null.', value.span);
-      }
-
-      final valuePattern = new RegExp(r"[/\\]");
-      if (valuePattern.hasMatch(value.value)) {
-        _error('"executables" values may not contain path separators.',
-            value.span);
-      }
-
-      _executables[key.value] = value.value;
-    });
-
-    return _executables;
-  }
-  Map<String, String> _executables;
-
-  /// Whether the package is private and cannot be published.
-  ///
-  /// This is specified in the pubspec by setting "publish_to" to "none".
-  bool get isPrivate => publishTo == "none";
-
-  /// Whether or not the pubspec has no contents.
-  bool get isEmpty =>
-    name == null && version == Version.none && dependencies.isEmpty;
-
-  /// Loads the pubspec for a package located in [packageDir].
-  ///
-  /// If [expectedName] is passed and the pubspec doesn't have a matching name
-  /// field, this will throw a [PubspecError].
-  factory Pubspec.load(String packageDir, SourceRegistry sources,
-      {String expectedName}) {
-    var pubspecPath = path.join(packageDir, 'pubspec.yaml');
-    var pubspecUri = path.toUri(pubspecPath);
-    if (!fileExists(pubspecPath)) {
-      throw new FileException(
-          'Could not find a file named "pubspec.yaml" in "$packageDir".',
-          pubspecPath);
-    }
-
-    return new Pubspec.parse(readTextFile(pubspecPath), sources,
-        expectedName: expectedName, location: pubspecUri);
-  }
-
-  Pubspec(this._name, {Version version, Iterable<PackageDep> dependencies,
-          Iterable<PackageDep> devDependencies,
-          Iterable<PackageDep> dependencyOverrides,
-          VersionConstraint sdkConstraint,
-          Iterable<Iterable<TransformerConfig>> transformers,
-          Map fields, SourceRegistry sources})
-      : _version = version,
-        _dependencies = dependencies == null ? null : dependencies.toList(),
-        _devDependencies = devDependencies == null ? null :
-            devDependencies.toList(),
-        _dependencyOverrides = dependencyOverrides == null ? null :
-            dependencyOverrides.toList(),
-        _environment = new PubspecEnvironment(sdkConstraint),
-        _transformers = transformers == null ? [] :
-            transformers.map((phase) => phase.toSet()).toList(),
-        fields = fields == null ? new YamlMap() : new YamlMap.wrap(fields),
-        _sources = sources;
-
-  Pubspec.empty()
-    : _sources = null,
-      _name = null,
-      _version = Version.none,
-      _dependencies = <PackageDep>[],
-      _devDependencies = <PackageDep>[],
-      _environment = new PubspecEnvironment(),
-      _transformers = <Set<TransformerConfig>>[],
-      fields = new YamlMap();
-
-  /// Returns a Pubspec object for an already-parsed map representing its
-  /// contents.
-  ///
-  /// If [expectedName] is passed and the pubspec doesn't have a matching name
-  /// field, this will throw a [PubspecError].
-  ///
-  /// [location] is the location from which this pubspec was loaded.
-  Pubspec.fromMap(Map fields, this._sources, {String expectedName,
-      Uri location})
-      : fields = fields is YamlMap ? fields :
-            new YamlMap.wrap(fields, sourceUrl: location) {
-    // If [expectedName] is passed, ensure that the actual 'name' field exists
-    // and matches the expectation.
-    if (expectedName == null) return;
-    if (name == expectedName) return;
-
-    throw new PubspecException('"name" field doesn\'t match expected name '
-        '"$expectedName".', this.fields.nodes["name"].span);
-  }
-
-  /// Parses the pubspec stored at [filePath] whose text is [contents].
-  ///
-  /// If the pubspec doesn't define a version for itself, it defaults to
-  /// [Version.none].
-  factory Pubspec.parse(String contents, SourceRegistry sources,
-      {String expectedName, Uri location}) {
-    var pubspecNode = loadYamlNode(contents, sourceUrl: location);
-    if (pubspecNode is YamlScalar && pubspecNode.value == null) {
-      pubspecNode = new YamlMap(sourceUrl: location);
-    } else if (pubspecNode is! YamlMap) {
-      throw new PubspecException(
-          'The pubspec must be a YAML mapping.', pubspecNode.span);
-    }
-
-    return new Pubspec.fromMap(pubspecNode, sources,
-        expectedName: expectedName, location: location);
-  }
-
-  /// Returns a list of most errors in this pubspec.
-  ///
-  /// This will return at most one error for each field.
-  List<PubspecException> get allErrors {
-    var errors = <PubspecException>[];
-    _getError(fn()) {
-      try {
-        fn();
-      } on PubspecException catch (e) {
-        errors.add(e);
-      }
-    }
-
-    _getError(() => this.name);
-    _getError(() => this.version);
-    _getError(() => this.dependencies);
-    _getError(() => this.devDependencies);
-    _getError(() => this.transformers);
-    _getError(() => this.environment);
-    _getError(() => this.publishTo);
-    return errors;
-  }
-
-  /// Parses the dependency field named [field], and returns the corresponding
-  /// list of dependencies.
-  List<PackageDep> _parseDependencies(String field) {
-    var dependencies = <PackageDep>[];
-
-    var yaml = fields[field];
-    // Allow an empty dependencies key.
-    if (yaml == null) return dependencies;
-
-    if (yaml is! Map) {
-      _error('"$field" field must be a map.', fields.nodes[field].span);
-    }
-
-    var nonStringNode = yaml.nodes.keys.firstWhere((e) => e.value is! String,
-        orElse: () => null);
-    if (nonStringNode != null) {
-      _error('A dependency name must be a string.', nonStringNode.span);
-    }
-
-    yaml.nodes.forEach((nameNode, specNode) {
-      var name = nameNode.value;
-      var spec = specNode.value;
-      if (fields['name'] != null && name == this.name) {
-        _error('A package may not list itself as a dependency.',
-            nameNode.span);
-      }
-
-      var descriptionNode;
-      var sourceName;
-
-      var versionConstraint = new VersionRange();
-      if (spec == null) {
-        descriptionNode = nameNode;
-        sourceName = _sources.defaultSource.name;
-      } else if (spec is String) {
-        descriptionNode = nameNode;
-        sourceName = _sources.defaultSource.name;
-        versionConstraint = _parseVersionConstraint(specNode);
-      } else if (spec is Map) {
-        // Don't write to the immutable YAML map.
-        spec = new Map.from(spec);
-
-        if (spec.containsKey('version')) {
-          spec.remove('version');
-          versionConstraint = _parseVersionConstraint(
-              specNode.nodes['version']);
-        }
-
-        var sourceNames = spec.keys.toList();
-        if (sourceNames.length > 1) {
-          _error('A dependency may only have one source.', specNode.span);
-        }
-
-        sourceName = sourceNames.single;
-        if (sourceName is! String) {
-          _error('A source name must be a string.',
-              specNode.nodes.keys.single.span);
-        }
-
-        descriptionNode = specNode.nodes[sourceName];
-      } else {
-        _error('A dependency specification must be a string or a mapping.',
-            specNode.span);
-      }
-
-      // Let the source validate the description.
-      var description = _wrapFormatException('description',
-          descriptionNode.span, () {
-        var pubspecPath;
-        if (_location != null && _isFileUri(_location)) {
-          pubspecPath = path.fromUri(_location);
-        }
-
-        return _sources[sourceName].parseDescription(
-            pubspecPath, descriptionNode.value, fromLockFile: false);
-      });
-
-      dependencies.add(new PackageDep(
-          name, sourceName, versionConstraint, description));
-    });
-
-    return dependencies;
-  }
-
-  /// Parses [node] to a [VersionConstraint].
-  VersionConstraint _parseVersionConstraint(YamlNode node) {
-    if (node.value == null) return VersionConstraint.any;
-    if (node.value is! String) {
-      _error('A version constraint must be a string.', node.span);
-    }
-
-    return _wrapFormatException('version constraint', node.span,
-        () => new VersionConstraint.parse(node.value));
-  }
-
-  /// Makes sure the same package doesn't appear as both a regular and dev
-  /// dependency.
-  void _checkDependencyOverlap(List<PackageDep> dependencies,
-      List<PackageDep> devDependencies) {
-    if (dependencies == null) return;
-    if (devDependencies == null) return;
-
-    var dependencyNames = dependencies.map((dep) => dep.name).toSet();
-    var collisions = dependencyNames.intersection(
-        devDependencies.map((dep) => dep.name).toSet());
-    if (collisions.isEmpty) return;
-
-    var span = fields["dependencies"].nodes.keys
-        .firstWhere((key) => collisions.contains(key.value)).span;
-
-    // TODO(nweiz): associate source range info with PackageDeps and use it
-    // here.
-    _error('${pluralize('Package', collisions.length)} '
-        '${toSentence(collisions.map((package) => '"$package"'))} cannot '
-        'appear in both "dependencies" and "dev_dependencies".',
-        span);
-  }
-
-  /// Runs [fn] and wraps any [FormatException] it throws in a
-  /// [PubspecException].
-  ///
-  /// [description] should be a noun phrase that describes whatever's being
-  /// parsed or processed by [fn]. [span] should be the location of whatever's
-  /// being processed within the pubspec.
-  _wrapFormatException(String description, SourceSpan span, fn()) {
-    try {
-      return fn();
-    } on FormatException catch (e) {
-      _error('Invalid $description: ${e.message}', span);
-    }
-  }
-
-  _wrapSpanFormatException(String description, fn()) {
-    try {
-      return fn();
-    } on SourceSpanFormatException catch (e) {
-      _error('Invalid $description: ${e.message}', e.span);
-    }
-  }
-
-  /// Throws a [PubspecException] with the given message.
-  void _error(String message, SourceSpan span) {
-    throw new PubspecException(message, span);
-  }
-}
-
-/// The environment-related metadata in the pubspec.
-///
-/// Corresponds to the data under the "environment:" key in the pubspec.
-class PubspecEnvironment {
-  /// The version constraint specifying which SDK versions this package works
-  /// with.
-  final VersionConstraint sdkVersion;
-
-  PubspecEnvironment([VersionConstraint sdk])
-      : sdkVersion = sdk != null ? sdk : VersionConstraint.any;
-}
-
-/// An exception thrown when parsing a pubspec.
-///
-/// These exceptions are often thrown lazily while accessing pubspec properties.
-class PubspecException extends SourceSpanFormatException
-    implements ApplicationException {
-  PubspecException(String message, SourceSpan span)
-      : super(message, span);
-}
-
-/// Returns whether [uri] is a file URI.
-///
-/// This is slightly more complicated than just checking if the scheme is
-/// 'file', since relative URIs also refer to the filesystem on the VM.
-bool _isFileUri(Uri uri) => uri.scheme == 'file' || uri.scheme == '';
diff --git a/sdk/lib/_internal/pub/lib/src/sdk.dart b/sdk/lib/_internal/pub/lib/src/sdk.dart
deleted file mode 100644
index 3d09163..0000000
--- a/sdk/lib/_internal/pub/lib/src/sdk.dart
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// Operations relative to the user's installed Dart SDK.
-library pub.sdk;
-
-import 'dart:io';
-
-import 'package:path/path.dart' as path;
-import 'package:pub_semver/pub_semver.dart';
-
-import 'io.dart';
-
-/// Gets the path to the root directory of the SDK.
-///
-/// When running from the actual built SDK, this will be the SDK that contains
-/// the running Dart executable. When running from the repo, it will be the
-/// "sdk" directory in the Dart repository itself.
-final String rootDirectory =
-    runningFromSdk ? _rootDirectory : path.join(repoRoot, "sdk");
-
-/// Gets the path to the root directory of the SDK, assuming that the currently
-/// running Dart executable is within it.
-final String _rootDirectory =
-    path.dirname(path.dirname(Platform.executable));
-
-/// The SDK's revision number formatted to be a semantic version.
-///
-/// This can be set so that the version solver tests can artificially select
-/// different SDK versions.
-Version version = _getVersion();
-
-/// Determine the SDK's version number.
-Version _getVersion() {
-  // Some of the pub integration tests require an SDK version number, but the
-  // tests on the bots are not run from a built SDK so this lets us avoid
-  // parsing the missing version file.
-  var sdkVersion = Platform.environment["_PUB_TEST_SDK_VERSION"];
-  if (sdkVersion != null) return new Version.parse(sdkVersion);
-
-  if (runningFromSdk) {
-    // Read the "version" file.
-    var version = readTextFile(path.join(_rootDirectory, "version")).trim();
-    return new Version.parse(version);
-  }
-
-  // When running from the repo, read the canonical VERSION file in tools/.
-  // This makes it possible to run pub without having built the SDK first.
-  var contents = readTextFile(path.join(repoRoot, "tools/VERSION"));
-
-  parseField(name) {
-    var pattern = new RegExp("^$name ([a-z0-9]+)", multiLine: true);
-    var match = pattern.firstMatch(contents);
-    return match[1];
-  }
-
-  var channel = parseField("CHANNEL");
-  var major = parseField("MAJOR");
-  var minor = parseField("MINOR");
-  var patch = parseField("PATCH");
-  var prerelease = parseField("PRERELEASE");
-  var prereleasePatch = parseField("PRERELEASE_PATCH");
-
-  var version = "$major.$minor.$patch";
-  if (channel == "be") {
-    // TODO(rnystrom): tools/utils.py includes the svn commit here. Should we?
-    version += "-edge";
-  } else if (channel == "dev") {
-    version += "-dev.$prerelease.$prereleasePatch";
-  }
-
-  return new Version.parse(version);
-}
diff --git a/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart b/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart
deleted file mode 100644
index f487dd6..0000000
--- a/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart
+++ /dev/null
@@ -1,658 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// A back-tracking depth-first solver.
-///
-/// Attempts to find the best solution for a root package's transitive
-/// dependency graph, where a "solution" is a set of concrete package versions.
-/// A valid solution will select concrete versions for every package reached
-/// from the root package's dependency graph, and each of those packages will
-/// fit the version constraints placed on it.
-///
-/// The solver builds up a solution incrementally by traversing the dependency
-/// graph starting at the root package. When it reaches a new package, it gets
-/// the set of versions that meet the current constraint placed on it. It
-/// *speculatively* selects one version from that set and adds it to the
-/// current solution and then proceeds. If it fully traverses the dependency
-/// graph, the solution is valid and it stops.
-///
-/// If it reaches an error because:
-///
-/// - A new dependency is placed on a package that's already been selected in
-///   the solution and the selected version doesn't match the new constraint.
-///
-/// - There are no versions available that meet the constraint placed on a
-///   package.
-///
-/// - etc.
-///
-/// then the current solution is invalid. It will then backtrack to the most
-/// recent speculative version choice and try the next one. That becomes the
-/// new in-progress solution and it tries to proceed from there. It will keep
-/// doing this, traversing and then backtracking when it meets a failure until
-/// a valid solution has been found or until all possible options for all
-/// speculative choices have been exhausted.
-library pub.solver.backtracking_solver;
-
-import 'dart:async';
-
-import 'package:pub_semver/pub_semver.dart';
-
-import '../barback.dart' as barback;
-import '../exceptions.dart';
-import '../lock_file.dart';
-import '../log.dart' as log;
-import '../package.dart';
-import '../pubspec.dart';
-import '../sdk.dart' as sdk;
-import '../source_registry.dart';
-import '../source/unknown.dart';
-import '../utils.dart';
-import 'version_queue.dart';
-import 'version_selection.dart';
-import 'version_solver.dart';
-
-/// The top-level solver.
-///
-/// Keeps track of the current potential solution, and the other possible
-/// versions for speculative package selections. Backtracks and advances to the
-/// next potential solution in the case of a failure.
-class BacktrackingSolver {
-  final SolveType type;
-  final SourceRegistry sources;
-  final Package root;
-
-  /// The lockfile that was present before solving.
-  final LockFile lockFile;
-
-  final PubspecCache cache;
-
-  /// The set of packages that are being explicitly upgraded.
-  ///
-  /// The solver will only allow the very latest version for each of these
-  /// packages.
-  final _forceLatest = new Set<String>();
-
-  /// The set of packages whose dependecy is being overridden by the root
-  /// package, keyed by the name of the package.
-  ///
-  /// Any dependency on a package that appears in this map will be overriden
-  /// to use the one here.
-  final _overrides = new Map<String, PackageDep>();
-
-  /// The package versions currently selected by the solver, along with the
-  /// versions which are remaining to be tried.
-  ///
-  /// Every time a package is encountered when traversing the dependency graph,
-  /// the solver must select a version for it, sometimes when multiple versions
-  /// are valid. This keeps track of which versions have been selected so far
-  /// and which remain to be tried.
-  ///
-  /// Each entry in the list is a [VersionQueue], which is an ordered queue of
-  /// versions to try for a single package. It maintains the currently selected
-  /// version for that package. When a new dependency is encountered, a queue
-  /// of versions of that dependency is pushed onto the end of the list. A
-  /// queue is removed from the list once it's empty, indicating that none of
-  /// the versions provided a solution.
-  ///
-  /// The solver tries versions in depth-first order, so only the last queue in
-  /// the list will have items removed from it. When a new constraint is placed
-  /// on an already-selected package, and that constraint doesn't match the
-  /// selected version, that will cause the current solution to fail and
-  /// trigger backtracking.
-  final _versions = <VersionQueue>[];
-
-  /// The current set of package versions the solver has selected, along with
-  /// metadata about those packages' dependencies.
-  ///
-  /// This has the same view of the selected versions as [_versions], except for
-  /// two differences. First, [_versions] doesn't have an entry for the root
-  /// package, since it has only one valid version, but [_selection] does, since
-  /// its dependencies are relevant. Second, when backtracking, [_versions]
-  /// contains the version that's being backtracked, while [_selection] does
-  /// not.
-  VersionSelection _selection;
-
-  /// The number of solutions the solver has tried so far.
-  var _attemptedSolutions = 1;
-
-  BacktrackingSolver(SolveType type, SourceRegistry sources, this.root,
-          this.lockFile, List<String> useLatest)
-      : type = type,
-        sources = sources,
-        cache = new PubspecCache(type, sources) {
-    _selection = new VersionSelection(this);
-
-    for (var package in useLatest) {
-      _forceLatest.add(package);
-    }
-
-    for (var override in root.dependencyOverrides) {
-      _overrides[override.name] = override;
-    }
-  }
-
-  /// Run the solver.
-  ///
-  /// Completes with a list of specific package versions if successful or an
-  /// error if it failed to find a solution.
-  Future<SolveResult> solve() async {
-    var stopwatch = new Stopwatch();
-
-    _logParameters();
-
-    // Sort the overrides by package name to make sure they're deterministic.
-    var overrides = _overrides.values.toList();
-    overrides.sort((a, b) => a.name.compareTo(b.name));
-
-    try {
-      stopwatch.start();
-
-      // Pre-cache the root package's known pubspec.
-      var rootID = new PackageId.root(root);
-      cache.cache(rootID, root.pubspec);
-      cache.cache(new PackageId.magic('pub itself'), _implicitPubspec());
-      await _selection.select(rootID);
-
-      _validateSdkConstraint(root.pubspec);
-
-      logSolve();
-      var packages = await _solve();
-
-      var pubspecs = new Map.fromIterable(packages,
-          key: (id) => id.name,
-          value: (id) => cache.getCachedPubspec(id));
-
-      var resolved = await Future.wait(
-          packages.map((id) => sources[id.source].resolveId(id)));
-
-      return new SolveResult.success(sources, root, lockFile, resolved,
-          overrides, pubspecs, _getAvailableVersions(resolved),
-          _attemptedSolutions);
-    } on SolveFailure catch (error) {
-      // Wrap a failure in a result so we can attach some other data.
-      return new SolveResult.failure(sources, root, lockFile, overrides,
-          error, _attemptedSolutions);
-    } finally {
-      // Gather some solving metrics.
-      var buffer = new StringBuffer();
-      buffer.writeln('${runtimeType} took ${stopwatch.elapsed} seconds.');
-      buffer.writeln(cache.describeResults());
-      log.solver(buffer);
-    }
-  }
-
-  /// Creates a pubspec for pub's implicit dependencies on barback and related
-  /// packages.
-  Pubspec _implicitPubspec() {
-    var dependencies = [];
-    barback.pubConstraints.forEach((name, constraint) {
-      dependencies.add(new PackageDep(name, "hosted", constraint, name));
-    });
-
-    return new Pubspec("pub itself", dependencies: dependencies);
-  }
-
-  /// Generates a map containing all of the known available versions for each
-  /// package in [packages].
-  ///
-  /// The version list may not always be complete. If the package is the root
-  /// root package, or if it's a package that we didn't unlock while solving
-  /// because we weren't trying to upgrade it, we will just know the current
-  /// version.
-  Map<String, List<Version>> _getAvailableVersions(List<PackageId> packages) {
-    var availableVersions = new Map<String, List<Version>>();
-    for (var package in packages) {
-      var cached = cache.getCachedVersions(package.toRef());
-      var versions;
-      if (cached != null) {
-        versions = cached.map((id) => id.version).toList();
-      } else {
-        // If the version list was never requested, just use the one known
-        // version.
-        versions = [package.version];
-      }
-
-      availableVersions[package.name] = versions;
-    }
-
-    return availableVersions;
-  }
-
-  /// Gets the version of [package] currently locked in the lock file.
-  ///
-  /// Returns `null` if it isn't in the lockfile (or has been unlocked).
-  PackageId getLocked(String package) {
-    if (type == SolveType.GET) return lockFile.packages[package];
-
-    // When downgrading, we don't want to force the latest versions of
-    // non-hosted packages, since they don't support multiple versions and thus
-    // can't be downgraded.
-    if (type == SolveType.DOWNGRADE) {
-      var locked = lockFile.packages[package];
-      if (locked != null && !sources[locked.source].hasMultipleVersions) {
-        return locked;
-      }
-    }
-
-    if (_forceLatest.isEmpty || _forceLatest.contains(package)) return null;
-    return lockFile.packages[package];
-  }
-
-  /// Gets the package [name] that's currently contained in the lockfile if it
-  /// matches the current constraint and has the same source and description as
-  /// other references to that package.
-  ///
-  /// Returns `null` otherwise.
-  PackageId _getValidLocked(String name) {
-    var package = getLocked(name);
-    if (package == null) return null;
-
-    var constraint = _selection.getConstraint(name);
-    if (!constraint.allows(package.version)) {
-      logSolve('$package is locked but does not match $constraint');
-      return null;
-    } else {
-      logSolve('$package is locked');
-    }
-
-    var required = _selection.getRequiredDependency(name);
-    if (required != null) {
-      if (package.source != required.dep.source) return null;
-
-      var source = sources[package.source];
-      if (!source.descriptionsEqual(
-          package.description, required.dep.description)) return null;
-    }
-
-    return package;
-  }
-
-  /// Tries to find the best set of versions that meet the constraints.
-  ///
-  /// Selects matching versions of unselected packages, or backtracks if there
-  /// are no such versions.
-  Future<List<PackageId>> _solve() async {
-    // TODO(nweiz): Use real while loops when issue 23394 is fixed.
-    await Future.doWhile(() async {
-      // Avoid starving the event queue by waiting for a timer-level event.
-      await new Future(() {});
-
-      // If there are no more packages to traverse, we've traversed the whole
-      // graph.
-      var ref = _selection.nextUnselected;
-      if (ref == null) return false;
-
-      var queue;
-      try {
-        queue = await _versionQueueFor(ref);
-      } on SolveFailure catch (error) {
-        // TODO(nweiz): adjust the priority of [ref] in the unselected queue
-        // since we now know it's problematic. We should reselect it as soon as
-        // we've selected a different version of one of its dependers.
-
-        // There are no valid versions of [ref] to select, so we have to
-        // backtrack and unselect some previously-selected packages.
-        if (await _backtrack()) return true;
-
-        // Backtracking failed, which means we're out of possible solutions.
-        // Throw the error that caused us to try backtracking.
-        if (error is! NoVersionException) rethrow;
-
-        // If we got a NoVersionException, convert it to a
-        // non-version-specific one so that it's clear that there aren't *any*
-        // acceptable versions that satisfy the constraint.
-        throw new NoVersionException(
-            error.package,
-            null,
-            (error as NoVersionException).constraint,
-            error.dependencies);
-      }
-
-      await _selection.select(queue.current);
-      _versions.add(queue);
-
-      logSolve();
-      return true;
-    });
-
-    // If we got here, we successfully found a solution.
-    return _selection.ids.where((id) => !id.isMagic).toList();
-  }
-
-  /// Creates a queue of available versions for [ref].
-  ///
-  /// The returned queue starts at a version that is valid according to the
-  /// current dependency constraints. If no such version is available, throws a
-  /// [SolveFailure].
-  Future<VersionQueue> _versionQueueFor(PackageRef ref) async {
-    if (ref.isRoot) {
-      return await VersionQueue.create(
-          new PackageId.root(root), () => new Future.value([]));
-    }
-
-    var locked = _getValidLocked(ref.name);
-    var queue = await VersionQueue.create(locked,
-        () => _getAllowedVersions(ref, locked));
-
-    await _findValidVersion(queue);
-
-    return queue;
-  }
-
-  /// Gets all versions of [ref] that could be selected, other than [locked].
-  Future<Iterable<PackageId>> _getAllowedVersions(PackageRef ref,
-      PackageId locked) async {
-    var allowed;
-    try {
-      allowed = await cache.getVersions(ref);
-    } on PackageNotFoundException catch (error) {
-      // Show the user why the package was being requested.
-      throw new DependencyNotFoundException(
-          ref.name, error, _selection.getDependenciesOn(ref.name).toList());
-    }
-
-    if (_forceLatest.contains(ref.name)) allowed = [allowed.first];
-
-    if (locked != null) {
-      allowed = allowed.where((version) => version != locked);
-    }
-
-    return allowed;
-  }
-
-  /// Backtracks from the current failed solution and determines the next
-  /// solution to try.
-  ///
-  /// This backjumps based on the cause of previous failures to minize
-  /// backtracking.
-  ///
-  /// Returns `true` if there is a new solution to try.
-  Future<bool> _backtrack() async {
-    // Bail if there is nothing to backtrack to.
-    if (_versions.isEmpty) return false;
-
-    // TODO(nweiz): Use real while loops when issue 23394 is fixed.
-
-    // Advance past the current version of the leaf-most package.
-    await Future.doWhile(() async {
-      // Move past any packages that couldn't have led to the failure.
-      await Future.doWhile(() async {
-        if (_versions.isEmpty || _versions.last.hasFailed) return false;
-        var queue = _versions.removeLast();
-        assert(_selection.ids.last == queue.current);
-        await _selection.unselectLast();
-        return true;
-      });
-
-      if (_versions.isEmpty) return false;
-
-      var queue = _versions.last;
-      var name = queue.current.name;
-      assert(_selection.ids.last == queue.current);
-      await _selection.unselectLast();
-
-      // Fast forward through versions to find one that's valid relative to the
-      // current constraints.
-      var foundVersion = false;
-      if (await queue.advance()) {
-        try {
-          await _findValidVersion(queue);
-          foundVersion = true;
-        } on SolveFailure {
-          // `foundVersion` is already false.
-        }
-      }
-
-      // If we found a valid version, add it to the selection and stop
-      // backtracking. Otherwise, backtrack through this package and on.
-      if (foundVersion) {
-        await _selection.select(queue.current);
-        logSolve();
-        return false;
-      } else {
-        logSolve('no more versions of $name, backtracking');
-        _versions.removeLast();
-        return true;
-      }
-    });
-
-    if (!_versions.isEmpty) _attemptedSolutions++;
-    return !_versions.isEmpty;
-  }
-
-  /// Rewinds [queue] until it reaches a version that's valid relative to the
-  /// current constraints.
-  ///
-  /// If the first version is valid, no rewinding will be done. If no version is
-  /// valid, this throws a [SolveFailure] explaining why.
-  Future _findValidVersion(VersionQueue queue) {
-    // TODO(nweiz): Use real while loops when issue 23394 is fixed.
-    return Future.doWhile(() async {
-      try {
-        await _checkVersion(queue.current);
-        return false;
-      } on SolveFailure {
-        var name = queue.current.name;
-        if (await queue.advance()) return true;
-
-        // If we've run out of valid versions for this package, mark its oldest
-        // depender as failing. This ensures that we look at graphs in which the
-        // package isn't selected at all.
-        _fail(_selection.getDependenciesOn(name).first.depender.name);
-
-        // TODO(nweiz): Throw a more detailed error here that combines all the
-        // errors that were thrown for individual versions and fully explains
-        // why we couldn't select any versions.
-
-        // The queue is out of versions, so throw the final error we
-        // encountered while trying to find one.
-        rethrow;
-      }
-    });
-  }
-
-  /// Checks whether the package identified by [id] is valid relative to the
-  /// current constraints.
-  ///
-  /// If it's not, throws a [SolveFailure] explaining why.
-  Future _checkVersion(PackageId id) async {
-    var constraint = _selection.getConstraint(id.name);
-    if (!constraint.allows(id.version)) {
-      var deps = _selection.getDependenciesOn(id.name);
-
-      for (var dep in deps) {
-        if (dep.dep.constraint.allows(id.version)) continue;
-        _fail(dep.depender.name);
-      }
-
-      logSolve(
-          "version ${id.version} of ${id.name} doesn't match $constraint:\n" +
-              _selection.describeDependencies(id.name));
-      throw new NoVersionException(
-          id.name, id.version, constraint, deps.toList());
-    }
-
-    var pubspec;
-    try {
-      pubspec = await cache.getPubspec(id);
-    } on PackageNotFoundException {
-      // We can only get here if the lockfile refers to a specific package
-      // version that doesn't exist (probably because it was yanked).
-      throw new NoVersionException(id.name, null, id.version, []);
-    }
-
-    _validateSdkConstraint(pubspec);
-
-    for (var dep in await depsFor(id)) {
-      if (dep.isMagic) continue;
-
-      var dependency = new Dependency(id, dep);
-      var allDeps = _selection.getDependenciesOn(dep.name).toList();
-      allDeps.add(dependency);
-
-      var depConstraint = _selection.getConstraint(dep.name);
-      if (!depConstraint.allowsAny(dep.constraint)) {
-        for (var otherDep in _selection.getDependenciesOn(dep.name)) {
-          if (otherDep.dep.constraint.allowsAny(dep.constraint)) continue;
-          _fail(otherDep.depender.name);
-        }
-
-        logSolve(
-            'inconsistent constraints on ${dep.name}:\n'
-            '  $dependency\n' +
-                _selection.describeDependencies(dep.name));
-        throw new DisjointConstraintException(dep.name, allDeps);
-      }
-
-      var selected = _selection.selected(dep.name);
-      if (selected != null && !dep.constraint.allows(selected.version)) {
-        _fail(dep.name);
-
-        logSolve(
-            "constraint doesn't match selected version ${selected.version} of "
-                "${dep.name}:\n"
-            "  $dependency");
-        throw new NoVersionException(dep.name, selected.version, dep.constraint,
-            allDeps);
-      }
-
-      var required = _selection.getRequiredDependency(dep.name);
-      if (required == null) continue;
-
-      if (dep.source != required.dep.source) {
-        // Mark the dependers as failing rather than the package itself, because
-        // no version from this source will be compatible.
-        for (var otherDep in _selection.getDependenciesOn(dep.name)) {
-          _fail(otherDep.depender.name);
-        }
-
-        logSolve(
-            'inconsistent source "${dep.source}" for ${dep.name}:\n'
-            '  $dependency\n' +
-                _selection.describeDependencies(dep.name));
-        throw new SourceMismatchException(dep.name, allDeps);
-      }
-
-      var source = sources[dep.source];
-      if (!source.descriptionsEqual(
-          dep.description, required.dep.description)) {
-        // Mark the dependers as failing rather than the package itself, because
-        // no version with this description will be compatible.
-        for (var otherDep in _selection.getDependenciesOn(dep.name)) {
-          _fail(otherDep.depender.name);
-        }
-
-        logSolve(
-            'inconsistent description "${dep.description}" for ${dep.name}:\n'
-            '  $dependency\n' +
-                _selection.describeDependencies(dep.name));
-        throw new DescriptionMismatchException(dep.name, allDeps);
-      }
-    }
-
-    return true;
-  }
-
-  /// Marks the package named [name] as having failed.
-  ///
-  /// This will cause the backtracker not to jump over this package.
-  void _fail(String name) {
-    // Don't mark the root package as failing because it's not in [_versions]
-    // and there's only one version of it anyway.
-    if (name == root.name) return;
-    _versions.firstWhere((queue) => queue.current.name == name).fail();
-  }
-
-  /// Returns the dependencies of the package identified by [id].
-  ///
-  /// This takes overrides and dev dependencies into account when neccessary.
-  Future<Set<PackageDep>> depsFor(PackageId id) async {
-    var pubspec = await cache.getPubspec(id);
-    var deps = pubspec.dependencies.toSet();
-    if (id.isRoot) {
-      // Include dev dependencies of the root package.
-      deps.addAll(pubspec.devDependencies);
-
-      // Add all overrides. This ensures a dependency only present as an
-      // override is still included.
-      deps.addAll(_overrides.values);
-
-      // Replace any overridden dependencies.
-      deps = deps.map((dep) {
-        var override = _overrides[dep.name];
-        if (override != null) return override;
-
-        // Not overridden.
-        return dep;
-      }).toSet();
-    } else {
-      // Ignore any overridden dependencies.
-      deps.removeWhere((dep) => _overrides.containsKey(dep.name));
-    }
-
-    // Make sure the package doesn't have any bad dependencies.
-    for (var dep in deps.toSet()) {
-      if (!dep.isRoot && sources[dep.source] is UnknownSource) {
-        throw new UnknownSourceException(id.name, [new Dependency(id, dep)]);
-      }
-
-      if (dep.name == 'barback') {
-        deps.add(new PackageDep.magic('pub itself'));
-      }
-    }
-
-    return deps;
-  }
-
-  /// Logs the initial parameters to the solver.
-  void _logParameters() {
-    var buffer = new StringBuffer();
-    buffer.writeln("Solving dependencies:");
-    for (var package in root.dependencies) {
-      buffer.write("- $package");
-      var locked = getLocked(package.name);
-      if (_forceLatest.contains(package.name)) {
-        buffer.write(" (use latest)");
-      } else if (locked != null) {
-        var version = locked.version;
-        buffer.write(" (locked to $version)");
-      }
-      buffer.writeln();
-    }
-    log.solver(buffer.toString().trim());
-  }
-
-  /// Logs [message] in the context of the current selected packages.
-  ///
-  /// If [message] is omitted, just logs a description of leaf-most selection.
-  void logSolve([String message]) {
-    if (message == null) {
-      if (_versions.isEmpty) {
-        message = "* start at root";
-      } else {
-        message = "* select ${_versions.last.current}";
-      }
-    } else {
-      // Otherwise, indent it under the current selected package.
-      message = prefixLines(message);
-    }
-
-    // Indent for the previous selections.
-    log.solver(prefixLines(message, prefix: '| ' * _versions.length));
-  }
-}
-
-/// Ensures that if [pubspec] has an SDK constraint, then it is compatible
-/// with the current SDK.
-///
-/// Throws a [SolveFailure] if not.
-void _validateSdkConstraint(Pubspec pubspec) {
-  if (pubspec.environment.sdkVersion.allows(sdk.version)) return;
-
-  throw new BadSdkVersionException(pubspec.name,
-      'Package ${pubspec.name} requires SDK version '
-      '${pubspec.environment.sdkVersion} but the current SDK is '
-      '${sdk.version}.');
-}
diff --git a/sdk/lib/_internal/pub/lib/src/solver/solve_report.dart b/sdk/lib/_internal/pub/lib/src/solver/solve_report.dart
deleted file mode 100644
index 2a089b5..0000000
--- a/sdk/lib/_internal/pub/lib/src/solver/solve_report.dart
+++ /dev/null
@@ -1,249 +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 pub.solver.solve_report;
-
-import 'package:pub_semver/pub_semver.dart';
-
-import '../lock_file.dart';
-import '../log.dart' as log;
-import '../package.dart';
-import '../source_registry.dart';
-import '../utils.dart';
-import 'version_solver.dart';
-
-/// Unlike [SolveResult], which is the static data describing a resolution,
-/// this class contains the mutable state used while generating the report
-/// itself.
-///
-/// It's a report builder.
-class SolveReport {
-  final SolveType _type;
-  final SourceRegistry _sources;
-  final Package _root;
-  final LockFile _previousLockFile;
-  final SolveResult _result;
-
-  /// The dependencies in [_result], keyed by package name.
-  final _dependencies = new Map<String, PackageId>();
-
-  final _output = new StringBuffer();
-
-  SolveReport(this._type, this._sources, this._root, this._previousLockFile,
-      this._result) {
-    // Fill the map so we can use it later.
-    for (var id in _result.packages) {
-      _dependencies[id.name] = id;
-    }
-  }
-
-  /// Displays a report of the results of the version resolution relative to
-  /// the previous lock file.
-  void show() {
-    _reportChanges();
-    _reportOverrides();
-  }
-
-  /// Displays a one-line message summarizing what changes were made (or would
-  /// be made) to the lockfile.
-  ///
-  /// If [dryRun] is true, describes it in terms of what would be done.
-  void summarize({bool dryRun: false}) {
-    // Count how many dependencies actually changed.
-    var dependencies = _dependencies.keys.toSet();
-    dependencies.addAll(_previousLockFile.packages.keys);
-    dependencies.remove(_root.name);
-
-    var numChanged = dependencies.where((name) {
-      var oldId = _previousLockFile.packages[name];
-      var newId = _dependencies[name];
-
-      // Added or removed dependencies count.
-      if (oldId == null) return true;
-      if (newId == null) return true;
-
-      // The dependency existed before, so see if it was modified.
-      return !_sources.idsEqual(oldId, newId);
-    }).length;
-
-    if (dryRun) {
-      if (numChanged == 0) {
-        log.message("No dependencies would change.");
-      } else if (numChanged == 1) {
-        log.message("Would change $numChanged dependency.");
-      } else {
-        log.message("Would change $numChanged dependencies.");
-      }
-    } else {
-      if (numChanged == 0) {
-        if (_type == SolveType.GET) {
-          log.message("Got dependencies!");
-        } else {
-          log.message("No dependencies changed.");
-        }
-      } else if (numChanged == 1) {
-        log.message("Changed $numChanged dependency!");
-      } else {
-        log.message("Changed $numChanged dependencies!");
-      }
-    }
-  }
-
-  /// Displays a report of all of the previous and current dependencies and
-  /// how they have changed.
-  void _reportChanges() {
-    _output.clear();
-
-    // Show the new set of dependencies ordered by name.
-    var names = _result.packages.map((id) => id.name).toList();
-    names.remove(_root.name);
-    names.sort();
-    names.forEach(_reportPackage);
-
-    // Show any removed ones.
-    var removed = _previousLockFile.packages.keys.toSet();
-    removed.removeAll(names);
-    if (removed.isNotEmpty) {
-      _output.writeln("These packages are no longer being depended on:");
-      removed = removed.toList();
-      removed.sort();
-      removed.forEach((name) => _reportPackage(name, alwaysShow: true));
-    }
-
-    log.message(_output);
-  }
-
-  /// Displays a warning about the overrides currently in effect.
-  void _reportOverrides() {
-    _output.clear();
-
-    if (_result.overrides.isNotEmpty) {
-      _output.writeln("Warning: You are using these overridden dependencies:");
-      var overrides = _result.overrides.map((dep) => dep.name).toList();
-      overrides.sort((a, b) => a.compareTo(b));
-
-      overrides.forEach(
-          (name) => _reportPackage(name, alwaysShow: true,
-              highlightOverride: false));
-
-      log.warning(_output);
-    }
-  }
-
-  /// Reports the results of the upgrade on the package named [name].
-  ///
-  /// If [alwaysShow] is true, the package is reported even if it didn't change,
-  /// regardless of [_type]. If [highlightOverride] is true (or absent), writes
-  /// "(override)" next to overridden packages.
-  void _reportPackage(String name,
-      {bool alwaysShow: false, bool highlightOverride: true}) {
-    var newId = _dependencies[name];
-    var oldId = _previousLockFile.packages[name];
-    var id = newId != null ? newId : oldId;
-
-    var isOverridden = _result.overrides.map(
-        (dep) => dep.name).contains(id.name);
-
-    // If the package was previously a dependency but the dependency has
-    // changed in some way.
-    var changed = false;
-
-    // If the dependency was added or removed.
-    var addedOrRemoved = false;
-
-    // Show a one-character "icon" describing the change. They are:
-    //
-    //     ! The package is being overridden.
-    //     - The package was removed.
-    //     + The package was added.
-    //     > The package was upgraded from a lower version.
-    //     < The package was downgraded from a higher version.
-    //     * Any other change between the old and new package.
-    var icon;
-    if (isOverridden) {
-      icon = log.magenta("! ");
-    } else if (newId == null) {
-      icon = log.red("- ");
-      addedOrRemoved = true;
-    } else if (oldId == null) {
-      icon = log.green("+ ");
-      addedOrRemoved = true;
-    } else if (!_sources.idDescriptionsEqual(oldId, newId)) {
-      icon = log.cyan("* ");
-      changed = true;
-    } else if (oldId.version < newId.version) {
-      icon = log.green("> ");
-      changed = true;
-    } else if (oldId.version > newId.version) {
-      icon = log.cyan("< ");
-      changed = true;
-    } else {
-      // Unchanged.
-      icon = "  ";
-    }
-
-    if (_type == SolveType.GET && !(alwaysShow || changed || addedOrRemoved)) {
-      return;
-    }
-
-    _output.write(icon);
-    _output.write(log.bold(id.name));
-    _output.write(" ");
-    _writeId(id);
-
-    // If the package was upgraded, show what it was upgraded from.
-    if (changed) {
-      _output.write(" (was ");
-      _writeId(oldId);
-      _output.write(")");
-    }
-
-    // Highlight overridden packages.
-    if (isOverridden && highlightOverride) {
-      _output.write(" ${log.magenta('(overridden)')}");
-    }
-
-    // See if there are any newer versions of the package that we were
-    // unable to upgrade to.
-    if (newId != null && _type != SolveType.DOWNGRADE) {
-      var versions = _result.availableVersions[newId.name];
-
-      var newerStable = false;
-      var newerUnstable = false;
-
-      for (var version in versions) {
-        if (version > newId.version) {
-          if (version.isPreRelease) {
-            newerUnstable = true;
-          } else {
-            newerStable = true;
-          }
-        }
-      }
-
-      // If there are newer stable versions, only show those.
-      var message;
-      if (newerStable) {
-        message = "(${maxAll(versions, Version.prioritize)} available)";
-      } else if (newerUnstable) {
-        message = "(${maxAll(versions)} available)";
-      }
-
-      if (message != null) _output.write(" ${log.cyan(message)}");
-    }
-
-    _output.writeln();
-  }
-
-  /// Writes a terse description of [id] (not including its name) to the output.
-  void _writeId(PackageId id) {
-    _output.write(id.version);
-
-    var source = _sources[id.source];
-    if (source != _sources.defaultSource) {
-      var description = source.formatDescription(_root.dir, id.description);
-      _output.write(" from ${id.source} $description");
-    }
-  }
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/lib/src/solver/unselected_package_queue.dart b/sdk/lib/_internal/pub/lib/src/solver/unselected_package_queue.dart
deleted file mode 100644
index 2c3cb294..0000000
--- a/sdk/lib/_internal/pub/lib/src/solver/unselected_package_queue.dart
+++ /dev/null
@@ -1,149 +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 pub.solver.unselected_package_queue;
-
-import 'dart:async';
-import 'dart:collection';
-
-import 'package:stack_trace/stack_trace.dart';
-
-import '../log.dart' as log;
-import '../package.dart';
-import 'backtracking_solver.dart';
-
-/// A priority queue of package references.
-///
-/// This is used to determine which packages should be selected by the solver,
-/// and when. It's ordered such that the earliest packages should be selected
-/// first.
-class UnselectedPackageQueue {
-  /// The underlying priority set.
-  SplayTreeSet<PackageRef> _set;
-
-  /// The version solver.
-  final BacktrackingSolver _solver;
-
-  /// A cache of the number of versions for each package ref.
-  ///
-  /// This is cached because sorting is synchronous and retrieving this
-  /// information is asynchronous.
-  final _numVersions = new Map<PackageRef, int>();
-
-  /// The first package in the queue (that is, the package that should be
-  /// selected soonest).
-  PackageRef get first => _set.first;
-
-  /// Whether there are no more packages in the queue.
-  bool get isEmpty => _set.isEmpty;
-
-  UnselectedPackageQueue(this._solver) {
-    _set = new SplayTreeSet(_comparePackages);
-  }
-
-  /// Adds [ref] to the queue, if it's not there already.
-  Future add(PackageRef ref) async {
-    if (_solver.getLocked(ref.name) == null && !_numVersions.containsKey(ref)) {
-      // Only get the number of versions for unlocked packages. We do this for
-      // two reasons: first, locked packages are always sorted first anyway;
-      // second, if every package is locked, we want to do version resolution
-      // without any HTTP requests if possible.
-      _numVersions[ref] = await _getNumVersions(ref);
-    }
-
-    _set.add(ref);
-  }
-
-  /// Removes [ref] from the queue.
-  void remove(PackageRef ref) {
-    _set.remove(ref);
-  }
-
-  /// The [Comparator] used to sort the queue.
-  int _comparePackages(PackageRef ref1, PackageRef ref2) {
-    var name1 = ref1.name;
-    var name2 = ref2.name;
-
-    if (name1 == name2) {
-      assert(ref1 == ref2);
-      return 0;
-    }
-
-    // Select the root package before anything else.
-    if (ref1.isRoot) return -1;
-    if (ref2.isRoot) return 1;
-
-    // Sort magic refs before anything other than the root. The only magic
-    // dependency that makes sense as a ref is "pub itself", and it only has a
-    // single version.
-    if (ref1.isMagic && ref2.isMagic) return name1.compareTo(name2);
-    if (ref1.isMagic) return -1;
-    if (ref2.isMagic) return 1;
-
-    var locked1 = _solver.getLocked(name1) != null;
-    var locked2 = _solver.getLocked(name2) != null;
-
-    // Select locked packages before unlocked packages to ensure that they
-    // remain locked as long as possible.
-    if (locked1 && !locked2) return -1;
-    if (!locked1 && locked2) return 1;
-
-    // TODO(nweiz): Should we sort packages by something like number of
-    // dependencies? We should be able to get that quickly for locked packages
-    // if we have their pubspecs locally.
-
-    // Sort locked packages by name among themselves to ensure that solving is
-    // deterministic.
-    if (locked1 && locked2) return name1.compareTo(name2);
-
-    // Sort unlocked packages by the number of versions that might be selected
-    // for them. In general, packages with fewer versions are less likely to
-    // benefit from changing versions, so they should be selected earlier.
-    var versions1 = _numVersions[ref1];
-    var versions2 = _numVersions[ref2];
-    if (versions1 == null && versions2 != null) return -1;
-    if (versions1 != null && versions2 == null) return 1;
-    if (versions1 != versions2) return versions1.compareTo(versions2);
-
-    // Fall back on sorting by name to ensure determinism.
-    return name1.compareTo(name2);
-  }
-
-  /// Returns the number of versions available for a given package.
-  ///
-  /// This excludes versions that don't match the root package's dependencies,
-  /// since those versions can never be selected by the solver.
-  Future<int> _getNumVersions(PackageRef ref) async {
-    // There is only ever one version of the root package.
-    if (ref.isRoot) return 1;
-
-    var versions;
-    try {
-      versions = await _solver.cache.getVersions(ref);
-    } catch (error, stackTrace) {
-      // If it fails for any reason, just treat that as no versions. This
-      // will sort this reference higher so that we can traverse into it
-      // and report the error more properly.
-      log.solver("Could not get versions for $ref:\n$error\n\n" +
-          new Chain.forTrace(stackTrace).terse.toString());
-      return 0;
-    }
-
-    // If the root package depends on this one, ignore versions that don't match
-    // that constraint. Since the root package's dependency constraints won't
-    // change during solving, we can safely filter out packages that don't meet
-    // it.
-    for (var rootDep in _solver.root.immediateDependencies) {
-      if (rootDep.name != ref.name) continue;
-      return versions.where((id) => rootDep.constraint.allows(id.version))
-          .length;
-    }
-
-    // TODO(nweiz): Also ignore versions with non-matching SDK constraints or
-    // dependencies that are incompatible with the root package's.
-    return versions.length;
-  }
-
-  String toString() => _set.toString();
-}
diff --git a/sdk/lib/_internal/pub/lib/src/solver/version_queue.dart b/sdk/lib/_internal/pub/lib/src/solver/version_queue.dart
deleted file mode 100644
index a6723aa..0000000
--- a/sdk/lib/_internal/pub/lib/src/solver/version_queue.dart
+++ /dev/null
@@ -1,105 +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 pub.solver.version_queue;
-
-import 'dart:async';
-import 'dart:collection' show Queue;
-
-import '../package.dart';
-
-/// A function that asynchronously returns a sequence of package IDs.
-typedef Future<Iterable<PackageId>> PackageIdGenerator();
-
-/// A prioritized, asynchronous queue of the possible versions that can be
-/// selected for one package.
-///
-/// If there is a locked version, that comes first, followed by other versions
-/// in descending order. This avoids requesting the list of versions until
-/// needed (i.e. after any locked version has been consumed) to avoid unneeded
-/// network requests.
-class VersionQueue {
-  /// The set of allowed versions that match [_constraint].
-  ///
-  /// If [_locked] is not `null`, this will initially be `null` until we
-  /// advance past the locked version.
-  Queue<PackageId> _allowed;
-
-  /// The callback that will generate the sequence of packages. This will be
-  /// called as lazily as possible.
-  final PackageIdGenerator _allowedGenerator;
-
-  /// The currently locked version of the package, or `null` if there is none,
-  /// or we have advanced past it.
-  PackageId _locked;
-
-  /// Gets the currently selected version.
-  PackageId get current {
-    if (_locked != null) return _locked;
-    return _allowed.first;
-  }
-
-  /// Whether the currently selected version has been responsible for a solve
-  /// failure, or depends on a package that has.
-  ///
-  /// The solver uses this to determine which packages to backtrack to after a
-  /// failure occurs. Any selected package that did *not* cause the failure can
-  /// be skipped by the backtracker.
-  bool get hasFailed => _hasFailed;
-  bool _hasFailed = false;
-
-  /// Creates a new [VersionQueue] queue for starting with the optional
-  /// [locked] package followed by the results of calling [allowedGenerator].
-  ///
-  /// This is asynchronous so that [current] can always be accessed
-  /// synchronously. If there is no locked version, we need to get the list of
-  /// versions asynchronously before we can determine what the first one is.
-  static Future<VersionQueue> create(PackageId locked,
-      PackageIdGenerator allowedGenerator) async {
-    var versions = new VersionQueue._(locked, allowedGenerator);
-
-    // If there isn't a locked version, it needs to be calculated before we can
-    // return.
-    if (locked == null) await versions._calculateAllowed();
-    return versions;
-  }
-
-  VersionQueue._(this._locked, this._allowedGenerator);
-
-  /// Tries to advance to the next possible version.
-  ///
-  /// Returns `true` if it moved to a new version (which can be accessed from
-  /// [current]. Returns `false` if there are no more versions.
-  Future<bool> advance() async {
-    // Any failure was the fault of the previous version, not necessarily the
-    // new one.
-    _hasFailed = false;
-
-    // If we have a locked version, consume it first.
-    if (_locked != null) {
-      // Advancing past the locked version, so need to load the others now
-      // so that [current] is available.
-      await _calculateAllowed();
-      _locked = null;
-    } else {
-      // Move to the next allowed version.
-      _allowed.removeFirst();
-    }
-
-    return _allowed.isNotEmpty;
-  }
-
-  /// Marks the selected version as being directly or indirectly responsible
-  /// for a solve failure.
-  void fail() {
-    _hasFailed = true;
-  }
-
-  /// Determines the list of allowed versions matching its constraint and places
-  /// them in [_allowed].
-  Future _calculateAllowed() async {
-    var allowed = await _allowedGenerator();
-    _allowed = new Queue<PackageId>.from(allowed);
-  }
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/lib/src/solver/version_selection.dart b/sdk/lib/_internal/pub/lib/src/solver/version_selection.dart
deleted file mode 100644
index c815f9f..0000000
--- a/sdk/lib/_internal/pub/lib/src/solver/version_selection.dart
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.solver.version_selection;
-
-import 'dart:async';
-import 'dart:collection';
-
-import 'package:pub_semver/pub_semver.dart';
-
-import '../package.dart';
-import 'backtracking_solver.dart';
-import 'unselected_package_queue.dart';
-import 'version_solver.dart';
-
-/// A representation of the version solver's current selected versions.
-///
-/// This is used to track the joint constraints from the selected packages on
-/// other packages, as well as the set of packages that are depended on but have
-/// yet to be selected.
-///
-/// A [VersionSelection] is always internally consistent. That is, all selected
-/// packages are compatible with dependencies on those packages, no constraints
-/// are empty, and dependencies agree on sources and descriptions. However, the
-/// selection itself doesn't ensure this; that's up to the [BacktrackingSolver]
-/// that controls it.
-class VersionSelection {
-  /// The version solver.
-  final BacktrackingSolver _solver;
-
-  /// The packages that have been selected, in the order they were selected.
-  List<PackageId> get ids => new UnmodifiableListView<PackageId>(_ids);
-  final _ids = <PackageId>[];
-
-  /// Tracks all of the dependencies on a given package.
-  ///
-  /// Each key is a package. Its value is the list of dependencies placed on
-  /// that package, in the order that their dependers appear in [ids].
-  final _dependencies = new Map<String, List<Dependency>>();
-
-  /// A priority queue of packages that are depended on but have yet to be
-  /// selected.
-  final UnselectedPackageQueue _unselected;
-
-  /// The next package for which some version should be selected by the solver.
-  PackageRef get nextUnselected =>
-      _unselected.isEmpty ? null : _unselected.first;
-
-  VersionSelection(BacktrackingSolver solver)
-      : _solver = solver,
-        _unselected = new UnselectedPackageQueue(solver);
-
-  /// Adds [id] to the selection.
-  Future select(PackageId id) async {
-    _unselected.remove(id.toRef());
-    _ids.add(id);
-
-    // TODO(nweiz): Use a real for loop when issue 23394 is fixed.
-
-    // Add all of [id]'s dependencies to [_dependencies], as well as to
-    // [_unselected] if necessary.
-    await Future.forEach(await _solver.depsFor(id), (dep) async {
-      var deps = getDependenciesOn(dep.name);
-      deps.add(new Dependency(id, dep));
-
-      // If this is the first dependency on this package, add it to the
-      // unselected queue.
-      if (deps.length == 1 && dep.name != _solver.root.name) {
-        await _unselected.add(dep.toRef());
-      }
-    });
-  }
-
-  /// Removes the most recently selected package from the selection.
-  Future unselectLast() async {
-    var id = _ids.removeLast();
-    await _unselected.add(id.toRef());
-
-    for (var dep in await _solver.depsFor(id)) {
-      var deps = getDependenciesOn(dep.name);
-      deps.removeLast();
-
-      if (deps.isEmpty) {
-        _unselected.remove(dep.toRef());
-      }
-    }
-  }
-
-  /// Returns the selected id for [packageName].
-  PackageId selected(String packageName) =>
-      ids.firstWhere((id) => id.name == packageName, orElse: () => null);
-
-  /// Gets a "required" reference to the package [name].
-  ///
-  /// This is the first non-root dependency on that package. All dependencies
-  /// on a package must agree on source and description, except for references
-  /// to the root package. This will return a reference to that "canonical"
-  /// source and description, or `null` if there is no required reference yet.
-  ///
-  /// This is required because you may have a circular dependency back onto the
-  /// root package. That second dependency won't be a root dependency and it's
-  /// *that* one that other dependencies need to agree on. In other words, you
-  /// can have a bunch of dependencies back onto the root package as long as
-  /// they all agree with each other.
-  Dependency getRequiredDependency(String name) {
-    return getDependenciesOn(name)
-        .firstWhere((dep) => !dep.dep.isRoot, orElse: () => null);
-  }
-
-  /// Gets the combined [VersionConstraint] currently placed on package [name].
-  VersionConstraint getConstraint(String name) {
-    var constraint = getDependenciesOn(name)
-        .map((dep) => dep.dep.constraint)
-        .fold(VersionConstraint.any, (a, b) => a.intersect(b));
-
-    // The caller should ensure that no version gets added with conflicting
-    // constraints.
-    assert(!constraint.isEmpty);
-
-    return constraint;
-  }
-
-  /// Returns a string description of the dependencies on [name].
-  String describeDependencies(String name) =>
-      getDependenciesOn(name).map((dep) => "  $dep").join('\n');
-
-  /// Gets the list of known dependencies on package [name].
-  ///
-  /// Creates an empty list if needed.
-  List<Dependency> getDependenciesOn(String name) =>
-      _dependencies.putIfAbsent(name, () => <Dependency>[]);
-}
diff --git a/sdk/lib/_internal/pub/lib/src/solver/version_solver.dart b/sdk/lib/_internal/pub/lib/src/solver/version_solver.dart
deleted file mode 100644
index d739214..0000000
--- a/sdk/lib/_internal/pub/lib/src/solver/version_solver.dart
+++ /dev/null
@@ -1,487 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.solver.version_solver;
-
-import 'dart:async';
-import "dart:convert";
-
-import 'package:pub_semver/pub_semver.dart';
-import 'package:stack_trace/stack_trace.dart';
-
-import '../exceptions.dart';
-import '../lock_file.dart';
-import '../log.dart' as log;
-import '../package.dart';
-import '../pubspec.dart';
-import '../source_registry.dart';
-import '../utils.dart';
-import 'backtracking_solver.dart';
-import 'solve_report.dart';
-
-/// Attempts to select the best concrete versions for all of the transitive
-/// dependencies of [root] taking into account all of the [VersionConstraint]s
-/// that those dependencies place on each other and the requirements imposed by
-/// [lockFile].
-///
-/// If [useLatest] is given, then only the latest versions of the referenced
-/// packages will be used. This is for forcing an upgrade to one or more
-/// packages.
-///
-/// If [upgradeAll] is true, the contents of [lockFile] are ignored.
-Future<SolveResult> resolveVersions(SolveType type, SourceRegistry sources,
-    Package root, {LockFile lockFile, List<String> useLatest}) {
-  if (lockFile == null) lockFile = new LockFile.empty();
-  if (useLatest == null) useLatest = [];
-
-  return log.progress('Resolving dependencies', () {
-    return new BacktrackingSolver(type, sources, root, lockFile, useLatest)
-        .solve();
-  });
-}
-
-/// The result of a version resolution.
-class SolveResult {
-  /// Whether the solver found a complete solution or failed.
-  bool get succeeded => error == null;
-
-  /// The list of concrete package versions that were selected for each package
-  /// reachable from the root, or `null` if the solver failed.
-  final List<PackageId> packages;
-
-  /// The dependency overrides that were used in the solution.
-  final List<PackageDep> overrides;
-
-  /// A map from package names to the pubspecs for the versions of those
-  /// packages that were installed, or `null` if the solver failed.
-  final Map<String, Pubspec> pubspecs;
-
-  /// The available versions of all selected packages from their source.
-  ///
-  /// Will be empty if the solve failed. An entry here may not include the full
-  /// list of versions available if the given package was locked and did not
-  /// need to be unlocked during the solve.
-  final Map<String, List<Version>> availableVersions;
-
-  /// The error that prevented the solver from finding a solution or `null` if
-  /// it was successful.
-  final SolveFailure error;
-
-  /// The number of solutions that were attempted before either finding a
-  /// successful solution or exhausting all options.
-  ///
-  /// In other words, one more than the number of times it had to backtrack
-  /// because it found an invalid solution.
-  final int attemptedSolutions;
-
-  final SourceRegistry _sources;
-  final Package _root;
-  final LockFile _previousLockFile;
-
-  /// Returns the names of all packages that were changed.
-  ///
-  /// This includes packages that were added or removed.
-  Set<String> get changedPackages {
-    if (packages == null) return null;
-
-    var changed = packages
-        .where((id) =>
-            !_sources.idsEqual(_previousLockFile.packages[id.name], id))
-        .map((id) => id.name).toSet();
-
-    return changed.union(_previousLockFile.packages.keys
-        .where((package) => !availableVersions.containsKey(package))
-        .toSet());
-  }
-
-  SolveResult.success(this._sources, this._root, this._previousLockFile,
-      this.packages, this.overrides, this.pubspecs, this.availableVersions,
-      this.attemptedSolutions)
-      : error = null;
-
-  SolveResult.failure(this._sources, this._root, this._previousLockFile,
-      this.overrides, this.error, this.attemptedSolutions)
-      : this.packages = null,
-        this.pubspecs = null,
-        this.availableVersions = {};
-
-  /// Displays a report of what changes were made to the lockfile.
-  ///
-  /// [type] is the type of version resolution that was run.
-  void showReport(SolveType type) {
-    new SolveReport(type, _sources, _root, _previousLockFile, this).show();
-  }
-
-  /// Displays a one-line message summarizing what changes were made (or would
-  /// be made) to the lockfile.
-  ///
-  /// [type] is the type of version resolution that was run.
-  void summarizeChanges(SolveType type, {bool dryRun: false}) {
-    new SolveReport(type, _sources, _root, _previousLockFile, this)
-        .summarize(dryRun: dryRun);
-  }
-
-  String toString() {
-    if (!succeeded) {
-      return 'Failed to solve after $attemptedSolutions attempts:\n'
-             '$error';
-    }
-
-    return 'Took $attemptedSolutions tries to resolve to\n'
-           '- ${packages.join("\n- ")}';
-  }
-}
-
-/// Maintains a cache of previously-requested data: pubspecs and version lists.
-///
-/// Used to avoid requesting the same pubspec from the server repeatedly.
-class PubspecCache {
-  final SourceRegistry _sources;
-
-  /// The already-requested cached pubspec lists.
-  final _versions = new Map<PackageRef, List<PackageId>>();
-
-  /// The errors from failed version list requests.
-  final _versionErrors = new Map<PackageRef, Pair<Object, Chain>>();
-
-  /// The already-requested cached pubspecs.
-  final _pubspecs = new Map<PackageId, Pubspec>();
-
-  // TODO(nweiz): Currently, if [getCachedPubspec] returns pubspecs cached via
-  // [getVersions], the "complex backtrack" test case in version_solver_test
-  // fails. Fix that. See also [BacktrackingSolver._getTransitiveDependers].
-  /// The set of package ids for which [getPubspec] has been explicitly called.
-  final _explicitlyCached = new Set<PackageId>();
-
-  /// The type of version resolution that was run.
-  final SolveType _type;
-
-  /// The number of times a version list was requested and it wasn't cached and
-  /// had to be requested from the source.
-  int _versionCacheMisses = 0;
-
-  /// The number of times a version list was requested and the cached version
-  /// was returned.
-  int _versionCacheHits = 0;
-
-  /// The number of times a pubspec was requested and it wasn't cached and had
-  /// to be requested from the source.
-  int _pubspecCacheMisses = 0;
-
-  /// The number of times a pubspec was requested and the cached version was
-  /// returned.
-  int _pubspecCacheHits = 0;
-
-  PubspecCache(this._type, this._sources);
-
-  /// Caches [pubspec] as the [Pubspec] for the package identified by [id].
-  void cache(PackageId id, Pubspec pubspec) {
-    _pubspecs[id] = pubspec;
-  }
-
-  /// Loads the pubspec for the package identified by [id].
-  Future<Pubspec> getPubspec(PackageId id) async {
-    _explicitlyCached.add(id);
-
-    // Complete immediately if it's already cached.
-    if (_pubspecs.containsKey(id)) {
-      _pubspecCacheHits++;
-      return _pubspecs[id];
-    }
-
-    _pubspecCacheMisses++;
-
-    var source = _sources[id.source];
-    var pubspec = await source.describe(id);
-    _pubspecs[id] = pubspec;
-    return pubspec;
-  }
-
-  /// Returns the previously cached pubspec for the package identified by [id]
-  /// or returns `null` if not in the cache.
-  Pubspec getCachedPubspec(PackageId id) =>
-      _explicitlyCached.contains(id) ? _pubspecs[id] : null;
-
-  /// Gets the list of versions for [package].
-  ///
-  /// Packages are sorted in descending version order with all "stable"
-  /// versions (i.e. ones without a prerelease suffix) before pre-release
-  /// versions. This ensures that the solver prefers stable packages over
-  /// unstable ones.
-  Future<List<PackageId>> getVersions(PackageRef package) async {
-    if (package.isRoot) {
-      throw new StateError("Cannot get versions for root package $package.");
-    }
-
-    if (package.isMagic) return [new PackageId.magic(package.name)];
-
-    // See if we have it cached.
-    var versions = _versions[package];
-    if (versions != null) {
-      _versionCacheHits++;
-      return versions;
-    }
-
-    // See if we cached a failure.
-    var error = _versionErrors[package];
-    if (error != null) {
-      _versionCacheHits++;
-      await new Future.error(error.first, error.last);
-    }
-
-    _versionCacheMisses++;
-
-    var source = _sources[package.source];
-    var pubspecs;
-    try {
-      pubspecs = await source.getVersions(package.name, package.description);
-    } catch (error, stackTrace) {
-      // If an error occurs, cache that too. We only want to do one request
-      // for any given package, successful or not.
-      var chain = new Chain.forTrace(stackTrace);
-      log.solver("Could not get versions for $package:\n$error\n\n" +
-          chain.terse.toString());
-      _versionErrors[package] = new Pair(error, chain);
-      throw error;
-    }
-
-    // Sort by priority so we try preferred versions first.
-    pubspecs.sort((pubspec1, pubspec2) {
-      return _type == SolveType.DOWNGRADE
-          ? Version.antiprioritize(pubspec1.version, pubspec2.version)
-          : Version.prioritize(pubspec1.version, pubspec2.version);
-    });
-
-    var ids = pubspecs.reversed.map((pubspec) {
-      var id = package.atVersion(pubspec.version);
-      // Eagerly cache the pubspec now since we have it.
-      _pubspecs[id] = pubspec;
-      return id;
-    }).toList();
-    _versions[package] = ids;
-    return ids;
-  }
-
-  /// Returns the previously cached list of versions for the package identified
-  /// by [package] or returns `null` if not in the cache.
-  List<PackageId> getCachedVersions(PackageRef package) => _versions[package];
-
-  /// Returns a user-friendly output string describing metrics of the solve.
-  String describeResults() {
-    var results = '''- Requested $_versionCacheMisses version lists
-- Looked up $_versionCacheHits cached version lists
-- Requested $_pubspecCacheMisses pubspecs
-- Looked up $_pubspecCacheHits cached pubspecs
-''';
-
-    // Uncomment this to dump the visited package graph to JSON.
-    //results += _debugWritePackageGraph();
-
-    return results;
-  }
-}
-
-/// A reference from a depending package to a package that it depends on.
-class Dependency {
-  /// The package that has this dependency.
-  final PackageId depender;
-
-  /// The package being depended on.
-  final PackageDep dep;
-
-  Dependency(this.depender, this.dep);
-
-  String toString() => '$depender -> $dep';
-}
-
-/// An enum for types of version resolution.
-class SolveType {
-  /// As few changes to the lockfile as possible to be consistent with the
-  /// pubspec.
-  static const GET = const SolveType._("get");
-
-  /// Upgrade all packages or specific packages to the highest versions
-  /// possible, regardless of the lockfile.
-  static const UPGRADE = const SolveType._("upgrade");
-
-  /// Downgrade all packages or specific packages to the lowest versions
-  /// possible, regardless of the lockfile.
-  static const DOWNGRADE = const SolveType._("downgrade");
-
-  final String _name;
-
-  const SolveType._(this._name);
-
-  String toString() => _name;
-}
-
-/// Base class for all failures that can occur while trying to resolve versions.
-abstract class SolveFailure implements ApplicationException {
-  /// The name of the package whose version could not be solved.
-  ///
-  /// Will be `null` if the failure is not specific to one package.
-  final String package;
-
-  /// The known dependencies on [package] at the time of the failure.
-  ///
-  /// Will be an empty collection if the failure is not specific to one package.
-  final Iterable<Dependency> dependencies;
-
-  String get message => toString();
-
-  /// A message describing the specific kind of solve failure.
-  String get _message {
-    throw new UnimplementedError("Must override _message or toString().");
-  }
-
-  SolveFailure(this.package, Iterable<Dependency> dependencies)
-      : dependencies = dependencies != null ? dependencies : <Dependency>[];
-
-  String toString() {
-    if (dependencies.isEmpty) return _message;
-
-    var buffer = new StringBuffer();
-    buffer.write("$_message:");
-
-    var sorted = dependencies.toList();
-    sorted.sort((a, b) => a.depender.name.compareTo(b.depender.name));
-
-    for (var dep in sorted) {
-      buffer.writeln();
-      buffer.write("- ${log.bold(dep.depender.name)}");
-      if (!dep.depender.isMagic && !dep.depender.isRoot) {
-        buffer.write(" ${dep.depender.version}");
-      }
-      buffer.write(" ${_describeDependency(dep.dep)}");
-    }
-
-    return buffer.toString();
-  }
-
-  /// Describes a dependency's reference in the output message.
-  ///
-  /// Override this to highlight which aspect of [dep] led to the failure.
-  String _describeDependency(PackageDep dep) =>
-      "depends on version ${dep.constraint}";
-}
-
-/// Exception thrown when the current SDK's version does not match a package's
-/// constraint on it.
-class BadSdkVersionException extends SolveFailure {
-  final String _message;
-
-  BadSdkVersionException(String package, String message)
-      : super(package, null),
-        _message = message;
-}
-
-/// Exception thrown when the [VersionConstraint] used to match a package is
-/// valid (i.e. non-empty), but there are no available versions of the package
-/// that fit that constraint.
-class NoVersionException extends SolveFailure {
-  final VersionConstraint constraint;
-
-  /// The last selected version of the package that failed to meet the new
-  /// constraint.
-  ///
-  /// This will be `null` when the failure occurred because there are no
-  /// versions of the package *at all* that match the constraint. It will be
-  /// non-`null` when a version was selected, but then the solver tightened a
-  /// constraint such that that version was no longer allowed.
-  final Version version;
-
-  NoVersionException(String package, this.version, this.constraint,
-      Iterable<Dependency> dependencies)
-      : super(package, dependencies);
-
-  String get _message {
-    if (version == null) {
-      return "Package $package has no versions that match $constraint derived "
-          "from";
-    }
-
-    return "Package $package $version does not match $constraint derived from";
-  }
-}
-
-// TODO(rnystrom): Report the list of depending packages and their constraints.
-/// Exception thrown when the most recent version of [package] must be selected,
-/// but doesn't match the [VersionConstraint] imposed on the package.
-class CouldNotUpgradeException extends SolveFailure {
-  final VersionConstraint constraint;
-  final Version best;
-
-  CouldNotUpgradeException(String package, this.constraint, this.best)
-      : super(package, null);
-
-  String get _message =>
-      "The latest version of $package, $best, does not match $constraint.";
-}
-
-/// Exception thrown when the [VersionConstraint] used to match a package is
-/// the empty set: in other words, multiple packages depend on it and have
-/// conflicting constraints that have no overlap.
-class DisjointConstraintException extends SolveFailure {
-  DisjointConstraintException(String package, Iterable<Dependency> dependencies)
-      : super(package, dependencies);
-
-  String get _message => "Incompatible version constraints on $package";
-}
-
-/// Exception thrown when two packages with the same name but different sources
-/// are depended upon.
-class SourceMismatchException extends SolveFailure {
-  String get _message => "Incompatible dependencies on $package";
-
-  SourceMismatchException(String package, Iterable<Dependency> dependencies)
-      : super(package, dependencies);
-
-  String _describeDependency(PackageDep dep) =>
-      "depends on it from source ${dep.source}";
-}
-
-/// Exception thrown when a dependency on an unknown source name is found.
-class UnknownSourceException extends SolveFailure {
-  UnknownSourceException(String package, Iterable<Dependency> dependencies)
-      : super(package, dependencies);
-
-  String toString() {
-    var dep = dependencies.single;
-    return 'Package ${dep.depender.name} depends on ${dep.dep.name} from '
-           'unknown source "${dep.dep.source}".';
-  }
-}
-
-/// Exception thrown when two packages with the same name and source but
-/// different descriptions are depended upon.
-class DescriptionMismatchException extends SolveFailure {
-  String get _message => "Incompatible dependencies on $package";
-
-  DescriptionMismatchException(String package,
-      Iterable<Dependency> dependencies)
-      : super(package, dependencies);
-
-  String _describeDependency(PackageDep dep) {
-    // TODO(nweiz): Dump descriptions to YAML when that's supported.
-    return "depends on it with description ${JSON.encode(dep.description)}";
-  }
-}
-
-/// Exception thrown when a dependency could not be found in its source.
-///
-/// Unlike [PackageNotFoundException], this includes information about the
-/// dependent packages requesting the missing one.
-class DependencyNotFoundException extends SolveFailure {
-  final PackageNotFoundException _innerException;
-  String get _message => "${_innerException.message}\nDepended on by";
-
-  DependencyNotFoundException(String package, this._innerException,
-      Iterable<Dependency> dependencies)
-      : super(package, dependencies);
-
-  /// The failure isn't because of the version of description of the package,
-  /// it's the package itself that can't be found, so just show the name and no
-  /// descriptive details.
-  String _describeDependency(PackageDep dep) => "";
-}
diff --git a/sdk/lib/_internal/pub/lib/src/source.dart b/sdk/lib/_internal/pub/lib/src/source.dart
deleted file mode 100644
index 85218d3..0000000
--- a/sdk/lib/_internal/pub/lib/src/source.dart
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.source;
-
-import 'dart:async';
-
-import 'package:pub_semver/pub_semver.dart';
-
-import 'package.dart';
-import 'pubspec.dart';
-import 'system_cache.dart';
-
-/// A source from which to get packages.
-///
-/// Each source has many packages that it looks up using [PackageId]s. Sources
-/// that inherit this directly (currently just [PathSource]) are *uncached*
-/// sources. They deliver a package directly to the package that depends on it.
-///
-/// Other sources are *cached* sources. These extend [CachedSource]. When a
-/// package needs a dependency from a cached source, it is first installed in
-/// the [SystemCache] and then acquired from there.
-abstract class Source {
-  /// The name of the source.
-  ///
-  /// Should be lower-case, suitable for use in a filename, and unique accross
-  /// all sources.
-  String get name;
-
-  /// Whether this source can choose between multiple versions of the same
-  /// package during version solving.
-  ///
-  /// Defaults to `false`.
-  final bool hasMultipleVersions = false;
-
-  /// Whether or not this source is the default source.
-  bool get isDefault => systemCache.sources.defaultSource == this;
-
-  /// The system cache with which this source is registered.
-  SystemCache get systemCache {
-    assert(_systemCache != null);
-    return _systemCache;
-  }
-
-  /// The system cache variable.
-  ///
-  /// Set by [_bind].
-  SystemCache _systemCache;
-
-  /// Records the system cache to which this source belongs.
-  ///
-  /// This should only be called once for each source, by
-  /// [SystemCache.register]. It should not be overridden by base classes.
-  void bind(SystemCache systemCache) {
-    assert(_systemCache == null);
-    this._systemCache = systemCache;
-  }
-
-  /// Get the pubspecs of all versions that exist for the package described by
-  /// [description].
-  ///
-  /// [name] is the expected name of the package.
-  ///
-  /// Note that this does *not* require the packages to be downloaded locally,
-  /// which is the point. This is used during version resolution to determine
-  /// which package versions are available to be downloaded (or already
-  /// downloaded).
-  ///
-  /// By default, this assumes that each description has a single version and
-  /// uses [describe] to get that version.
-  Future<List<Pubspec>> getVersions(String name, description) async {
-    var id = new PackageId(name, this.name, Version.none, description);
-    return [await describe(id)];
-  }
-
-  /// Loads the (possibly remote) pubspec for the package version identified by
-  /// [id].
-  ///
-  /// This may be called for packages that have not yet been downloaded during
-  /// the version resolution process.
-  ///
-  /// Sources should not override this. Instead, they implement [doDescribe].
-  Future<Pubspec> describe(PackageId id) {
-    if (id.isRoot) throw new ArgumentError("Cannot describe the root package.");
-    if (id.source != name) {
-      throw new ArgumentError("Package $id does not use source $name.");
-    }
-
-    // Delegate to the overridden one.
-    return doDescribe(id);
-  }
-
-  /// Loads the (possibly remote) pubspec for the package version identified by
-  /// [id].
-  ///
-  /// This may be called for packages that have not yet been downloaded during
-  /// the version resolution process.
-  ///
-  /// This method is effectively protected: subclasses must implement it, but
-  /// external code should not call this. Instead, call [describe].
-  Future<Pubspec> doDescribe(PackageId id);
-
-  /// Ensures [id] is available locally and creates a symlink at [symlink]
-  /// pointing it.
-  Future get(PackageId id, String symlink);
-
-  /// Returns the directory where this package can (or could) be found locally.
-  ///
-  /// If the source is cached, this will be a path in the system cache. In that
-  /// case, this will return a directory even if the package has not been
-  /// installed into the cache yet.
-  Future<String> getDirectory(PackageId id);
-
-  /// Gives the source a chance to interpret and validate the description for
-  /// a package coming from this source.
-  ///
-  /// When a [Pubspec] or [LockFile] is parsed, it reads in the description for
-  /// each dependency. It is up to the dependency's [Source] to determine how
-  /// that should be interpreted. This will be called during parsing to validate
-  /// that the given [description] is well-formed according to this source, and
-  /// to give the source a chance to canonicalize the description.
-  ///
-  /// [containingPath] is the path to the local file (pubspec or lockfile)
-  /// where this description appears. It may be `null` if the description is
-  /// coming from some in-memory source (such as pulling down a pubspec from
-  /// pub.dartlang.org).
-  ///
-  /// It should return if a (possibly modified) valid description, or throw a
-  /// [FormatException] if not valid.
-  ///
-  /// [fromLockFile] is true when the description comes from a [LockFile], to
-  /// allow the source to use lockfile-specific descriptions via [resolveId].
-  dynamic parseDescription(String containingPath, description,
-                           {bool fromLockFile: false});
-
-  /// When a [LockFile] is serialized, it uses this method to get the
-  /// [description] in the right format.
-  ///
-  /// [containingPath] is the containing directory of the root package.
-  dynamic serializeDescription(String containingPath, description) {
-    return description;
-  }
-
-  /// When a package [description] is shown to the user, this is called to
-  /// convert it into a human-friendly form.
-  ///
-  /// By default, it just converts the description to a string, but sources
-  /// may customize this. [containingPath] is the containing directory of the
-  /// root package.
-  String formatDescription(String containingPath, description) {
-    return description.toString();
-  }
-
-  /// Returns whether or not [description1] describes the same package as
-  /// [description2] for this source.
-  ///
-  /// This method should be light-weight. It doesn't need to validate that
-  /// either package exists.
-  bool descriptionsEqual(description1, description2);
-
-  /// Resolves [id] to a more possibly more precise that will uniquely identify
-  /// a package regardless of when the package is requested.
-  ///
-  /// For some sources, [PackageId]s can point to different chunks of code at
-  /// different times. This takes such an [id] and returns a future that
-  /// completes to a [PackageId] that will uniquely specify a single chunk of
-  /// code forever.
-  ///
-  /// For example, [GitSource] might take an [id] with description
-  /// `http://github.com/dart-lang/some-lib.git` and return an id with a
-  /// description that includes the current commit of the Git repository.
-  ///
-  /// Pub calls this after getting a package, so the source can use the local
-  /// package to determine information about the resolved id.
-  ///
-  /// The returned [PackageId] may have a description field that's invalid
-  /// according to [parseDescription], although it must still be serializable
-  /// to JSON and YAML. It must also be equal to [id] according to
-  /// [descriptionsEqual].
-  ///
-  /// By default, this just returns [id].
-  Future<PackageId> resolveId(PackageId id) => new Future.value(id);
-
-  /// Returns the source's name.
-  String toString() => name;
-}
diff --git a/sdk/lib/_internal/pub/lib/src/source/cached.dart b/sdk/lib/_internal/pub/lib/src/source/cached.dart
deleted file mode 100644
index 3775aa9..0000000
--- a/sdk/lib/_internal/pub/lib/src/source/cached.dart
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.source.cached;
-
-import 'dart:async';
-
-import 'package:path/path.dart' as path;
-
-import '../io.dart';
-import '../package.dart';
-import '../pubspec.dart';
-import '../source.dart';
-import '../utils.dart';
-
-/// Base class for a [Source] that installs packages into pub's [SystemCache].
-///
-/// A source should be cached if it requires network access to retrieve
-/// packages or the package needs to be "frozen" at the point in time that it's
-/// installed. (For example, Git packages are cached because installing from
-/// the same repo over time may yield different commits.)
-abstract class CachedSource extends Source {
-  /// The root directory of this source's cache within the system cache.
-  ///
-  /// This shouldn't be overridden by subclasses.
-  String get systemCacheRoot => path.join(systemCache.rootDir, name);
-
-  /// If [id] is already in the system cache, just loads it from there.
-  ///
-  /// Otherwise, defers to the subclass.
-  Future<Pubspec> doDescribe(PackageId id) {
-    return getDirectory(id).then((packageDir) {
-      if (fileExists(path.join(packageDir, "pubspec.yaml"))) {
-        return new Pubspec.load(packageDir, systemCache.sources,
-            expectedName: id.name);
-      }
-
-      return describeUncached(id);
-    });
-  }
-
-  /// Loads the (possibly remote) pubspec for the package version identified by
-  /// [id].
-  ///
-  /// This will only be called for packages that have not yet been installed in
-  /// the system cache.
-  Future<Pubspec> describeUncached(PackageId id);
-
-  Future get(PackageId id, String symlink) {
-    return downloadToSystemCache(id).then((pkg) {
-      createPackageSymlink(id.name, pkg.dir, symlink);
-    });
-  }
-
-  /// Determines if the package with [id] is already downloaded to the system
-  /// cache.
-  Future<bool> isInSystemCache(PackageId id) =>
-      getDirectory(id).then(dirExists);
-
-  /// Downloads the package identified by [id] to the system cache.
-  Future<Package> downloadToSystemCache(PackageId id);
-
-  /// Returns the [Package]s that have been downloaded to the system cache.
-  List<Package> getCachedPackages();
-
-  /// Reinstalls all packages that have been previously installed into the
-  /// system cache by this source.
-  ///
-  /// Returns a [Pair] whose first element is the number of packages
-  /// successfully repaired and the second is the number of failures.
-  Future<Pair<int, int>> repairCachedPackages();
-}
diff --git a/sdk/lib/_internal/pub/lib/src/source/git.dart b/sdk/lib/_internal/pub/lib/src/source/git.dart
deleted file mode 100644
index dc4c8b3..0000000
--- a/sdk/lib/_internal/pub/lib/src/source/git.dart
+++ /dev/null
@@ -1,340 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.source.git;
-
-import 'dart:async';
-
-import 'package:path/path.dart' as path;
-
-import '../git.dart' as git;
-import '../io.dart';
-import '../log.dart' as log;
-import '../package.dart';
-import '../pubspec.dart';
-import '../utils.dart';
-import 'cached.dart';
-
-/// A package source that gets packages from Git repos.
-class GitSource extends CachedSource {
-  /// Given a valid git package description, returns the URL of the repository
-  /// it pulls from.
-  static String urlFromDescription(description) => description["url"];
-
-  final name = "git";
-
-  /// The paths to the canonical clones of repositories for which "git fetch"
-  /// has already been run during this run of pub.
-  final _updatedRepos = new Set<String>();
-
-  /// Given a Git repo that contains a pub package, gets the name of the pub
-  /// package.
-  Future<String> getPackageNameFromRepo(String repo) {
-    // Clone the repo to a temp directory.
-    return withTempDir((tempDir) {
-      return _clone(repo, tempDir, shallow: true).then((_) {
-        var pubspec = new Pubspec.load(tempDir, systemCache.sources);
-        return pubspec.name;
-      });
-    });
-  }
-
-  /// Since we don't have an easy way to read from a remote Git repo, this
-  /// just installs [id] into the system cache, then describes it from there.
-  Future<Pubspec> describeUncached(PackageId id) {
-    return downloadToSystemCache(id).then((package) => package.pubspec);
-  }
-
-  /// Clones a Git repo to the local filesystem.
-  ///
-  /// The Git cache directory is a little idiosyncratic. At the top level, it
-  /// contains a directory for each commit of each repository, named `<package
-  /// name>-<commit hash>`. These are the canonical package directories that are
-  /// linked to from the `packages/` directory.
-  ///
-  /// In addition, the Git system cache contains a subdirectory named `cache/`
-  /// which contains a directory for each separate repository URL, named
-  /// `<package name>-<url hash>`. These are used to check out the repository
-  /// itself; each of the commit-specific directories are clones of a directory
-  /// in `cache/`.
-  Future<Package> downloadToSystemCache(PackageId id) {
-    var revisionCachePath;
-
-    if (!git.isInstalled) {
-      fail("Cannot get ${id.name} from Git (${_getUrl(id)}).\n"
-          "Please ensure Git is correctly installed.");
-    }
-
-    ensureDir(path.join(systemCacheRoot, 'cache'));
-    return _ensureRevision(id).then((_) => getDirectory(id)).then((path) {
-      revisionCachePath = path;
-      if (entryExists(revisionCachePath)) return null;
-      return _clone(_repoCachePath(id), revisionCachePath, mirror: false);
-    }).then((_) {
-      var ref = _getEffectiveRef(id);
-      if (ref == 'HEAD') return null;
-      return _checkOut(revisionCachePath, ref);
-    }).then((_) {
-      return new Package.load(id.name, revisionCachePath, systemCache.sources);
-    });
-  }
-
-  /// Returns the path to the revision-specific cache of [id].
-  Future<String> getDirectory(PackageId id) {
-    return _ensureRevision(id).then((rev) {
-      var revisionCacheName = '${id.name}-$rev';
-      return path.join(systemCacheRoot, revisionCacheName);
-    });
-  }
-
-  /// Ensures [description] is a Git URL.
-  dynamic parseDescription(String containingPath, description,
-                           {bool fromLockFile: false}) {
-    // TODO(rnystrom): Handle git URLs that are relative file paths (#8570).
-    // TODO(rnystrom): Now that this function can modify the description, it
-    // may as well canonicalize it to a map so that other code in the source
-    // can assume that.
-    // A single string is assumed to be a Git URL.
-    if (description is String) return description;
-    if (description is! Map || !description.containsKey('url')) {
-      throw new FormatException("The description must be a Git URL or a map "
-          "with a 'url' key.");
-    }
-
-    var parsed = new Map.from(description);
-    parsed.remove('url');
-    parsed.remove('ref');
-    if (fromLockFile) parsed.remove('resolved-ref');
-
-    if (!parsed.isEmpty) {
-      var plural = parsed.length > 1;
-      var keys = parsed.keys.join(', ');
-      throw new FormatException("Invalid key${plural ? 's' : ''}: $keys.");
-    }
-
-    return description;
-  }
-
-  /// If [description] has a resolved ref, print it out in short-form.
-  ///
-  /// This helps distinguish different git commits with the same pubspec
-  /// version.
-  String formatDescription(String containingPath, description) {
-    if (description is Map && description.containsKey('resolved-ref')) {
-      return "${description['url']} at "
-          "${description['resolved-ref'].substring(0, 6)}";
-    } else {
-      return super.formatDescription(containingPath, description);
-    }
-  }
-
-  /// Two Git descriptions are equal if both their URLs and their refs are
-  /// equal.
-  bool descriptionsEqual(description1, description2) {
-    // TODO(nweiz): Do we really want to throw an error if you have two
-    // dependencies on some repo, one of which specifies a ref and one of which
-    // doesn't? If not, how do we handle that case in the version solver?
-    if (_getUrl(description1) != _getUrl(description2)) return false;
-    if (_getRef(description1) != _getRef(description2)) return false;
-
-    if (description1 is Map && description1.containsKey('resolved-ref') &&
-        description2 is Map && description2.containsKey('resolved-ref')) {
-      return description1['resolved-ref'] == description2['resolved-ref'];
-    }
-
-    return true;
-  }
-
-  /// Attaches a specific commit to [id] to disambiguate it.
-  Future<PackageId> resolveId(PackageId id) {
-    return _ensureRevision(id).then((revision) {
-      var description = {'url': _getUrl(id), 'ref': _getRef(id)};
-      description['resolved-ref'] = revision;
-      return new PackageId(id.name, name, id.version, description);
-    });
-  }
-
-  List<Package> getCachedPackages() {
-    // TODO(keertip): Implement getCachedPackages().
-    throw new UnimplementedError(
-        "The git source doesn't support listing its cached packages yet.");
-  }
-
-  /// Resets all cached packages back to the pristine state of the Git
-  /// repository at the revision they are pinned to.
-  Future<Pair<int, int>> repairCachedPackages() async {
-    if (!dirExists(systemCacheRoot)) return new Pair(0, 0);
-
-    var successes = 0;
-    var failures = 0;
-
-    var packages = listDir(systemCacheRoot)
-        .where((entry) => dirExists(path.join(entry, ".git")))
-        .map((packageDir) => new Package.load(null, packageDir,
-            systemCache.sources))
-        .toList();
-
-    // Note that there may be multiple packages with the same name and version
-    // (pinned to different commits). The sort order of those is unspecified.
-    packages.sort(Package.orderByNameAndVersion);
-
-    for (var package in packages) {
-      log.message("Resetting Git repository for "
-          "${log.bold(package.name)} ${package.version}...");
-
-      try {
-        // Remove all untracked files.
-        await git.run(["clean", "-d", "--force", "-x"],
-            workingDir: package.dir);
-
-        // Discard all changes to tracked files.
-        await git.run(["reset", "--hard", "HEAD"], workingDir: package.dir);
-
-        successes++;
-      } on git.GitException catch (error, stackTrace) {
-        log.error("Failed to reset ${log.bold(package.name)} "
-            "${package.version}. Error:\n$error");
-        log.fine(stackTrace);
-        failures++;
-
-        tryDeleteEntry(package.dir);
-      }
-    }
-
-    return new Pair(successes, failures);
-  }
-
-  /// Ensure that the canonical clone of the repository referred to by [id] (the
-  /// one in `<system cache>/git/cache`) exists and contains the revision
-  /// referred to by [id].
-  ///
-  /// Returns a future that completes to the hash of the revision identified by
-  /// [id].
-  Future<String> _ensureRevision(PackageId id) {
-    return new Future.sync(() {
-      var path = _repoCachePath(id);
-      if (!entryExists(path)) {
-        return _clone(_getUrl(id), path, mirror: true)
-            .then((_) => _getRev(id));
-      }
-
-      // If [id] didn't come from a lockfile, it may be using a symbolic
-      // reference. We want to get the latest version of that reference.
-      var description = id.description;
-      if (description is! Map || !description.containsKey('resolved-ref')) {
-        return _updateRepoCache(id).then((_) => _getRev(id));
-      }
-
-      // If [id] did come from a lockfile, then we want to avoid running "git
-      // fetch" if possible to avoid networking time and errors. See if the
-      // revision exists in the repo cache before updating it.
-      return _getRev(id).catchError((error) {
-        if (error is! git.GitException) throw error;
-        return _updateRepoCache(id).then((_) => _getRev(id));
-      });
-    });
-  }
-
-  /// Runs "git fetch" in the canonical clone of the repository referred to by
-  /// [id].
-  ///
-  /// This assumes that the canonical clone already exists.
-  Future _updateRepoCache(PackageId id) {
-    var path = _repoCachePath(id);
-    if (_updatedRepos.contains(path)) return new Future.value();
-    return git.run(["fetch"], workingDir: path).then((_) {
-      _updatedRepos.add(path);
-    });
-  }
-
-  /// Runs "git rev-list" in the canonical clone of the repository referred to
-  /// by [id] on the effective ref of [id].
-  ///
-  /// This assumes that the canonical clone already exists.
-  Future<String> _getRev(PackageId id) {
-    return git.run(["rev-list", "--max-count=1", _getEffectiveRef(id)],
-        workingDir: _repoCachePath(id)).then((result) => result.first);
-  }
-
-  /// Clones the repo at the URI [from] to the path [to] on the local
-  /// filesystem.
-  ///
-  /// If [mirror] is true, creates a bare, mirrored clone. This doesn't check
-  /// out the working tree, but instead makes the repository a local mirror of
-  /// the remote repository. See the manpage for `git clone` for more
-  /// information.
-  ///
-  /// If [shallow] is true, creates a shallow clone that contains no history
-  /// for the repository.
-  Future _clone(String from, String to, {bool mirror: false,
-      bool shallow: false}) {
-    return new Future.sync(() {
-      // Git on Windows does not seem to automatically create the destination
-      // directory.
-      ensureDir(to);
-      var args = ["clone", from, to];
-
-      if (mirror) args.insert(1, "--mirror");
-      if (shallow) args.insertAll(1, ["--depth", "1"]);
-
-      return git.run(args);
-    }).then((result) => null);
-  }
-
-  /// Checks out the reference [ref] in [repoPath].
-  Future _checkOut(String repoPath, String ref) {
-    return git.run(["checkout", ref], workingDir: repoPath).then(
-        (result) => null);
-  }
-
-  /// Returns the path to the canonical clone of the repository referred to by
-  /// [id] (the one in `<system cache>/git/cache`).
-  String _repoCachePath(PackageId id) {
-    var repoCacheName = '${id.name}-${sha1(_getUrl(id))}';
-    return path.join(systemCacheRoot, 'cache', repoCacheName);
-  }
-
-  /// Returns the repository URL for [id].
-  ///
-  /// [description] may be a description or a [PackageId].
-  String _getUrl(description) {
-    description = _getDescription(description);
-    if (description is String) return description;
-    return description['url'];
-  }
-
-  /// Returns the commit ref that should be checked out for [description].
-  ///
-  /// This differs from [_getRef] in that it doesn't just return the ref in
-  /// [description]. It will return a sensible default if that ref doesn't
-  /// exist, and it will respect the "resolved-ref" parameter set by
-  /// [resolveId].
-  ///
-  /// [description] may be a description or a [PackageId].
-  String _getEffectiveRef(description) {
-    description = _getDescription(description);
-    if (description is Map && description.containsKey('resolved-ref')) {
-      return description['resolved-ref'];
-    }
-
-    var ref = _getRef(description);
-    return ref == null ? 'HEAD' : ref;
-  }
-
-  /// Returns the commit ref for [description], or null if none is given.
-  ///
-  /// [description] may be a description or a [PackageId].
-  String _getRef(description) {
-    description = _getDescription(description);
-    if (description is String) return null;
-    return description['ref'];
-  }
-
-  /// Returns [description] if it's a description, or [PackageId.description] if
-  /// it's a [PackageId].
-  _getDescription(description) {
-    if (description is PackageId) return description.description;
-    return description;
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/source/hosted.dart b/sdk/lib/_internal/pub/lib/src/source/hosted.dart
deleted file mode 100644
index c9ab68e..0000000
--- a/sdk/lib/_internal/pub/lib/src/source/hosted.dart
+++ /dev/null
@@ -1,372 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.source.hosted;
-
-import 'dart:async';
-import 'dart:io' as io;
-import "dart:convert";
-
-import 'package:http/http.dart' as http;
-import 'package:path/path.dart' as path;
-import 'package:pub_semver/pub_semver.dart';
-
-import '../exceptions.dart';
-import '../http.dart';
-import '../io.dart';
-import '../log.dart' as log;
-import '../package.dart';
-import '../pubspec.dart';
-import '../utils.dart';
-import 'cached.dart';
-
-/// A package source that gets packages from a package hosting site that uses
-/// the same API as pub.dartlang.org.
-class HostedSource extends CachedSource {
-  final name = "hosted";
-  final hasMultipleVersions = true;
-
-  /// Gets the default URL for the package server for hosted dependencies.
-  static String get defaultUrl {
-    var url = io.Platform.environment["PUB_HOSTED_URL"];
-    if (url != null) return url;
-
-    return "https://pub.dartlang.org";
-  }
-
-  /// Downloads a list of all versions of a package that are available from the
-  /// site.
-  Future<List<Pubspec>> getVersions(String name, description) async {
-    var url = _makeUrl(description,
-        (server, package) => "$server/api/packages/$package");
-
-    log.io("Get versions from $url.");
-
-    var body;
-    try {
-      body = await httpClient.read(url, headers: PUB_API_HEADERS);
-    } catch (error, stackTrace) {
-      var parsed = _parseDescription(description);
-      _throwFriendlyError(error, stackTrace, parsed.first, parsed.last);
-    }
-
-    var doc = JSON.decode(body);
-    return doc['versions'].map((map) {
-      return new Pubspec.fromMap(
-          map['pubspec'], systemCache.sources,
-          expectedName: name, location: url);
-    }).toList();
-  }
-
-  /// Downloads and parses the pubspec for a specific version of a package that
-  /// is available from the site.
-  Future<Pubspec> describeUncached(PackageId id) async {
-    // Request it from the server.
-    var url = _makeVersionUrl(id, (server, package, version) =>
-        "$server/api/packages/$package/versions/$version");
-
-    log.io("Describe package at $url.");
-    var version;
-    try {
-      version = JSON.decode(
-          await httpClient.read(url, headers: PUB_API_HEADERS));
-    } catch (error, stackTrace) {
-      var parsed = _parseDescription(id.description);
-      _throwFriendlyError(error, stackTrace, id.name, parsed.last);
-    }
-
-    return new Pubspec.fromMap(
-        version['pubspec'], systemCache.sources,
-        expectedName: id.name, location: url);
-  }
-
-  /// Downloads the package identified by [id] to the system cache.
-  Future<Package> downloadToSystemCache(PackageId id) {
-    return isInSystemCache(id).then((inCache) {
-      // Already cached so don't download it.
-      if (inCache) return true;
-
-      var packageDir = _getDirectory(id);
-      ensureDir(path.dirname(packageDir));
-      var parsed = _parseDescription(id.description);
-      return _download(parsed.last, parsed.first, id.version, packageDir);
-    }).then((found) {
-      if (!found) fail('Package $id not found.');
-      return new Package.load(id.name, _getDirectory(id), systemCache.sources);
-    });
-  }
-
-  /// The system cache directory for the hosted source contains subdirectories
-  /// for each separate repository URL that's used on the system.
-  ///
-  /// Each of these subdirectories then contains a subdirectory for each
-  /// package downloaded from that site.
-  Future<String> getDirectory(PackageId id) =>
-      new Future.value(_getDirectory(id));
-
-  String _getDirectory(PackageId id) {
-    var parsed = _parseDescription(id.description);
-    var dir = _urlToDirectory(parsed.last);
-    return path.join(systemCacheRoot, dir, "${parsed.first}-${id.version}");
-  }
-
-  String packageName(description) => _parseDescription(description).first;
-
-  bool descriptionsEqual(description1, description2) =>
-      _parseDescription(description1) == _parseDescription(description2);
-
-  /// Ensures that [description] is a valid hosted package description.
-  ///
-  /// There are two valid formats. A plain string refers to a package with the
-  /// given name from the default host, while a map with keys "name" and "url"
-  /// refers to a package with the given name from the host at the given URL.
-  dynamic parseDescription(String containingPath, description,
-                           {bool fromLockFile: false}) {
-    _parseDescription(description);
-    return description;
-  }
-
-  /// Re-downloads all packages that have been previously downloaded into the
-  /// system cache from any server.
-  Future<Pair<int, int>> repairCachedPackages() async {
-    if (!dirExists(systemCacheRoot)) return new Pair(0, 0);
-
-    var successes = 0;
-    var failures = 0;
-
-    for (var serverDir in listDir(systemCacheRoot)) {
-      var url = _directoryToUrl(path.basename(serverDir));
-      var packages = _getCachedPackagesInDirectory(path.basename(serverDir));
-      packages.sort(Package.orderByNameAndVersion);
-
-      for (var package in packages) {
-        try {
-          await _download(url, package.name, package.version, package.dir);
-          successes++;
-        } catch (error, stackTrace) {
-          failures++;
-          var message = "Failed to repair ${log.bold(package.name)} "
-              "${package.version}";
-          if (url != defaultUrl) message += " from $url";
-          log.error("$message. Error:\n$error");
-          log.fine(stackTrace);
-
-          tryDeleteEntry(package.dir);
-        }
-      }
-    }
-
-    return new Pair(successes, failures);
-  }
-
-  /// Gets all of the packages that have been downloaded into the system cache
-  /// from the default server.
-  List<Package> getCachedPackages() {
-    return _getCachedPackagesInDirectory(_urlToDirectory(defaultUrl));
-  }
-
-  /// Gets all of the packages that have been downloaded into the system cache
-  /// into [dir].
-  List<Package> _getCachedPackagesInDirectory(String dir) {
-    var cacheDir = path.join(systemCacheRoot, dir);
-    if (!dirExists(cacheDir)) return [];
-
-    return listDir(cacheDir)
-        .map((entry) => new Package.load(null, entry, systemCache.sources))
-        .toList();
-  }
-
-  /// Downloads package [package] at [version] from [server], and unpacks it
-  /// into [destPath].
-  Future<bool> _download(String server, String package, Version version,
-      String destPath) {
-    return new Future.sync(() {
-      var url = Uri.parse("$server/packages/$package/versions/$version.tar.gz");
-      log.io("Get package from $url.");
-      log.message('Downloading ${log.bold(package)} ${version}...');
-
-      // Download and extract the archive to a temp directory.
-      var tempDir = systemCache.createTempDir();
-      return httpClient.send(new http.Request("GET", url))
-          .then((response) => response.stream)
-          .then((stream) {
-        return timeout(extractTarGz(stream, tempDir), HTTP_TIMEOUT, url,
-            'downloading $url');
-      }).then((_) {
-        // Remove the existing directory if it exists. This will happen if
-        // we're forcing a download to repair the cache.
-        if (dirExists(destPath)) deleteEntry(destPath);
-
-        // Now that the get has succeeded, move it to the real location in the
-        // cache. This ensures that we don't leave half-busted ghost
-        // directories in the user's pub cache if a get fails.
-        renameDir(tempDir, destPath);
-        return true;
-      });
-    });
-  }
-
-  /// When an error occurs trying to read something about [package] from [url],
-  /// this tries to translate into a more user friendly error message.
-  ///
-  /// Always throws an error, either the original one or a better one.
-  void _throwFriendlyError(error, StackTrace stackTrace, String package,
-      String url) {
-    if (error is PubHttpException &&
-        error.response.statusCode == 404) {
-      throw new PackageNotFoundException(
-          "Could not find package $package at $url.", error, stackTrace);
-    }
-
-    if (error is TimeoutException) {
-      fail("Timed out trying to find package $package at $url.",
-          error, stackTrace);
-    }
-
-    if (error is io.SocketException) {
-      fail("Got socket error trying to find package $package at $url.",
-           error, stackTrace);
-    }
-
-    // Otherwise re-throw the original exception.
-    throw error;
-  }
-}
-
-/// This is the modified hosted source used when pub get or upgrade are run
-/// with "--offline".
-///
-/// This uses the system cache to get the list of available packages and does
-/// no network access.
-class OfflineHostedSource extends HostedSource {
-  /// Gets the list of all versions of [name] that are in the system cache.
-  Future<List<Pubspec>> getVersions(String name, description) async {
-    var parsed = _parseDescription(description);
-    var server = parsed.last;
-    log.io("Finding versions of $name in "
-        "$systemCacheRoot/${_urlToDirectory(server)}");
-    var versions = await _getCachedPackagesInDirectory(_urlToDirectory(server))
-        .where((package) => package.name == name)
-        .map((package) => package.pubspec)
-        .toList();
-
-    // If there are no versions in the cache, report a clearer error.
-    if (versions.isEmpty) fail("Could not find package $name in cache.");
-
-    return versions;
-  }
-
-  Future<bool> _download(String server, String package, Version version,
-      String destPath) {
-    // Since HostedSource is cached, this will only be called for uncached
-    // packages.
-    throw new UnsupportedError("Cannot download packages when offline.");
-  }
-
-  Future<Pubspec> doDescribeUncached(PackageId id) {
-    // [getVersions()] will only return packages that are already cached.
-    // [CachedSource] will only call [doDescribeUncached()] on a package after
-    // it has failed to find it in the cache, so this code should not be
-    // reached.
-    throw new UnsupportedError("Cannot describe packages when offline.");
-  }
-}
-
-/// Given a URL, returns a "normalized" string to be used as a directory name
-/// for packages downloaded from the server at that URL.
-///
-/// This normalization strips off the scheme (which is presumed to be HTTP or
-/// HTTPS) and *sort of* URL-encodes it. I say "sort of" because it does it
-/// incorrectly: it uses the character's *decimal* ASCII value instead of hex.
-///
-/// This could cause an ambiguity since some characters get encoded as three
-/// digits and others two. It's possible for one to be a prefix of the other.
-/// In practice, the set of characters that are encoded don't happen to have
-/// any collisions, so the encoding is reversible.
-///
-/// This behavior is a bug, but is being preserved for compatibility.
-String _urlToDirectory(String url) {
-  // Normalize all loopback URLs to "localhost".
-  url = url.replaceAllMapped(new RegExp(r"^https?://(127\.0\.0\.1|\[::1\])?"),
-      (match) => match[1] == null ? '' : 'localhost');
-  return replace(url, new RegExp(r'[<>:"\\/|?*%]'),
-      (match) => '%${match[0].codeUnitAt(0)}');
-}
-
-/// Given a directory name in the system cache, returns the URL of the server
-/// whose packages it contains.
-///
-/// See [_urlToDirectory] for details on the mapping. Note that because the
-/// directory name does not preserve the scheme, this has to guess at it. It
-/// chooses "http" for loopback URLs (mainly to support the pub tests) and
-/// "https" for all others.
-String _directoryToUrl(String url) {
-  // Decode the pseudo-URL-encoded characters.
-  var chars = '<>:"\\/|?*%';
-  for (var i = 0; i < chars.length; i++) {
-    var c = chars.substring(i, i + 1);
-    url = url.replaceAll("%${c.codeUnitAt(0)}", c);
-  }
-
-  // Figure out the scheme.
-  var scheme = "https";
-
-  // See if it's a loopback IP address.
-  if (isLoopback(url.replaceAll(new RegExp(":.*"), ""))) scheme = "http";
-  return "$scheme://$url";
-}
-
-/// Parses [description] into its server and package name components, then
-/// converts that to a Uri given [pattern].
-///
-/// Ensures the package name is properly URL encoded.
-Uri _makeUrl(description, String pattern(String server, String package)) {
-  var parsed = _parseDescription(description);
-  var server = parsed.last;
-  var package = Uri.encodeComponent(parsed.first);
-  return Uri.parse(pattern(server, package));
-}
-
-/// Parses [id] into its server, package name, and version components, then
-/// converts that to a Uri given [pattern].
-///
-/// Ensures the package name is properly URL encoded.
-Uri _makeVersionUrl(PackageId id,
-    String pattern(String server, String package, String version)) {
-  var parsed = _parseDescription(id.description);
-  var server = parsed.last;
-  var package = Uri.encodeComponent(parsed.first);
-  var version = Uri.encodeComponent(id.version.toString());
-  return Uri.parse(pattern(server, package, version));
-}
-
-/// Parses the description for a package.
-///
-/// If the package parses correctly, this returns a (name, url) pair. If not,
-/// this throws a descriptive FormatException.
-Pair<String, String> _parseDescription(description) {
-  if (description is String) {
-    return new Pair<String, String>(description, HostedSource.defaultUrl);
-  }
-
-  if (description is! Map) {
-    throw new FormatException(
-        "The description must be a package name or map.");
-  }
-
-  if (!description.containsKey("name")) {
-    throw new FormatException(
-    "The description map must contain a 'name' key.");
-  }
-
-  var name = description["name"];
-  if (name is! String) {
-    throw new FormatException("The 'name' key must have a string value.");
-  }
-
-  var url = description["url"];
-  if (url == null) url = HostedSource.defaultUrl;
-
-  return new Pair<String, String>(name, url);
-}
diff --git a/sdk/lib/_internal/pub/lib/src/source/path.dart b/sdk/lib/_internal/pub/lib/src/source/path.dart
deleted file mode 100644
index 8786968..0000000
--- a/sdk/lib/_internal/pub/lib/src/source/path.dart
+++ /dev/null
@@ -1,160 +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 pub.source.path;
-
-import 'dart:async';
-
-import 'package:path/path.dart' as p;
-
-import '../exceptions.dart';
-import '../io.dart';
-import '../package.dart';
-import '../pubspec.dart';
-import '../source.dart';
-import '../utils.dart';
-
-/// A package [Source] that gets packages from a given local file path.
-class PathSource extends Source {
-  /// Returns a valid description for a reference to a package at [path].
-  static describePath(String path) {
-    return {
-      "path": path,
-      "relative": p.isRelative(path)
-    };
-  }
-
-  /// Given a valid path reference description, returns the file path it
-  /// describes.
-  ///
-  /// This returned path may be relative or absolute and it is up to the caller
-  /// to know how to interpret a relative path.
-  static String pathFromDescription(description) => description["path"];
-
-  final name = 'path';
-
-  Future<Pubspec> doDescribe(PackageId id) {
-    return new Future.sync(() {
-      var dir = _validatePath(id.name, id.description);
-      return new Pubspec.load(dir, systemCache.sources,
-          expectedName: id.name);
-    });
-  }
-
-  bool descriptionsEqual(description1, description2) {
-    // Compare real paths after normalizing and resolving symlinks.
-    var path1 = canonicalize(description1["path"]);
-    var path2 = canonicalize(description2["path"]);
-    return path1 == path2;
-  }
-
-  Future get(PackageId id, String symlink) {
-    return new Future.sync(() {
-      var dir = _validatePath(id.name, id.description);
-      createPackageSymlink(id.name, dir, symlink,
-          relative: id.description["relative"]);
-    });
-  }
-
-  Future<String> getDirectory(PackageId id) =>
-      newFuture(() => _validatePath(id.name, id.description));
-
-  /// Parses a path dependency.
-  ///
-  /// This takes in a path string and returns a map. The "path" key will be the
-  /// original path but resolved relative to the containing path. The
-  /// "relative" key will be `true` if the original path was relative.
-  ///
-  /// A path coming from a pubspec is a simple string. From a lock file, it's
-  /// an expanded {"path": ..., "relative": ...} map.
-  dynamic parseDescription(String containingPath, description,
-                           {bool fromLockFile: false}) {
-    if (fromLockFile) {
-      if (description is! Map) {
-        throw new FormatException("The description must be a map.");
-      }
-
-      if (description["path"] is! String) {
-        throw new FormatException("The 'path' field of the description must "
-            "be a string.");
-      }
-
-      if (description["relative"] is! bool) {
-        throw new FormatException("The 'relative' field of the description "
-            "must be a boolean.");
-      }
-
-      return description;
-    }
-
-    if (description is! String) {
-      throw new FormatException("The description must be a path string.");
-    }
-
-    // Resolve the path relative to the containing file path, and remember
-    // whether the original path was relative or absolute.
-    var isRelative = p.isRelative(description);
-    if (isRelative) {
-      // Relative paths coming from pubspecs that are not on the local file
-      // system aren't allowed. This can happen if a hosted or git dependency
-      // has a path dependency.
-      if (containingPath == null) {
-        throw new FormatException('"$description" is a relative path, but this '
-            'isn\'t a local pubspec.');
-      }
-
-      description = p.normalize(
-          p.join(p.dirname(containingPath), description));
-    }
-
-    return {
-      "path": description,
-      "relative": isRelative
-    };
-  }
-
-  /// Serializes path dependency's [description].
-  ///
-  /// For the descriptions where `relative` attribute is `true`, tries to make
-  /// `path` relative to the specified [containingPath].
-  dynamic serializeDescription(String containingPath, description) {
-    if (description["relative"]) {
-      return {
-        "path": p.relative(description['path'], from: containingPath),
-        "relative": true
-      };
-    }
-    return description;
-  }
-
-  /// Converts a parsed relative path to its original relative form.
-  String formatDescription(String containingPath, description) {
-    var sourcePath = description["path"];
-    if (description["relative"]) {
-      sourcePath = p.relative(description['path'], from: containingPath);
-    }
-
-    return sourcePath;
-  }
-
-  /// Ensures that [description] is a valid path description and returns a
-  /// normalized path to the package.
-  ///
-  /// It must be a map, with a "path" key containing a path that points to an
-  /// existing directory. Throws an [ApplicationException] if the path is
-  /// invalid.
-  String _validatePath(String name, description) {
-    var dir = description["path"];
-
-    if (dirExists(dir)) return dir;
-
-    if (fileExists(dir)) {
-      fail('Path dependency for package $name must refer to a directory, '
-           'not a file. Was "$dir".');
-    }
-
-    throw new PackageNotFoundException(
-        'Could not find package $name at "$dir".');
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/source/unknown.dart b/sdk/lib/_internal/pub/lib/src/source/unknown.dart
deleted file mode 100644
index 714ff5c..0000000
--- a/sdk/lib/_internal/pub/lib/src/source/unknown.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.source.unknown;
-
-import 'dart:async';
-
-import '../package.dart';
-import '../pubspec.dart';
-import '../source.dart';
-
-/// A [Null Object] that represents a source not recognized by pub.
-///
-/// It provides some default behavior so that pub can work with sources it
-/// doesn't recognize.
-///
-/// [null object]: http://en.wikipedia.org/wiki/Null_Object_pattern
-class UnknownSource extends Source {
-  final String name;
-
-  UnknownSource(this.name);
-
-  /// Two unknown sources are the same if their names are the same.
-  bool operator==(other) =>
-      other is UnknownSource &&
-      other.name == name;
-
-  int get hashCode => name.hashCode;
-
-  Future<Pubspec> doDescribe(PackageId id) => throw new UnsupportedError(
-      "Cannot describe a package from unknown source '$name'.");
-
-  Future get(PackageId id, String symlink) => throw new UnsupportedError(
-      "Cannot get an unknown source '$name'.");
-
-  /// Returns the directory where this package can be found locally.
-  Future<String> getDirectory(PackageId id) => throw new UnsupportedError(
-      "Cannot find a package from an unknown source '$name'.");
-
-  bool descriptionsEqual(description1, description2) =>
-      description1 == description2;
-
-  /// Unknown sources do no validation.
-  dynamic parseDescription(String containingPath, description,
-                           {bool fromLockFile: false}) => description;
-}
diff --git a/sdk/lib/_internal/pub/lib/src/source_registry.dart b/sdk/lib/_internal/pub/lib/src/source_registry.dart
deleted file mode 100644
index d46ae93..0000000
--- a/sdk/lib/_internal/pub/lib/src/source_registry.dart
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.source_registry;
-
-import 'dart:collection';
-
-import 'package.dart';
-import 'source.dart';
-import 'source/unknown.dart';
-
-/// A class that keeps track of [Source]s used for getting packages.
-class SourceRegistry extends IterableBase<Source> {
-  final _sources = new Map<String, Source>();
-  Source _default;
-
-  /// Returns the default source, which is used when no source is specified.
-  Source get defaultSource => _default;
-
-  /// Iterates over the registered sources in name order.
-  Iterator<Source> get iterator {
-    var sources = _sources.values.toList();
-    sources.sort((a, b) => a.name.compareTo(b.name));
-    return sources.iterator;
-  }
-
-  /// Returns whether [id1] and [id2] refer to the same package, including
-  /// validating that their descriptions are equivalent.
-  bool idsEqual(PackageId id1, PackageId id2) {
-    if (id1 != id2) return false;
-    if (id1 == null && id2 == null) return true;
-    return idDescriptionsEqual(id1, id2);
-  }
-
-  /// Returns whether [id1] and [id2] have the same source and description.
-  ///
-  /// This doesn't check whether the name or versions are equal.
-  bool idDescriptionsEqual(PackageId id1, PackageId id2) {
-    if (id1.source != id2.source) return false;
-    return this[id1.source].descriptionsEqual(id1.description, id2.description);
-  }
-
-  /// Sets the default source.
-  ///
-  /// This takes a string, which must be the name of a registered source.
-  void setDefault(String name) {
-    if (!_sources.containsKey(name)) {
-      throw new StateError('Default source $name is not in the registry');
-    }
-
-    _default = _sources[name];
-  }
-
-  /// Registers a new source.
-  ///
-  /// This source may not have the same name as a source that's already been
-  /// registered.
-  void register(Source source) {
-    if (_sources.containsKey(source.name)) {
-      throw new StateError('Source registry already has a source named '
-          '${source.name}');
-    }
-
-    _sources[source.name] = source;
-  }
-
-  /// Returns the source named [name].
-  ///
-  /// Returns an [UnknownSource] if no source with that name has been
-  /// registered. If [name] is null, returns the default source.
-  Source operator[](String name) {
-    if (name == null) {
-      if (defaultSource != null) return defaultSource;
-      throw new StateError('No default source has been registered');
-    }
-
-    if (_sources.containsKey(name)) return _sources[name];
-    return new UnknownSource(name);
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/system_cache.dart b/sdk/lib/_internal/pub/lib/src/system_cache.dart
deleted file mode 100644
index 424585da..0000000
--- a/sdk/lib/_internal/pub/lib/src/system_cache.dart
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.system_cache;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:path/path.dart' as path;
-
-import 'io.dart';
-import 'io.dart' as io show createTempDir;
-import 'log.dart' as log;
-import 'package.dart';
-import 'source/cached.dart';
-import 'source/git.dart';
-import 'source/hosted.dart';
-import 'source/path.dart';
-import 'source.dart';
-import 'source_registry.dart';
-
-/// The system-wide cache of downloaded packages.
-///
-/// This cache contains all packages that are downloaded from the internet.
-/// Packages that are available locally (e.g. path dependencies) don't use this
-/// cache.
-class SystemCache {
-  /// The root directory where this package cache is located.
-  final String rootDir;
-
-  String get tempDir => path.join(rootDir, '_temp');
-
-  /// The sources from which to get packages.
-  final sources = new SourceRegistry();
-
-  static String defaultDir = (() {
-    if (Platform.environment.containsKey('PUB_CACHE')) {
-      return Platform.environment['PUB_CACHE'];
-    } else if (Platform.operatingSystem == 'windows') {
-      var appData = Platform.environment['APPDATA'];
-      return path.join(appData, 'Pub', 'Cache');
-    } else {
-      return '${Platform.environment['HOME']}/.pub-cache';
-    }
-  })();
-
-  /// Creates a new package cache which is backed by the given directory on the
-  /// user's file system.
-  SystemCache([String rootDir])
-      : rootDir = rootDir == null ? SystemCache.defaultDir : rootDir;
-
-  /// Creates a system cache and registers the standard set of sources.
-  ///
-  /// If [isOffline] is `true`, then the offline hosted source will be used.
-  /// Defaults to `false`.
-  factory SystemCache.withSources({String rootDir, bool isOffline: false}) {
-    var cache = new SystemCache(rootDir);
-    cache.register(new GitSource());
-
-    if (isOffline) {
-      cache.register(new OfflineHostedSource());
-    } else {
-      cache.register(new HostedSource());
-    }
-
-    cache.register(new PathSource());
-    cache.sources.setDefault('hosted');
-    return cache;
-  }
-
-  /// Registers a new source.
-  ///
-  /// This source must not have the same name as a source that's already been
-  /// registered.
-  void register(Source source) {
-    source.bind(this);
-    sources.register(source);
-  }
-
-  /// Determines if the system cache contains the package identified by [id].
-  Future<bool> contains(PackageId id) {
-    var source = sources[id.source];
-
-    if (source is! CachedSource) {
-      throw new ArgumentError("Package $id is not cacheable.");
-    }
-
-    return source.isInSystemCache(id);
-  }
-
-  /// Create a new temporary directory within the system cache.
-  ///
-  /// The system cache maintains its own temporary directory that it uses to
-  /// stage packages into while downloading. It uses this instead of the OS's
-  /// system temp directory to ensure that it's on the same volume as the pub
-  /// system cache so that it can move the directory from it.
-  String createTempDir() {
-    var temp = ensureDir(tempDir);
-    return io.createTempDir(temp, 'dir');
-  }
-
-  /// Deletes the system cache's internal temp directory.
-  void deleteTempDir() {
-    log.fine('Clean up system cache temp directory $tempDir.');
-    if (dirExists(tempDir)) deleteEntry(tempDir);
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/transcript.dart b/sdk/lib/_internal/pub/lib/src/transcript.dart
deleted file mode 100644
index ce3aab6..0000000
--- a/sdk/lib/_internal/pub/lib/src/transcript.dart
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.transcript;
-
-import 'dart:collection';
-
-/// A rolling transcript of entries of type [T].
-///
-/// It has a maximum number of entries. If entries are added that exceed that
-/// it discards entries from the *middle* of the transcript. Generally, in logs,
-/// the first and last entries are the most important, so it maintains those.
-class Transcript<T> {
-  /// The maximum number of transcript entries.
-  final int max;
-
-  /// The number of entries that were discarded after reaching [max].
-  int get discarded => _discarded;
-  int _discarded = 0;
-
-  /// The earliest half of the entries.
-  ///
-  /// This will be empty until the maximum number of entries is hit at which
-  /// point the oldest half of the entries will be moved from [_newest] to
-  /// here.
-  final _oldest = new List<T>();
-
-  /// The most recent half of the entries.
-  final _newest = new Queue<T>();
-
-  /// Creates a new [Transcript] that can hold up to [max] entries.
-  Transcript(this.max);
-
-  /// Adds [entry] to the transcript.
-  ///
-  /// If the transcript already has the maximum number of entries, discards one
-  /// from the middle.
-  void add(T entry) {
-    if (discarded > 0) {
-      // We're already in "rolling" mode.
-      _newest.removeFirst();
-      _discarded++;
-    } else if (_newest.length == max) {
-      // We are crossing the threshold where we have to discard items. Copy
-      // the first half over to the oldest list.
-      while (_newest.length > max ~/ 2) {
-        _oldest.add(_newest.removeFirst());
-      }
-
-      // Discard the middle item.
-      _newest.removeFirst();
-      _discarded++;
-    }
-
-    _newest.add(entry);
-  }
-
-  /// Traverses the entries in the transcript from oldest to newest.
-  ///
-  /// Invokes [onEntry] for each item. When it reaches the point in the middle
-  /// where excess entries where dropped, invokes [onGap] with the number of
-  /// dropped entries. If no more than [max] entries were added, does not
-  /// invoke [onGap].
-  void forEach(void onEntry(T entry), [void onGap(int)]) {
-    if (_oldest.isNotEmpty) {
-      _oldest.forEach(onEntry);
-      if (onGap != null) onGap(discarded);
-    }
-
-    _newest.forEach(onEntry);
-  }
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/lib/src/utils.dart b/sdk/lib/_internal/pub/lib/src/utils.dart
deleted file mode 100644
index d0eb936..0000000
--- a/sdk/lib/_internal/pub/lib/src/utils.dart
+++ /dev/null
@@ -1,942 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// Generic utility functions. Stuff that should possibly be in core.
-library pub.utils;
-
-import 'dart:async';
-import "dart:convert";
-import 'dart:io';
-
-// This is used by [libraryPath]. It must be kept up-to-date with all libraries
-// whose paths are looked up using that function.
-@MirrorsUsed(targets: const ['pub.io', 'test_pub'])
-import 'dart:mirrors';
-
-import "package:crypto/crypto.dart";
-import 'package:path/path.dart' as path;
-import "package:stack_trace/stack_trace.dart";
-
-import 'exceptions.dart';
-import 'log.dart' as log;
-
-export '../../asset/dart/utils.dart';
-
-/// A regular expression matching a Dart identifier.
-///
-/// This also matches a package name, since they must be Dart identifiers.
-final identifierRegExp = new RegExp(r"[a-zA-Z_][a-zA-Z0-9_]+");
-
-/// Like [identifierRegExp], but anchored so that it only matches strings that
-/// are *just* Dart identifiers.
-final onlyIdentifierRegExp = new RegExp("^${identifierRegExp.pattern}\$");
-
-/// A pair of values.
-class Pair<E, F> {
-  E first;
-  F last;
-
-  Pair(this.first, this.last);
-
-  String toString() => '($first, $last)';
-
-  bool operator==(other) {
-    if (other is! Pair) return false;
-    return other.first == first && other.last == last;
-  }
-
-  int get hashCode => first.hashCode ^ last.hashCode;
-}
-
-/// A completer that waits until all added [Future]s complete.
-// TODO(rnystrom): Copied from web_components. Remove from here when it gets
-// added to dart:core. (See #6626.)
-class FutureGroup<T> {
-  int _pending = 0;
-  Completer<List<T>> _completer = new Completer<List<T>>();
-  final List<Future<T>> futures = <Future<T>>[];
-  bool completed = false;
-
-  final List<T> _values = <T>[];
-
-  /// Wait for [task] to complete.
-  Future<T> add(Future<T> task) {
-    if (completed) {
-      throw new StateError("The FutureGroup has already completed.");
-    }
-
-    _pending++;
-    futures.add(task.then((value) {
-      if (completed) return;
-
-      _pending--;
-      _values.add(value);
-
-      if (_pending <= 0) {
-        completed = true;
-        _completer.complete(_values);
-      }
-    }).catchError((e, stackTrace) {
-      if (completed) return;
-
-      completed = true;
-      _completer.completeError(e, stackTrace);
-    }));
-
-    return task;
-  }
-
-  Future<List> get future => _completer.future;
-}
-
-/// Like [new Future], but avoids around issue 11911 by using [new Future.value]
-/// under the covers.
-Future newFuture(callback()) => new Future.value().then((_) => callback());
-
-/// Runs [callback] in an error zone and pipes any unhandled error to the
-/// returned [Future].
-///
-/// If the returned [Future] produces an error, its stack trace will always be a
-/// [Chain]. By default, this chain will contain only the local stack trace, but
-/// if [captureStackChains] is passed, it will contain the full stack chain for
-/// the error.
-Future captureErrors(Future callback(), {bool captureStackChains: false}) {
-  var completer = new Completer();
-  var wrappedCallback = () {
-    new Future.sync(callback).then(completer.complete)
-        .catchError((e, stackTrace) {
-      // [stackTrace] can be null if we're running without [captureStackChains],
-      // since dart:io will often throw errors without stack traces.
-      if (stackTrace != null) {
-        stackTrace = new Chain.forTrace(stackTrace);
-      } else {
-        stackTrace = new Chain([]);
-      }
-      if (!completer.isCompleted) completer.completeError(e, stackTrace);
-    });
-  };
-
-  if (captureStackChains) {
-    Chain.capture(wrappedCallback, onError: (error, stackTrace) {
-      if (!completer.isCompleted) completer.completeError(error, stackTrace);
-    });
-  } else {
-    runZoned(wrappedCallback, onError: (e, stackTrace) {
-      if (stackTrace == null) {
-        stackTrace = new Chain.current();
-      } else {
-        stackTrace = new Chain([new Trace.from(stackTrace)]);
-      }
-      if (!completer.isCompleted) completer.completeError(e, stackTrace);
-    });
-  }
-
-  return completer.future;
-}
-
-/// Like [Future.wait], but prints all errors from the futures as they occur and
-/// only returns once all Futures have completed, successfully or not.
-///
-/// This will wrap the first error thrown in a [SilentException] and rethrow it.
-Future waitAndPrintErrors(Iterable<Future> futures) {
-  return Future.wait(futures.map((future) {
-    return future.catchError((error, stackTrace) {
-      log.exception(error, stackTrace);
-      throw error;
-    });
-  })).catchError((error, stackTrace) {
-    throw new SilentException(error, stackTrace);
-  });
-}
-
-/// Returns a [StreamTransformer] that will call [onDone] when the stream
-/// completes.
-///
-/// The stream will be passed through unchanged.
-StreamTransformer onDoneTransformer(void onDone()) {
-  return new StreamTransformer.fromHandlers(handleDone: (sink) {
-    onDone();
-    sink.close();
-  });
-}
-
-// TODO(rnystrom): Move into String?
-/// Pads [source] to [length] by adding spaces at the end.
-String padRight(String source, int length) {
-  final result = new StringBuffer();
-  result.write(source);
-
-  while (result.length < length) {
-    result.write(' ');
-  }
-
-  return result.toString();
-}
-
-/// Pads [source] to [length] by adding [char]s at the beginning.
-///
-/// If [char] is `null`, it defaults to a space.
-String padLeft(String source, int length, [String char]) {
-  if (char == null) char = ' ';
-  if (source.length >= length) return source;
-
-  return char * (length - source.length) + source;
-}
-
-/// Returns a labelled sentence fragment starting with [name] listing the
-/// elements [iter].
-///
-/// If [iter] does not have one item, name will be pluralized by adding "s" or
-/// using [plural], if given.
-String namedSequence(String name, Iterable iter, [String plural]) {
-  if (iter.length == 1) return "$name ${iter.single}";
-
-  if (plural == null) plural = "${name}s";
-  return "$plural ${toSentence(iter)}";
-}
-
-/// Returns a sentence fragment listing the elements of [iter].
-///
-/// This converts each element of [iter] to a string and separates them with
-/// commas and/or "and" where appropriate.
-String toSentence(Iterable iter) {
-  if (iter.length == 1) return iter.first.toString();
-  return iter.take(iter.length - 1).join(", ") + " and ${iter.last}";
-}
-
-/// Returns [name] if [number] is 1, or the plural of [name] otherwise.
-///
-/// By default, this just adds "s" to the end of [name] to get the plural. If
-/// [plural] is passed, that's used instead.
-String pluralize(String name, int number, {String plural}) {
-  if (number == 1) return name;
-  if (plural != null) return plural;
-  return '${name}s';
-}
-
-/// Escapes any regex metacharacters in [string] so that using as a [RegExp]
-/// pattern will match the string literally.
-// TODO(rnystrom): Remove when #4706 is fixed.
-String quoteRegExp(String string) {
-  // Note: make sure "\" is done first so that we don't escape the other
-  // escaped characters. We could do all of the replaces at once with a regexp
-  // but string literal for regex that matches all regex metacharacters would
-  // be a bit hard to read.
-  for (var metacharacter in r"\^$.*+?()[]{}|".split("")) {
-    string = string.replaceAll(metacharacter, "\\$metacharacter");
-  }
-
-  return string;
-}
-
-/// Creates a URL string for [address]:[port].
-///
-/// Handles properly formatting IPv6 addresses.
-Uri baseUrlForAddress(InternetAddress address, int port) {
-  if (address.isLoopback) {
-    return new Uri(scheme: "http", host: "localhost", port: port);
-  }
-
-  // IPv6 addresses in URLs need to be enclosed in square brackets to avoid
-  // URL ambiguity with the ":" in the address.
-  if (address.type == InternetAddressType.IP_V6) {
-    return new Uri(scheme: "http", host: "[${address.address}]", port: port);
-  }
-
-  return new Uri(scheme: "http", host: address.address, port: port);
-}
-
-/// Returns whether [host] is a host for a localhost or loopback URL.
-///
-/// Unlike [InternetAddress.isLoopback], this hostnames from URLs as well as
-/// from [InternetAddress]es, including "localhost".
-bool isLoopback(String host) {
-  if (host == 'localhost') return true;
-
-  // IPv6 hosts in URLs are surrounded by square brackets.
-  if (host.startsWith("[") && host.endsWith("]")) {
-    host = host.substring(1, host.length - 1);
-  }
-
-  try {
-    return new InternetAddress(host).isLoopback;
-  } on ArgumentError catch (_) {
-    // The host isn't an IP address and isn't "localhost', so it's almost
-    // certainly not a loopback host.
-    return false;
-  }
-}
-
-/// Flattens nested lists inside an iterable into a single list containing only
-/// non-list elements.
-List flatten(Iterable nested) {
-  var result = [];
-  helper(list) {
-    for (var element in list) {
-      if (element is List) {
-        helper(element);
-      } else {
-        result.add(element);
-      }
-    }
-  }
-  helper(nested);
-  return result;
-}
-
-/// Returns a set containing all elements in [minuend] that are not in
-/// [subtrahend].
-Set setMinus(Iterable minuend, Iterable subtrahend) {
-  var minuendSet = new Set.from(minuend);
-  minuendSet.removeAll(subtrahend);
-  return minuendSet;
-}
-
-/// Returns whether there's any overlap between [set1] and [set2].
-bool overlaps(Set set1, Set set2) {
-  // Iterate through the smaller set.
-  var smaller = set1.length > set2.length ? set1 : set2;
-  var larger = smaller == set1 ? set2 : set1;
-  return smaller.any(larger.contains);
-}
-
-/// Returns a list containing the sorted elements of [iter].
-List ordered(Iterable<Comparable> iter) {
-  var list = iter.toList();
-  list.sort();
-  return list;
-}
-
-/// Returns the element of [iter] for which [f] returns the minimum value.
-minBy(Iterable iter, Comparable f(element)) {
-  var min = null;
-  var minComparable = null;
-  for (var element in iter) {
-    var comparable = f(element);
-    if (minComparable == null ||
-        comparable.compareTo(minComparable) < 0) {
-      min = element;
-      minComparable = comparable;
-    }
-  }
-  return min;
-}
-
-/// Returns every pair of consecutive elements in [iter].
-///
-/// For example, if [iter] is `[1, 2, 3, 4]`, this will return `[(1, 2), (2, 3),
-/// (3, 4)]`.
-Iterable<Pair> pairs(Iterable iter) {
-  var previous = iter.first;
-  return iter.skip(1).map((element) {
-    var oldPrevious = previous;
-    previous = element;
-    return new Pair(oldPrevious, element);
-  });
-}
-
-/// Creates a new map from [map] with new keys and values.
-///
-/// The return values of [key] are used as the keys and the return values of
-/// [value] are used as the values for the new map.
-///
-/// [key] defaults to returning the original key and [value] defaults to
-/// returning the original value.
-Map mapMap(Map map, {key(key, value), value(key, value)}) {
-  if (key == null) key = (key, _) => key;
-  if (value == null) value = (_, value) => value;
-
-  var result = {};
-  map.forEach((mapKey, mapValue) {
-    result[key(mapKey, mapValue)] = value(mapKey, mapValue);
-  });
-  return result;
-}
-
-/// Like [Map.fromIterable], but [key] and [value] may return [Future]s.
-Future<Map> mapFromIterableAsync(Iterable iter, {key(element),
-    value(element)}) {
-  if (key == null) key = (element) => element;
-  if (value == null) value = (element) => element;
-
-  var map = new Map();
-  return Future.wait(iter.map((element) {
-    return Future.wait([
-      new Future.sync(() => key(element)),
-      new Future.sync(() => value(element))
-    ]).then((results) {
-      map[results[0]] = results[1];
-    });
-  })).then((_) => map);
-}
-
-/// Returns a new map with all entries in both [map1] and [map2].
-///
-/// If there are overlapping keys, [map2]'s value wins.
-Map mergeMaps(Map map1, Map map2) {
-  var result = {};
-  result.addAll(map1);
-  result.addAll(map2);
-  return result;
-}
-
-/// Returns the transitive closure of [graph].
-///
-/// This assumes [graph] represents a graph with a vertex for each key and an
-/// edge betweek each key and the values for that key.
-Map<dynamic, Set> transitiveClosure(Map<dynamic, Iterable> graph) {
-  // This uses the Floyd-Warshall algorithm
-  // (https://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm).
-  var result = {};
-  graph.forEach((vertex, edges) {
-    result[vertex] = new Set.from(edges)..add(vertex);
-  });
-
-  for (var vertex1 in graph.keys) {
-    for (var vertex2 in graph.keys) {
-      for (var vertex3 in graph.keys) {
-        if (result[vertex2].contains(vertex1) &&
-            result[vertex1].contains(vertex3)) {
-          result[vertex2].add(vertex3);
-        }
-      }
-    }
-  }
-
-  return result;
-}
-
-/// Given a list of filenames, returns a set of patterns that can be used to
-/// filter for those filenames.
-///
-/// For a given path, that path ends with some string in the returned set if
-/// and only if that path's basename is in [files].
-Set<String> createFileFilter(Iterable<String> files) {
-  return files.expand((file) {
-    var result = ["/$file"];
-    if (Platform.operatingSystem == 'windows') result.add("\\$file");
-    return result;
-  }).toSet();
-}
-
-/// Given a blacklist of directory names, returns a set of patterns that can
-/// be used to filter for those directory names.
-///
-/// For a given path, that path contains some string in the returned set if
-/// and only if one of that path's components is in [dirs].
-Set<String> createDirectoryFilter(Iterable<String> dirs) {
-  return dirs.expand((dir) {
-    var result = ["/$dir/"];
-    if (Platform.operatingSystem == 'windows') {
-      result..add("/$dir\\")..add("\\$dir/")..add("\\$dir\\");
-    }
-    return result;
-  }).toSet();
-}
-
-/// Returns the maximum value in [iter] by [compare].
-///
-/// [compare] defaults to [Comparable.compare].
-maxAll(Iterable iter, [int compare(element1, element2)]) {
-  if (compare == null) compare = Comparable.compare;
-  return iter.reduce((max, element) =>
-      compare(element, max) > 0 ? element : max);
-}
-
-/// Returns the minimum value in [iter] by [compare].
-///
-/// [compare] defaults to [Comparable.compare].
-minAll(Iterable iter, [int compare(element1, element2)]) {
-  if (compare == null) compare = Comparable.compare;
-  return iter.reduce((max, element) =>
-      compare(element, max) < 0 ? element : max);
-}
-
-/// Replace each instance of [matcher] in [source] with the return value of
-/// [fn].
-String replace(String source, Pattern matcher, String fn(Match)) {
-  var buffer = new StringBuffer();
-  var start = 0;
-  for (var match in matcher.allMatches(source)) {
-    buffer.write(source.substring(start, match.start));
-    start = match.end;
-    buffer.write(fn(match));
-  }
-  buffer.write(source.substring(start));
-  return buffer.toString();
-}
-
-/// Returns whether or not [str] ends with [matcher].
-bool endsWithPattern(String str, Pattern matcher) {
-  for (var match in matcher.allMatches(str)) {
-    if (match.end == str.length) return true;
-  }
-  return false;
-}
-
-/// Returns the hex-encoded sha1 hash of [source].
-String sha1(String source) {
-  var sha = new SHA1();
-  sha.add(source.codeUnits);
-  return CryptoUtils.bytesToHex(sha.close());
-}
-
-/// Configures [future] so that its result (success or exception) is passed on
-/// to [completer].
-void chainToCompleter(Future future, Completer completer) {
-  future.then(completer.complete, onError: completer.completeError);
-}
-
-/// Ensures that [stream] can emit at least one value successfully (or close
-/// without any values).
-///
-/// For example, reading asynchronously from a non-existent file will return a
-/// stream that fails on the first chunk. In order to handle that more
-/// gracefully, you may want to check that the stream looks like it's working
-/// before you pipe the stream to something else.
-///
-/// This lets you do that. It returns a [Future] that completes to a [Stream]
-/// emitting the same values and errors as [stream], but only if at least one
-/// value can be read successfully. If an error occurs before any values are
-/// emitted, the returned Future completes to that error.
-Future<Stream> validateStream(Stream stream) {
-  var completer = new Completer<Stream>();
-  var controller = new StreamController(sync: true);
-
-  StreamSubscription subscription;
-  subscription = stream.listen((value) {
-    // We got a value, so the stream is valid.
-    if (!completer.isCompleted) completer.complete(controller.stream);
-    controller.add(value);
-  }, onError: (error, [stackTrace]) {
-    // If the error came after values, it's OK.
-    if (completer.isCompleted) {
-      controller.addError(error, stackTrace);
-      return;
-    }
-
-    // Otherwise, the error came first and the stream is invalid.
-    completer.completeError(error, stackTrace);
-
-    // We don't be returning the stream at all in this case, so unsubscribe
-    // and swallow the error.
-    subscription.cancel();
-  }, onDone: () {
-    // It closed with no errors, so the stream is valid.
-    if (!completer.isCompleted) completer.complete(controller.stream);
-    controller.close();
-  });
-
-  return completer.future;
-}
-
-// TODO(nweiz): remove this when issue 7964 is fixed.
-/// Returns a [Future] that will complete to the first element of [stream].
-///
-/// Unlike [Stream.first], this is safe to use with single-subscription streams.
-Future streamFirst(Stream stream) {
-  var completer = new Completer();
-  var subscription;
-  subscription = stream.listen((value) {
-    subscription.cancel();
-    completer.complete(value);
-  }, onError: (e, [stackTrace]) {
-    completer.completeError(e, stackTrace);
-  }, onDone: () {
-    completer.completeError(new StateError("No elements"), new Chain.current());
-  }, cancelOnError: true);
-  return completer.future;
-}
-
-/// Returns a wrapped version of [stream] along with a [StreamSubscription] that
-/// can be used to control the wrapped stream.
-Pair<Stream, StreamSubscription> streamWithSubscription(Stream stream) {
-  var controller =
-      stream.isBroadcast ? new StreamController.broadcast(sync: true)
-                         : new StreamController(sync: true);
-  var subscription = stream.listen(controller.add,
-      onError: controller.addError,
-      onDone: controller.close);
-  return new Pair<Stream, StreamSubscription>(controller.stream, subscription);
-}
-
-// TODO(nweiz): remove this when issue 7787 is fixed.
-/// Creates two single-subscription [Stream]s that each emit all values and
-/// errors from [stream].
-///
-/// This is useful if [stream] is single-subscription but multiple subscribers
-/// are necessary.
-Pair<Stream, Stream> tee(Stream stream) {
-  var controller1 = new StreamController(sync: true);
-  var controller2 = new StreamController(sync: true);
-  stream.listen((value) {
-    controller1.add(value);
-    controller2.add(value);
-  }, onError: (error, [stackTrace]) {
-    controller1.addError(error, stackTrace);
-    controller2.addError(error, stackTrace);
-  }, onDone: () {
-    controller1.close();
-    controller2.close();
-  });
-  return new Pair<Stream, Stream>(controller1.stream, controller2.stream);
-}
-
-/// Merges [stream1] and [stream2] into a single stream that emits events from
-/// both sources.
-Stream mergeStreams(Stream stream1, Stream stream2) {
-  var doneCount = 0;
-  var controller = new StreamController(sync: true);
-
-  for (var stream in [stream1, stream2]) {
-    stream.listen(
-        controller.add,
-        onError: controller.addError,
-        onDone: () {
-      doneCount++;
-      if (doneCount == 2) controller.close();
-    });
-  }
-
-  return controller.stream;
-}
-
-/// A regular expression matching a trailing CR character.
-final _trailingCR = new RegExp(r"\r$");
-
-// TODO(nweiz): Use `text.split(new RegExp("\r\n?|\n\r?"))` when issue 9360 is
-// fixed.
-/// Splits [text] on its line breaks in a Windows-line-break-friendly way.
-List<String> splitLines(String text) =>
-  text.split("\n").map((line) => line.replaceFirst(_trailingCR, "")).toList();
-
-/// Converts a stream of arbitrarily chunked strings into a line-by-line stream.
-///
-/// The lines don't include line termination characters. A single trailing
-/// newline is ignored.
-Stream<String> streamToLines(Stream<String> stream) {
-  var buffer = new StringBuffer();
-  return stream.transform(new StreamTransformer.fromHandlers(
-      handleData: (chunk, sink) {
-        var lines = splitLines(chunk);
-        var leftover = lines.removeLast();
-        for (var line in lines) {
-          if (!buffer.isEmpty) {
-            buffer.write(line);
-            line = buffer.toString();
-            buffer = new StringBuffer();
-          }
-
-          sink.add(line);
-        }
-        buffer.write(leftover);
-      },
-      handleDone: (sink) {
-        if (!buffer.isEmpty) sink.add(buffer.toString());
-        sink.close();
-      }));
-}
-
-/// Like [Iterable.where], but allows [test] to return [Future]s and uses the
-/// results of those [Future]s as the test.
-Future<Iterable> futureWhere(Iterable iter, test(value)) {
-  return Future.wait(iter.map((e) {
-    var result = test(e);
-    if (result is! Future) result = new Future.value(result);
-    return result.then((result) => new Pair(e, result));
-  }))
-      .then((pairs) => pairs.where((pair) => pair.last))
-      .then((pairs) => pairs.map((pair) => pair.first));
-}
-
-// TODO(nweiz): unify the following functions with the utility functions in
-// pkg/http.
-
-/// Like [String.split], but only splits on the first occurrence of the pattern.
-///
-/// This always returns an array of two elements or fewer.
-List<String> split1(String toSplit, String pattern) {
-  if (toSplit.isEmpty) return <String>[];
-
-  var index = toSplit.indexOf(pattern);
-  if (index == -1) return [toSplit];
-  return [toSplit.substring(0, index),
-    toSplit.substring(index + pattern.length)];
-}
-
-/// Adds additional query parameters to [url], overwriting the original
-/// parameters if a name conflict occurs.
-Uri addQueryParameters(Uri url, Map<String, String> parameters) {
-  var queryMap = queryToMap(url.query);
-  queryMap.addAll(parameters);
-  return url.resolve("?${mapToQuery(queryMap)}");
-}
-
-/// Convert a URL query string (or `application/x-www-form-urlencoded` body)
-/// into a [Map] from parameter names to values.
-Map<String, String> queryToMap(String queryList) {
-  var map = {};
-  for (var pair in queryList.split("&")) {
-    var split = split1(pair, "=");
-    if (split.isEmpty) continue;
-    var key = urlDecode(split[0]);
-    var value = split.length > 1 ? urlDecode(split[1]) : "";
-    map[key] = value;
-  }
-  return map;
-}
-
-/// Convert a [Map] from parameter names to values to a URL query string.
-String mapToQuery(Map<String, String> map) {
-  var pairs = <List<String>>[];
-  map.forEach((key, value) {
-    key = Uri.encodeQueryComponent(key);
-    value = (value == null || value.isEmpty)
-       ? null : Uri.encodeQueryComponent(value);
-    pairs.add([key, value]);
-  });
-  return pairs.map((pair) {
-    if (pair[1] == null) return pair[0];
-    return "${pair[0]}=${pair[1]}";
-  }).join("&");
-}
-
-/// Returns the union of all elements in each set in [sets].
-Set unionAll(Iterable<Set> sets) =>
-  sets.fold(new Set(), (union, set) => union.union(set));
-
-// TODO(nweiz): remove this when issue 9068 has been fixed.
-/// Whether [uri1] and [uri2] are equal.
-///
-/// This consider HTTP URIs to default to port 80, and HTTPs URIs to default to
-/// port 443.
-bool urisEqual(Uri uri1, Uri uri2) =>
-  canonicalizeUri(uri1) == canonicalizeUri(uri2);
-
-/// Return [uri] with redundant port information removed.
-Uri canonicalizeUri(Uri uri) {
-  return uri;
-}
-
-/// Returns a human-friendly representation of [inputPath].
-///
-/// If [inputPath] isn't too distant from the current working directory, this
-/// will return the relative path to it. Otherwise, it will return the absolute
-/// path.
-String nicePath(String inputPath) {
-  var relative = path.relative(inputPath);
-  var split = path.split(relative);
-  if (split.length > 1 && split[0] == '..' && split[1] == '..') {
-    return path.absolute(inputPath);
-  }
-  return relative;
-}
-
-/// Returns a human-friendly representation of [duration].
-String niceDuration(Duration duration) {
-  var result = duration.inMinutes > 0 ? "${duration.inMinutes}:" : "";
-
-  var s = duration.inSeconds % 59;
-  var ms = duration.inMilliseconds % 1000;
-
-  // If we're using verbose logging, be more verbose but more accurate when
-  // reporting timing information.
-  if (log.verbosity.isLevelVisible(log.Level.FINE)) {
-    ms = padLeft(ms.toString(), 3, '0');
-  } else {
-    ms ~/= 100;
-  }
-
-  return "$result$s.${ms}s";
-}
-
-/// Decodes a URL-encoded string.
-///
-/// Unlike [Uri.decodeComponent], this includes replacing `+` with ` `.
-String urlDecode(String encoded) =>
-  Uri.decodeComponent(encoded.replaceAll("+", " "));
-
-/// Takes a simple data structure (composed of [Map]s, [Iterable]s, scalar
-/// objects, and [Future]s) and recursively resolves all the [Future]s contained
-/// within.
-///
-/// Completes with the fully resolved structure.
-Future awaitObject(object) {
-  // Unroll nested futures.
-  if (object is Future) return object.then(awaitObject);
-  if (object is Iterable) {
-    return Future.wait(object.map(awaitObject).toList());
-  }
-  if (object is! Map) return new Future.value(object);
-
-  var pairs = <Future<Pair>>[];
-  object.forEach((key, value) {
-    pairs.add(awaitObject(value)
-        .then((resolved) => new Pair(key, resolved)));
-  });
-  return Future.wait(pairs).then((resolvedPairs) {
-    var map = {};
-    for (var pair in resolvedPairs) {
-      map[pair.first] = pair.last;
-    }
-    return map;
-  });
-}
-
-/// Returns the path to the library named [libraryName].
-///
-/// The library name must be globally unique, or the wrong library path may be
-/// returned. Any libraries accessed must be added to the [MirrorsUsed]
-/// declaration in the import above.
-String libraryPath(String libraryName) {
-  var lib = currentMirrorSystem().findLibrary(new Symbol(libraryName));
-  return path.fromUri(lib.uri);
-}
-
-/// Whether "special" strings such as Unicode characters or color escapes are
-/// safe to use.
-///
-/// On Windows or when not printing to a terminal, only printable ASCII
-/// characters should be used.
-bool get canUseSpecialChars => !runningAsTest &&
-    Platform.operatingSystem != 'windows' &&
-    stdioType(stdout) == StdioType.TERMINAL;
-
-/// Gets a "special" string (ANSI escape or Unicode).
-///
-/// On Windows or when not printing to a terminal, returns something else since
-/// those aren't supported.
-String getSpecial(String special, [String onWindows = '']) =>
-    canUseSpecialChars ? special : onWindows;
-
-/// Prepends each line in [text] with [prefix].
-///
-/// If [firstPrefix] is passed, the first line is prefixed with that instead.
-String prefixLines(String text, {String prefix: '| ', String firstPrefix}) {
-  var lines = text.split('\n');
-  if (firstPrefix == null) {
-    return lines.map((line) => '$prefix$line').join('\n');
-  }
-
-  var firstLine = "$firstPrefix${lines.first}";
-  lines = lines.skip(1).map((line) => '$prefix$line').toList();
-  lines.insert(0, firstLine);
-  return lines.join('\n');
-}
-
-/// Whether pub is running as a subprocess in an integration test or in a unit
-/// test that has explicitly set this.
-bool runningAsTest = Platform.environment.containsKey('_PUB_TESTING');
-
-/// Whether today is April Fools' day.
-bool get isAprilFools {
-  // Tests should never see April Fools' output.
-  if (runningAsTest) return false;
-
-  var date = new DateTime.now();
-  return date.month == 4 && date.day == 1;
-}
-
-/// Wraps [fn] to guard against several different kinds of stack overflow
-/// exceptions:
-///
-/// * A sufficiently long [Future] chain can cause a stack overflow if there are
-///   no asynchronous operations in it (issue 9583).
-/// * A recursive function that recurses too deeply without an asynchronous
-///   operation can cause a stack overflow.
-/// * Even if the former is guarded against by adding asynchronous operations,
-///   returning a value through the [Future] chain can still cause a stack
-///   overflow.
-Future resetStack(fn()) {
-  // Using a [Completer] breaks the [Future] chain for the return value and
-  // avoids the third case described above.
-  var completer = new Completer();
-
-  // Using [new Future] adds an asynchronous operation that works around the
-  // first and second cases described above.
-  newFuture(fn).then((val) {
-    scheduleMicrotask(() => completer.complete(val));
-  }).catchError((err, stackTrace) {
-    scheduleMicrotask(() => completer.completeError(err, stackTrace));
-  });
-  return completer.future;
-}
-
-/// The subset of strings that don't need quoting in YAML.
-///
-/// This pattern does not strictly follow the plain scalar grammar of YAML,
-/// which means some strings may be unnecessarily quoted, but it's much simpler.
-final _unquotableYamlString = new RegExp(r"^[a-zA-Z_-][a-zA-Z_0-9-]*$");
-
-/// Converts [data], which is a parsed YAML object, to a pretty-printed string,
-/// using indentation for maps.
-String yamlToString(data) {
-  var buffer = new StringBuffer();
-
-  _stringify(bool isMapValue, String indent, data) {
-    // TODO(nweiz): Serialize using the YAML library once it supports
-    // serialization.
-
-    // Use indentation for (non-empty) maps.
-    if (data is Map && !data.isEmpty) {
-      if (isMapValue) {
-        buffer.writeln();
-        indent += '  ';
-      }
-
-      // Sort the keys. This minimizes deltas in diffs.
-      var keys = data.keys.toList();
-      keys.sort((a, b) => a.toString().compareTo(b.toString()));
-
-      var first = true;
-      for (var key in keys) {
-        if (!first) buffer.writeln();
-        first = false;
-
-        var keyString = key;
-        if (key is! String || !_unquotableYamlString.hasMatch(key)) {
-          keyString = JSON.encode(key);
-        }
-
-        buffer.write('$indent$keyString:');
-        _stringify(true, indent, data[key]);
-      }
-
-      return;
-    }
-
-    // Everything else we just stringify using JSON to handle escapes in
-    // strings and number formatting.
-    var string = data;
-
-    // Don't quote plain strings if not needed.
-    if (data is! String || !_unquotableYamlString.hasMatch(data)) {
-      string = JSON.encode(data);
-    }
-
-    if (isMapValue) {
-      buffer.write(' $string');
-    } else {
-      buffer.write('$indent$string');
-    }
-  }
-
-  _stringify(false, '', data);
-  return buffer.toString();
-}
-
-/// Throw a [ApplicationException] with [message].
-void fail(String message, [innerError, StackTrace innerTrace]) {
-  if (innerError != null) {
-    throw new WrappedException(message, innerError, innerTrace);
-  } else {
-    throw new ApplicationException(message);
-  }
-}
-
-/// Throw a [DataException] with [message] to indicate that the command has
-/// failed because of invalid input data.
-///
-/// This will report the error and cause pub to exit with [exit_codes.DATA].
-void dataError(String message) => throw new DataException(message);
diff --git a/sdk/lib/_internal/pub/lib/src/validator.dart b/sdk/lib/_internal/pub/lib/src/validator.dart
deleted file mode 100644
index 7bdcdc9..0000000
--- a/sdk/lib/_internal/pub/lib/src/validator.dart
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.validator;
-
-import 'dart:async';
-
-import 'entrypoint.dart';
-import 'log.dart' as log;
-import 'utils.dart';
-import 'validator/compiled_dartdoc.dart';
-import 'validator/dependency.dart';
-import 'validator/dependency_override.dart';
-import 'validator/directory.dart';
-import 'validator/executable.dart';
-import 'validator/license.dart';
-import 'validator/name.dart';
-import 'validator/pubspec_field.dart';
-import 'validator/sdk_constraint.dart';
-import 'validator/size.dart';
-import 'validator/utf8_readme.dart';
-
-/// The base class for validators that check whether a package is fit for
-/// uploading.
-///
-/// Each validator should override [errors], [warnings], or both to return
-/// lists of errors or warnings to display to the user. Errors will cause the
-/// package not to be uploaded; warnings will require the user to confirm the
-/// upload.
-abstract class Validator {
-  /// The entrypoint that's being validated.
-  final Entrypoint entrypoint;
-
-  /// The accumulated errors for this validator.
-  ///
-  /// Filled by calling [validate].
-  final errors = <String>[];
-
-  /// The accumulated warnings for this validator.
-  ///
-  /// Filled by calling [validate].
-  final warnings = <String>[];
-
-  Validator(this.entrypoint);
-
-  /// Validates the entrypoint, adding any errors and warnings to [errors] and
-  /// [warnings], respectively.
-  Future validate();
-
-  /// Run all validators on the [entrypoint] package and print their results.
-  ///
-  /// The future completes with the error and warning messages, respectively.
-  ///
-  /// [packageSize], if passed, should complete to the size of the tarred
-  /// package, in bytes. This is used to validate that it's not too big to
-  /// upload to the server.
-  static Future<Pair<List<String>, List<String>>> runAll(
-      Entrypoint entrypoint, [Future<int> packageSize]) {
-    var validators = [
-      new LicenseValidator(entrypoint),
-      new NameValidator(entrypoint),
-      new PubspecFieldValidator(entrypoint),
-      new DependencyValidator(entrypoint),
-      new DependencyOverrideValidator(entrypoint),
-      new DirectoryValidator(entrypoint),
-      new ExecutableValidator(entrypoint),
-      new CompiledDartdocValidator(entrypoint),
-      new Utf8ReadmeValidator(entrypoint),
-      new SdkConstraintValidator(entrypoint)
-    ];
-    if (packageSize != null) {
-      validators.add(new SizeValidator(entrypoint, packageSize));
-    }
-
-    return Future.wait(validators.map((validator) => validator.validate()))
-      .then((_) {
-      var errors =
-          flatten(validators.map((validator) => validator.errors));
-      var warnings =
-          flatten(validators.map((validator) => validator.warnings));
-
-      if (!errors.isEmpty) {
-        log.error("Missing requirements:");
-        for (var error in errors) {
-          log.error("* ${error.split('\n').join('\n  ')}");
-        }
-        log.error("");
-      }
-
-      if (!warnings.isEmpty) {
-        log.warning("Suggestions:");
-        for (var warning in warnings) {
-          log.warning("* ${warning.split('\n').join('\n  ')}");
-        }
-        log.warning("");
-      }
-
-      return new Pair<List<String>, List<String>>(errors, warnings);
-    });
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/validator/compiled_dartdoc.dart b/sdk/lib/_internal/pub/lib/src/validator/compiled_dartdoc.dart
deleted file mode 100644
index 10b351f..0000000
--- a/sdk/lib/_internal/pub/lib/src/validator/compiled_dartdoc.dart
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.validator.compiled_dartdoc;
-
-import 'dart:async';
-
-import 'package:path/path.dart' as path;
-
-import '../entrypoint.dart';
-import '../io.dart';
-import '../validator.dart';
-
-/// Validates that a package doesn't contain compiled Dartdoc
-/// output.
-class CompiledDartdocValidator extends Validator {
-  CompiledDartdocValidator(Entrypoint entrypoint)
-    : super(entrypoint);
-
-  Future validate() {
-    return new Future.sync(() {
-      for (var entry in entrypoint.root.listFiles(useGitIgnore: true)) {
-        if (path.basename(entry) != "nav.json") continue;
-        var dir = path.dirname(entry);
-
-        // Look for tell-tale Dartdoc output files all in the same directory.
-        var files = [
-          entry,
-          path.join(dir, "index.html"),
-          path.join(dir, "styles.css"),
-          path.join(dir, "dart-logo-small.png"),
-          path.join(dir, "client-live-nav.js")
-        ];
-
-        if (files.every((val) => fileExists(val))) {
-          warnings.add("Avoid putting generated documentation in "
-                  "${path.relative(dir)}.\n"
-              "Generated documentation bloats the package with redundant "
-                  "data.");
-        }
-      }
-    });
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/validator/dependency.dart b/sdk/lib/_internal/pub/lib/src/validator/dependency.dart
deleted file mode 100644
index 8e8ea84..0000000
--- a/sdk/lib/_internal/pub/lib/src/validator/dependency.dart
+++ /dev/null
@@ -1,217 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.validator.dependency;
-
-import 'dart:async';
-
-import 'package:pub_semver/pub_semver.dart';
-
-import '../entrypoint.dart';
-import '../log.dart' as log;
-import '../package.dart';
-import '../validator.dart';
-
-/// The range of all pub versions that don't support `^` version constraints.
-///
-/// This is the actual range of pub versions, whereas [_postCaretPubVersions] is
-/// the nicer-looking range that doesn't include a prerelease tag.
-final _preCaretPubVersions = new VersionConstraint.parse("<1.8.0-dev.3.0");
-
-/// The range of all pub versions that do support `^` version constraints.
-///
-/// This is intersected with the user's SDK constraint to provide a suggested
-/// constraint.
-final _postCaretPubVersions = new VersionConstraint.parse("^1.8.0");
-
-/// A validator that validates a package's dependencies.
-class DependencyValidator extends Validator {
-  /// Whether the SDK constraint guarantees that `^` version constraints are
-  /// safe.
-  bool get _caretAllowed => entrypoint.root.pubspec.environment.sdkVersion
-      .intersect(_preCaretPubVersions).isEmpty;
-
-  DependencyValidator(Entrypoint entrypoint)
-    : super(entrypoint);
-
-  Future validate() async {
-    var caretDeps = [];
-
-    for (var dependency in entrypoint.root.pubspec.dependencies) {
-      if (dependency.source != "hosted") {
-        await _warnAboutSource(dependency);
-      } else if (dependency.constraint.isAny) {
-        _warnAboutNoConstraint(dependency);
-      } else if (dependency.constraint is Version) {
-        _warnAboutSingleVersionConstraint(dependency);
-      } else if (dependency.constraint is VersionRange) {
-        if (dependency.constraint.min == null) {
-          _warnAboutNoConstraintLowerBound(dependency);
-        } else if (dependency.constraint.max == null) {
-          _warnAboutNoConstraintUpperBound(dependency);
-        }
-
-        if (dependency.constraint.toString().startsWith("^")) {
-          caretDeps.add(dependency);
-        }
-      }
-    }
-
-    if (caretDeps.isNotEmpty && !_caretAllowed) {
-      _errorAboutCaretConstraints(caretDeps);
-    }
-  }
-
-  /// Warn that dependencies should use the hosted source.
-  Future _warnAboutSource(PackageDep dep) async {
-    var versions;
-    try {
-      var pubspecs = await entrypoint.cache.sources['hosted']
-          .getVersions(dep.name, dep.name);
-      versions = pubspecs.map((pubspec) => pubspec.version).toList();
-    } catch (error) {
-      versions = [];
-    }
-
-    var constraint;
-    var primary = Version.primary(versions);
-    if (primary != null) {
-      constraint = _constraintForVersion(primary);
-    } else {
-      constraint = dep.constraint.toString();
-      if (!dep.constraint.isAny && dep.constraint is! Version) {
-        constraint = '"$constraint"';
-      }
-    }
-
-    // Path sources are errors. Other sources are just warnings.
-    var messages = warnings;
-    if (dep.source == "path") {
-      messages = errors;
-    }
-
-    messages.add('Don\'t depend on "${dep.name}" from the ${dep.source} '
-            'source. Use the hosted source instead. For example:\n'
-        '\n'
-        'dependencies:\n'
-        '  ${dep.name}: $constraint\n'
-        '\n'
-        'Using the hosted source ensures that everyone can download your '
-            'package\'s dependencies along with your package.');
-  }
-
-  /// Warn that dependencies should have version constraints.
-  void _warnAboutNoConstraint(PackageDep dep) {
-    var message = 'Your dependency on "${dep.name}" should have a version '
-        'constraint.';
-    var locked = entrypoint.lockFile.packages[dep.name];
-    if (locked != null) {
-      message = '$message For example:\n'
-        '\n'
-        'dependencies:\n'
-        '  ${dep.name}: ${_constraintForVersion(locked.version)}\n';
-    }
-    warnings.add("$message\n"
-        'Without a constraint, you\'re promising to support ${log.bold("all")} '
-            'future versions of "${dep.name}".');
-  }
-
-  /// Warn that dependencies should allow more than a single version.
-  void _warnAboutSingleVersionConstraint(PackageDep dep) {
-    warnings.add(
-        'Your dependency on "${dep.name}" should allow more than one version. '
-            'For example:\n'
-        '\n'
-        'dependencies:\n'
-        '  ${dep.name}: ${_constraintForVersion(dep.constraint)}\n'
-        '\n'
-        'Constraints that are too tight will make it difficult for people to '
-            'use your package\n'
-        'along with other packages that also depend on "${dep.name}".');
-  }
-
-  /// Warn that dependencies should have lower bounds on their constraints.
-  void _warnAboutNoConstraintLowerBound(PackageDep dep) {
-    var message = 'Your dependency on "${dep.name}" should have a lower bound.';
-    var locked = entrypoint.lockFile.packages[dep.name];
-    if (locked != null) {
-      var constraint;
-      if (locked.version == (dep.constraint as VersionRange).max) {
-        constraint = _constraintForVersion(locked.version);
-      } else {
-        constraint = '">=${locked.version} ${dep.constraint}"';
-      }
-
-      message = '$message For example:\n'
-        '\n'
-        'dependencies:\n'
-        '  ${dep.name}: $constraint\n';
-    }
-    warnings.add("$message\n"
-        'Without a constraint, you\'re promising to support ${log.bold("all")} '
-            'previous versions of "${dep.name}".');
-  }
-
-  /// Warn that dependencies should have upper bounds on their constraints.
-  void _warnAboutNoConstraintUpperBound(PackageDep dep) {
-    var constraint;
-    if ((dep.constraint as VersionRange).includeMin) {
-      constraint = _constraintForVersion((dep.constraint as VersionRange).min);
-    } else {
-      constraint = '"${dep.constraint} '
-          '<${(dep.constraint as VersionRange).min.nextBreaking}"';
-    }
-
-    warnings.add(
-        'Your dependency on "${dep.name}" should have an upper bound. For '
-            'example:\n'
-        '\n'
-        'dependencies:\n'
-        '  ${dep.name}: $constraint\n'
-        '\n'
-        'Without an upper bound, you\'re promising to support '
-            '${log.bold("all")} future versions of ${dep.name}.');
-  }
-
-  /// Emits an error for any version constraints that use `^` without an
-  /// appropriate SDK constraint.
-  void _errorAboutCaretConstraints(List<PackageDep> caretDeps) {
-    var newSdkConstraint = entrypoint.root.pubspec.environment.sdkVersion
-        .intersect(_postCaretPubVersions);
-
-    if (newSdkConstraint.isEmpty) newSdkConstraint = _postCaretPubVersions;
-
-    var buffer = new StringBuffer(
-        "Older versions of pub don't support ^ version constraints.\n"
-        "Make sure your SDK constraint excludes those old versions:\n"
-        "\n"
-        "environment:\n"
-        "  sdk: \"$newSdkConstraint\"\n"
-        "\n");
-
-    if (caretDeps.length == 1) {
-      buffer.writeln("Or use a fully-expanded constraint:");
-    } else {
-      buffer.writeln("Or use fully-expanded constraints:");
-    }
-
-    buffer.writeln();
-    buffer.writeln("dependencies:");
-
-    caretDeps.forEach((dep) {
-      VersionRange constraint = dep.constraint;
-      buffer.writeln(
-          "  ${dep.name}: \">=${constraint.min} <${constraint.max}\"");
-    });
-
-    errors.add(buffer.toString().trim());
-  }
-
-  /// Returns the suggested version constraint for a dependency that was tested
-  /// against [version].
-  String _constraintForVersion(Version version) {
-    if (_caretAllowed) return "^$version";
-    return '">=$version <${version.nextBreaking}"';
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/validator/dependency_override.dart b/sdk/lib/_internal/pub/lib/src/validator/dependency_override.dart
deleted file mode 100644
index a5ce299..0000000
--- a/sdk/lib/_internal/pub/lib/src/validator/dependency_override.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.validator.dependency_override;
-
-import 'dart:async';
-
-import '../entrypoint.dart';
-import '../validator.dart';
-
-/// A validator that validates a package's dependencies overrides (or the
-/// absence thereof).
-class DependencyOverrideValidator extends Validator {
-  DependencyOverrideValidator(Entrypoint entrypoint)
-    : super(entrypoint);
-
-  Future validate() {
-    if (entrypoint.root.dependencyOverrides.isNotEmpty) {
-      errors.add(
-          'Your pubspec.yaml must not have a "dependency_overrides" field.\n'
-          'This ensures you test your package against the same versions of '
-              'its dependencies\n'
-          'that users will have when they use it.');
-    }
-    return new Future.value();
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/validator/directory.dart b/sdk/lib/_internal/pub/lib/src/validator/directory.dart
deleted file mode 100644
index 6039fc5..0000000
--- a/sdk/lib/_internal/pub/lib/src/validator/directory.dart
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.validator.directory;
-
-import 'dart:async';
-
-import 'package:path/path.dart' as path;
-
-import '../entrypoint.dart';
-import '../io.dart';
-import '../validator.dart';
-
-/// A validator that validates a package's top-level directories.
-class DirectoryValidator extends Validator {
-  DirectoryValidator(Entrypoint entrypoint)
-    : super(entrypoint);
-
-  static final _PLURAL_NAMES = [
-    "benchmarks", "docs", "examples", "tests", "tools"
-  ];
-
-  Future validate() {
-    return new Future.sync(() {
-      for (var dir in listDir(entrypoint.root.dir)) {
-        if (!dirExists(dir)) continue;
-
-        dir = path.basename(dir);
-        if (_PLURAL_NAMES.contains(dir)) {
-          // Cut off the "s"
-          var singularName = dir.substring(0, dir.length - 1);
-          warnings.add('Rename the top-level "$dir" directory to '
-                  '"$singularName".\n'
-              'The Pub layout convention is to use singular directory '
-                  'names.\n'
-              'Plural names won\'t be correctly identified by Pub and other '
-                  'tools.');
-        }
-
-        if (dir.contains(new RegExp(r"^samples?$"))) {
-          warnings.add('Rename the top-level "$dir" directory to "example".\n'
-              'This allows Pub to find your examples and create "packages" '
-                  'directories for them.\n');
-        }
-      }
-    });
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/validator/executable.dart b/sdk/lib/_internal/pub/lib/src/validator/executable.dart
deleted file mode 100644
index 939b443..0000000
--- a/sdk/lib/_internal/pub/lib/src/validator/executable.dart
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.validator.executable;
-
-import 'dart:async';
-
-import 'package:path/path.dart' as p;
-
-import '../entrypoint.dart';
-import '../validator.dart';
-
-/// Validates that a package's pubspec doesn't contain executables that
-/// reference non-existent scripts.
-class ExecutableValidator extends Validator {
-  ExecutableValidator(Entrypoint entrypoint)
-    : super(entrypoint);
-
-  Future validate() async {
-    // TODO(rnystrom): This can print false positives since a script may be
-    // produced by a transformer. Do something better.
-    var binFiles = entrypoint.root.listFiles(beneath: "bin", recursive: false)
-        .map((path) => entrypoint.root.relative(path))
-        .toList();
-
-    entrypoint.root.pubspec.executables.forEach((executable, script) {
-      var scriptPath = p.join("bin", "$script.dart");
-      if (binFiles.contains(scriptPath)) return;
-
-      warnings.add('Your pubspec.yaml lists an executable "$executable" that '
-          'points to a script "$scriptPath" that does not exist.');
-    });
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/validator/license.dart b/sdk/lib/_internal/pub/lib/src/validator/license.dart
deleted file mode 100644
index 067765b..0000000
--- a/sdk/lib/_internal/pub/lib/src/validator/license.dart
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.validator.license;
-
-import 'dart:async';
-
-import 'package:path/path.dart' as path;
-
-import '../entrypoint.dart';
-import '../validator.dart';
-
-/// A validator that checks that a LICENSE-like file exists.
-class LicenseValidator extends Validator {
-  LicenseValidator(Entrypoint entrypoint)
-    : super(entrypoint);
-
-  Future validate() {
-    return new Future.sync(() {
-      var licenseLike = new RegExp(
-          r"^([a-zA-Z0-9]+[-_])?(LICENSE|COPYING)(\..*)?$");
-      if (entrypoint.root.listFiles(recursive: false)
-          .map(path.basename)
-          .any(licenseLike.hasMatch)) {
-        return;
-      }
-
-      errors.add(
-          "You must have a COPYING or LICENSE file in the root directory.\n"
-          "An open-source license helps ensure people can legally use your "
-          "code.");
-    });
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/validator/name.dart b/sdk/lib/_internal/pub/lib/src/validator/name.dart
deleted file mode 100644
index 94e2024..0000000
--- a/sdk/lib/_internal/pub/lib/src/validator/name.dart
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.validator.name;
-
-import 'dart:async';
-
-import 'package:path/path.dart' as path;
-
-import '../entrypoint.dart';
-import '../validator.dart';
-
-/// Dart reserved words, from the Dart spec.
-final _RESERVED_WORDS = [
-  "assert", "break", "case", "catch", "class", "const", "continue", "default",
-  "do", "else", "extends", "false", "final", "finally", "for", "if", "in", "is",
-  "new", "null", "return", "super", "switch", "this", "throw", "true", "try",
-  "var", "void", "while", "with"
-];
-
-/// A validator that validates the name of the package and its libraries.
-class NameValidator extends Validator {
-  NameValidator(Entrypoint entrypoint)
-    : super(entrypoint);
-
-  Future validate() {
-    return new Future.sync(() {
-      _checkName(entrypoint.root.name, 'Package name "${entrypoint.root.name}"',
-          isPackage: true);
-
-      var libraries = _libraries;
-      for (var library in libraries) {
-        var libName = path.basenameWithoutExtension(library);
-        _checkName(libName, 'The name of "$library", "$libName",',
-            isPackage: false);
-      }
-
-      if (libraries.length == 1) {
-        var libName = path.basenameWithoutExtension(libraries[0]);
-        if (libName == entrypoint.root.name) return;
-        warnings.add('The name of "${libraries[0]}", "$libName", should match '
-            'the name of the package, "${entrypoint.root.name}".\n'
-            'This helps users know what library to import.');
-      }
-    });
-  }
-
-  /// Returns a list of all libraries in the current package as paths relative
-  /// to the package's root directory.
-  List<String> get _libraries {
-    var libDir = entrypoint.root.path("lib");
-    return entrypoint.root.listFiles(beneath: "lib")
-        .map((file) => path.relative(file, from: path.dirname(libDir)))
-        .where((file) => !path.split(file).contains("src") &&
-                         path.extension(file) == '.dart')
-        .toList();
-  }
-
-  void _checkName(String name, String description, {bool isPackage}) {
-    // Packages names are more stringent than libraries.
-    var messages = isPackage ? errors : warnings;
-
-    if (name == "") {
-      errors.add("$description may not be empty.");
-    } else if (!new RegExp(r"^[a-zA-Z0-9_]*$").hasMatch(name)) {
-      messages.add("$description may only contain letters, numbers, and "
-          "underscores.\n"
-          "Using a valid Dart identifier makes the name usable in Dart code.");
-    } else if (!new RegExp(r"^[a-zA-Z_]").hasMatch(name)) {
-      messages.add("$description must begin with a letter or underscore.\n"
-          "Using a valid Dart identifier makes the name usable in Dart code.");
-    } else if (_RESERVED_WORDS.contains(name.toLowerCase())) {
-      messages.add("$description may not be a reserved word in Dart.\n"
-          "Using a valid Dart identifier makes the name usable in Dart code.");
-    } else if (new RegExp(r"[A-Z]").hasMatch(name)) {
-      warnings.add('$description should be lower-case. Maybe use '
-          '"${_unCamelCase(name)}"?');
-    }
-  }
-
-  String _unCamelCase(String source) {
-    var builder = new StringBuffer();
-    var lastMatchEnd = 0;
-    for (var match in new RegExp(r"[a-z]([A-Z])").allMatches(source)) {
-      builder
-        ..write(source.substring(lastMatchEnd, match.start + 1))
-        ..write("_")
-        ..write(match.group(1).toLowerCase());
-      lastMatchEnd = match.end;
-    }
-    builder.write(source.substring(lastMatchEnd));
-    return builder.toString().toLowerCase();
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/validator/pubspec_field.dart b/sdk/lib/_internal/pub/lib/src/validator/pubspec_field.dart
deleted file mode 100644
index 546eb26..0000000
--- a/sdk/lib/_internal/pub/lib/src/validator/pubspec_field.dart
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.validator.pubspec_field;
-
-import 'dart:async';
-
-import '../entrypoint.dart';
-import '../validator.dart';
-
-/// A validator that checks that the pubspec has valid "author" and "homepage"
-/// fields.
-class PubspecFieldValidator extends Validator {
-  PubspecFieldValidator(Entrypoint entrypoint)
-    : super(entrypoint);
-
-  Future validate() {
-    _validateAuthors();
-    _validateFieldIsString('description');
-    _validateFieldIsString('homepage');
-    _validateFieldUrl('homepage');
-    _validateFieldUrl('documentation');
-
-    // Any complex parsing errors in version will be exposed through
-    // [Pubspec.allErrors].
-    _validateFieldIsString('version');
-
-    // Pubspec errors are detected lazily, so we make sure there aren't any
-    // here.
-    for (var error in entrypoint.root.pubspec.allErrors) {
-      errors.add('In your pubspec.yaml, ${error.message}');
-    }
-
-    return new Future.value();
-  }
-
-  /// Adds an error if the "author" or "authors" field doesn't exist or has the
-  /// wrong type.
-  void _validateAuthors() {
-    var pubspec = entrypoint.root.pubspec;
-    var author = pubspec.fields['author'];
-    var authors = pubspec.fields['authors'];
-    if (author == null && authors == null) {
-      errors.add('Your pubspec.yaml must have an "author" or "authors" field.');
-      return;
-    }
-
-    if (author != null && author is! String) {
-      errors.add('Your pubspec.yaml\'s "author" field must be a string, but it '
-          'was "$author".');
-      return;
-    }
-
-    if (authors != null &&
-        (authors is! List || authors.any((author) => author is! String))) {
-      errors.add('Your pubspec.yaml\'s "authors" field must be a list, but '
-          'it was "$authors".');
-      return;
-    }
-
-    if (authors == null) authors = [author];
-
-    var hasName = new RegExp(r"^ *[^< ]");
-    var hasEmail = new RegExp(r"<[^>]+> *$");
-    for (var authorName in authors) {
-      if (!hasName.hasMatch(authorName)) {
-        warnings.add('Author "$authorName" in pubspec.yaml should have a '
-            'name.');
-      }
-      if (!hasEmail.hasMatch(authorName)) {
-        warnings.add('Author "$authorName" in pubspec.yaml should have an '
-            'email address\n(e.g. "name <email>").');
-      }
-    }
-  }
-
-  /// Adds an error if [field] doesn't exist or isn't a string.
-  void _validateFieldIsString(String field) {
-    var value = entrypoint.root.pubspec.fields[field];
-    if (value == null) {
-      errors.add('Your pubspec.yaml is missing a "$field" field.');
-    } else if (value is! String) {
-      errors.add('Your pubspec.yaml\'s "$field" field must be a string, but '
-          'it was "$value".');
-    }
-  }
-
-  /// Adds an error if the URL for [field] is invalid.
-  void _validateFieldUrl(String field) {
-    var url = entrypoint.root.pubspec.fields[field];
-    if (url == null) return;
-
-    if (url is! String) {
-      errors.add('Your pubspec.yaml\'s "$field" field must be a string, but '
-          'it was "$url".');
-      return;
-    }
-
-    var goodScheme = new RegExp(r'^https?:');
-    if (!goodScheme.hasMatch(url)) {
-      errors.add('Your pubspec.yaml\'s "$field" field must be an "http:" or '
-          '"https:" URL, but it was "$url".');
-    }
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/validator/sdk_constraint.dart b/sdk/lib/_internal/pub/lib/src/validator/sdk_constraint.dart
deleted file mode 100644
index b192b05..0000000
--- a/sdk/lib/_internal/pub/lib/src/validator/sdk_constraint.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.validator.sdk_constraint;
-
-import 'dart:async';
-
-import '../entrypoint.dart';
-import '../validator.dart';
-
-/// A validator that validates that a package's SDK constraint doesn't use the
-/// "^" syntax.
-class SdkConstraintValidator extends Validator {
-  SdkConstraintValidator(Entrypoint entrypoint)
-    : super(entrypoint);
-
-  Future validate() async {
-    var constraint = entrypoint.root.pubspec.environment.sdkVersion;
-    if (!constraint.toString().startsWith("^")) return;
-
-    errors.add(
-        "^ version constraints aren't allowed for SDK constraints since "
-          "older versions of pub don't support them.\n"
-        "Expand it manually instead:\n"
-        "\n"
-        "environment:\n"
-        "  sdk: \">=${constraint.min} <${constraint.max}\"");
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/validator/size.dart b/sdk/lib/_internal/pub/lib/src/validator/size.dart
deleted file mode 100644
index b3da388..0000000
--- a/sdk/lib/_internal/pub/lib/src/validator/size.dart
+++ /dev/null
@@ -1,32 +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 pub.validator.size;
-
-import 'dart:async';
-import 'dart:math' as math;
-
-import '../entrypoint.dart';
-import '../validator.dart';
-
-/// The maximum size of the package to upload (100 MB).
-const _MAX_SIZE = 100 * 1024 * 1024;
-
-/// A validator that validates that a package isn't too big.
-class SizeValidator extends Validator {
-  final Future<int> packageSize;
-
-  SizeValidator(Entrypoint entrypoint, this.packageSize)
-    : super(entrypoint);
-
-  Future validate() {
-    return packageSize.then((size) {
-      if (size <= _MAX_SIZE) return;
-      var sizeInMb = (size / math.pow(2, 20)).toStringAsPrecision(4);
-      errors.add("Your package is $sizeInMb MB. Hosted packages must be "
-          "smaller than 100 MB.");
-    });
-  }
-}
-
diff --git a/sdk/lib/_internal/pub/lib/src/validator/utf8_readme.dart b/sdk/lib/_internal/pub/lib/src/validator/utf8_readme.dart
deleted file mode 100644
index 9f30d65..0000000
--- a/sdk/lib/_internal/pub/lib/src/validator/utf8_readme.dart
+++ /dev/null
@@ -1,35 +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 pub.validator.utf8_readme;
-
-import 'dart:async';
-import 'dart:convert';
-
-import '../entrypoint.dart';
-import '../io.dart';
-import '../validator.dart';
-
-/// Validates that a package's README is valid utf-8.
-class Utf8ReadmeValidator extends Validator {
-  Utf8ReadmeValidator(Entrypoint entrypoint)
-    : super(entrypoint);
-
-  Future validate() {
-    return new Future.sync(() {
-      var readme = entrypoint.root.readmePath;
-      if (readme == null) return;
-      var bytes = readBinaryFile(readme);
-      try {
-        // UTF8.decode doesn't allow invalid UTF-8.
-        UTF8.decode(bytes);
-      } on FormatException catch (_) {
-        warnings.add("$readme contains invalid UTF-8.\n"
-            "This will cause it to be displayed incorrectly on "
-                "pub.dartlang.org.");
-      }
-    });
-  }
-}
-
diff --git a/sdk/lib/_internal/pub/pub.status b/sdk/lib/_internal/pub/pub.status
deleted file mode 100644
index 8776cae..0000000
--- a/sdk/lib/_internal/pub/pub.status
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-test/dart2js/compiles_generated_file_from_dependency_test: Pass, Slow
-test/serve/web_socket/url_to_asset_id_test: Pass, Slow
-test/transformer/loads_a_diamond_transformer_dependency_graph_test: Pass, Slow
-
-# Pub only runs on the VM, so just rule out all compilers.
-[ $compiler == dart2js ]
-*: Skip
-
-# Pub only runs on the standalone VM, not the browser.
-[ $runtime == drt || $runtime == dartium || $runtime == opera ]
-*: Skip
-
-[ $runtime == vm && $system == windows ]
-test/run/app_can_read_from_stdin_test: Fail # Issue 19448
-test/run/forwards_signal_posix_test: SkipByDesign
diff --git a/sdk/lib/_internal/pub/test/ascii_tree_test.dart b/sdk/lib/_internal/pub/test/ascii_tree_test.dart
deleted file mode 100644
index 96d81ee..0000000
--- a/sdk/lib/_internal/pub/test/ascii_tree_test.dart
+++ /dev/null
@@ -1,248 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library lock_file_test;
-
-import 'package:unittest/unittest.dart';
-
-import '../lib/src/ascii_tree.dart' as tree;
-import '../lib/src/utils.dart';
-
-main() {
-  runningAsTest = true;
-
-  group('tree.fromFiles', () {
-    test('no files', () {
-      expect(tree.fromFiles([]), equals(""));
-    });
-
-    test('up to ten files in one directory are shown', () {
-      var files = [
-        "dir/a.dart",
-        "dir/b.dart",
-        "dir/c.dart",
-        "dir/d.dart",
-        "dir/e.dart",
-        "dir/f.dart",
-        "dir/g.dart",
-        "dir/h.dart",
-        "dir/i.dart",
-        "dir/j.dart"
-      ];
-      expect(tree.fromFiles(files), equals("""
-'-- dir
-    |-- a.dart
-    |-- b.dart
-    |-- c.dart
-    |-- d.dart
-    |-- e.dart
-    |-- f.dart
-    |-- g.dart
-    |-- h.dart
-    |-- i.dart
-    '-- j.dart
-"""));
-    });
-
-    test('files are elided if there are more than ten', () {
-      var files = [
-        "dir/a.dart",
-        "dir/b.dart",
-        "dir/c.dart",
-        "dir/d.dart",
-        "dir/e.dart",
-        "dir/f.dart",
-        "dir/g.dart",
-        "dir/h.dart",
-        "dir/i.dart",
-        "dir/j.dart",
-        "dir/k.dart"
-      ];
-      expect(tree.fromFiles(files), equals("""
-'-- dir
-    |-- a.dart
-    |-- b.dart
-    |-- c.dart
-    | (5 more...)
-    |-- i.dart
-    |-- j.dart
-    '-- k.dart
-"""));
-    });
-
-    test('files are not elided at the top level', () {
-      var files = [
-        "a.dart",
-        "b.dart",
-        "c.dart",
-        "d.dart",
-        "e.dart",
-        "f.dart",
-        "g.dart",
-        "h.dart",
-        "i.dart",
-        "j.dart",
-        "k.dart"
-      ];
-      expect(tree.fromFiles(files), equals("""
-|-- a.dart
-|-- b.dart
-|-- c.dart
-|-- d.dart
-|-- e.dart
-|-- f.dart
-|-- g.dart
-|-- h.dart
-|-- i.dart
-|-- j.dart
-'-- k.dart
-"""));
-    });
-
-    test('a complex example', () {
-      var files = [
-        "TODO",
-        "example/console_example.dart",
-        "example/main.dart",
-        "example/web copy/web_example.dart",
-        "test/absolute_test.dart",
-        "test/basename_test.dart",
-        "test/dirname_test.dart",
-        "test/extension_test.dart",
-        "test/is_absolute_test.dart",
-        "test/is_relative_test.dart",
-        "test/join_test.dart",
-        "test/normalize_test.dart",
-        "test/relative_test.dart",
-        "test/split_test.dart",
-        ".gitignore",
-        "README.md",
-        "lib/path.dart",
-        "pubspec.yaml",
-        "test/all_test.dart",
-        "test/path_posix_test.dart",
-        "test/path_windows_test.dart"
-      ];
-
-      expect(tree.fromFiles(files), equals("""
-|-- .gitignore
-|-- README.md
-|-- TODO
-|-- example
-|   |-- console_example.dart
-|   |-- main.dart
-|   '-- web copy
-|       '-- web_example.dart
-|-- lib
-|   '-- path.dart
-|-- pubspec.yaml
-'-- test
-    |-- absolute_test.dart
-    |-- all_test.dart
-    |-- basename_test.dart
-    | (7 more...)
-    |-- path_windows_test.dart
-    |-- relative_test.dart
-    '-- split_test.dart
-"""));
-    });
-  });
-
-  group('treeFromMap', () {
-    test('empty map', () {
-      expect(tree.fromMap({}), equals(""));
-    });
-
-    test('a complex example', () {
-      var map = {
-        ".gitignore": {},
-        "README.md": {},
-        "TODO": {},
-        "example": {
-          "console_example.dart": {},
-          "main.dart": {},
-          "web copy": {
-            "web_example.dart": {}
-          },
-        },
-        "lib": {
-          "path.dart": {}
-        },
-        "pubspec.yaml": {},
-        "test": {
-          "absolute_test.dart": {},
-          "basename_test.dart": {},
-          "dirname_test.dart": {},
-          "extension_test.dart": {},
-          "is_absolute_test.dart": {},
-          "is_relative_test.dart": {},
-          "join_test.dart": {},
-          "normalize_test.dart": {},
-          "relative_test.dart": {},
-          "split_test.dart": {}
-        }
-      };
-
-      expect(tree.fromMap(map), equals("""
-|-- .gitignore
-|-- README.md
-|-- TODO
-|-- example
-|   |-- console_example.dart
-|   |-- main.dart
-|   '-- web copy
-|       '-- web_example.dart
-|-- lib
-|   '-- path.dart
-|-- pubspec.yaml
-'-- test
-    |-- absolute_test.dart
-    |-- basename_test.dart
-    |-- dirname_test.dart
-    |-- extension_test.dart
-    |-- is_absolute_test.dart
-    |-- is_relative_test.dart
-    |-- join_test.dart
-    |-- normalize_test.dart
-    |-- relative_test.dart
-    '-- split_test.dart
-"""));
-    });
-  });
-
-  test('does not elide children if showAllChildren is true', () {
-    var map = {
-      'dir': {
-        'a.dart': {},
-        'b.dart': {},
-        'c.dart': {},
-        'd.dart': {},
-        'e.dart': {},
-        'f.dart': {},
-        'g.dart': {},
-        'h.dart': {},
-        'i.dart': {},
-        'j.dart': {},
-        'k.dart': {},
-        'l.dart': {},
-      }
-    };
-    expect(tree.fromMap(map, showAllChildren: true), equals("""
-'-- dir
-    |-- a.dart
-    |-- b.dart
-    |-- c.dart
-    |-- d.dart
-    |-- e.dart
-    |-- f.dart
-    |-- g.dart
-    |-- h.dart
-    |-- i.dart
-    |-- j.dart
-    |-- k.dart
-    '-- l.dart
-"""));
-  });
-
-}
diff --git a/sdk/lib/_internal/pub/test/asset/out-of-date.snapshot b/sdk/lib/_internal/pub/test/asset/out-of-date.snapshot
deleted file mode 100644
index 38c3b9d..0000000
--- a/sdk/lib/_internal/pub/test/asset/out-of-date.snapshot
+++ /dev/null
Binary files differ
diff --git a/sdk/lib/_internal/pub/test/barback/all_includes_all_default_directories_test.dart b/sdk/lib/_internal/pub/test/barback/all_includes_all_default_directories_test.dart
deleted file mode 100644
index bc214e4..0000000
--- a/sdk/lib/_internal/pub/test/barback/all_includes_all_default_directories_test.dart
+++ /dev/null
@@ -1,66 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../serve/utils.dart';
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  setUp(() {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir('benchmark', [d.file('file.txt', 'benchmark')]),
-      d.dir('bin',       [d.file('file.txt', 'bin')]),
-      d.dir('example',   [d.file('file.txt', 'example')]),
-      d.dir('test',      [d.file('file.txt', 'test')]),
-      d.dir('web',       [d.file('file.txt', 'web')]),
-      d.dir('unknown',   [d.file('file.txt', 'unknown')])
-    ]).create();
-  });
-
-  integration("build --all finds assets in default source directories", () {
-    schedulePub(args: ["build", "--all"],
-        output: new RegExp(r'Built 5 files to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('benchmark', [
-          d.file('file.txt', 'benchmark')
-        ]),
-        d.dir('bin', [
-          d.file('file.txt', 'bin')
-        ]),
-        d.dir('example', [
-          d.file('file.txt', 'example')
-        ]),
-        d.dir('test', [
-          d.file('file.txt', 'test')
-        ]),
-        d.dir('web', [
-          d.file('file.txt', 'web')
-        ]),
-        // Only includes default source directories.
-        d.nothing('unknown')
-      ])
-    ]).validate();
-  });
-
-  integration("serve --all finds assets in default source directories", () {
-    pubServe(args: ["--all"]);
-
-    requestShouldSucceed("file.txt", "benchmark", root: "benchmark");
-    requestShouldSucceed("file.txt", "bin", root: "bin");
-    requestShouldSucceed("file.txt", "example", root: "example");
-    requestShouldSucceed("file.txt", "test", root: "test");
-    requestShouldSucceed("file.txt", "web", root: "web");
-
-    expectNotServed("unknown");
-
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/barback/directory_args_test.dart b/sdk/lib/_internal/pub/test/barback/directory_args_test.dart
deleted file mode 100644
index 9042690..0000000
--- a/sdk/lib/_internal/pub/test/barback/directory_args_test.dart
+++ /dev/null
@@ -1,52 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-
-  setUp(() {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir('bar', [d.file('file.txt', 'bar')]),
-      d.dir('foo', [d.file('file.txt', 'foo')]),
-      d.dir('test', [d.file('file.txt', 'test')]),
-      d.dir('web', [d.file('file.txt', 'web')])
-    ]).create();
-  });
-
-  integration("builds only the given directories", () {
-    schedulePub(args: ["build", "foo", "bar"],
-        output: new RegExp(r'Built 2 files to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('bar', [
-          d.file('file.txt', 'bar')
-        ]),
-        d.dir('foo', [
-          d.file('file.txt', 'foo')
-        ]),
-        d.nothing('test'),
-        d.nothing('web')
-      ])
-    ]).validate();
-  });
-
-  integration("serves only the given directories", () {
-    pubServe(args: ["foo", "bar"]);
-
-    requestShouldSucceed("file.txt", "bar", root: "bar");
-    requestShouldSucceed("file.txt", "foo", root: "foo");
-    expectNotServed("test");
-    expectNotServed("web");
-
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/barback/fails_if_args_with_all_test.dart b/sdk/lib/_internal/pub/test/barback/fails_if_args_with_all_test.dart
deleted file mode 100644
index 42f7943..0000000
--- a/sdk/lib/_internal/pub/test/barback/fails_if_args_with_all_test.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-
-  setUp(() {
-    d.appDir().create();
-  });
-
-  pubBuildAndServeShouldFail("if a directory is passed with --all",
-      args: ["example", "--all"],
-      error: 'Directory names are not allowed if "--all" is passed.',
-      exitCode: exit_codes.USAGE);
-}
diff --git a/sdk/lib/_internal/pub/test/barback/fails_if_dir_arg_does_not_exist_test.dart b/sdk/lib/_internal/pub/test/barback/fails_if_dir_arg_does_not_exist_test.dart
deleted file mode 100644
index 2f5d56e..0000000
--- a/sdk/lib/_internal/pub/test/barback/fails_if_dir_arg_does_not_exist_test.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-
-  setUp(() {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("bar", [
-        d.file("file.txt", "contents")
-      ])
-    ]).create();
-  });
-
-  pubBuildAndServeShouldFail("if a specified directory doesn't exist",
-      args: ["foo", "bar", "baz"],
-      error: 'Directories "foo" and "baz" do not exist.',
-      exitCode: exit_codes.DATA);
-}
diff --git a/sdk/lib/_internal/pub/test/barback/fails_if_dir_outside_package_test.dart b/sdk/lib/_internal/pub/test/barback/fails_if_dir_outside_package_test.dart
deleted file mode 100644
index 7e66218..0000000
--- a/sdk/lib/_internal/pub/test/barback/fails_if_dir_outside_package_test.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-
-  setUp(() {
-    d.appDir().create();
-  });
-
-  pubBuildAndServeShouldFail("if source directory reaches outside the package",
-      args: [".."],
-      error: 'Directory ".." isn\'t in this package.',
-      exitCode: exit_codes.USAGE);
-}
diff --git a/sdk/lib/_internal/pub/test/barback/fails_if_no_default_dirs_test.dart b/sdk/lib/_internal/pub/test/barback/fails_if_no_default_dirs_test.dart
deleted file mode 100644
index 3b0aa97..0000000
--- a/sdk/lib/_internal/pub/test/barback/fails_if_no_default_dirs_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-
-  setUp(() {
-    d.appDir().create();
-  });
-
-  pubBuildAndServeShouldFail("if no directories were passed and no default "
-          "ones exist",
-      args: [],
-      buildError: 'Your package must have a "web" directory,\n'
-          'or you must specify the source directories.',
-      serveError: 'Your package must have "web" and/or "test" directories,\n'
-          'or you must specify the source directories.',
-      exitCode: exit_codes.DATA);
-}
diff --git a/sdk/lib/_internal/pub/test/barback/fails_on_all_with_no_buildable_directories_test.dart b/sdk/lib/_internal/pub/test/barback/fails_on_all_with_no_buildable_directories_test.dart
deleted file mode 100644
index 8c0a06f..0000000
--- a/sdk/lib/_internal/pub/test/barback/fails_on_all_with_no_buildable_directories_test.dart
+++ /dev/null
@@ -1,25 +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 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-
-  setUp(() {
-    d.appDir().create();
-  });
-
-  pubBuildAndServeShouldFail("on --all with no default source directories",
-      args: ["--all"],
-      error: 'There are no source directories present.\n'
-        'The default directories are "benchmark", "bin", "example", '
-        '"test" and "web".',
-      exitCode: exit_codes.DATA);
-}
diff --git a/sdk/lib/_internal/pub/test/barback/fails_on_disallowed_directories_test.dart b/sdk/lib/_internal/pub/test/barback/fails_on_disallowed_directories_test.dart
deleted file mode 100644
index a57d8e7..0000000
--- a/sdk/lib/_internal/pub/test/barback/fails_on_disallowed_directories_test.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-
-  setUp(() {
-    d.appDir().create();
-  });
-
-  var libSub = path.join("lib", "sub");
-  pubBuildAndServeShouldFail("if given directories are not allowed",
-      args: [libSub, "lib"],
-      error: 'Directories "$libSub" and "lib" are not allowed.',
-      exitCode: exit_codes.USAGE);
-}
diff --git a/sdk/lib/_internal/pub/test/barback/fails_on_overlapping_directories_test.dart b/sdk/lib/_internal/pub/test/barback/fails_on_overlapping_directories_test.dart
deleted file mode 100644
index 8e98b86..0000000
--- a/sdk/lib/_internal/pub/test/barback/fails_on_overlapping_directories_test.dart
+++ /dev/null
@@ -1,52 +0,0 @@
-// 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:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-
-  setUp(() {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.dir("sub1", [
-          d.file("file.txt", "contents"),
-          d.dir("sub2", [
-            d.file("file.txt", "contents")
-          ]),
-          d.dir("sub3", [
-            d.file("file.txt", "contents")
-          ])
-        ])
-      ])
-    ]).create();
-  });
-
-  var webSub1 = path.join("web", "sub1");
-  var webSub1Sub2 = path.join("web", "sub1", "sub2");
-  var webSub1Sub3 = path.join("web", "sub1", "sub3");
-
-  pubBuildAndServeShouldFail("if a superdirectory follows a subdirectory",
-      args: [webSub1Sub2, webSub1],
-      error: 'Directories "$webSub1Sub2" and "$webSub1" cannot overlap.',
-      exitCode: exit_codes.USAGE);
-
-  pubBuildAndServeShouldFail("if a subdirectory follows a superdirectory",
-      args: [webSub1, webSub1Sub2],
-      error: 'Directories "$webSub1" and "$webSub1Sub2" cannot overlap.',
-      exitCode: exit_codes.USAGE);
-
-  pubBuildAndServeShouldFail("if multiple directories overlap",
-      args: [webSub1, webSub1Sub2, webSub1Sub3],
-      error: 'Directories "$webSub1", "$webSub1Sub2" and "$webSub1Sub3" '
-             'cannot overlap.',
-      exitCode: exit_codes.USAGE);
-}
diff --git a/sdk/lib/_internal/pub/test/barback/subdirectories_test.dart b/sdk/lib/_internal/pub/test/barback/subdirectories_test.dart
deleted file mode 100644
index 92d8a95..0000000
--- a/sdk/lib/_internal/pub/test/barback/subdirectories_test.dart
+++ /dev/null
@@ -1,64 +0,0 @@
-// 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:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../serve/utils.dart';
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  setUp(() {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.dir("one", [
-          d.dir("inner", [d.file("file.txt", "one")])
-        ]),
-        d.dir("two", [
-          d.dir("inner", [d.file("file.txt", "two")])
-        ]),
-        d.dir("nope", [
-          d.dir("inner", [d.file("file.txt", "nope")])
-        ])
-      ])
-    ]).create();
-  });
-
-  var webOne = p.join("web", "one");
-  var webTwoInner = p.join("web", "two", "inner");
-
-  integration("builds subdirectories", () {
-    schedulePub(args: ["build", webOne, webTwoInner],
-        output: new RegExp(r'Built 2 files to "build".'));
-
-    d.dir(appPath, [
-      d.dir("build", [
-        d.dir("web", [
-          d.dir("one", [
-            d.dir("inner", [d.file("file.txt", "one")])
-          ]),
-          d.dir("two", [
-            d.dir("inner", [d.file("file.txt", "two")])
-          ]),
-          d.nothing("nope")
-        ])
-      ])
-    ]).validate();
-  });
-
-  integration("serves subdirectories", () {
-    pubServe(args: [webOne, webTwoInner]);
-
-    requestShouldSucceed("inner/file.txt", "one", root: webOne);
-    requestShouldSucceed("file.txt", "two", root: webTwoInner);
-    expectNotServed("web");
-    expectNotServed(p.join("web", "three"));
-
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/barback/utils.dart b/sdk/lib/_internal/pub/test/barback/utils.dart
deleted file mode 100644
index e4d9efe..0000000
--- a/sdk/lib/_internal/pub/test/barback/utils.dart
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../test_pub.dart';
-
-/// Runs separate integration tests for "pub build", "pub serve", and
-/// "pub build --format json" and validates that in all cases, it fails with
-/// an expected error message and exits with [exitCode].
-///
-/// The integrations assume set up is already done, so you will likely want to
-/// call [setUp] before this.
-///
-/// If [error] is provided, then both pub build and pub serve should exit with
-/// that message. Otherwise, [buildError] is the expected error from pub build
-/// and [serveError] from pub serve.
-void pubBuildAndServeShouldFail(String description, {List<String> args,
-    String error, String buildError, String serveError, int exitCode}) {
-
-  if (error != null) {
-    assert(buildError == null);
-    buildError = error;
-
-    assert(serveError == null);
-    serveError = error;
-  }
-
-  // Usage errors also print the usage, so validate that.
-  var buildExpectation = buildError;
-  var serveExpectation = serveError;
-  if (exitCode == exit_codes.USAGE) {
-    buildExpectation = allOf(
-        startsWith(buildExpectation), contains("Usage: pub build"));
-    serveExpectation = allOf(
-        startsWith(serveExpectation), contains("Usage: pub serve"));
-  }
-
-  integration("build fails $description", () {
-    schedulePub(args: ["build"]..addAll(args),
-        error: buildExpectation,
-        exitCode: exitCode);
-  });
-
-  integration("build --format json fails $description", () {
-    schedulePub(args: ["build", "--format", "json"]..addAll(args),
-        outputJson: {
-          "error": buildError // No usage in JSON output.
-        },
-        exitCode: exitCode);
-  });
-
-  integration("serve fails $description", () {
-    schedulePub(args: ["serve"]..addAll(args),
-        error: serveExpectation,
-        exitCode: exitCode);
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/build/allows_arbitrary_modes_test.dart b/sdk/lib/_internal/pub/test/build/allows_arbitrary_modes_test.dart
deleted file mode 100644
index e9f4096..0000000
--- a/sdk/lib/_internal/pub/test/build/allows_arbitrary_modes_test.dart
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class ModeTransformer extends Transformer {
-  final BarbackSettings settings;
-  ModeTransformer.asPlugin(this.settings);
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    return new Future.value().then((_) {
-      var id = transform.primaryInput.id.changeExtension(".out");
-      transform.addOutput(new Asset.fromString(id, settings.mode.toString()));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("allows user-defined mode names", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      schedulePub(args: ["build", "--mode", "depeche"]);
-
-      d.dir(appPath, [
-        d.dir('build', [
-          d.dir('web', [
-            d.file('foo.out', 'depeche')
-          ])
-        ])
-      ]).validate();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/build/can_specify_output_directory_test.dart b/sdk/lib/_internal/pub/test/build/can_specify_output_directory_test.dart
deleted file mode 100644
index 9264ea7..0000000
--- a/sdk/lib/_internal/pub/test/build/can_specify_output_directory_test.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("can specify the output directory to build into", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir('web', [
-        d.file('file.txt', 'web')
-      ])
-    ]).create();
-
-    var outDir = path.join("out", "dir");
-    schedulePub(args: ["build", "-o", outDir],
-        output: contains('Built 1 file to "$outDir".'));
-
-    d.dir(appPath, [
-      d.dir("out", [
-        d.dir("dir", [
-          d.dir("web", [
-            d.file("file.txt", "web")
-          ]),
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/build/cleans_entire_build_directory_test.dart b/sdk/lib/_internal/pub/test/build/cleans_entire_build_directory_test.dart
deleted file mode 100644
index 16d25c2..0000000
--- a/sdk/lib/_internal/pub/test/build/cleans_entire_build_directory_test.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  integration("cleans entire build directory before a build", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir('example', [
-        d.file('file.txt', 'example')
-      ]),
-      d.dir('test', [
-        d.file('file.txt', 'test')
-      ])
-    ]).create();
-
-    // Make a build directory containing "example".
-    schedulePub(args: ["build", "example"],
-        output: new RegExp(r'Built 1 file to "build".'));
-
-    // Now build again with just "test". Should wipe out "example".
-    schedulePub(args: ["build", "test"],
-        output: new RegExp(r'Built 1 file to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.nothing('example'),
-        d.dir('test', [
-          d.file('file.txt', 'test')
-        ]),
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/build/copies_browser_js_next_to_entrypoints_test.dart b/sdk/lib/_internal/pub/test/build/copies_browser_js_next_to_entrypoints_test.dart
deleted file mode 100644
index 99e4e64..0000000
--- a/sdk/lib/_internal/pub/test/build/copies_browser_js_next_to_entrypoints_test.dart
+++ /dev/null
@@ -1,75 +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 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-
-  integration("compiles dart.js and interop.js next to entrypoints", () {
-    // Dart2js can take a long time to compile dart code, so we increase the
-    // timeout to cope with that.
-    currentSchedule.timeout *= 3;
-
-    serveBrowserPackage();
-
-    d.dir(appPath, [
-      d.appPubspec({"browser": "1.0.0"}),
-      d.dir('foo', [
-        d.file('file.dart', 'void main() => print("hello");'),
-        d.dir('subdir', [
-          d.file('subfile.dart', 'void main() => print("subhello");')
-        ])
-      ]),
-      d.dir('web', [
-        d.file('file.dart', 'void main() => print("hello");'),
-        d.dir('subweb', [
-          d.file('subfile.dart', 'void main() => print("subhello");')
-        ])
-      ])
-    ]).create();
-
-    pubGet();
-
-    schedulePub(args: ["build", "foo", "web"],
-        output: new RegExp(r'Built 12 files to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('foo', [
-          d.matcherFile('file.dart.js', isNot(isEmpty)),
-          d.dir('packages', [d.dir('browser', [
-            d.file('dart.js', 'contents of dart.js'),
-            d.file('interop.js', 'contents of interop.js')
-          ])]),
-          d.dir('subdir', [
-            d.dir('packages', [d.dir('browser', [
-              d.file('dart.js', 'contents of dart.js'),
-              d.file('interop.js', 'contents of interop.js')
-            ])]),
-            d.matcherFile('subfile.dart.js', isNot(isEmpty)),
-          ])
-        ]),
-        d.dir('web', [
-          d.matcherFile('file.dart.js', isNot(isEmpty)),
-          d.dir('packages', [d.dir('browser', [
-            d.file('dart.js', 'contents of dart.js'),
-            d.file('interop.js', 'contents of interop.js')
-          ])]),
-          d.dir('subweb', [
-            d.dir('packages', [d.dir('browser', [
-              d.file('dart.js', 'contents of dart.js'),
-              d.file('interop.js', 'contents of interop.js')
-            ])]),
-            d.matcherFile('subfile.dart.js', isNot(isEmpty))
-          ])
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/build/copies_browser_js_with_dependency_override_test.dart b/sdk/lib/_internal/pub/test/build/copies_browser_js_with_dependency_override_test.dart
deleted file mode 100644
index 893eec3..0000000
--- a/sdk/lib/_internal/pub/test/build/copies_browser_js_with_dependency_override_test.dart
+++ /dev/null
@@ -1,52 +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 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  // This is a regression test for http://dartbug.com/16617.
-
-  initConfig();
-
-  integration("compiles dart.js and interop.js next to entrypoints when "
-      "browser is a dependency_override", () {
-    // Dart2js can take a long time to compile dart code, so we increase the
-    // timeout to cope with that.
-    currentSchedule.timeout *= 3;
-
-    serveBrowserPackage();
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependency_overrides": {
-          "browser": "any"
-        }
-      }),
-      d.dir('web', [
-        d.file('file.dart', 'void main() => print("hello");')
-      ])
-    ]).create();
-
-    pubGet();
-
-    schedulePub(args: ["build", "--all"],
-        output: new RegExp(r'Built 3 files to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('web', [
-          d.dir('packages', [d.dir('browser', [
-            d.file('dart.js', 'contents of dart.js'),
-            d.file('interop.js', 'contents of interop.js')
-          ])])
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/build/copies_browser_js_with_dev_dependency_test.dart b/sdk/lib/_internal/pub/test/build/copies_browser_js_with_dev_dependency_test.dart
deleted file mode 100644
index a174e3e..0000000
--- a/sdk/lib/_internal/pub/test/build/copies_browser_js_with_dev_dependency_test.dart
+++ /dev/null
@@ -1,52 +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 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  // This is a regression test for http://dartbug.com/16617.
-
-  initConfig();
-
-  integration("compiles dart.js and interop.js next to entrypoints when "
-      "browser is a dev dependency", () {
-    // Dart2js can take a long time to compile dart code, so we increase the
-    // timeout to cope with that.
-    currentSchedule.timeout *= 3;
-
-    serveBrowserPackage();
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dev_dependencies": {
-          "browser": "any"
-        }
-      }),
-      d.dir('web', [
-        d.file('file.dart', 'void main() => print("hello");')
-      ])
-    ]).create();
-
-    pubGet();
-
-    schedulePub(args: ["build", "--all"],
-        output: new RegExp(r'Built 3 files to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('web', [
-          d.dir('packages', [d.dir('browser', [
-            d.file('dart.js', 'contents of dart.js'),
-            d.file('interop.js', 'contents of interop.js')
-          ])])
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/build/copies_non_dart_files_to_build_test.dart b/sdk/lib/_internal/pub/test/build/copies_non_dart_files_to_build_test.dart
deleted file mode 100644
index 443143f..0000000
--- a/sdk/lib/_internal/pub/test/build/copies_non_dart_files_to_build_test.dart
+++ /dev/null
@@ -1,41 +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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  integration("copies non-Dart files to build/", () {
-    servePackages((builder) => builder.serve("browser", "1.0.0"));
-
-    d.dir(appPath, [
-      // A browser dependency with no entrypoints shouldn't cause dart.js to be
-      // copied in.
-      d.appPubspec({"browser": "1.0.0"}),
-      d.dir('web', [
-        d.file('file.txt', 'contents'),
-        d.dir('subdir', [
-          d.file('subfile.txt', 'subcontents')
-        ])
-      ])
-    ]).create();
-
-    schedulePub(args: ["build"],
-        output: new RegExp(r'Built 2 files to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('web', [
-          d.nothing('packages'),
-          d.file('file.txt', 'contents'),
-          d.dir('subdir', [
-            d.file('subfile.txt', 'subcontents')
-          ])
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/build/defaults_to_release_mode_test.dart b/sdk/lib/_internal/pub/test/build/defaults_to_release_mode_test.dart
deleted file mode 100644
index a507ef7..0000000
--- a/sdk/lib/_internal/pub/test/build/defaults_to_release_mode_test.dart
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class ModeTransformer extends Transformer {
-  final BarbackSettings settings;
-  ModeTransformer.asPlugin(this.settings);
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    return new Future.value().then((_) {
-      var id = transform.primaryInput.id.changeExtension(".out");
-      transform.addOutput(new Asset.fromString(id, settings.mode.toString()));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("defaults to release mode", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      schedulePub(args: ["build"]);
-
-      d.dir(appPath, [
-        d.dir('build', [
-          d.dir('web', [
-            d.file('foo.out', 'release')
-          ])
-        ])
-      ]).validate();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/build/handles_long_paths_test.dart b/sdk/lib/_internal/pub/test/build/handles_long_paths_test.dart
deleted file mode 100644
index 3b8b17b..0000000
--- a/sdk/lib/_internal/pub/test/build/handles_long_paths_test.dart
+++ /dev/null
@@ -1,73 +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 'package:scheduled_test/scheduled_test.dart';
-
-import 'package:path/path.dart' as path;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  // This is a regression test for dartbug.com/14442.
-  //
-  // If you have a long chain of path dependencies with long relative paths,
-  // you can end up with a combined path that is longer than the OS can handle.
-  // For example, the path that revealed this bug was:
-  //
-  // C:\jenkins-slave\workspace\mSEE-Dev\ozone\dart\portfolio-manager\src\main\
-  // portfolio-manager\..\..\..\..\portfolio-common\src\main\portfolio-common\
-  // ../../../../dart-visualization/src/main/dart-visualization\lib\src\vega\
-  // data\transform\visual
-  //
-  // This test ensures that we're normalizing at some point before we throw the
-  // path at the OS to choke on.
-
-  integration("handles long relative paths", () {
-    // Dart2js can take a long time to compile dart code, so we increase the
-    // timeout to cope with that.
-    currentSchedule.timeout *= 3;
-
-    d.dir("some_long_dependency_name", [
-      d.libPubspec("foo", "0.0.1"),
-      d.dir("lib", [
-        d.file("foo.txt", "foo")
-      ])
-    ]).create();
-
-    // Build a 2,800 character (non-canonicalized) path.
-    var longPath = "";
-    for (var i = 0; i < 100; i++)
-    {
-      longPath = path.join(longPath, "..", "some_long_dependency_name");
-    }
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": longPath}
-      }),
-      d.dir("web", [
-        d.file("index.html", "html"),
-      ])
-    ]).create();
-
-    schedulePub(args: ["build"],
-        output: new RegExp(r'Built 2 files to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('web', [
-          d.file("index.html", "html"),
-          d.dir('packages', [
-            d.dir('foo', [
-              d.file('foo.txt', 'foo')
-            ])
-          ])
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/build/includes_assets_from_dependencies_test.dart b/sdk/lib/_internal/pub/test/build/includes_assets_from_dependencies_test.dart
deleted file mode 100644
index 6661940..0000000
--- a/sdk/lib/_internal/pub/test/build/includes_assets_from_dependencies_test.dart
+++ /dev/null
@@ -1,78 +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 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  integration("includes assets from the 'lib' directory of dependencies", () {
-    // Dart2js can take a long time to compile dart code, so we increase the
-    // timeout to cope with that.
-    currentSchedule.timeout *= 3;
-
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1"),
-      d.dir("lib", [
-        d.file("foo.txt", "foo"),
-        d.dir("sub", [
-          d.file("bar.txt", "bar"),
-        ])
-      ])
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      }),
-      d.dir("example", [
-        d.file("index.html", "html"),
-      ]),
-      d.dir("web", [
-        d.file("index.html", "html"),
-        d.dir("sub", [
-          d.file("index.html", "html")
-        ])
-      ])
-    ]).create();
-
-    schedulePub(args: ["build", "--all"],
-        output: new RegExp(r'Built 7 files to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('example', [
-          d.file("index.html", "html"),
-          d.dir('packages', [
-            d.dir('foo', [
-              d.file('foo.txt', 'foo'),
-              d.dir('sub', [
-                d.file('bar.txt', 'bar'),
-              ]),
-            ])
-          ])
-        ]),
-        d.dir('web', [
-          d.file("index.html", "html"),
-          d.dir('packages', [
-            d.dir('foo', [
-              d.file('foo.txt', 'foo'),
-              d.dir('sub', [
-                d.file('bar.txt', 'bar'),
-              ]),
-            ])
-          ]),
-          d.dir("sub", [
-            d.file("index.html", "html"),
-            // "packages" should *only* be created in the top-level directory.
-            d.nothing("packages")
-          ])
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/build/includes_dart_files_from_dependencies_in_debug_test.dart b/sdk/lib/_internal/pub/test/build/includes_dart_files_from_dependencies_in_debug_test.dart
deleted file mode 100644
index e7a9700..0000000
--- a/sdk/lib/_internal/pub/test/build/includes_dart_files_from_dependencies_in_debug_test.dart
+++ /dev/null
@@ -1,64 +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 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  integration("includes .dart files from dependencies in debug mode", () {
-    // Dart2js can take a long time to compile dart code, so we increase the
-    // timeout to cope with that.
-    currentSchedule.timeout *= 3;
-
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1"),
-      d.dir("lib", [
-        d.file('foo.dart', 'foo() => print("hello");'),
-        d.dir("sub", [
-          d.file('bar.dart', 'bar() => print("hello");'),
-        ])
-      ])
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      }),
-      d.dir("example", [
-        d.file("main.dart", 'myapp() => print("not entrypoint");'),
-        d.dir("sub", [
-          d.file("main.dart", 'myapp() => print("not entrypoint");')
-        ])
-      ])
-    ]).create();
-
-    schedulePub(args: ["build", "--mode", "debug", "example"],
-        output: new RegExp(r'Built \d+ files to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('example', [
-          d.file("main.dart", 'myapp() => print("not entrypoint");'),
-          d.dir('packages', [
-            d.dir('foo', [
-              d.file('foo.dart', 'foo() => print("hello");'),
-              d.dir("sub", [
-                d.file('bar.dart', 'bar() => print("hello");'),
-              ])
-            ])
-          ]),
-          d.dir("sub", [
-            d.file("main.dart", 'myapp() => print("not entrypoint");'),
-            // Does *not* copy packages into subdirectories.
-            d.nothing("packages")
-          ])
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/build/includes_dart_files_in_debug_mode_test.dart b/sdk/lib/_internal/pub/test/build/includes_dart_files_in_debug_mode_test.dart
deleted file mode 100644
index e80c557..0000000
--- a/sdk/lib/_internal/pub/test/build/includes_dart_files_in_debug_mode_test.dart
+++ /dev/null
@@ -1,42 +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 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  integration("includes Dart files in debug mode", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir('web', [
-        d.file('file1.dart', 'var main = () => print("hello");'),
-        d.file('file2.dart', 'void main(arg1, arg2, arg3) => print("hello");'),
-        d.file('file3.dart', 'class Foo { void main() => print("hello"); }'),
-        d.file('file4.dart', 'var foo;')
-      ])
-    ]).create();
-
-    schedulePub(args: ["build", "--mode", "debug"],
-        output: new RegExp(r'Built \d+ files to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('web', [
-          d.nothing('file1.dart.js'),
-          d.matcherFile('file1.dart', isNot(isEmpty)),
-          d.nothing('file2.dart.js'),
-          d.matcherFile('file2.dart', isNot(isEmpty)),
-          d.nothing('file3.dart.js'),
-          d.matcherFile('file3.dart', isNot(isEmpty)),
-          d.nothing('file4.dart.js'),
-          d.matcherFile('file4.dart', isNot(isEmpty))
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/build/outputs_error_to_json_test.dart b/sdk/lib/_internal/pub/test/build/outputs_error_to_json_test.dart
deleted file mode 100644
index bbd31fd..0000000
--- a/sdk/lib/_internal/pub/test/build/outputs_error_to_json_test.dart
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class RewriteTransformer extends Transformer {
-  RewriteTransformer.asPlugin();
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) => throw new Exception('oh no!');
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("outputs error to JSON in a failed build", () {
-      // Loading transformers takes several seconds, so make sure we don't
-      // timeout.
-      currentSchedule.timeout *= 2;
-
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp"]
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", TRANSFORMER)
-        ]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      schedulePub(args: ["build", "--format", "json"],
-          outputJson: {
-            "buildResult": "failure",
-            "errors": [
-              {
-                "error": startsWith("Transform Rewrite on myapp|web/foo.txt "
-                    "threw error: oh no!")
-              }
-            ],
-            "log": []
-          },
-          exitCode: exit_codes.DATA);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/build/outputs_results_to_json_test.dart b/sdk/lib/_internal/pub/test/build/outputs_results_to_json_test.dart
deleted file mode 100644
index 3fb7c1c..0000000
--- a/sdk/lib/_internal/pub/test/build/outputs_results_to_json_test.dart
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  integration("outputs results to JSON in a successful build", () {
-    // Dart2js can take a long time to compile dart code, so we increase the
-    // timeout to cope with that.
-    currentSchedule.timeout *= 3;
-
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir('web', [
-        d.file('main.dart', 'void main() => print("hello");')
-      ])
-    ]).create();
-
-    schedulePub(args: ["build", "--format", "json"],
-        outputJson: {
-          'buildResult': 'success',
-          'outputDirectory': 'build',
-          'numFiles': 1,
-          'log': [
-            {
-              'level': 'Info',
-              'transformer': {
-                'name': 'Dart2JS',
-                'primaryInput': {'package': 'myapp', 'path': 'web/main.dart'}
-              },
-              'assetId': {'package': 'myapp', 'path': 'web/main.dart'},
-              'message': 'Compiling myapp|web/main.dart...'
-            },
-            {
-              'level': 'Info',
-              'transformer': {
-                'name': 'Dart2JS',
-                'primaryInput': {'package': 'myapp', 'path': 'web/main.dart'}
-              },
-              'assetId': {'package': 'myapp', 'path': 'web/main.dart'},
-              'message': contains(r'to compile myapp|web/main.dart.')
-            },
-            {
-              'level': 'Fine',
-              'transformer': {
-                'name': 'Dart2JS',
-                'primaryInput': {'package': 'myapp', 'path': 'web/main.dart'}
-              },
-              'assetId': {'package': 'myapp', 'path': 'web/main.dart'},
-              'message': contains(r'Took')
-            }
-          ]
-        });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/build/preserves_htaccess_test.dart b/sdk/lib/_internal/pub/test/build/preserves_htaccess_test.dart
deleted file mode 100644
index 7ed6754..0000000
--- a/sdk/lib/_internal/pub/test/build/preserves_htaccess_test.dart
+++ /dev/null
@@ -1,32 +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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  integration("preserves .htaccess as a special case", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir('web', [
-        d.file('.htaccess', 'fblthp'),
-        d.file('.hidden', 'asdfgh')
-      ])
-    ]).create();
-
-    schedulePub(args: ["build"],
-        output: new RegExp(r'Built \d+ files? to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('web', [
-          d.file('.htaccess', 'fblthp'),
-          d.nothing('.hidden')
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/build/utils.dart b/sdk/lib/_internal/pub/test/build/utils.dart
deleted file mode 100644
index 6f3df99..0000000
--- a/sdk/lib/_internal/pub/test/build/utils.dart
+++ /dev/null
@@ -1,44 +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:convert';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-/// Runs the hosted test server and serves a valid "browser" package that
-/// contains the same files (but not their contents) as the real browser
-/// package.
-void serveBrowserPackage() {
-  serve([
-    d.dir('api', [
-      d.dir('packages', [
-        d.file('browser', JSON.encode({
-          'versions': [packageVersionApiMap(packageMap('browser', '1.0.0'))]
-        })),
-        d.dir('browser', [
-          d.dir('versions', [
-            d.file('1.0.0', JSON.encode(
-                packageVersionApiMap(
-                    packageMap('browser', '1.0.0'),
-                    full: true)))
-          ])
-        ])
-      ])
-    ]),
-    d.dir('packages', [
-      d.dir('browser', [
-        d.dir('versions', [
-          d.tar('1.0.0.tar.gz', [
-            d.file('pubspec.yaml', yaml(packageMap("browser", "1.0.0"))),
-            d.dir('lib', [
-              d.file('dart.js', 'contents of dart.js'),
-              d.file('interop.js', 'contents of interop.js')
-            ])
-          ])
-        ])
-      ])
-    ])
-  ]);
-}
diff --git a/sdk/lib/_internal/pub/test/cache/add/adds_latest_matching_version_test.dart b/sdk/lib/_internal/pub/test/cache/add/adds_latest_matching_version_test.dart
deleted file mode 100644
index f602a31..0000000
--- a/sdk/lib/_internal/pub/test/cache/add/adds_latest_matching_version_test.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('adds the latest version of the package matching the '
-              'version constraint', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.2");
-      builder.serve("foo", "1.2.3");
-      builder.serve("foo", "2.0.0-dev");
-      builder.serve("foo", "2.0.0");
-    });
-
-    schedulePub(args: ["cache", "add", "foo", "-v", ">=1.0.0 <2.0.0"],
-        output: 'Downloading foo 1.2.3...');
-
-    d.cacheDir({"foo": "1.2.3"}).validate();
-    d.hostedCache([
-      d.nothing("foo-1.2.2"),
-      d.nothing("foo-2.0.0-dev"),
-      d.nothing("foo-2.0.0")
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/add/adds_latest_version_test.dart b/sdk/lib/_internal/pub/test/cache/add/adds_latest_version_test.dart
deleted file mode 100644
index a938576..0000000
--- a/sdk/lib/_internal/pub/test/cache/add/adds_latest_version_test.dart
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('adds the latest stable version of the package', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.2");
-      builder.serve("foo", "1.2.3");
-      builder.serve("foo", "1.2.4-dev");
-    });
-
-    schedulePub(args: ["cache", "add", "foo"],
-        output: 'Downloading foo 1.2.3...');
-
-    d.cacheDir({"foo": "1.2.3"}).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/add/all_adds_all_matching_versions_test.dart b/sdk/lib/_internal/pub/test/cache/add/all_adds_all_matching_versions_test.dart
deleted file mode 100644
index 79b8555..0000000
--- a/sdk/lib/_internal/pub/test/cache/add/all_adds_all_matching_versions_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('"--all" adds all matching versions of the package', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.2");
-      builder.serve("foo", "1.2.3-dev");
-      builder.serve("foo", "1.2.3");
-      builder.serve("foo", "2.0.0");
-    });
-
-    schedulePub(args: ["cache", "add", "foo", "-v", ">=1.0.0 <2.0.0", "--all"],
-        output: '''
-          Downloading foo 1.2.2...
-          Downloading foo 1.2.3-dev...
-          Downloading foo 1.2.3...''');
-
-    d.cacheDir({"foo": "1.2.2"}).validate();
-    d.cacheDir({"foo": "1.2.3-dev"}).validate();
-    d.cacheDir({"foo": "1.2.3"}).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/add/all_with_some_versions_present_test.dart b/sdk/lib/_internal/pub/test/cache/add/all_with_some_versions_present_test.dart
deleted file mode 100644
index 3faa1c5..0000000
--- a/sdk/lib/_internal/pub/test/cache/add/all_with_some_versions_present_test.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('"--all" adds all non-installed versions of the package', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.1");
-      builder.serve("foo", "1.2.2");
-      builder.serve("foo", "1.2.3");
-      builder.serve("foo", "2.0.0");
-    });
-
-    // Install a couple of versions first.
-    schedulePub(args: ["cache", "add", "foo", "-v", "1.2.1"],
-        output: 'Downloading foo 1.2.1...');
-
-    schedulePub(args: ["cache", "add", "foo", "-v", "1.2.3"],
-        output: 'Downloading foo 1.2.3...');
-
-    // They should show up as already installed now.
-    schedulePub(args: ["cache", "add", "foo", "--all"],
-        output: '''
-          Already cached foo 1.2.1.
-          Downloading foo 1.2.2...
-          Already cached foo 1.2.3.
-          Downloading foo 2.0.0...''');
-
-    d.cacheDir({"foo": "1.2.1"}).validate();
-    d.cacheDir({"foo": "1.2.2"}).validate();
-    d.cacheDir({"foo": "1.2.3"}).validate();
-    d.cacheDir({"foo": "2.0.0"}).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/add/already_cached_test.dart b/sdk/lib/_internal/pub/test/cache/add/already_cached_test.dart
deleted file mode 100644
index f6aaa92..0000000
--- a/sdk/lib/_internal/pub/test/cache/add/already_cached_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('does nothing if the package is already cached', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.3");
-    });
-
-    // Run once to put it in the cache.
-    schedulePub(args: ["cache", "add", "foo"],
-        output: 'Downloading foo 1.2.3...');
-
-    // Should be in the cache now.
-    schedulePub(args: ["cache", "add", "foo"],
-        output: 'Already cached foo 1.2.3.');
-
-    d.cacheDir({"foo": "1.2.3"}).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/add/bad_version_test.dart b/sdk/lib/_internal/pub/test/cache/add/bad_version_test.dart
deleted file mode 100644
index c0df5aa..0000000
--- a/sdk/lib/_internal/pub/test/cache/add/bad_version_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('fails if the version constraint cannot be parsed', () {
-    schedulePub(args: ["cache", "add", "foo", "-v", "1.0"],
-        error: """
-            Could not parse version "1.0". Unknown text at "1.0".
-            
-            Usage: pub cache add <package> [--version <constraint>] [--all]
-            -h, --help       Print this usage information.
-                --all        Install all matching versions.
-            -v, --version    Version constraint.
-
-            Run "pub help" to see global options.
-            See http://dartlang.org/tools/pub/cmd/pub-cache.html for detailed documentation.
-            """,
-        exitCode: exit_codes.USAGE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/add/missing_package_arg_test.dart b/sdk/lib/_internal/pub/test/cache/add/missing_package_arg_test.dart
deleted file mode 100644
index 4229af7..0000000
--- a/sdk/lib/_internal/pub/test/cache/add/missing_package_arg_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('fails if no package was given', () {
-    schedulePub(args: ["cache", "add"],
-        error: """
-            No package to add given.
-            
-            Usage: pub cache add <package> [--version <constraint>] [--all]
-            -h, --help       Print this usage information.
-                --all        Install all matching versions.
-            -v, --version    Version constraint.
-
-            Run "pub help" to see global options.
-            See http://dartlang.org/tools/pub/cmd/pub-cache.html for detailed documentation.
-            """,
-        exitCode: exit_codes.USAGE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/add/no_matching_version_test.dart b/sdk/lib/_internal/pub/test/cache/add/no_matching_version_test.dart
deleted file mode 100644
index 53fd3c5..0000000
--- a/sdk/lib/_internal/pub/test/cache/add/no_matching_version_test.dart
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('fails if no version matches the version constraint', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.2");
-      builder.serve("foo", "1.2.3");
-    });
-
-    schedulePub(args: ["cache", "add", "foo", "-v", ">2.0.0"],
-        error: 'Package foo has no versions that match >2.0.0.',
-        exitCode: 1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/add/package_not_found_test.dart b/sdk/lib/_internal/pub/test/cache/add/package_not_found_test.dart
deleted file mode 100644
index 1ee9daf..0000000
--- a/sdk/lib/_internal/pub/test/cache/add/package_not_found_test.dart
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('fails if the package cound not be found on the source', () {
-    serveNoPackages();
-
-    schedulePub(args: ["cache", "add", "foo"],
-        error: new RegExp(r"Could not find package foo at http://.*"),
-        exitCode: exit_codes.UNAVAILABLE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/add/unexpected_arguments_test.dart b/sdk/lib/_internal/pub/test/cache/add/unexpected_arguments_test.dart
deleted file mode 100644
index 0dec65a..0000000
--- a/sdk/lib/_internal/pub/test/cache/add/unexpected_arguments_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('fails if there are extra arguments', () {
-    schedulePub(args: ["cache", "add", "foo", "bar", "baz"],
-        error: """
-            Unexpected arguments "bar" and "baz".
-            
-            Usage: pub cache add <package> [--version <constraint>] [--all]
-            -h, --help       Print this usage information.
-                --all        Install all matching versions.
-            -v, --version    Version constraint.
-
-            Run "pub help" to see global options.
-            See http://dartlang.org/tools/pub/cmd/pub-cache.html for detailed documentation.
-            """,
-        exitCode: exit_codes.USAGE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/list_test.dart b/sdk/lib/_internal/pub/test/cache/list_test.dart
deleted file mode 100644
index 3a7bb8e..0000000
--- a/sdk/lib/_internal/pub/test/cache/list_test.dart
+++ /dev/null
@@ -1,79 +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 pub_cache_test;
-
-import 'package:path/path.dart' as path;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  hostedDir(package) {
-    return path.join(sandboxDir, cachePath, "hosted",
-        "pub.dartlang.org", package);
-  }
-
-  integration('running pub cache list when there is no cache', () {
-    schedulePub(args: ['cache', 'list'], output: '{"packages":{}}');
-  });
-
-  integration('running pub cache list on empty cache', () {
-    // Set up a cache.
-    d.dir(cachePath, [
-      d.dir('hosted', [
-         d.dir('pub.dartlang.org', [
-        ])
-      ])
-    ]).create();
-
-    schedulePub(args: ['cache', 'list'], outputJson: {"packages":{}});
-  });
-
-  integration('running pub cache list', () {
-    // Set up a cache.
-    d.dir(cachePath, [
-      d.dir('hosted', [
-         d.dir('pub.dartlang.org', [
-          d.dir("foo-1.2.3", [
-            d.libPubspec("foo", "1.2.3"),
-            d.libDir("foo")
-          ]),
-          d.dir("bar-2.0.0", [
-            d.libPubspec("bar", "2.0.0"),
-            d.libDir("bar") ])
-        ])
-      ])
-    ]).create();
-
-    schedulePub(args: ['cache', 'list'], outputJson: {
-      "packages": {
-        "bar": {"2.0.0": {"location": hostedDir('bar-2.0.0')}},
-        "foo": {"1.2.3": {"location": hostedDir('foo-1.2.3')}}
-      }
-    });
-  });
-
-  integration('includes packages containing deps with bad sources', () {
-    // Set up a cache.
-    d.dir(cachePath, [
-      d.dir('hosted', [
-         d.dir('pub.dartlang.org', [
-          d.dir("foo-1.2.3", [
-            d.libPubspec("foo", "1.2.3", deps: { "bar": {"bad": "bar"}}),
-            d.libDir("foo")
-          ])
-        ])
-      ])
-    ]).create();
-
-    schedulePub(args: ['cache', 'list'], outputJson: {
-      "packages": {
-        "foo": {"1.2.3": {"location": hostedDir('foo-1.2.3')}}
-      }
-    });
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/cache/repair/empty_cache_test.dart b/sdk/lib/_internal/pub/test/cache/repair/empty_cache_test.dart
deleted file mode 100644
index 9f398b7..0000000
--- a/sdk/lib/_internal/pub/test/cache/repair/empty_cache_test.dart
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('does nothing if the cache is empty', () {
-    // Repair them.
-    schedulePub(args: ["cache", "repair"],
-        output: "No packages in cache, so nothing to repair.");
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/repair/handles_corrupted_binstub_test.dart b/sdk/lib/_internal/pub/test/cache/repair/handles_corrupted_binstub_test.dart
deleted file mode 100644
index 5af3b47..0000000
--- a/sdk/lib/_internal/pub/test/cache/repair/handles_corrupted_binstub_test.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'dart:io';
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('handles a corrupted binstub script', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", contents: [
-        d.dir("bin", [
-          d.file("script.dart", "main(args) => print('ok');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    d.dir(cachePath, [
-      d.dir('bin', [
-        d.file(binStubName('script'), 'junk')
-      ])
-    ]).create();
-
-    schedulePub(args: ["cache", "repair"],
-        error: contains('Error reading binstub for "script":'));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/repair/handles_corrupted_global_lockfile_test.dart b/sdk/lib/_internal/pub/test/cache/repair/handles_corrupted_global_lockfile_test.dart
deleted file mode 100644
index 098f602..0000000
--- a/sdk/lib/_internal/pub/test/cache/repair/handles_corrupted_global_lockfile_test.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('handles a corrupted global lockfile', () {
-    d.dir(cachePath, [
-      d.dir('global_packages/foo', [
-        d.file('pubspec.lock', 'junk')
-      ])
-    ]).create();
-
-    schedulePub(args: ["cache", "repair"],
-        error: contains('Failed to reactivate foo:'),
-        output: contains('Failed to reactivate 1 package.'));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/repair/handles_failure_test.dart b/sdk/lib/_internal/pub/test/cache/repair/handles_failure_test.dart
deleted file mode 100644
index 6f9e009..0000000
--- a/sdk/lib/_internal/pub/test/cache/repair/handles_failure_test.dart
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('handles failure to reinstall some packages', () {
-    // Only serve two packages so repairing will have a failure.
-    servePackages((builder) {
-      builder.serve("foo", "1.2.3");
-      builder.serve("foo", "1.2.5");
-    });
-
-    // Set up a cache with some packages.
-    d.dir(cachePath, [
-      d.dir('hosted', [
-        d.async(port.then((p) => d.dir('localhost%58$p', [
-          d.dir("foo-1.2.3", [
-            d.libPubspec("foo", "1.2.3"),
-            d.file("broken.txt")
-          ]),
-          d.dir("foo-1.2.4", [
-            d.libPubspec("foo", "1.2.4"),
-            d.file("broken.txt")
-          ]),
-          d.dir("foo-1.2.5", [
-            d.libPubspec("foo", "1.2.5"),
-            d.file("broken.txt")
-          ])
-        ])))
-      ])
-    ]).create();
-
-    // Repair them.
-    var pub = startPub(args: ["cache", "repair"]);
-
-    pub.stdout.expect("Downloading foo 1.2.3...");
-    pub.stdout.expect("Downloading foo 1.2.4...");
-    pub.stdout.expect("Downloading foo 1.2.5...");
-
-    pub.stderr.expect(startsWith("Failed to repair foo 1.2.4. Error:"));
-    pub.stderr.expect("HTTP error 404: Not Found");
-
-    pub.stdout.expect("Reinstalled 2 packages.");
-    pub.stdout.expect("Failed to reinstall 1 package.");
-
-    pub.shouldExit(exit_codes.UNAVAILABLE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/repair/handles_orphaned_binstub_test.dart b/sdk/lib/_internal/pub/test/cache/repair/handles_orphaned_binstub_test.dart
deleted file mode 100644
index af6fd33..0000000
--- a/sdk/lib/_internal/pub/test/cache/repair/handles_orphaned_binstub_test.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-const _ORPHANED_BINSTUB = """
-#!/usr/bin/env sh
-# This file was created by pub v0.1.2-3.
-# Package: foo
-# Version: 1.0.0
-# Executable: foo-script
-# Script: script
-dart "/path/to/.pub-cache/global_packages/foo/bin/script.dart.snapshot" "\$@"
-""";
-
-main() {
-  initConfig();
-  integration('handles an orphaned binstub script', () {
-    d.dir(cachePath, [
-      d.dir('bin', [
-        d.file(binStubName('script'), _ORPHANED_BINSTUB)
-      ])
-    ]).create();
-
-    schedulePub(args: ["cache", "repair"], error: allOf([
-      contains('Binstubs exist for non-activated packages:'),
-      contains('From foo: foo-script')
-    ]));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/repair/recompiles_snapshots_test.dart b/sdk/lib/_internal/pub/test/cache/repair/recompiles_snapshots_test.dart
deleted file mode 100644
index feb9f39..0000000
--- a/sdk/lib/_internal/pub/test/cache/repair/recompiles_snapshots_test.dart
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('recompiles activated executable snapshots', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", contents: [
-        d.dir("bin", [
-          d.file("script.dart", "main(args) => print('ok');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    d.dir(cachePath, [
-      d.dir('global_packages/foo/bin', [
-        d.file('script.dart.snapshot', 'junk')
-      ])
-    ]).create();
-
-    schedulePub(args: ["cache", "repair"],
-        output: '''
-          Downloading foo 1.0.0...
-          Reinstalled 1 package.
-          Reactivating foo 1.0.0...
-          Precompiling executables...
-          Loading source assets...
-          Precompiled foo:script.
-          Reactivated 1 package.''');
-
-    var pub = pubRun(global: true, args: ["foo:script"]);
-    pub.stdout.expect("ok");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/repair/reinstalls_git_packages_test.dart b/sdk/lib/_internal/pub/test/cache/repair/reinstalls_git_packages_test.dart
deleted file mode 100644
index 138cd04..0000000
--- a/sdk/lib/_internal/pub/test/cache/repair/reinstalls_git_packages_test.dart
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/io.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('reinstalls previously cached git packages', () {
-    // Create two cached revisions of foo.
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.0')
-    ]).create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-    pubGet();
-
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.1')
-    ]).commit();
-
-    pubUpgrade();
-
-    // Break them.
-    var fooDirs;
-    schedule(() {
-      // Find the cached foo packages for each revision.
-      var gitCacheDir = path.join(sandboxDir, cachePath, "git");
-      fooDirs = listDir(gitCacheDir)
-          .where((dir) => path.basename(dir).startsWith("foo-")).toList();
-
-      // Delete "foo.dart" from them.
-      for (var dir in fooDirs) {
-        deleteEntry(path.join(dir, "lib", "foo.dart"));
-      }
-    });
-
-    // Repair them.
-    schedulePub(args: ["cache", "repair"],
-        output: '''
-          Resetting Git repository for foo 1.0.0...
-          Resetting Git repository for foo 1.0.1...
-          Reinstalled 2 packages.''');
-
-    // The missing libraries should have been replaced.
-    schedule(() {
-      var fooLibs = fooDirs.map((dir) {
-        var fooDirName = path.basename(dir);
-        return d.dir(fooDirName, [
-          d.dir("lib", [d.file("foo.dart", 'main() => "foo";')])
-        ]);
-      }).toList();
-
-      d.dir(cachePath, [
-        d.dir("git", fooLibs)
-      ]).validate();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/repair/reinstalls_hosted_packages_test.dart b/sdk/lib/_internal/pub/test/cache/repair/reinstalls_hosted_packages_test.dart
deleted file mode 100644
index cb81320..0000000
--- a/sdk/lib/_internal/pub/test/cache/repair/reinstalls_hosted_packages_test.dart
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('reinstalls previously cached hosted packages', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.3");
-      builder.serve("foo", "1.2.4");
-      builder.serve("foo", "1.2.5");
-      builder.serve("bar", "1.2.3");
-      builder.serve("bar", "1.2.4");
-    });
-
-    // Set up a cache with some broken packages.
-    d.dir(cachePath, [
-      d.dir('hosted', [
-        d.async(port.then((p) => d.dir('localhost%58$p', [
-          d.dir("foo-1.2.3", [
-            d.libPubspec("foo", "1.2.3"),
-            d.file("broken.txt")
-          ]),
-          d.dir("foo-1.2.5", [
-            d.libPubspec("foo", "1.2.5"),
-            d.file("broken.txt")
-          ]),
-          d.dir("bar-1.2.4", [
-            d.libPubspec("bar", "1.2.4"),
-            d.file("broken.txt")
-          ])
-        ])))
-      ])
-    ]).create();
-
-    // Repair them.
-    schedulePub(args: ["cache", "repair"],
-        output: '''
-          Downloading bar 1.2.4...
-          Downloading foo 1.2.3...
-          Downloading foo 1.2.5...
-          Reinstalled 3 packages.''');
-
-    // The broken versions should have been replaced.
-    d.hostedCache([
-      d.dir("bar-1.2.4", [d.nothing("broken.txt")]),
-      d.dir("foo-1.2.3", [d.nothing("broken.txt")]),
-      d.dir("foo-1.2.5", [d.nothing("broken.txt")])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/cache/repair/updates_binstubs_test.dart b/sdk/lib/_internal/pub/test/cache/repair/updates_binstubs_test.dart
deleted file mode 100644
index e84f4e8..0000000
--- a/sdk/lib/_internal/pub/test/cache/repair/updates_binstubs_test.dart
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-const _OUTDATED_BINSTUB = """
-#!/usr/bin/env sh
-# This file was created by pub v0.1.2-3.
-# Package: foo
-# Version: 1.0.0
-# Executable: foo-script
-# Script: script
-dart "/path/to/.pub-cache/global_packages/foo/bin/script.dart.snapshot" "\$@"
-""";
-
-main() {
-  initConfig();
-  integration('updates an outdated binstub script', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", pubspec: {
-        "executables": {
-          "foo-script": "script"
-        }
-      }, contents: [
-        d.dir("bin", [
-          d.file("script.dart", "main(args) => print('ok \$args');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    d.dir(cachePath, [
-      d.dir('bin', [
-        d.file(binStubName('foo-script'), _OUTDATED_BINSTUB)
-      ])
-    ]).create();
-
-    // Repair them.
-    schedulePub(args: ["cache", "repair"],
-        output: '''
-          Downloading foo 1.0.0...
-          Reinstalled 1 package.
-          Reactivating foo 1.0.0...
-          Precompiling executables...
-          Loading source assets...
-          Precompiled foo:script.
-          Installed executable foo-script.
-          Reactivated 1 package.''');
-
-    // The broken versions should have been replaced.
-    d.dir(cachePath, [
-      d.dir('bin', [
-        // 253 is the VM's exit code upon seeing an out-of-date snapshot.
-        d.matcherFile(binStubName('foo-script'), contains('253'))
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/allows_import_in_dart_code_test.dart b/sdk/lib/_internal/pub/test/dart2js/allows_import_in_dart_code_test.dart
deleted file mode 100644
index cc6f4fa..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/allows_import_in_dart_code_test.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  integration("handles imports in the Dart code", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1"),
-      d.dir("lib", [
-        d.file("foo.dart", """
-library foo;
-foo() => 'footext';
-""")
-      ])
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      }),
-      d.dir("lib", [
-        d.file("lib.dart", """
-library lib;
-lib() => 'libtext';
-""")
-      ]),
-      d.dir("web", [
-        d.file("main.dart", """
-import 'package:foo/foo.dart';
-import 'package:myapp/lib.dart';
-void main() {
-  print(foo());
-  print(lib());
-}
-""")
-      ])
-    ]).create();
-
-    pubServe(shouldGetFirst: true);
-    requestShouldSucceed("main.dart.js", contains("footext"));
-    requestShouldSucceed("main.dart.js", contains("libtext"));
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/compiles_entrypoints_in_root_package_test.dart b/sdk/lib/_internal/pub/test/dart2js/compiles_entrypoints_in_root_package_test.dart
deleted file mode 100644
index f8207e6..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/compiles_entrypoints_in_root_package_test.dart
+++ /dev/null
@@ -1,77 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("compiles Dart entrypoints in root package to JS", () {
-    // Dart2js can take a long time to compile dart code, so we increase the
-    // timeout to cope with that.
-    currentSchedule.timeout *= 3;
-
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir('benchmark', [
-        d.file('file.dart', 'void main() => print("hello");'),
-        d.file('lib.dart', 'void foo() => print("hello");'),
-        d.dir('subdir', [
-          d.file('subfile.dart', 'void main() => print("ping");')
-        ])
-      ]),
-      d.dir('foo', [
-        d.file('file.dart', 'void main() => print("hello");'),
-        d.file('lib.dart', 'void foo() => print("hello");'),
-        d.dir('subdir', [
-          d.file('subfile.dart', 'void main() => print("ping");')
-        ])
-      ]),
-      d.dir('web', [
-        d.file('file.dart', 'void main() => print("hello");'),
-        d.file('lib.dart', 'void foo() => print("hello");'),
-        d.dir('subdir', [
-          d.file('subfile.dart', 'void main() => print("ping");')
-        ])
-      ])
-    ]).create();
-
-    schedulePub(args: ["build", "benchmark", "foo", "web"],
-        output: new RegExp(r'Built 6 files to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('benchmark', [
-          d.matcherFile('file.dart.js', isNot(isEmpty)),
-          d.nothing('file.dart'),
-          d.nothing('lib.dart'),
-          d.dir('subdir', [
-            d.matcherFile('subfile.dart.js', isNot(isEmpty)),
-            d.nothing('subfile.dart')
-          ])
-        ]),
-        d.dir('foo', [
-          d.matcherFile('file.dart.js', isNot(isEmpty)),
-          d.nothing('file.dart'),
-          d.nothing('lib.dart'),
-          d.dir('subdir', [
-            d.matcherFile('subfile.dart.js', isNot(isEmpty)),
-            d.nothing('subfile.dart')
-          ])
-        ]),
-        d.dir('web', [
-          d.matcherFile('file.dart.js', isNot(isEmpty)),
-          d.nothing('file.dart'),
-          d.nothing('lib.dart'),
-          d.dir('subdir', [
-            d.matcherFile('subfile.dart.js', isNot(isEmpty)),
-            d.nothing('subfile.dart')
-          ])
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/compiles_generated_dart_file_test.dart b/sdk/lib/_internal/pub/test/dart2js/compiles_generated_dart_file_test.dart
deleted file mode 100644
index 5254847..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/compiles_generated_dart_file_test.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("compiles a generated Dart file to JS", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "version": "0.0.1",
-          "transformers": ["myapp/transformer"]
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", dartTransformer("munge"))
-        ]),
-        d.dir("web", [
-          d.file("main.dart", """
-const TOKEN = "before";
-void main() => print(TOKEN);
-""")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("main.dart.js", contains("(before, munge)"));
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/compiles_generated_file_from_dependency_outside_web_test.dart b/sdk/lib/_internal/pub/test/dart2js/compiles_generated_file_from_dependency_outside_web_test.dart
deleted file mode 100644
index d64b533..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/compiles_generated_file_from_dependency_outside_web_test.dart
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  // This is a regression test for issue #17198.
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("compiles a Dart file that imports a generated file to JS "
-        "outside web/", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "version": "0.0.1",
-          "transformers": ["myapp/transformer"]
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", dartTransformer("munge"))
-        ]),
-        d.dir("test", [
-          d.file("main.dart", """
-import "other.dart";
-void main() => print(TOKEN);
-"""),
-          d.file("other.dart", """
-library other;
-const TOKEN = "before";
-""")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe(args: ["test"]);
-      requestShouldSucceed("main.dart.js", contains("(before, munge)"),
-          root: "test");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/compiles_generated_file_from_dependency_test.dart b/sdk/lib/_internal/pub/test/dart2js/compiles_generated_file_from_dependency_test.dart
deleted file mode 100644
index 34be15a..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/compiles_generated_file_from_dependency_test.dart
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("compiles a Dart file that imports a generated file in another "
-                "package to JS", () {
-      d.dir("foo", [
-        d.pubspec({
-          "name": "foo",
-          "version": "0.0.1",
-          "transformers": ["foo/transformer"]
-        }),
-        d.dir("lib", [
-          d.file("foo.dart", """
-library foo;
-const TOKEN = "before";
-foo() => TOKEN;
-"""),
-          d.file("transformer.dart", dartTransformer("munge"))
-        ])
-      ]).create();
-
-      d.dir(appPath, [
-        d.appPubspec({
-          "foo": {
-            "path": "../foo"
-          }
-        }),
-        d.dir("web", [
-          d.file("main.dart", """
-import "package:foo/foo.dart";
-main() => print(foo());
-""")
-        ])
-      ]).create();
-
-      createLockFile("myapp", sandbox: ["foo"], pkg: ["barback"]);
-
-      pubServe();
-      requestShouldSucceed("main.dart.js", contains("(before, munge)"));
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/compiles_imported_generated_file_test.dart b/sdk/lib/_internal/pub/test/dart2js/compiles_imported_generated_file_test.dart
deleted file mode 100644
index 3b76645..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/compiles_imported_generated_file_test.dart
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("compiles a Dart file that imports a generated file to JS", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "version": "0.0.1",
-          "transformers": ["myapp/transformer"]
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", dartTransformer("munge"))
-        ]),
-        d.dir("web", [
-          d.file("main.dart", """
-import "other.dart";
-void main() => print(TOKEN);
-"""),
-          d.file("other.dart", """
-library other;
-const TOKEN = "before";
-""")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("main.dart.js", contains("(before, munge)"));
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/converts_isolate_entrypoint_in_web_test.dart b/sdk/lib/_internal/pub/test/dart2js/converts_isolate_entrypoint_in_web_test.dart
deleted file mode 100644
index 8d908cb..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/converts_isolate_entrypoint_in_web_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  integration("converts a Dart isolate entrypoint in web to JS", () {
-    // Increase the timeout because dart2js takes a lot longer than usual to
-    // compile isolate entrypoints.
-    currentSchedule.timeout *= 2;
-
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("isolate.dart", "void main(List<String> args, SendPort "
-            "sendPort) => print('hello');")
-      ])
-    ]).create();
-
-    pubServe();
-    requestShouldSucceed("isolate.dart.js", contains("hello"));
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/does_not_compile_if_disabled_test.dart b/sdk/lib/_internal/pub/test/dart2js/does_not_compile_if_disabled_test.dart
deleted file mode 100644
index 2be40d6..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/does_not_compile_if_disabled_test.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  integration("does not compile if dart2js is disabled", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("main.dart", "void main() => print('hello');")
-      ])
-    ]).create();
-
-    pubServe(args: ["--no-dart2js"]);
-    requestShould404("main.dart.js");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/does_not_compile_until_its_output_is_requested_test.dart b/sdk/lib/_internal/pub/test/dart2js/does_not_compile_until_its_output_is_requested_test.dart
deleted file mode 100644
index b67b147..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/does_not_compile_until_its_output_is_requested_test.dart
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_stream.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  integration("does not compile until its output is requested", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "version": "0.0.1",
-      }),
-      d.dir("web", [
-        d.file("syntax-error.dart", "syntax error")
-      ])
-    ]).create();
-
-    var server = pubServe();
-    server.stdout.expect("Build completed successfully");
-
-    // Once we request the output, it should start compiling and fail.
-    requestShould404("syntax-error.dart.js");
-    server.stdout.expect(emitsLines(
-        "[Info from Dart2JS]:\n"
-        "Compiling myapp|web/syntax-error.dart..."));
-    server.stdout.expect(consumeThrough("Build completed with 1 errors."));
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/does_not_support_invalid_command_line_options_type_test.dart b/sdk/lib/_internal/pub/test/dart2js/does_not_support_invalid_command_line_options_type_test.dart
deleted file mode 100644
index cc69ed6..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/does_not_support_invalid_command_line_options_type_test.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  integration("doesn't support invalid commandLineOptions type", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "transformers": [{
-          "\$dart2js": {
-            "commandLineOptions": "foo",
-          }
-        }]
-      }),
-      d.dir("web", [d.file("main.dart", "void main() {}")])
-    ]).create();
-
-    var server = pubServe();
-    // Make a request first to trigger compilation.
-    requestShould404("main.dart.js");
-    server.stderr.expect(emitsLines(
-        'Build error:\n'
-        'Transform Dart2JS on myapp|web/main.dart threw error: '
-            'Invalid value for \$dart2js.commandLineOptions: '
-            '"foo" (expected list of strings).'));
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/does_not_support_invalid_environment_type_test.dart b/sdk/lib/_internal/pub/test/dart2js/does_not_support_invalid_environment_type_test.dart
deleted file mode 100644
index 27a62da..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/does_not_support_invalid_environment_type_test.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  integration("doesn't support invalid environment type", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "transformers": [{
-          "\$dart2js": {
-            "environment": "foo",
-          }
-        }]
-      }),
-      d.dir("web", [d.file("main.dart", "void main() {}")])
-    ]).create();
-
-    var server = pubServe();
-    // Make a request first to trigger compilation.
-    requestShould404("main.dart.js");
-    server.stderr.expect(emitsLines(
-        'Build error:\n'
-        'Transform Dart2JS on myapp|web/main.dart threw error: '
-            'Invalid value for \$dart2js.environment: "foo" '
-            '(expected map from strings to strings).'));
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/does_not_support_invalid_option_test.dart b/sdk/lib/_internal/pub/test/dart2js/does_not_support_invalid_option_test.dart
deleted file mode 100644
index 1d29919..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/does_not_support_invalid_option_test.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  integration("doesn't support an invalid dart2js option", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "transformers": [{
-          "\$dart2js": {"invalidOption": true}
-        }]
-      })
-    ]).create();
-
-    // TODO(nweiz): This should provide more context about how the option got
-    // passed to dart2js. See issue 16008.
-    var pub = startPubServe();
-    pub.stderr.expect('Unrecognized dart2js option "invalidOption".');
-    pub.shouldExit(exit_codes.DATA);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/doesnt_support_invalid_type_for_boolean_option_test.dart b/sdk/lib/_internal/pub/test/dart2js/doesnt_support_invalid_type_for_boolean_option_test.dart
deleted file mode 100644
index a357d4f..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/doesnt_support_invalid_type_for_boolean_option_test.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  integration("doesn't support invalid type for boolean option", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "transformers": [{
-          "\$dart2js": {
-            "checked": "foo",
-          }
-        }]
-      }),
-      d.dir("web", [d.file("main.dart", "void main() {}")])
-    ]).create();
-
-    var server = pubServe();
-    requestShould404("main.dart.js");
-    server.stderr.expect(emitsLines(
-        'Build error:\n'
-        'Transform Dart2JS on myapp|web/main.dart threw error: '
-            'Invalid value for \$dart2js.checked: "foo" '
-            '(expected true or false).'));
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/environment_constant_test.dart b/sdk/lib/_internal/pub/test/dart2js/environment_constant_test.dart
deleted file mode 100644
index dab1260..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/environment_constant_test.dart
+++ /dev/null
@@ -1,65 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../serve/utils.dart';
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  group("passes environment constants to dart2js", () {
-    setUp(() {
-      // Dart2js can take a long time to compile dart code, so we increase the
-      // timeout to cope with that.
-      currentSchedule.timeout *= 3;
-
-      d.dir(appPath, [
-        d.appPubspec(),
-        d.dir('web', [
-          d.file('file.dart',
-              'void main() => print(const String.fromEnvironment("name"));')
-        ])
-      ]).create();
-    });
-
-    integration('from "pub build"', () {
-      schedulePub(args: ["build", "--define", "name=fblthp"],
-          output: new RegExp(r'Built 1 file to "build".'));
-
-      d.dir(appPath, [
-        d.dir('build', [
-          d.dir('web', [
-            d.matcherFile('file.dart.js', contains('fblthp')),
-          ])
-        ])
-      ]).validate();
-    });
-
-    integration('from "pub serve"', () {
-      pubServe(args: ["--define", "name=fblthp"]);
-      requestShouldSucceed("file.dart.js", contains("fblthp"));
-      endPubServe();
-    });
-
-    integration('which takes precedence over the pubspec', () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {"\$dart2js": {"environment": {"name": "slartibartfast"}}}
-          ]
-        })
-      ]).create();
-
-      pubServe(args: ["--define", "name=fblthp"]);
-      requestShouldSucceed("file.dart.js", allOf([
-        contains("fblthp"),
-        isNot(contains("slartibartfast"))
-      ]));
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/ignores_entrypoint_in_dependency_test.dart b/sdk/lib/_internal/pub/test/dart2js/ignores_entrypoint_in_dependency_test.dart
deleted file mode 100644
index 0d7b02b..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/ignores_entrypoint_in_dependency_test.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  integration("ignores a Dart entrypoint in a dependency", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1"),
-      d.dir("lib", [
-        d.file("lib.dart", "main() => print('foo');")
-      ])
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      })
-    ]).create();
-
-    pubServe(shouldGetFirst: true);
-    requestShould404("web/packages/foo/lib.dart.js");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/ignores_entrypoints_in_lib_test.dart b/sdk/lib/_internal/pub/test/dart2js/ignores_entrypoints_in_lib_test.dart
deleted file mode 100644
index 73dda87..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/ignores_entrypoints_in_lib_test.dart
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  setUp(() {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir('lib', [
-        d.file('file.dart', 'void main() => print("hello");'),
-      ]),
-      d.dir('web', [
-        d.file('index.html', 'html'),
-      ])
-    ]).create();
-  });
-
-  integration("build ignores Dart entrypoints in lib", () {
-    schedulePub(args: ["build", "--all"],
-        output: new RegExp(r'Built 1 file to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.nothing('lib')
-      ])
-    ]).validate();
-  });
-
-  integration("serve ignores Dart entrypoints in lib", () {
-    pubServe();
-    requestShould404("packages/myapp/main.dart.js");
-    endPubServe();
-  });
-
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/ignores_non_entrypoint_dart_files_test.dart b/sdk/lib/_internal/pub/test/dart2js/ignores_non_entrypoint_dart_files_test.dart
deleted file mode 100644
index 6dc92cf..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/ignores_non_entrypoint_dart_files_test.dart
+++ /dev/null
@@ -1,45 +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 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  setUp(() {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir('web', [
-        d.file('file1.dart', 'var main = () => print("hello");'),
-        d.file('file2.dart', 'void main(arg1, arg2, arg3) => print("hello");'),
-        d.file('file3.dart', 'class Foo { void main() => print("hello"); }'),
-        d.file('file4.dart', 'var foo;')
-      ])
-    ]).create();
-  });
-
-  integration("build ignores non-entrypoint Dart files", () {
-    schedulePub(args: ["build"],
-        output: new RegExp(r'Built 0 files to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.nothing('web')
-      ])
-    ]).validate();
-  });
-
-  integration("serve ignores non-entrypoint Dart files", () {
-    pubServe();
-    requestShould404("file1.dart.js");
-    requestShould404("file2.dart.js");
-    requestShould404("file3.dart.js");
-    requestShould404("file4.dart.js");
-    endPubServe();
-  });
-
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/includes_source_maps_if_sourceMaps_true_test.dart b/sdk/lib/_internal/pub/test/dart2js/includes_source_maps_if_sourceMaps_true_test.dart
deleted file mode 100644
index 7efba1d..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/includes_source_maps_if_sourceMaps_true_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("includes source maps in a release build if sourceMaps true", () {
-    d.dir(appPath, [
-      d.pubspec({
-        'name': 'myapp',
-        'transformers': [{
-          '\$dart2js': {
-            'sourceMaps': true
-          }
-        }]
-      }),
-      d.dir("web", [
-        d.file("main.dart", "void main() => print('hello');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["build"],
-        output: new RegExp(r'Built \d+ files to "build".'),
-        exitCode: 0);
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('web', [
-          d.matcherFile('main.dart.js',
-              contains("# sourceMappingURL=main.dart.js.map")),
-          d.matcherFile('main.dart.js.map', contains('"file": "main.dart.js"'))
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/includes_source_maps_in_debug_test.dart b/sdk/lib/_internal/pub/test/dart2js/includes_source_maps_in_debug_test.dart
deleted file mode 100644
index 69ff7a1..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/includes_source_maps_in_debug_test.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("includes source map URLs in a debug build", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("main.dart", "void main() => print('hello');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["build", "--mode", "debug"],
-        output: new RegExp(r'Built \d+ files to "build".'),
-        exitCode: 0);
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('web', [
-          d.matcherFile('main.dart.js',
-              contains("# sourceMappingURL=main.dart.js.map")),
-          d.matcherFile('main.dart.js.map', contains('"file": "main.dart.js"'))
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/minifies_in_release_mode_test.dart b/sdk/lib/_internal/pub/test/dart2js/minifies_in_release_mode_test.dart
deleted file mode 100644
index b4694064..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/minifies_in_release_mode_test.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  integration("generates minified JS in release mode", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("main.dart", "void main() => print('hello');")
-      ])
-    ]).create();
-
-    pubServe(args: ["--mode", "release"]);
-    requestShouldSucceed("main.dart.js", isMinifiedDart2JSOutput);
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/minify_configuration_overrides_mode_test.dart b/sdk/lib/_internal/pub/test/dart2js/minify_configuration_overrides_mode_test.dart
deleted file mode 100644
index da0e6bc..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/minify_configuration_overrides_mode_test.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  integration("minify configuration overrides the mode", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "transformers": [{
-          "\$dart2js": {"minify": true}
-        }]
-      }),
-      d.dir("web", [
-        d.file("main.dart", "void main() => print('Hello!');")
-      ])
-    ]).create();
-
-    pubServe();
-    requestShouldSucceed("main.dart.js", isMinifiedDart2JSOutput);
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/omits_source_map_if_sourceMaps_false_test.dart b/sdk/lib/_internal/pub/test/dart2js/omits_source_map_if_sourceMaps_false_test.dart
deleted file mode 100644
index aaecf9b..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/omits_source_map_if_sourceMaps_false_test.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("omits source maps from a debug build if sourceMaps false", () {
-    d.dir(appPath, [
-      d.pubspec({
-        'name': 'myapp',
-        'transformers': [{
-          '\$dart2js': {
-            'sourceMaps': false
-          }
-        }]
-      }),
-      d.dir("web", [
-        d.file("main.dart", "void main() => print('hello');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["build", "--mode", "debug"],
-        output: new RegExp(r'Built \d+ files to "build".'),
-        exitCode: 0);
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('web', [
-          d.nothing('main.dart.js.map')
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/omits_source_map_in_release_test.dart b/sdk/lib/_internal/pub/test/dart2js/omits_source_map_in_release_test.dart
deleted file mode 100644
index f26611e..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/omits_source_map_in_release_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("omits source maps from a release build", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("main.dart", "void main() => print('hello');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["build"],
-        output: new RegExp(r'Built 1 file to "build".'),
-        exitCode: 0);
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('web', [
-          d.nothing('main.dart.js.map')
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/output_can_be_consumed_by_successive_phases.dart b/sdk/lib/_internal/pub/test/dart2js/output_can_be_consumed_by_successive_phases.dart
deleted file mode 100644
index 2c278c5..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/output_can_be_consumed_by_successive_phases.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-/// The code for a transformer that renames ".js" files to ".out".
-const JS_REWRITE_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class RewriteTransformer extends Transformer {
-  RewriteTransformer.asPlugin();
-
-  String get allowedExtensions => '.js';
-
-  Future apply(Transform transform) {
-    return transform.primaryInput.readAsString().then((contents) {
-      var id = transform.primaryInput.id.changeExtension(".out");
-      transform.addOutput(new Asset.fromString(id, contents));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("output can be consumed by successive phases", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["\$dart2js", "myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", JS_REWRITE_TRANSFORMER)
-        ])]),
-        d.dir("web", [d.file("main.dart", "void main() {}")])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("main.dart.out", isUnminifiedDart2JSOutput);
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/outputs_deferred_libraries_test.dart b/sdk/lib/_internal/pub/test/dart2js/outputs_deferred_libraries_test.dart
deleted file mode 100644
index 7a0f4ae..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/outputs_deferred_libraries_test.dart
+++ /dev/null
@@ -1,65 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const MAIN = """
-import 'dart:async';
-
-import 'a.dart' deferred as a;
-import 'b.dart' deferred as b;
-
-void main() {
-  Future.wait([lazyA.loadLibrary(), lazyB.loadLibrary()]).then((_) {
-    a.fn();
-    b.fn();
-  });
-}
-""";
-
-const A = """
-library a;
-
-fn() => print("a");
-""";
-
-const B = """
-library b;
-
-fn() => print("b");
-""";
-
-main() {
-  initConfig();
-  integration("compiles deferred libraries to separate outputs", () {
-    // Dart2js can take a long time to compile dart code, so we increase the
-    // timeout to cope with that.
-    currentSchedule.timeout *= 3;
-
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir('web', [
-        d.file('main.dart', MAIN),
-        d.file('a.dart', A),
-        d.file('b.dart', B)
-      ])
-    ]).create();
-
-    schedulePub(args: ["build"],
-        output: new RegExp(r'Built 3 files to "build".'));
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('web', [
-          d.matcherFile('main.dart.js', isNot(isEmpty)),
-          d.matcherFile('main.dart.js_1.part.js', isNot(isEmpty)),
-          d.matcherFile('main.dart.js_2.part.js', isNot(isEmpty)),
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/passes_along_environment_constants_test.dart b/sdk/lib/_internal/pub/test/dart2js/passes_along_environment_constants_test.dart
deleted file mode 100644
index e6d569d..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/passes_along_environment_constants_test.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  integration("passes along environment constants", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "transformers": [{
-          "\$dart2js": {"environment": {'CONSTANT': 'true'}}
-        }]
-      }),
-      d.dir("web", [
-        d.file("main.dart", """
-void main() {
-  if (const bool.fromEnvironment('CONSTANT')) {
-    print("hello");
-  }
-}
-""")
-      ])
-    ]).create();
-
-    pubServe();
-    requestShouldSucceed("main.dart.js", contains("hello"));
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/reports_dart_parse_errors_test.dart b/sdk/lib/_internal/pub/test/dart2js/reports_dart_parse_errors_test.dart
deleted file mode 100644
index 0821b86..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/reports_dart_parse_errors_test.dart
+++ /dev/null
@@ -1,59 +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 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("reports Dart parse errors", () {
-    // Dart2js can take a long time to compile dart code, so we increase the
-    // timeout to cope with that.
-    currentSchedule.timeout *= 3;
-
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir('web', [
-        d.file('file.txt', 'contents'),
-        d.file('file.dart', 'void void;'),
-        d.dir('subdir', [
-          d.file('subfile.dart', 'void void;')
-        ])
-      ])
-    ]).create();
-
-    var pub = startPub(args: ["build"]);
-    pub.stdout.expect(startsWith("Loading source assets..."));
-    pub.stdout.expect(startsWith("Building myapp..."));
-
-    var consumeFile = consumeThrough(inOrder([
-      "[Error from Dart2JS]:",
-      startsWith(p.join("web", "file.dart") + ":")
-    ]));
-    var consumeSubfile = consumeThrough(inOrder([
-      "[Error from Dart2JS]:",
-      startsWith(p.join("web", "subdir", "subfile.dart") + ":")
-    ]));
-
-    // It's nondeterministic what order the dart2js transformers start running,
-    // so we allow the error messages to be emitted in either order.
-    pub.stderr.expect(either(
-        inOrder([consumeFile, consumeSubfile]),
-        inOrder([consumeSubfile, consumeFile])));
-
-    pub.shouldExit(exit_codes.DATA);
-
-    // Doesn't output anything if an error occurred.
-    d.dir(appPath, [
-      d.dir('build', [
-        d.nothing('web')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/source_maps_include_core_libs_in_subdirectory_test.dart b/sdk/lib/_internal/pub/test/dart2js/source_maps_include_core_libs_in_subdirectory_test.dart
deleted file mode 100644
index cedb073..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/source_maps_include_core_libs_in_subdirectory_test.dart
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../serve/utils.dart';
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  // This test is a bit shaky. Since dart2js is free to inline things, it's
-  // not precise as to which source libraries will actually be referenced in
-  // the source map. But this tries to use a type in the core library
-  // (Duration) and validate that its source ends up in the source map.
-  integration("Dart core libraries are available to source maps when the "
-      "build directory is a subdirectory", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.dir("sub", [
-          d.file("main.dart", "main() => new Duration().toString();")
-        ])
-      ])
-    ]).create();
-
-    var webSub = path.join("web", "sub");
-    pubServe(args: [webSub]);
-
-    requestShouldSucceed("main.dart.js.map",
-        contains(r"packages/$sdk/lib/core/duration.dart"),
-        root: webSub);
-    requestShouldSucceed(r"packages/$sdk/lib/core/duration.dart",
-        contains("class Duration"),
-        root: webSub);
-
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/source_maps_include_core_libs_test.dart b/sdk/lib/_internal/pub/test/dart2js/source_maps_include_core_libs_test.dart
deleted file mode 100644
index 6af59c6..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/source_maps_include_core_libs_test.dart
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  // This test is a bit shaky. Since dart2js is free to inline things, it's
-  // not precise as to which source libraries will actually be referenced in
-  // the source map. But this tries to use a type in the core library
-  // (Duration) and validate that its source ends up in the source map.
-  integration("Dart core libraries are available to source maps", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("main.dart", "main() => new Duration().toString();"),
-        d.dir("sub", [
-          d.file("main.dart", "main() => new Duration().toString();")
-        ])
-      ])
-    ]).create();
-
-    schedulePub(args: ["build", "--mode", "debug"],
-        output: new RegExp(r'Built \d+ files to "build".'),
-        exitCode: 0);
-
-    d.dir(appPath, [
-      d.dir("build", [
-        d.dir("web", [
-          d.matcherFile("main.dart.js.map",
-              contains(r"packages/$sdk/lib/core/duration.dart")),
-          d.dir("sub", [
-            d.matcherFile("main.dart.js.map",
-                contains(r"../packages/$sdk/lib/core/duration.dart"))
-          ]),
-          d.dir("packages", [
-            d.dir(r"$sdk", [
-              d.dir("lib", [
-                d.dir(r"core", [
-                  d.matcherFile("duration.dart",
-                      contains("class Duration"))
-                ])
-              ])
-            ])
-          ])
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/supports_configuration_with_build_test.dart b/sdk/lib/_internal/pub/test/dart2js/supports_configuration_with_build_test.dart
deleted file mode 100644
index 9650192..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/supports_configuration_with_build_test.dart
+++ /dev/null
@@ -1,88 +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:convert';
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("compiles dart.js and interop.js next to entrypoints when "
-              "dartjs is explicitly configured", () {
-    // Dart2js can take a long time to compile dart code, so we increase the
-    // timeout to cope with that.
-    currentSchedule.timeout *= 3;
-
-    serve([
-      d.dir('api', [
-        d.dir('packages', [
-          d.file('browser', JSON.encode({
-            'versions': [packageVersionApiMap(packageMap('browser', '1.0.0'))]
-          })),
-          d.dir('browser', [
-            d.dir('versions', [
-              d.file('1.0.0', JSON.encode(
-                  packageVersionApiMap(
-                      packageMap('browser', '1.0.0'),
-                      full: true)))
-            ])
-          ])
-        ])
-      ]),
-      d.dir('packages', [
-        d.dir('browser', [
-          d.dir('versions', [
-            d.tar('1.0.0.tar.gz', [
-              d.file('pubspec.yaml', yaml(packageMap("browser", "1.0.0"))),
-              d.dir('lib', [
-                d.file('dart.js', 'contents of dart.js'),
-                d.file('interop.js', 'contents of interop.js')
-              ])
-            ])
-          ])
-        ])
-      ])
-    ]);
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {
-          "browser": "1.0.0"
-        },
-        "transformers": [{
-          "\$dart2js": {
-            "minify": true
-          }
-        }]
-      }),
-      d.dir('web', [
-        d.file('file.dart', 'void main() => print("hello");'),
-      ])
-    ]).create();
-
-    pubGet();
-
-    schedulePub(args: ["build"],
-        output: new RegExp(r'Built 3 files to "build".'),
-        exitCode: 0);
-
-    d.dir(appPath, [
-      d.dir('build', [
-        d.dir('web', [
-          d.matcherFile('file.dart.js', isMinifiedDart2JSOutput),
-          d.dir('packages', [
-            d.dir('browser', [
-              d.file('dart.js', 'contents of dart.js'),
-              d.file('interop.js', 'contents of interop.js')
-            ])
-          ]),
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/supports_valid_options_test.dart b/sdk/lib/_internal/pub/test/dart2js/supports_valid_options_test.dart
deleted file mode 100644
index 2cd9deb..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/supports_valid_options_test.dart
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  integration("supports most dart2js command-line options", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "transformers": [{
-          "\$dart2js": {
-            "commandLineOptions": ["--enable-diagnostic-colors"],
-            "checked": true,
-            "csp": true,
-            "minify": true,
-            "verbose": true,
-            "environment": {"name": "value"},
-            "suppressWarnings": true,
-            "suppressHints": true,
-            "suppressPackageWarnings": false,
-            "terse": true,
-            "sourceMaps": false
-          }
-        }]
-      }),
-      d.dir("web", [
-        d.file("main.dart", "void main() => print('Hello!');")
-      ])
-    ]).create();
-
-    // None of these options should be rejected, either by pub or by dart2js.
-    pubServe();
-    requestShouldSucceed("main.dart.js", isNot(isEmpty));
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dart2js/unminified_in_nonrelease_mode_test.dart b/sdk/lib/_internal/pub/test/dart2js/unminified_in_nonrelease_mode_test.dart
deleted file mode 100644
index 3171bdd..0000000
--- a/sdk/lib/_internal/pub/test/dart2js/unminified_in_nonrelease_mode_test.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  integration("generates unminified JS when not in release mode", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("main.dart", "void main() => print('hello');")
-      ])
-    ]).create();
-
-    pubServe(args: ["--mode", "whatever"]);
-    requestShouldSucceed("main.dart.js", isUnminifiedDart2JSOutput);
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dependency_computer/conservative_dependencies_test.dart b/sdk/lib/_internal/pub/test/dependency_computer/conservative_dependencies_test.dart
deleted file mode 100644
index 19118a6..0000000
--- a/sdk/lib/_internal/pub/test/dependency_computer/conservative_dependencies_test.dart
+++ /dev/null
@@ -1,466 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-void main() {
-  initConfig();
-
-  integration("reports previous transformers as dependencies if the "
-      "transformer is transformed", () {
-    // The root app just exists so that something is transformed by pkg and qux.
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "version": "1.0.0",
-        "dependencies": {
-          "pkg": {"path": "../pkg"},
-          "qux": {"path": "../qux"}
-        },
-        "transformers": ["pkg", "qux"]
-      })
-    ]).create();
-
-    d.dir("pkg", [
-      d.pubspec({
-        "name": "pkg",
-        "version": "1.0.0",
-        "dependencies": {
-          "foo": {"path": "../foo"},
-          "bar": {"path": "../bar"},
-          "baz": {"path": "../baz"},
-        },
-        "transformers": [
-          {"foo": {"\$include": "lib/pkg.dart"}},
-          {"bar": {"\$exclude": "lib/transformer.dart"}},
-          "baz"
-        ]
-      }),
-      d.dir("lib", [
-        d.file("pkg.dart", ""),
-        d.file("transformer.dart", transformer())
-      ])
-    ]).create();
-
-    // Even though foo and bar don't modify pkg/lib/transformer.dart themselves,
-    // it may be modified to import a library that they modify or generate, so
-    // pkg will depend on them.
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("lib", [d.file("foo.dart", transformer())])
-    ]).create();
-
-    d.dir("bar", [
-      d.libPubspec("bar", "1.0.0"),
-      d.dir("lib", [d.file("bar.dart", transformer())])
-    ]).create();
-
-    // baz transforms pkg/lib/transformer.dart, so pkg will obviously
-    // depend on it.
-    d.dir("baz", [
-      d.libPubspec("baz", "1.0.0"),
-      d.dir("lib", [d.file("baz.dart", transformer())])
-    ]).create();
-
-    // qux doesn't transform anything in pkg, so pkg won't depend on it.
-    d.dir("qux", [
-      d.libPubspec("qux", "1.0.0"),
-      d.dir("lib", [d.file("qux.dart", transformer())])
-    ]).create();
-
-    expectDependencies({
-      'pkg': ['foo', 'bar', 'baz'], 'foo': [], 'bar': [], 'baz': [], 'qux': []
-    });
-  });
-
-  integration("reports all transitive package dependencies' transformers as "
-      "dependencies if the transformer is transformed", () {
-    // The root app just exists so that something is transformed by pkg and qux.
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {
-          "pkg": {"path": "../pkg"},
-          "qux": {"path": "../qux"}
-        },
-        "transformers": ["pkg"]
-      })
-    ]).create();
-
-    d.dir("pkg", [
-      d.pubspec({
-        "name": "pkg",
-        "version": "1.0.0",
-        "dependencies": {
-          "foo": {"path": "../foo"},
-          "baz": {"path": "../baz"}
-        },
-        "transformers": ["baz"]
-      }),
-      d.dir("lib", [d.file("pkg.dart", transformer())])
-    ]).create();
-
-    // pkg depends on foo. Even though it's not transformed by foo, its
-    // transformed transformer could import foo, so it has to depend on foo.
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "version": "1.0.0",
-        "dependencies": {"bar": {"path": "../bar"}},
-        "transformers": ["foo"]
-      }),
-      d.dir("lib", [d.file("foo.dart", transformer())])
-    ]).create();
-
-    // foo depends on bar, and like pkg's dependency on foo, the transformed
-    // version of foo's transformer could import bar, so foo has to depend on
-    // bar.
-    d.dir("bar", [
-      d.pubspec({
-        "name": "bar",
-        "version": "1.0.0",
-        "transformers": ["bar"]
-      }),
-      d.dir("lib", [d.file("bar.dart", transformer())])
-    ]).create();
-
-    /// foo is transformed by baz.
-    d.dir("baz", [
-      d.libPubspec("baz", "1.0.0"),
-      d.dir("lib", [d.file("baz.dart", transformer())])
-    ]).create();
-
-    /// qux is not part of pkg's transitive dependency tree, so pkg shouldn't
-    /// depend on it.
-    d.dir("qux", [
-      d.pubspec({
-        "name": "qux",
-        "version": "1.0.0",
-        "transformers": ["qux"]
-      }),
-      d.dir("lib", [d.file("qux.dart", transformer())])
-    ]).create();
-
-    expectDependencies({
-      'pkg': ['foo', 'bar', 'baz'], 'foo': [], 'bar': [], 'baz': [], 'qux': []
-    });
-  });
-
-  integration("reports previous transformers as dependencies if a "
-      "nonexistent local file is imported", () {
-    // The root app just exists so that something is transformed by pkg and bar.
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {
-          "pkg": {"path": "../pkg"},
-          "bar": {"path": "../bar"}
-        },
-        "transformers": ["pkg", "bar"]
-      })
-    ]).create();
-
-    d.dir("pkg", [
-      d.pubspec({
-        "name": "pkg",
-        "version": "1.0.0",
-        "dependencies": {
-          "foo": {"path": "../foo"},
-          "bar": {"path": "../bar"}
-        },
-        "transformers": [{"foo": {"\$include": "lib/pkg.dart"}}]
-      }),
-      d.dir("lib", [
-        d.file("pkg.dart", ""),
-        d.file("transformer.dart", transformer(["nonexistent.dart"]))
-      ])
-    ]).create();
-
-    // Since pkg's transformer imports a nonexistent file, we assume that file
-    // was generated by foo's transformer. Thus pkg's transformer depends on
-    // foo's even though the latter doesn't transform the former.
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("lib", [d.file("foo.dart", transformer())])
-    ]).create();
-
-    /// qux is not part of pkg's transitive dependency tree, so pkg shouldn't
-    /// depend on it.
-    d.dir("bar", [
-      d.libPubspec("bar", "1.0.0"),
-      d.dir("lib", [d.file("bar.dart", transformer())])
-    ]).create();
-
-    expectDependencies({'pkg': ['foo'], 'foo': [], 'bar': []});
-  });
-
-  integration("reports all that package's dependencies' transformers as "
-      "dependencies if a non-existent file is imported from another package",
-      () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {
-          "foo": {"path": "../foo"},
-          "qux": {"path": "../qux"}
-        },
-        "transformers": ["myapp"]
-      }),
-      d.dir("lib", [
-        d.file("myapp.dart", transformer(["package:foo/nonexistent.dart"]))
-      ])
-    ]).create();
-
-    // myapp imported a nonexistent file from foo so myapp will depend on every
-    // transformer transitively reachable from foo, since the nonexistent file
-    // could be generated to import anything.
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "version": "1.0.0",
-        "dependencies": {
-          "bar": {"path": "../bar"},
-          "baz": {"path": "../baz"}
-        },
-        "transformers": ["foo"]
-      }),
-      d.dir("lib", [d.file("foo.dart", transformer())])
-    ]).create();
-
-    // bar is a dependency of foo so myapp will depend on it.
-    d.dir("bar", [
-      d.pubspec({
-        "name": "bar",
-        "version": "1.0.0",
-        "transformers": ["bar"]
-      }),
-      d.dir("lib", [d.file("bar.dart", transformer())])
-    ]).create();
-
-    // baz is a dependency of foo so myapp will depend on it.
-    d.dir("baz", [
-      d.pubspec({
-        "name": "baz",
-        "version": "1.0.0",
-        "transformers": ["baz"]
-      }),
-      d.dir("lib", [d.file("baz.dart", transformer())])
-    ]).create();
-
-    // qux is not transitively reachable from foo so myapp won't depend on it.
-    d.dir("qux", [
-      d.pubspec({
-        "name": "qux",
-        "version": "1.0.0",
-        "transformers": ["qux"]
-      }),
-      d.dir("lib", [d.file("qux.dart", transformer())])
-    ]).create();
-
-    expectDependencies({
-      'myapp': ['foo', 'bar', 'baz'], 'foo': [], 'bar': [], 'baz': [], 'qux': []
-    });
-  });
-
-  integration("reports all that package's dependencies' transformers as "
-      "dependencies if a non-existent transformer is used from another package",
-      () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {
-          "foo": {"path": "../foo"},
-          "qux": {"path": "../qux"}
-        },
-        "transformers": ["myapp"]
-      }),
-      d.dir("lib", [
-        d.file("myapp.dart", transformer(["package:foo/nonexistent.dart"]))
-      ])
-    ]).create();
-
-    // myapp imported a nonexistent file from foo so myapp will depend on every
-    // transformer transitively reachable from foo, since the nonexistent file
-    // could be generated to import anything.
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "version": "1.0.0",
-        "dependencies": {
-          "bar": {"path": "../bar"},
-          "baz": {"path": "../baz"}
-        },
-        "transformers": ["bar"]
-      })
-    ]).create();
-
-    // bar is a dependency of foo so myapp will depend on it.
-    d.dir("bar", [
-      d.libPubspec("bar", "1.0.0"),
-      d.dir("lib", [d.file("bar.dart", transformer())])
-    ]).create();
-
-    // baz is a dependency of foo so myapp will depend on it.
-    d.dir("baz", [
-      d.pubspec({
-        "name": "baz",
-        "version": "1.0.0",
-        "transformers": ["baz"]
-      }),
-      d.dir("lib", [d.file("baz.dart", transformer())])
-    ]).create();
-
-    // qux is not transitively reachable from foo so myapp won't depend on it.
-    d.dir("qux", [
-      d.pubspec({
-        "name": "qux",
-        "version": "1.0.0",
-        "transformers": ["qux"]
-      }),
-      d.dir("lib", [d.file("qux.dart", transformer())])
-    ]).create();
-
-    expectDependencies({
-      'myapp': ['bar', 'baz'], 'bar': [], 'baz': [], 'qux': []
-    });
-  });
-
-  test("reports dependencies on transformers in past phases", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "transformers": [
-          "myapp/first",
-          "myapp/second",
-          "myapp/third"
-        ]
-      }),
-      d.dir("lib", [
-        d.file("first.dart", transformer()),
-        d.file("second.dart", transformer()),
-        d.file("third.dart", transformer())
-      ])
-    ]).create();
-
-    expectDependencies({
-      'myapp/first': [],
-      'myapp/second': ['myapp/first'],
-      'myapp/third': ['myapp/second', 'myapp/first']
-    });
-  });
-
-  integration("considers the entrypoint package's dev and override "
-      "dependencies", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "dev_dependencies": {"bar": {"path": "../bar"}},
-        "dependency_overrides": {"baz": {"path": "../baz"}},
-        "transformers": ["foo", "myapp"]
-      }),
-      d.dir("lib", [d.file("myapp.dart", transformer())])
-    ]).create();
-
-    // foo transforms myapp's transformer so it could import from bar or baz.
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "version": "1.0.0",
-        "transformers": ["foo"]
-      }),
-      d.dir("lib", [d.file("foo.dart", transformer())])
-    ]).create();
-
-    // bar is a dev dependency that myapp could import from, so myapp should
-    // depend on it.
-    d.dir("bar", [
-      d.pubspec({
-        "name": "bar",
-        "version": "1.0.0",
-        "transformers": ["bar"]
-      }),
-      d.dir("lib", [d.file("bar.dart", transformer())])
-    ]).create();
-
-    // baz is an override dependency that myapp could import from, so myapp
-    // should depend on it.
-    d.dir("baz", [
-      d.pubspec({
-        "name": "baz",
-        "version": "1.0.0",
-        "transformers": ["baz"]
-      }),
-      d.dir("lib", [d.file("baz.dart", transformer())])
-    ]).create();
-
-    expectDependencies({
-      'myapp': ['foo', 'bar', 'baz'], 'foo': [], 'bar': [], 'baz': []
-    });
-  });
-
-  integration("doesn't consider a non-entrypoint package's dev and override "
-      "dependencies", () {
-    // myapp just exists so that pkg isn't the entrypoint.
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"pkg": {"path": "../pkg"}}
-      })
-    ]).create();
-
-    d.dir("pkg", [
-      d.pubspec({
-        "name": "pkg",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "dev_dependencies": {"bar": {"path": "../bar"}},
-        "dependency_overrides": {"baz": {"path": "../baz"}},
-        "transformers": ["foo", "pkg"]
-      }),
-      d.dir("lib", [d.file("pkg.dart", transformer())])
-    ]).create();
-
-    // foo transforms pkg's transformer so it could theoretcially import from
-    // bar or baz. However, since pkg isn't the entrypoint, it doesn't have
-    // access to them.
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "version": "1.0.0",
-        "transformers": ["foo"]
-      }),
-      d.dir("lib", [d.file("foo.dart", transformer())])
-    ]).create();
-
-    // bar is a dev dependency that myapp can't import from, so myapp shouldn't
-    // depend on it.
-    d.dir("bar", [
-      d.pubspec({
-        "name": "bar",
-        "version": "1.0.0",
-        "transformers": ["bar"]
-      }),
-      d.dir("lib", [d.file("bar.dart", transformer())])
-    ]).create();
-
-    // baz is a dev dependency that myapp can't import from, so myapp shouldn't
-    // depend on it.
-    d.dir("baz", [
-      d.pubspec({
-        "name": "baz",
-        "version": "1.0.0",
-        "transformers": ["baz"]
-      }),
-      d.dir("lib", [d.file("baz.dart", transformer())])
-    ]).create();
-
-    expectDependencies({'pkg': ['foo'], 'foo': [], 'bar': [], 'baz': []});
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/dependency_computer/cycle_test.dart b/sdk/lib/_internal/pub/test/dependency_computer/cycle_test.dart
deleted file mode 100644
index b45eda4..0000000
--- a/sdk/lib/_internal/pub/test/dependency_computer/cycle_test.dart
+++ /dev/null
@@ -1,210 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-void main() {
-  initConfig();
-
-  integration("allows a package dependency cycle that's unrelated to "
-      "transformers", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": ["myapp/first", "myapp/second"]
-      }),
-      d.dir('lib', [
-        d.file("first.dart", transformer()),
-        d.file("second.dart", transformer())
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0", deps: {"bar": {"path": "../bar"}})
-    ]).create();
-
-    d.dir("bar", [
-      d.libPubspec("bar", "1.0.0", deps: {"baz": {"path": "../baz"}})
-    ]).create();
-
-    d.dir("baz", [
-      d.libPubspec("baz", "1.0.0", deps: {"foo": {"path": "../foo"}})
-    ]).create();
-
-    expectDependencies({'myapp/first': [], 'myapp/second': ['myapp/first']});
-  });
-
-  integration("disallows a package dependency cycle that may be related to "
-      "transformers", () {
-    // Two layers of myapp transformers are necessary here because otherwise pub
-    // will figure out that the transformer doesn't import "foo" and thus
-    // doesn't transitively import itself. Import loops are tested below.
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": ["myapp/first", "myapp/second"]
-      }),
-      d.dir('lib', [
-        d.file("first.dart", transformer()),
-        d.file("second.dart", transformer())
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0", deps: {"bar": {"path": "../bar"}})
-    ]).create();
-
-    d.dir("bar", [
-      d.libPubspec("bar", "1.0.0", deps: {"myapp": {"path": "../myapp"}})
-    ]).create();
-
-    expectCycleException([
-      "myapp is transformed by myapp/second",
-      "myapp depends on foo",
-      "foo depends on bar",
-      "bar depends on myapp",
-      "myapp is transformed by myapp/first"
-    ]);
-  });
-
-  integration("disallows a transformation dependency cycle", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": ["foo"]
-      }),
-      d.dir('lib', [d.file("myapp.dart", transformer())])
-    ]).create();
-
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "dependencies": {"bar": {"path": "../bar"}},
-        "transformers": ["bar"]
-      }),
-      d.dir('lib', [d.file("foo.dart", transformer())])
-    ]).create();
-
-    d.dir("bar", [
-      d.pubspec({
-        "name": "bar",
-        "dependencies": {"myapp": {"path": "../myapp"}},
-        "transformers": ["myapp"]
-      }),
-      d.dir('lib', [d.file("bar.dart", transformer())])
-    ]).create();
-
-    expectCycleException([
-      "bar is transformed by myapp",
-      "myapp is transformed by foo",
-      "foo is transformed by bar"
-    ]);
-  });
-
-  integration("allows a cross-package import cycle that's unrelated to "
-      "transformers", () {
-     d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": ["myapp"]
-      }),
-      d.dir('lib', [
-        d.file("myapp.dart", transformer(['package:foo/foo.dart']))
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0", deps: {"bar": {"path": "../bar"}}),
-      d.dir('lib', [d.file("foo.dart", "import 'package:bar/bar.dart';")])
-    ]).create();
-
-    d.dir("bar", [
-      d.libPubspec("bar", "1.0.0", deps: {"baz": {"path": "../baz"}}),
-      d.dir('lib', [d.file("bar.dart", "import 'package:baz/baz.dart';")])
-    ]).create();
-
-    d.dir("baz", [
-      d.libPubspec("baz", "1.0.0", deps: {"foo": {"path": "../foo"}}),
-      d.dir('lib', [d.file("baz.dart", "import 'package:foo/foo.dart';")])
-    ]).create();
-
-    expectDependencies({'myapp': []});
-  });
-
-  integration("disallows a cross-package import cycle that's related to "
-      "transformers", () {
-     d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": ["myapp"]
-      }),
-      d.dir('lib', [
-        d.file("myapp.dart", transformer(['package:foo/foo.dart']))
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0", deps: {"bar": {"path": "../bar"}}),
-      d.dir('lib', [d.file("foo.dart", "import 'package:bar/bar.dart';")])
-    ]).create();
-
-    d.dir("bar", [
-      d.libPubspec("bar", "1.0.0", deps: {"myapp": {"path": "../myapp"}}),
-      d.dir('lib', [d.file("bar.dart", "import 'package:myapp/myapp.dart';")])
-    ]).create();
-
-    expectCycleException([
-      "myapp is transformed by myapp",
-      "myapp depends on foo",
-      "foo depends on bar",
-      "bar depends on myapp"
-    ]);
-  });
-
-  integration("allows a single-package import cycle that's unrelated to "
-      "transformers", () {
-     d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": ["myapp"]
-      }),
-      d.dir('lib', [
-        d.file("myapp.dart", transformer(['foo.dart'])),
-        d.file("foo.dart", "import 'bar.dart';"),
-        d.file("bar.dart", "import 'baz.dart';"),
-        d.file("baz.dart", "import 'foo.dart';")
-      ])
-    ]).create();
-
-    expectDependencies({'myapp': []});
-  });
-
-  integration("allows a single-package import cycle that's related to "
-      "transformers", () {
-     d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": ["myapp"]
-      }),
-      d.dir('lib', [
-        d.file("myapp.dart", transformer(['foo.dart'])),
-        d.file("foo.dart", "import 'bar.dart';"),
-        d.file("bar.dart", "import 'myapp.dart';"),
-      ])
-    ]).create();
-
-    expectDependencies({'myapp': []});
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/dependency_computer/dev_transformers_test.dart b/sdk/lib/_internal/pub/test/dependency_computer/dev_transformers_test.dart
deleted file mode 100644
index 6daa90b..0000000
--- a/sdk/lib/_internal/pub/test/dependency_computer/dev_transformers_test.dart
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-void main() {
-  initConfig();
-
-  integration("doesn't return a dependency's transformer that can't run on lib",
-      () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}}
-      })
-    ]).create();
-
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "version": "1.0.0",
-        "transformers": [{"foo": {"\$include": "test/foo_test.dart"}}]
-      }),
-      d.dir("lib", [d.file("foo.dart", transformer())]),
-      d.dir("test", [d.file("foo_test.dart", "")])
-    ]).create();
-
-    expectDependencies({});
-  });
-
-  integration("does return the root package's transformer that can't run on "
-      "lib", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "transformers": [{"myapp": {"\$include": "test/myapp_test.dart"}}]
-      }),
-      d.dir("lib", [d.file("myapp.dart", transformer())]),
-      d.dir("test", [d.file("myapp_test.dart", "")])
-    ]).create();
-
-    expectDependencies({"myapp": []});
-  });
-
-  integration("does return a dependency's transformer that the root package "
-      "uses", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": [{"foo": {"\$include": "test/myapp_test.dart"}}]
-      }),
-      d.dir("test", [d.file("myapp_test.dart", "")])
-    ]).create();
-
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "version": "1.0.0"
-      }),
-      d.dir("lib", [d.file("foo.dart", transformer())])
-    ]).create();
-
-    expectDependencies({"foo": []});
-  });
-
-  integration("doesn't return a dependency's transformer that can run on bin",
-      () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}}
-      })
-    ]).create();
-
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "version": "1.0.0",
-        "transformers": [{"foo": {"\$include": "bin/foo.dart"}}]
-      }),
-      d.dir("lib", [d.file("foo.dart", transformer())]),
-      d.dir("test", [d.file("foo_test.dart", "")])
-    ]).create();
-
-    expectDependencies({"foo": []});
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dependency_computer/error_test.dart b/sdk/lib/_internal/pub/test/dependency_computer/error_test.dart
deleted file mode 100644
index a06a566..0000000
--- a/sdk/lib/_internal/pub/test/dependency_computer/error_test.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exceptions.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-void main() {
-  initConfig();
-
-  integration("fails if an unknown package is imported", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "transformers": ["myapp"]
-      }),
-      d.dir('lib', [
-        d.file("myapp.dart", transformer(["package:foo/foo.dart"]))
-      ])
-    ]).create();
-
-    expectException(predicate((error) {
-      expect(error, new isInstanceOf<ApplicationException>());
-      expect(error.message, equals(
-          'A transformer imported unknown package "foo" (in '
-          '"package:foo/foo.dart").'));
-      return true;
-    }));
-  });
-
-  integration("fails on a syntax error", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "transformers": ["myapp"]
-      }),
-      d.dir('lib', [
-        d.file("myapp.dart", "library;")
-      ])
-    ]).create();
-
-    expectException(new isInstanceOf<AnalyzerErrorGroup>());
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dependency_computer/import_dependencies_test.dart b/sdk/lib/_internal/pub/test/dependency_computer/import_dependencies_test.dart
deleted file mode 100644
index a923cea..0000000
--- a/sdk/lib/_internal/pub/test/dependency_computer/import_dependencies_test.dart
+++ /dev/null
@@ -1,193 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-void main() {
-  initConfig();
-
-  integration("reports a dependency if a transformed local file is imported",
-      () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": [
-          {"foo": {"\$include": "lib/lib.dart"}},
-          "myapp"
-        ]
-      }),
-      d.dir("lib", [
-        d.file("myapp.dart", ""),
-        d.file("lib.dart", ""),
-        d.file("transformer.dart", transformer(["lib.dart"]))
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.pubspec({"name": "foo", "version": "1.0.0"}),
-      d.dir("lib", [d.file("foo.dart", transformer())])
-    ]).create();
-
-    expectDependencies({'myapp': ['foo'], 'foo': []});
-  });
-
-  integration("reports a dependency if a transformed foreign file is imported",
-      () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": ["myapp"]
-      }),
-      d.dir("lib", [
-        d.file("myapp.dart", ""),
-        d.file("transformer.dart", transformer(["package:foo/foo.dart"]))
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "version": "1.0.0",
-        "transformers": [{"foo": {"\$include": "lib/foo.dart"}}]
-      }),
-      d.dir("lib", [
-        d.file("foo.dart", ""),
-        d.file("transformer.dart", transformer())
-      ])
-    ]).create();
-
-    expectDependencies({'myapp': ['foo'], 'foo': []});
-  });
-
-  integration("reports a dependency if a transformed external package file is "
-      "imported from an export", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": ["myapp"]
-      }),
-      d.dir("lib", [
-        d.file("myapp.dart", ""),
-        d.file("transformer.dart", transformer(["local.dart"])),
-        d.file("local.dart", "export 'package:foo/foo.dart';")
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "version": "1.0.0",
-        "transformers": [{"foo": {"\$include": "lib/foo.dart"}}]
-      }),
-      d.dir("lib", [
-        d.file("foo.dart", ""),
-        d.file("transformer.dart", transformer())
-      ])
-    ]).create();
-
-    expectDependencies({'myapp': ['foo'], 'foo': []});
-  });
-
-  integration("reports a dependency if a transformed foreign file is "
-      "transitively imported", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": ["myapp"]
-      }),
-      d.dir("lib", [
-        d.file("myapp.dart", ""),
-        d.file("transformer.dart", transformer(["local.dart"])),
-        d.file("local.dart", "import 'package:foo/foreign.dart';")
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "version": "1.0.0",
-        "transformers": [{"foo": {"\$include": "lib/foo.dart"}}]
-      }),
-      d.dir("lib", [
-        d.file("foo.dart", ""),
-        d.file("transformer.dart", transformer()),
-        d.file("foreign.dart", "import 'foo.dart';")
-      ])
-    ]).create();
-
-    expectDependencies({'myapp': ['foo'], 'foo': []});
-  });
-
-  integration("reports a dependency if a transformed foreign file is "
-      "transitively imported across packages", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": ["myapp"]
-      }),
-      d.dir("lib", [
-        d.file("myapp.dart", ""),
-        d.file("transformer.dart", transformer(["package:foo/foo.dart"])),
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "version": "1.0.0",
-        "dependencies": {"bar": {"path": "../bar"}}
-      }),
-      d.dir("lib", [d.file("foo.dart", "import 'package:bar/bar.dart';")])
-    ]).create();
-
-    d.dir("bar", [
-      d.pubspec({
-        "name": "bar",
-        "version": "1.0.0",
-        "transformers": [{"bar": {"\$include": "lib/bar.dart"}}]
-      }),
-      d.dir("lib", [
-        d.file("bar.dart", ""),
-        d.file("transformer.dart", transformer())
-      ])
-    ]).create();
-
-    expectDependencies({'myapp': ['bar'], 'bar': []});
-  });
-
-  integration("reports a dependency if an imported file is transformed by a "
-      "different package", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": [
-          {"foo": {'\$include': 'lib/local.dart'}},
-          "myapp"
-        ]
-      }),
-      d.dir("lib", [
-        d.file("myapp.dart", ""),
-        d.file("transformer.dart", transformer(["local.dart"])),
-        d.file("local.dart", "")
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.pubspec({"name": "foo", "version": "1.0.0"}),
-      d.dir("lib", [d.file("transformer.dart", transformer())])
-    ]).create();
-
-    expectDependencies({'myapp': ['foo'], 'foo': []});
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/dependency_computer/no_dependencies_test.dart b/sdk/lib/_internal/pub/test/dependency_computer/no_dependencies_test.dart
deleted file mode 100644
index c28e4a0..0000000
--- a/sdk/lib/_internal/pub/test/dependency_computer/no_dependencies_test.dart
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-void main() {
-  initConfig();
-
-  integration("reports no dependencies if no transformers are used", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}}
-      })
-    ]).create();
-
-    d.dir("foo", [d.libPubspec("foo", "1.0.0")]).create();
-
-    expectDependencies({});
-  });
-
-  integration("reports no dependencies if a transformer is used in a "
-      "package that doesn't expose a transformer", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": ["foo"]
-      })
-    ]).create();
-
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("lib", [d.file("foo.dart", transformer())])
-    ]).create();
-
-    expectDependencies({"foo": []});
-  });
-
-  integration("reports no dependencies for non-file/package imports", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": ["myapp"]
-      }),
-      d.dir("lib", [
-        d.file("myapp.dart", transformer([
-          "dart:async",
-          "http://dartlang.org/nonexistent.dart"
-        ]))
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("lib", [d.file("foo.dart", transformer())])
-    ]).create();
-
-    expectDependencies({"myapp": []});
-  });
-
-  integration("reports no dependencies for a single self transformer", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "transformers": ["myapp"]
-      }),
-      d.dir("lib", [d.file("myapp.dart", transformer())])
-    ]).create();
-
-    expectDependencies({"myapp": []});
-  });
-
-  integration("reports no dependencies if a transformer applies to files that "
-      "aren't used by the exposed transformer", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": [
-          {"foo": {"\$include": "lib/myapp.dart"}},
-          {"foo": {"\$exclude": "lib/transformer.dart"}},
-          "myapp"
-        ]
-      }),
-      d.dir("lib", [
-        d.file("myapp.dart", ""),
-        d.file("transformer.dart", transformer())
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("lib", [d.file("foo.dart", transformer())])
-    ]).create();
-
-    expectDependencies({"myapp": [], "foo": []});
-  });
-
-  integration("reports no dependencies if a transformer applies to a "
-      "dependency's files that aren't used by the exposed transformer", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": ["myapp"]
-      }),
-      d.dir("lib", [
-        d.file("myapp.dart", ""),
-        d.file("transformer.dart", transformer(["package:foo/foo.dart"]))
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "version": "1.0.0",
-        "transformers": [{"foo": {"\$exclude": "lib/foo.dart"}}]
-      }),
-      d.dir("lib", [
-        d.file("foo.dart", ""),
-        d.file("transformer.dart", transformer())
-      ])
-    ]).create();
-
-    expectDependencies({'myapp': [], 'foo': []});
-  });
-
-  test("reports no dependencies on transformers in future phases", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "transformers": [
-          {"myapp/first": {"\$include": "lib/myapp.dart"}},
-          {"myapp/second": {"\$include": "lib/first.dart"}},
-          {"myapp/third": {"\$include": "lib/second.dart"}}
-        ]
-      }),
-      d.dir("lib", [
-        d.file("myapp.dart", ""),
-        d.file("first.dart", transformer()),
-        d.file("second.dart", transformer()),
-        d.file("third.dart", transformer())
-      ])
-    ]).create();
-
-    expectDependencies({
-      'myapp/first': [],
-      'myapp/second': [],
-      'myapp/third': []
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dependency_computer/transformers_needed_by_library_test.dart b/sdk/lib/_internal/pub/test/dependency_computer/transformers_needed_by_library_test.dart
deleted file mode 100644
index 724307c..0000000
--- a/sdk/lib/_internal/pub/test/dependency_computer/transformers_needed_by_library_test.dart
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-void main() {
-  initConfig();
-
-  integration("reports a dependency if the library itself is transformed", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": [
-          {"foo": {"\$include": "bin/myapp.dart.dart"}}
-        ]
-      }),
-      d.dir("bin", [
-        d.file("myapp.dart", "import 'package:myapp/lib.dart';"),
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.pubspec({"name": "foo", "version": "1.0.0"}),
-      d.dir("lib", [d.file("foo.dart", transformer())])
-    ]).create();
-
-    expectLibraryDependencies('myapp|bin/myapp.dart', ['foo']);
-  });
-
-  integration("reports a dependency if a transformed local file is imported",
-      () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": [
-          {"foo": {"\$include": "lib/lib.dart"}}
-        ]
-      }),
-      d.dir("lib", [
-        d.file("lib.dart", ""),
-      ]),
-      d.dir("bin", [
-        d.file("myapp.dart", "import 'package:myapp/lib.dart';"),
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.pubspec({"name": "foo", "version": "1.0.0"}),
-      d.dir("lib", [d.file("foo.dart", transformer())])
-    ]).create();
-
-    expectLibraryDependencies('myapp|bin/myapp.dart', ['foo']);
-  });
-
-  integration("reports a dependency if a transformed foreign file is imported",
-      () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-      }),
-      d.dir("bin", [
-        d.file("myapp.dart", "import 'package:foo/foo.dart';")
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "version": "1.0.0",
-        "transformers": [{"foo": {"\$include": "lib/foo.dart"}}]
-      }),
-      d.dir("lib", [
-        d.file("foo.dart", ""),
-        d.file("transformer.dart", transformer())
-      ])
-    ]).create();
-
-    expectLibraryDependencies('myapp|bin/myapp.dart', ['foo']);
-  });
-
-  integration("doesn't report a dependency if no transformed files are "
-      "imported", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}},
-        "transformers": [
-          {"foo": {"\$include": "lib/lib.dart"}}
-        ]
-      }),
-      d.dir("lib", [
-        d.file("lib.dart", ""),
-        d.file("untransformed.dart", ""),
-      ]),
-      d.dir("bin", [
-        d.file("myapp.dart", "import 'package:myapp/untransformed.dart';"),
-      ])
-    ]).create();
-
-    d.dir("foo", [
-      d.pubspec({"name": "foo", "version": "1.0.0"}),
-      d.dir("lib", [d.file("foo.dart", transformer())])
-    ]).create();
-
-    expectLibraryDependencies('myapp|bin/myapp.dart', []);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/dependency_computer/utils.dart b/sdk/lib/_internal/pub/test/dependency_computer/utils.dart
deleted file mode 100644
index 87ce969..0000000
--- a/sdk/lib/_internal/pub/test/dependency_computer/utils.dart
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/barback/cycle_exception.dart';
-import '../../lib/src/barback/dependency_computer.dart';
-import '../../lib/src/entrypoint.dart';
-import '../../lib/src/io.dart';
-import '../../lib/src/package.dart';
-import '../../lib/src/package_graph.dart';
-import '../../lib/src/source/path.dart';
-import '../../lib/src/system_cache.dart';
-import '../../lib/src/utils.dart';
-import '../test_pub.dart';
-
-/// Expects that [DependencyComputer.transformersNeededByTransformers] will
-/// return a graph matching [expected] when run on the package graph defined by
-/// packages in the sandbox.
-void expectDependencies(Map<String, Iterable<String>> expected) {
-  expected = mapMap(expected, value: (_, ids) => ids.toSet());
-
-  schedule(() {
-    var computer = new DependencyComputer(_loadPackageGraph());
-    var result = mapMap(
-        computer.transformersNeededByTransformers(),
-        key: (id, _) => id.toString(),
-        value: (_, ids) => ids.map((id) => id.toString()).toSet());
-    expect(result, equals(expected));
-  }, "expect dependencies to match $expected");
-}
-
-/// Expects that [computeTransformersNeededByTransformers] will throw an
-/// exception matching [matcher] when run on the package graph defiend by
-/// packages in the sandbox.
-void expectException(matcher) {
-  schedule(() {
-    expect(() {
-      var computer = new DependencyComputer(_loadPackageGraph());
-      computer.transformersNeededByTransformers();
-    }, throwsA(matcher));
-  }, "expect an exception: $matcher");
-}
-
-/// Expects that [computeTransformersNeededByTransformers] will throw a
-/// [CycleException] with the given [steps] when run on the package graph
-/// defiend by packages in the sandbox.
-void expectCycleException(Iterable<String> steps) {
-  expectException(predicate((error) {
-    expect(error, new isInstanceOf<CycleException>());
-    expect(error.steps, equals(steps));
-    return true;
-  }, "cycle exception:\n${steps.map((step) => "  $step").join("\n")}"));
-}
-
-/// Expects that [DependencyComputer.transformersNeededByLibrary] will return
-/// transformer ids matching [expected] when run on the library identified by
-/// [id].
-void expectLibraryDependencies(String id, Iterable<String> expected) {
-  expected = expected.toSet();
-
-  schedule(() {
-    var computer = new DependencyComputer(_loadPackageGraph());
-    var result = computer.transformersNeededByLibrary(new AssetId.parse(id))
-        .map((id) => id.toString()).toSet();
-    expect(result, equals(expected));
-  }, "expect dependencies to match $expected");
-}
-
-/// Loads a [PackageGraph] from the packages in the sandbox.
-///
-/// This graph will also include barback and its transitive dependencies from
-/// the repo.
-PackageGraph _loadPackageGraph() {
-  // Load the sandbox packages.
-  var packages = {};
-
-  var systemCache = new SystemCache(p.join(sandboxDir, cachePath));
-  systemCache.sources
-      ..register(new PathSource())
-      ..setDefault('path');
-  var entrypoint = new Entrypoint(p.join(sandboxDir, appPath), systemCache);
-
-  for (var package in listDir(sandboxDir)) {
-    if (!fileExists(p.join(package, 'pubspec.yaml'))) continue;
-    var packageName = p.basename(package);
-    packages[packageName] = new Package.load(
-        packageName, package, systemCache.sources);
-  }
-
-  loadPackage(packageName) {
-    if (packages.containsKey(packageName)) return;
-    packages[packageName] = new Package.load(
-        packageName, packagePath(packageName), systemCache.sources);
-    for (var dep in packages[packageName].dependencies) {
-      loadPackage(dep.name);
-    }
-  }
-
-  loadPackage('barback');
-
-  return new PackageGraph(entrypoint, null, packages);
-}
-
-/// Returns the contents of a no-op transformer that imports each URL in
-/// [imports].
-String transformer([Iterable<String> imports]) {
-  if (imports == null) imports = [];
-
-  var buffer = new StringBuffer()
-      ..writeln('import "package:barback/barback.dart";');
-  for (var import in imports) {
-    buffer.writeln('import "$import";');
-  }
-
-  buffer.writeln("""
-NoOpTransformer extends Transformer {
-  bool isPrimary(AssetId id) => true;
-  void apply(Transform transform) {}
-}
-""");
-
-  return buffer.toString();
-}
diff --git a/sdk/lib/_internal/pub/test/dependency_override_test.dart b/sdk/lib/_internal/pub/test/dependency_override_test.dart
deleted file mode 100644
index 4e47e24..0000000
--- a/sdk/lib/_internal/pub/test/dependency_override_test.dart
+++ /dev/null
@@ -1,123 +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 'package:path/path.dart' as path;
-
-import 'descriptor.dart' as d;
-import 'test_pub.dart';
-
-main() {
-  initConfig();
-  forBothPubGetAndUpgrade((command) {
-    integration("chooses best version matching override constraint", () {
-      servePackages((builder) {
-        builder.serve("foo", "1.0.0");
-        builder.serve("foo", "2.0.0");
-        builder.serve("foo", "3.0.0");
-      });
-
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "dependencies": {
-            "foo": ">2.0.0"
-          },
-          "dependency_overrides": {
-            "foo": "<3.0.0"
-          }
-        })
-      ]).create();
-
-      pubCommand(command);
-
-      d.packagesDir({
-        "foo": "2.0.0"
-      }).validate();
-    });
-
-    integration("treats override as implicit dependency", () {
-      servePackages((builder) {
-        builder.serve("foo", "1.0.0");
-      });
-
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "dependency_overrides": {
-            "foo": "any"
-          }
-        })
-      ]).create();
-
-      pubCommand(command);
-
-      d.packagesDir({
-        "foo": "1.0.0"
-      }).validate();
-    });
-
-    integration("ignores other constraints on overridden package", () {
-      servePackages((builder) {
-        builder.serve("foo", "1.0.0");
-        builder.serve("foo", "2.0.0");
-        builder.serve("foo", "3.0.0");
-        builder.serve("bar", "1.0.0", pubspec: {
-          "dependencies": {"foo": "5.0.0-nonexistent"}
-        });
-      });
-
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "dependencies": {
-            "bar": "any"
-          },
-          "dependency_overrides": {
-            "foo": "<3.0.0"
-          }
-        })
-      ]).create();
-
-      pubCommand(command);
-
-      d.packagesDir({
-        "foo": "2.0.0",
-        "bar": "1.0.0"
-      }).validate();
-    });
-
-    integration("warns about overridden dependencies", () {
-      servePackages((builder) {
-        builder.serve("foo", "1.0.0");
-        builder.serve("bar", "1.0.0");
-      });
-
-      d.dir("baz", [
-        d.libDir("baz"),
-        d.libPubspec("baz", "0.0.1")
-      ]).create();
-
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "dependency_overrides": {
-            "foo": "any",
-            "bar": "any",
-            "baz": {"path": "../baz"}
-          }
-        })
-      ]).create();
-
-      var bazPath = path.join("..", "baz");
-
-      schedulePub(args: [command.name], output: command.success, error:
-          """
-          Warning: You are using these overridden dependencies:
-          ! bar 1.0.0
-          ! baz 0.0.1 from path $bazPath
-          ! foo 1.0.0
-          """);
-    });
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/deps_test.dart b/sdk/lib/_internal/pub/test/deps_test.dart
deleted file mode 100644
index 7c52006..0000000
--- a/sdk/lib/_internal/pub/test/deps_test.dart
+++ /dev/null
@@ -1,131 +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 'package:scheduled_test/scheduled_test.dart';
-
-import 'descriptor.dart' as d;
-import 'test_pub.dart';
-
-main() {
-  initConfig();
-
-  setUp(() {
-    servePackages((builder) {
-      builder.serve("normal", "1.2.3", deps: {
-        "transitive": "any",
-        "circular_a": "any"
-      });
-      builder.serve("transitive", "1.2.3", deps: {"shared": "any"});
-      builder.serve("shared", "1.2.3", deps: {"other": "any"});
-      builder.serve("unittest", "1.2.3", deps: {"shared": "any"});
-      builder.serve("other", "1.0.0");
-      builder.serve("overridden", "1.0.0");
-      builder.serve("overridden", "2.0.0");
-      builder.serve("override_only", "1.2.3");
-      builder.serve("circular_a", "1.2.3", deps: {"circular_b": "any"});
-      builder.serve("circular_b", "1.2.3", deps: {"circular_a": "any"});
-    });
-
-    d.dir("from_path", [
-      d.libDir("from_path"),
-      d.libPubspec("from_path", "1.2.3")
-    ]).create();
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {
-          "normal": "any",
-          "overridden": "1.0.0",
-          "from_path": {"path": "../from_path"}
-        },
-        "dev_dependencies": {
-          "unittest": "any"
-        },
-        "dependency_overrides": {
-          "overridden": "2.0.0",
-          "override_only": "any"
-        }
-      })
-    ]).create();
-  });
-
-  integration("lists dependencies in compact form", () {
-    pubGet();
-    schedulePub(args: ['deps', '-s', 'compact'], output: '''
-        myapp 0.0.0
-
-        dependencies:
-        - from_path 1.2.3
-        - normal 1.2.3 [transitive circular_a]
-        - overridden 2.0.0
-
-        dev dependencies:
-        - unittest 1.2.3 [shared]
-
-        dependency overrides:
-        - overridden 2.0.0
-        - override_only 1.2.3
-
-        transitive dependencies:
-        - circular_a 1.2.3 [circular_b]
-        - circular_b 1.2.3 [circular_a]
-        - other 1.0.0
-        - shared 1.2.3 [other]
-        - transitive 1.2.3 [shared]
-        ''');
-  });
-
-  integration("lists dependencies in list form", () {
-    pubGet();
-    schedulePub(args: ['deps', '--style', 'list'], output: '''
-        myapp 0.0.0
-
-        dependencies:
-        - from_path 1.2.3
-        - normal 1.2.3
-          - transitive any
-          - circular_a any
-        - overridden 2.0.0
-
-        dev dependencies:
-        - unittest 1.2.3
-          - shared any
-
-        dependency overrides:
-        - overridden 2.0.0
-        - override_only 1.2.3
-
-        transitive dependencies:
-        - circular_a 1.2.3
-          - circular_b any
-        - circular_b 1.2.3
-          - circular_a any
-        - other 1.0.0
-        - shared 1.2.3
-          - other any
-        - transitive 1.2.3
-          - shared any
-        ''');
-  });
-
-  integration("lists dependencies in tree form", () {
-    pubGet();
-    schedulePub(args: ['deps'], output: '''
-        myapp 0.0.0
-        |-- from_path 1.2.3
-        |-- normal 1.2.3
-        |   |-- circular_a 1.2.3
-        |   |   '-- circular_b 1.2.3
-        |   |       '-- circular_a...
-        |   '-- transitive 1.2.3
-        |       '-- shared...
-        |-- overridden 2.0.0
-        |-- override_only 1.2.3
-        '-- unittest 1.2.3
-            '-- shared 1.2.3
-                '-- other 1.0.0
-        ''');
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/descriptor.dart b/sdk/lib/_internal/pub/test/descriptor.dart
deleted file mode 100644
index 67db472..0000000
--- a/sdk/lib/_internal/pub/test/descriptor.dart
+++ /dev/null
@@ -1,184 +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.
-
-/// Pub-specific scheduled_test descriptors.
-library descriptor;
-
-import 'package:oauth2/oauth2.dart' as oauth2;
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:scheduled_test/descriptor.dart';
-
-import '../lib/src/io.dart';
-import '../lib/src/utils.dart';
-import 'descriptor/git.dart';
-import 'descriptor/tar.dart';
-import 'test_pub.dart';
-
-export 'package:scheduled_test/descriptor.dart';
-export 'descriptor/git.dart';
-export 'descriptor/tar.dart';
-
-/// Creates a new [GitRepoDescriptor] with [name] and [contents].
-GitRepoDescriptor git(String name, [Iterable<Descriptor> contents]) =>
-    new GitRepoDescriptor(name, contents == null ? <Descriptor>[] : contents);
-
-/// Creates a new [TarRepoDescriptor] with [name] and [contents].
-TarFileDescriptor tar(String name, [Iterable<Descriptor> contents]) =>
-    new TarFileDescriptor(name, contents == null ? <Descriptor>[] : contents);
-
-/// Describes a package that passes all validation.
-Descriptor get validPackage => dir(appPath, [
-  libPubspec("test_pkg", "1.0.0"),
-  file("LICENSE", "Eh, do what you want."),
-  dir("lib", [
-    file("test_pkg.dart", "int i = 1;")
-  ])
-]);
-
-/// Returns a descriptor of a snapshot that can't be run by the current VM.
-///
-/// This snapshot was generated by the VM on r39611, the revision immediately
-/// before snapshot versioning was added.
-FileDescriptor outOfDateSnapshot(String name) =>
-    binaryFile(name, readBinaryFile(testAssetPath('out-of-date.snapshot')));
-
-/// Describes a file named `pubspec.yaml` with the given YAML-serialized
-/// [contents], which should be a serializable object.
-///
-/// [contents] may contain [Future]s that resolve to serializable objects,
-/// which may in turn contain [Future]s recursively.
-Descriptor pubspec(Map contents) {
-  return async(awaitObject(contents).then((resolvedContents) =>
-      file("pubspec.yaml", yaml(resolvedContents))));
-}
-
-/// Describes a file named `pubspec.yaml` for an application package with the
-/// given [dependencies].
-Descriptor appPubspec([Map dependencies]) {
-  var map = {"name": "myapp"};
-  if (dependencies != null) map["dependencies"] = dependencies;
-  return pubspec(map);
-}
-
-/// Describes a file named `pubspec.yaml` for a library package with the given
-/// [name], [version], and [deps]. If "sdk" is given, then it adds an SDK
-/// constraint on that version.
-Descriptor libPubspec(String name, String version, {Map deps, String sdk}) {
-  var map = packageMap(name, version, deps);
-  if (sdk != null) map["environment"] = {"sdk": sdk};
-  return pubspec(map);
-}
-
-/// Describes a directory named `lib` containing a single dart file named
-/// `<name>.dart` that contains a line of Dart code.
-Descriptor libDir(String name, [String code]) {
-  // Default to printing the name if no other code was given.
-  if (code == null) code = name;
-  return dir("lib", [
-    file("$name.dart", 'main() => "$code";')
-  ]);
-}
-
-/// Describes a directory for a Git package. This directory is of the form
-/// found in the revision cache of the global package cache.
-Descriptor gitPackageRevisionCacheDir(String name, [int modifier]) {
-  var value = name;
-  if (modifier != null) value = "$name $modifier";
-  return pattern(new RegExp("$name${r'-[a-f0-9]+'}"),
-      (dirName) => dir(dirName, [libDir(name, value)]));
-}
-
-/// Describes a directory for a Git package. This directory is of the form
-/// found in the repo cache of the global package cache.
-Descriptor gitPackageRepoCacheDir(String name) {
-  return pattern(new RegExp("$name${r'-[a-f0-9]+'}"),
-      (dirName) => dir(dirName, [
-    dir('hooks'),
-    dir('info'),
-    dir('objects'),
-    dir('refs')
-  ]));
-}
-
-/// Describes the `packages/` directory containing all the given [packages],
-/// which should be name/version pairs. The packages will be validated against
-/// the format produced by the mock package server.
-///
-/// A package with a null version should not be downloaded.
-Descriptor packagesDir(Map<String, String> packages) {
-  var contents = <Descriptor>[];
-  packages.forEach((name, version) {
-    if (version == null) {
-      contents.add(nothing(name));
-    } else {
-      contents.add(dir(name, [
-        file("$name.dart", 'main() => "$name $version";')
-      ]));
-    }
-  });
-  return dir(packagesPath, contents);
-}
-
-/// Describes the global package cache directory containing all the given
-/// [packages], which should be name/version pairs. The packages will be
-/// validated against the format produced by the mock package server.
-///
-/// A package's value may also be a list of versions, in which case all
-/// versions are expected to be downloaded.
-///
-/// If [includePubspecs] is `true`, then pubspecs will be created for each
-/// package. Defaults to `false` so that the contents of pubspecs are not
-/// validated since they will often lack the dependencies section that the
-/// real pubspec being compared against has. You usually only need to pass
-/// `true` for this if you plan to call [create] on the resulting descriptor.
-Descriptor cacheDir(Map packages, {bool includePubspecs: false}) {
-  var contents = <Descriptor>[];
-  packages.forEach((name, versions) {
-    if (versions is! List) versions = [versions];
-    for (var version in versions) {
-      var packageContents = [libDir(name, '$name $version')];
-      if (includePubspecs) {
-        packageContents.add(libPubspec(name, version));
-      }
-      contents.add(dir("$name-$version", packageContents));
-    }
-  });
-
-  return hostedCache(contents);
-}
-
-/// Describes the main cache directory containing cached hosted packages
-/// downloaded from the mock package server.
-Descriptor hostedCache(Iterable<Descriptor> contents) {
-  return dir(cachePath, [
-    dir('hosted', [
-      async(port.then((p) => dir('localhost%58$p', contents)))
-    ])
-  ]);
-}
-
-/// Describes the file in the system cache that contains the client's OAuth2
-/// credentials. The URL "/token" on [server] will be used as the token
-/// endpoint for refreshing the access token.
-Descriptor credentialsFile(
-    ScheduledServer server,
-    String accessToken,
-    {String refreshToken,
-     DateTime expiration}) {
-  return async(server.url.then((url) {
-    return dir(cachePath, [
-      file('credentials.json', new oauth2.Credentials(
-          accessToken,
-          refreshToken,
-          url.resolve('/token'),
-          ['https://www.googleapis.com/auth/userinfo.email'],
-          expiration).toJson())
-    ]);
-  }));
-}
-
-/// Describes the application directory, containing only a pubspec specifying
-/// the given [dependencies].
-DirectoryDescriptor appDir([Map dependencies]) =>
-  dir(appPath, [appPubspec(dependencies)]);
diff --git a/sdk/lib/_internal/pub/test/descriptor/git.dart b/sdk/lib/_internal/pub/test/descriptor/git.dart
deleted file mode 100644
index 0ccf2e3..0000000
--- a/sdk/lib/_internal/pub/test/descriptor/git.dart
+++ /dev/null
@@ -1,78 +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 descriptor.git;
-
-import 'dart:async';
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/descriptor.dart';
-
-import '../../lib/src/git.dart' as git;
-
-/// Describes a Git repository and its contents.
-class GitRepoDescriptor extends DirectoryDescriptor {
-  GitRepoDescriptor(String name, List<Descriptor> contents)
-      : super(name, contents);
-
-  /// Creates the Git repository and commits the contents.
-  Future create([String parent]) => schedule(() {
-    return super.create(parent).then((_) {
-      return _runGitCommands(parent, [
-        ['init'],
-        ['add', '.'],
-        ['commit', '-m', 'initial commit']
-      ]);
-    });
-  }, 'creating Git repo:\n${describe()}');
-
-  /// Writes this descriptor to the filesystem, than commits any changes from
-  /// the previous structure to the Git repo.
-  ///
-  /// [parent] defaults to [defaultRoot].
-  Future commit([String parent]) => schedule(() {
-    return super.create(parent).then((_) {
-      return _runGitCommands(parent, [
-        ['add', '.'],
-        ['commit', '-m', 'update']
-      ]);
-    });
-  }, 'committing Git repo:\n${describe()}');
-
-  /// Return a Future that completes to the commit in the git repository
-  /// referred to by [ref] at the current point in the scheduled test run.
-  ///
-  /// [parent] defaults to [defaultRoot].
-  Future<String> revParse(String ref, [String parent]) => schedule(() {
-    return _runGit(['rev-parse', ref], parent).then((output) => output[0]);
-  }, 'parsing revision $ref for Git repo:\n${describe()}');
-
-  /// Schedule a Git command to run in this repository.
-  ///
-  /// [parent] defaults to [defaultRoot].
-  Future runGit(List<String> args, [String parent]) => schedule(() {
-    return _runGit(args, parent);
-  }, "running 'git ${args.join(' ')}' in Git repo:\n${describe()}");
-
-  Future _runGitCommands(String parent, List<List<String>> commands) =>
-      Future.forEach(commands, (command) => _runGit(command, parent));
-
-  Future<List<String>> _runGit(List<String> args, String parent) {
-    // Explicitly specify the committer information. Git needs this to commit
-    // and we don't want to rely on the buildbots having this already set up.
-    var environment = {
-      'GIT_AUTHOR_NAME': 'Pub Test',
-      'GIT_AUTHOR_EMAIL': 'pub@dartlang.org',
-      'GIT_COMMITTER_NAME': 'Pub Test',
-      'GIT_COMMITTER_EMAIL': 'pub@dartlang.org'
-    };
-
-    if (parent == null) parent = defaultRoot;
-    return git.run(args,
-        workingDir: path.join(parent, name),
-        environment: environment);
-  }
-}
-
diff --git a/sdk/lib/_internal/pub/test/descriptor/tar.dart b/sdk/lib/_internal/pub/test/descriptor/tar.dart
deleted file mode 100644
index 2a04a03..0000000
--- a/sdk/lib/_internal/pub/test/descriptor/tar.dart
+++ /dev/null
@@ -1,53 +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 descriptor.tar;
-
-import 'dart:async';
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/descriptor.dart';
-
-import '../../lib/src/io.dart';
-
-/// Describes a tar file and its contents.
-class TarFileDescriptor extends DirectoryDescriptor
-    implements ReadableDescriptor {
-  TarFileDescriptor(String name, List<Descriptor> contents)
-      : super(name, contents);
-
-  /// Creates the files and directories within this tar file, then archives
-  /// them, compresses them, and saves the result to [parentDir].
-  Future<String> create([String parent]) => schedule(() {
-    if (parent == null) parent = defaultRoot;
-    return withTempDir((tempDir) {
-      return Future.wait(contents.map((entry) {
-        return entry.create(tempDir);
-      })).then((_) {
-        var createdContents = listDir(tempDir,
-            recursive: true,
-            includeHidden: true);
-        return createTarGz(createdContents, baseDir: tempDir).toBytes();
-      }).then((bytes) {
-        var file = path.join(parent, name);
-        writeBinaryFile(file, bytes);
-        return file;
-      });
-    });
-  }, 'creating tar file:\n${describe()}');
-
-  /// Validates that the `.tar.gz` file at [path] contains the expected
-  /// contents.
-  Future validate([String parent]) {
-    throw new UnimplementedError("TODO(nweiz): implement this");
-  }
-
-  Stream<List<int>> read() {
-    return new Stream<List<int>>.fromFuture(withTempDir((tempDir) {
-      return create(tempDir).then((_) =>
-          readBinaryFile(path.join(tempDir, name)));
-    }));
-  }
-}
diff --git a/sdk/lib/_internal/pub/test/dev_dependency_test.dart b/sdk/lib/_internal/pub/test/dev_dependency_test.dart
deleted file mode 100644
index 35c72dd..0000000
--- a/sdk/lib/_internal/pub/test/dev_dependency_test.dart
+++ /dev/null
@@ -1,109 +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 'descriptor.dart' as d;
-import 'test_pub.dart';
-
-main() {
-  initConfig();
-  integration("includes root package's dev dependencies", () {
-    d.dir('foo', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '0.0.1')
-    ]).create();
-
-    d.dir('bar', [
-      d.libDir('bar'),
-      d.libPubspec('bar', '0.0.1')
-    ]).create();
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dev_dependencies": {
-          "foo": {"path": "../foo"},
-          "bar": {"path": "../bar"},
-        }
-      })
-    ]).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir("foo", [
-        d.file("foo.dart", 'main() => "foo";')
-      ]),
-      d.dir("bar", [
-        d.file("bar.dart", 'main() => "bar";')
-      ])
-    ]).validate();
-  });
-
-  integration("includes dev dependency's transitive dependencies", () {
-    d.dir('foo', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '0.0.1', deps: {
-        "bar": {"path": "../bar"}
-      })
-    ]).create();
-
-    d.dir('bar', [
-      d.libDir('bar'),
-      d.libPubspec('bar', '0.0.1')
-    ]).create();
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dev_dependencies": {
-          "foo": {"path": "../foo"}
-        }
-      })
-    ]).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir("foo", [
-        d.file("foo.dart", 'main() => "foo";')
-      ]),
-      d.dir("bar", [
-        d.file("bar.dart", 'main() => "bar";')
-      ])
-    ]).validate();
-  });
-
-  integration("ignores transitive dependency's dev dependencies", () {
-    d.dir('foo', [
-      d.libDir('foo'),
-      d.pubspec({
-        "name": "foo",
-        "version": "0.0.1",
-        "dev_dependencies": {
-          "bar": {"path": "../bar"}
-        }
-      })
-    ]).create();
-
-    d.dir('bar', [
-      d.libDir('bar'),
-      d.libPubspec('bar', '0.0.1')
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      })
-    ]).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir("foo", [
-        d.file("foo.dart", 'main() => "foo";')
-      ]),
-      d.nothing("bar")
-    ]).validate();
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/downgrade/does_not_show_other_versions_test.dart b/sdk/lib/_internal/pub/test/downgrade/does_not_show_other_versions_test.dart
deleted file mode 100644
index 2c49d31..0000000
--- a/sdk/lib/_internal/pub/test/downgrade/does_not_show_other_versions_test.dart
+++ /dev/null
@@ -1,34 +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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("does not show how many other versions are available", () {
-    servePackages((builder) {
-      builder.serve("downgraded", "1.0.0");
-      builder.serve("downgraded", "2.0.0");
-      builder.serve("downgraded", "3.0.0-dev");
-    });
-
-    d.appDir({
-      "downgraded": "3.0.0-dev"
-    }).create();
-
-    pubGet();
-
-    // Loosen the constraints.
-    d.appDir({
-      "downgraded": ">=2.0.0"
-    }).create();
-
-    pubDowngrade(output: contains("downgraded 2.0.0 (was 3.0.0-dev)"));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/downgrade/doesnt_change_git_dependencies_test.dart b/sdk/lib/_internal/pub/test/downgrade/doesnt_change_git_dependencies_test.dart
deleted file mode 100644
index e1e7395..0000000
--- a/sdk/lib/_internal/pub/test/downgrade/doesnt_change_git_dependencies_test.dart
+++ /dev/null
@@ -1,43 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("doesn't change git dependencies", () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.0')
-    ]).create();
-
-    d.appDir({
-      "foo": {"git": "../foo.git"}
-    }).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-
-    d.git('foo.git', [
-      d.libDir('foo', 'foo 2'),
-      d.libPubspec('foo', '1.0.0')
-    ]).commit();
-
-    pubDowngrade();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/downgrade/dry_run_does_not_apply_changes_test.dart b/sdk/lib/_internal/pub/test/downgrade/dry_run_does_not_apply_changes_test.dart
deleted file mode 100644
index c1f8335..0000000
--- a/sdk/lib/_internal/pub/test/downgrade/dry_run_does_not_apply_changes_test.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("--dry-run shows report but does not apply changes", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0");
-      builder.serve("foo", "2.0.0");
-    });
-
-    // Create the first lockfile.
-    d.appDir({
-      "foo": "2.0.0"
-    }).create();
-
-    pubGet();
-
-    // Change the pubspec.
-    d.appDir({
-      "foo": "any"
-    }).create();
-
-    // Also delete the "packages" directory.
-    schedule(() {
-      deleteEntry(path.join(sandboxDir, appPath, "packages"));
-    });
-
-    // Do the dry run.
-    pubDowngrade(args: ["--dry-run"], output: allOf([
-      contains("< foo 1.0.0"),
-      contains("Would change 1 dependency.")
-    ]));
-
-    d.dir(appPath, [
-      // The lockfile should be unmodified.
-      d.matcherFile("pubspec.lock", contains("2.0.0")),
-      // The "packages" directory should not have been regenerated.
-      d.nothing("packages")
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/downgrade/unlock_dependers_test.dart b/sdk/lib/_internal/pub/test/downgrade/unlock_dependers_test.dart
deleted file mode 100644
index c329bdb..0000000
--- a/sdk/lib/_internal/pub/test/downgrade/unlock_dependers_test.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("downgrades a locked package's dependers in order to get it to "
-      "min version", () {
-    servePackages((builder) {
-      builder.serve("foo", "2.0.0", deps: {"bar": ">1.0.0"});
-      builder.serve("bar", "2.0.0");
-    });
-
-    d.appDir({"foo": "any", "bar": "any"}).create();
-
-    pubGet();
-
-    d.packagesDir({
-      "foo": "2.0.0",
-      "bar": "2.0.0"
-    }).validate();
-
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", deps: {"bar": "any"});
-      builder.serve("bar", "1.0.0");
-    });
-
-    pubDowngrade(args: ['bar']);
-
-    d.packagesDir({
-      "foo": "1.0.0",
-      "bar": "1.0.0"
-    }).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/downgrade/unlock_if_necessary_test.dart b/sdk/lib/_internal/pub/test/downgrade/unlock_if_necessary_test.dart
deleted file mode 100644
index 8561bb4..0000000
--- a/sdk/lib/_internal/pub/test/downgrade/unlock_if_necessary_test.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("downgrades one locked hosted package's dependencies if it's "
-      "necessary", () {
-    servePackages((builder) {
-      builder.serve("foo", "2.0.0", deps: {"foo_dep": "any"});
-      builder.serve("foo_dep", "2.0.0");
-    });
-
-    d.appDir({"foo": "any"}).create();
-
-    pubGet();
-
-    d.packagesDir({
-      "foo": "2.0.0",
-      "foo_dep": "2.0.0"
-    }).validate();
-
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", deps: {"foo_dep": "<2.0.0"});
-      builder.serve("foo_dep", "1.0.0");
-    });
-
-    pubDowngrade(args: ['foo']);
-
-    d.packagesDir({
-      "foo": "1.0.0",
-      "foo_dep": "1.0.0"
-    }).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/error_group_test.dart b/sdk/lib/_internal/pub/test/error_group_test.dart
deleted file mode 100644
index 331a1ff..0000000
--- a/sdk/lib/_internal/pub/test/error_group_test.dart
+++ /dev/null
@@ -1,446 +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 error_group_test;
-
-import 'dart:async';
-
-import 'package:unittest/unittest.dart';
-
-import '../lib/src/error_group.dart';
-import '../lib/src/utils.dart';
-
-ErrorGroup errorGroup;
-
-// TODO(nweiz): once there's a global error handler, we should test that it does
-// and does not get called at appropriate times. See issue 5958.
-//
-// One particular thing we should test that has no tests now is that a stream
-// that has a subscription added and subsequently canceled counts as having no
-// listeners.
-
-main() {
-  group('with no futures or streams', () {
-    setUp(() {
-      errorGroup = new ErrorGroup();
-    });
-
-    test('should pass signaled errors to .done', () {
-      expect(errorGroup.done, throwsFormatException);
-      errorGroup.signalError(new FormatException());
-    });
-
-    test("shouldn't allow additional futures or streams once an error has been "
-        "signaled", () {
-      expect(errorGroup.done, throwsFormatException);
-      errorGroup.signalError(new FormatException());
-
-      expect(() => errorGroup.registerFuture(new Future.value()),
-          throwsStateError);
-      expect(() => errorGroup.registerStream(
-          new StreamController(sync: true).stream),
-          throwsStateError);
-    });
-  });
-
-  group('with a single future', () {
-    Completer completer;
-    Future future;
-
-    setUp(() {
-      errorGroup = new ErrorGroup();
-      completer = new Completer();
-      future = errorGroup.registerFuture(completer.future);
-    });
-
-    test('should pass through a value from the future', () {
-      expect(future, completion(equals('value')));
-      expect(errorGroup.done, completes);
-      completer.complete('value');
-    });
-
-    test("shouldn't allow additional futures or streams once .done has "
-        "been called", () {
-      completer.complete('value');
-
-      expect(completer.future
-                 .then((_) => errorGroup.registerFuture(new Future.value())),
-             throwsStateError);
-      expect(completer.future
-                 .then((_) => errorGroup.registerStream(
-                     new StreamController(sync: true).stream)),
-            throwsStateError);
-    });
-
-    test('should pass through an exception from the future if it has a '
-        'listener', () {
-      expect(future, throwsFormatException);
-      // errorGroup shouldn't top-level the exception
-      completer.completeError(new FormatException());
-    });
-
-    test('should notify the error group of an exception from the future even '
-        'if it has a listener', () {
-      expect(future, throwsFormatException);
-      expect(errorGroup.done, throwsFormatException);
-      completer.completeError(new FormatException());
-    });
-
-    test('should pass a signaled exception to the future if it has a listener '
-        'and should ignore a subsequent value from that future', () {
-      expect(future, throwsFormatException);
-      // errorGroup shouldn't top-level the exception
-      errorGroup.signalError(new FormatException());
-      completer.complete('value');
-    });
-
-    test('should pass a signaled exception to the future if it has a listener '
-        'and should ignore a subsequent exception from that future', () {
-      expect(future, throwsFormatException);
-      // errorGroup shouldn't top-level the exception
-      errorGroup.signalError(new FormatException());
-      completer.completeError(new ArgumentError());
-    });
-
-    test('should notify the error group of a signaled exception even if the '
-        'future has a listener', () {
-      expect(future, throwsFormatException);
-      expect(errorGroup.done, throwsFormatException);
-      errorGroup.signalError(new FormatException());
-    });
-
-    test("should complete .done if the future receives a value even if the "
-        "future doesn't have a listener", () {
-      expect(errorGroup.done, completes);
-      completer.complete('value');
-
-      // A listener added afterwards should receive the value
-      expect(errorGroup.done.then((_) => future),
-          completion(equals('value')));
-    });
-
-    test("should pipe an exception from the future to .done if the future "
-        "doesn't have a listener", () {
-      expect(errorGroup.done, throwsFormatException);
-      completer.completeError(new FormatException());
-
-      // A listener added afterwards should receive the exception
-      expect(errorGroup.done.catchError((_) {
-        expect(future, throwsFormatException);
-      }), completes);
-    });
-
-    test("should pass a signaled exception to .done if the future doesn't have "
-        "a listener",
-        () {
-      expect(errorGroup.done, throwsFormatException);
-      errorGroup.signalError(new FormatException());
-
-      // A listener added afterwards should receive the exception
-      expect(errorGroup.done.catchError((_) {
-        completer.complete('value'); // should be ignored
-        expect(future, throwsFormatException);
-      }), completes);
-    });
-  });
-
-  group('with multiple futures', () {
-    Completer completer1;
-    Completer completer2;
-    Future future1;
-    Future future2;
-
-    setUp(() {
-      errorGroup = new ErrorGroup();
-      completer1 = new Completer();
-      completer2 = new Completer();
-      future1 = errorGroup.registerFuture(completer1.future);
-      future2 = errorGroup.registerFuture(completer2.future);
-    });
-
-    test("should pipe exceptions from one future to the other and to "
-        ".complete", () {
-      expect(future1, throwsFormatException);
-      expect(future2, throwsFormatException);
-      expect(errorGroup.done, throwsFormatException);
-
-      completer1.completeError(new FormatException());
-    });
-
-    test("each future should be able to complete with a value "
-        "independently", () {
-      expect(future1, completion(equals('value1')));
-      expect(future2, completion(equals('value2')));
-      expect(errorGroup.done, completes);
-
-      completer1.complete('value1');
-      completer2.complete('value2');
-    });
-
-    test("shouldn't throw a top-level exception if a future receives an error "
-        "after the other listened future completes", () {
-      expect(future1, completion(equals('value')));
-      completer1.complete('value');
-
-      expect(future1.then((_) {
-        // shouldn't cause a top-level exception
-        completer2.completeError(new FormatException());
-      }), completes);
-    });
-
-    test("shouldn't throw a top-level exception if an error is signaled after "
-        "one listened future completes", () {
-      expect(future1, completion(equals('value')));
-      completer1.complete('value');
-
-      expect(future1.then((_) {
-        // shouldn't cause a top-level exception
-        errorGroup.signalError(new FormatException());
-      }), completes);
-    });
-  });
-
-  group('with a single stream', () {
-    StreamController controller;
-    Stream stream;
-
-    setUp(() {
-      errorGroup = new ErrorGroup();
-      controller = new StreamController.broadcast(sync: true);
-      stream = errorGroup.registerStream(controller.stream);
-    });
-
-    test('should pass through values from the stream', () {
-      StreamIterator iter = new StreamIterator(stream);
-      iter.moveNext().then((hasNext) {
-        expect(hasNext, isTrue);
-        expect(iter.current, equals(1));
-        iter.moveNext().then((hasNext) {
-          expect(hasNext, isTrue);
-          expect(iter.current, equals(2));
-          expect(iter.moveNext(), completion(isFalse));
-        });
-      });
-      expect(errorGroup.done, completes);
-
-      controller..add(1)..add(2)..close();
-    });
-
-    test('should pass through an error from the stream if it has a '
-        'listener', () {
-      expect(stream.first, throwsFormatException);
-      // errorGroup shouldn't top-level the exception
-      controller.addError(new FormatException());
-    });
-
-    test('should notify the error group of an exception from the stream even '
-        'if it has a listener', () {
-      expect(stream.first, throwsFormatException);
-      expect(errorGroup.done, throwsFormatException);
-      controller.addError(new FormatException());
-    });
-
-    test('should pass a signaled exception to the stream if it has a listener '
-         'and should unsubscribe that stream', () {
-      // errorGroup shouldn't top-level the exception
-      expect(stream.first, throwsFormatException);
-      errorGroup.signalError(new FormatException());
-
-      expect(newFuture(() {
-        controller.add('value');
-      }), completes);
-    });
-
-    test('should notify the error group of a signaled exception even if the '
-        'stream has a listener', () {
-      expect(stream.first, throwsFormatException);
-      expect(errorGroup.done, throwsFormatException);
-      errorGroup.signalError(new FormatException());
-    });
-
-    test("should see one value and complete .done when the stream is done even "
-         "if the stream doesn't have a listener", () {
-      expect(errorGroup.done, completes);
-      controller.add('value');
-      controller.close();
-
-      // Now that broadcast controllers have been removed a listener should
-      // see the value that has been put into the controller.
-      expect(errorGroup.done.then((_) => stream.toList()),
-          completion(equals(['value'])));
-    });
-
-  });
-
-  group('with a single single-subscription stream', () {
-    StreamController controller;
-    Stream stream;
-
-    setUp(() {
-      errorGroup = new ErrorGroup();
-      controller = new StreamController(sync: true);
-      stream = errorGroup.registerStream(controller.stream);
-    });
-
-    test("should complete .done when the stream is done even if the stream "
-        "doesn't have a listener", () {
-      expect(errorGroup.done, completes);
-      controller.add('value');
-      controller.close();
-
-      // A listener added afterwards should receive the value
-      expect(errorGroup.done.then((_) => stream.toList()),
-          completion(equals(['value'])));
-    });
-
-    test("should pipe an exception from the stream to .done if the stream "
-        "doesn't have a listener", () {
-      expect(errorGroup.done, throwsFormatException);
-      controller.addError(new FormatException());
-
-      // A listener added afterwards should receive the exception
-      expect(errorGroup.done.catchError((_) {
-        controller.add('value'); // should be ignored
-        expect(stream.first, throwsFormatException);
-      }), completes);
-    });
-
-    test("should pass a signaled exception to .done if the stream doesn't "
-        "have a listener",
-        () {
-      expect(errorGroup.done, throwsFormatException);
-      errorGroup.signalError(new FormatException());
-
-      // A listener added afterwards should receive the exception
-      expect(errorGroup.done.catchError((_) {
-        controller.add('value'); // should be ignored
-        expect(stream.first, throwsFormatException);
-      }), completes);
-    });
-  });
-
-  group('with multiple streams', () {
-    StreamController controller1;
-    StreamController controller2;
-    Stream stream1;
-    Stream stream2;
-
-    setUp(() {
-      errorGroup = new ErrorGroup();
-      controller1 = new StreamController.broadcast(sync: true);
-      controller2 = new StreamController.broadcast(sync: true);
-      stream1 = errorGroup.registerStream(controller1.stream);
-      stream2 = errorGroup.registerStream(controller2.stream);
-    });
-
-    test("should pipe exceptions from one stream to the other and to .done",
-        () {
-      expect(stream1.first, throwsFormatException);
-      expect(stream2.first, throwsFormatException);
-      expect(errorGroup.done, throwsFormatException);
-
-      controller1.addError(new FormatException());
-    });
-
-    test("each future should be able to emit values independently", () {
-      expect(stream1.toList(), completion(equals(['value1.1', 'value1.2'])));
-      expect(stream2.toList(), completion(equals(['value2.1', 'value2.2'])));
-      expect(errorGroup.done, completes);
-
-      controller1..add('value1.1')..add('value1.2')..close();
-      controller2..add('value2.1')..add('value2.2')..close();
-    });
-
-    test("shouldn't throw a top-level exception if a stream receives an error "
-        "after the other listened stream completes", () {
-      var signal = new Completer();
-      expect(stream1.toList().whenComplete(signal.complete),
-             completion(equals(['value1', 'value2'])));
-      controller1..add('value1')..add('value2')..close();
-
-      expect(signal.future.then((_) {
-        // shouldn't cause a top-level exception
-        controller2.addError(new FormatException());
-      }), completes);
-    });
-
-    test("shouldn't throw a top-level exception if an error is signaled after "
-        "one listened stream completes", () {
-      var signal = new Completer();
-      expect(stream1.toList().whenComplete(signal.complete),
-             completion(equals(['value1', 'value2'])));
-      controller1..add('value1')..add('value2')..close();
-
-      expect(signal.future.then((_) {
-        // shouldn't cause a top-level exception
-        errorGroup.signalError(new FormatException());
-      }), completes);
-    });
-  });
-
-  group('with a stream and a future', () {
-    StreamController controller;
-    Stream stream;
-    Completer completer;
-    Future future;
-
-    setUp(() {
-      errorGroup = new ErrorGroup();
-      controller = new StreamController.broadcast(sync: true);
-      stream = errorGroup.registerStream(controller.stream);
-      completer = new Completer();
-      future = errorGroup.registerFuture(completer.future);
-    });
-
-    test("should pipe exceptions from the stream to the future", () {
-      expect(stream.first, throwsFormatException);
-      expect(future, throwsFormatException);
-      expect(errorGroup.done, throwsFormatException);
-
-      controller.addError(new FormatException());
-    });
-
-    test("should pipe exceptions from the future to the stream", () {
-      expect(stream.first, throwsFormatException);
-      expect(future, throwsFormatException);
-      expect(errorGroup.done, throwsFormatException);
-
-      completer.completeError(new FormatException());
-    });
-
-    test("the stream and the future should be able to complete/emit values "
-        "independently", () {
-      expect(stream.toList(), completion(equals(['value1.1', 'value1.2'])));
-      expect(future, completion(equals('value2.0')));
-      expect(errorGroup.done, completes);
-
-      controller..add('value1.1')..add('value1.2')..close();
-      completer.complete('value2.0');
-    });
-
-    test("shouldn't throw a top-level exception if the stream receives an error "
-        "after the listened future completes", () {
-      expect(future, completion(equals('value')));
-      completer.complete('value');
-
-      expect(future.then((_) {
-        // shouldn't cause a top-level exception
-        controller.addError(new FormatException());
-      }), completes);
-    });
-
-    test("shouldn't throw a top-level exception if the future receives an "
-        "error after the listened stream completes", () {
-      var signal = new Completer();
-      expect(stream.toList().whenComplete(signal.complete),
-             completion(equals(['value1', 'value2'])));
-      controller..add('value1')..add('value2')..close();
-
-      expect(signal.future.then((_) {
-        // shouldn't cause a top-level exception
-        completer.completeError(new FormatException());
-      }), completes);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/broken_symlink_test.dart b/sdk/lib/_internal/pub/test/get/broken_symlink_test.dart
deleted file mode 100644
index 24a7c0b..0000000
--- a/sdk/lib/_internal/pub/test/get/broken_symlink_test.dart
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as path;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('replaces a broken "packages" symlink', () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.libDir('foo'),
-      d.dir("bin")
-    ]).create();
-
-    // Create a broken "packages" symlink in "bin".
-    scheduleSymlink("nonexistent", path.join(appPath, "packages"));
-
-    pubGet();
-
-    d.dir(appPath, [
-      d.dir("bin", [
-        d.dir("packages", [
-          d.dir("myapp", [
-            d.file('foo.dart', 'main() => "foo";')
-          ])
-        ])
-      ])
-    ]).validate();
-  });
-
-  integration('replaces a broken secondary "packages" symlink', () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.libDir('foo'),
-      d.dir("bin")
-    ]).create();
-
-    // Create a broken "packages" symlink in "bin".
-    scheduleSymlink("nonexistent", path.join(appPath, "bin", "packages"));
-
-    pubGet();
-
-    d.dir(appPath, [
-      d.dir("bin", [
-        d.dir("packages", [
-          d.dir("myapp", [
-            d.file('foo.dart', 'main() => "foo";')
-          ])
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/cache_transformed_dependency_test.dart b/sdk/lib/_internal/pub/test/get/cache_transformed_dependency_test.dart
deleted file mode 100644
index 5d0d354..0000000
--- a/sdk/lib/_internal/pub/test/get/cache_transformed_dependency_test.dart
+++ /dev/null
@@ -1,446 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const MODE_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class ModeTransformer extends Transformer {
-  final BarbackSettings _settings;
-
-  ModeTransformer.asPlugin(this._settings);
-
-  String get allowedExtensions => '.dart';
-
-  void apply(Transform transform) {
-    return transform.primaryInput.readAsString().then((contents) {
-      transform.addOutput(new Asset.fromString(
-          transform.primaryInput.id,
-          contents.replaceAll("MODE", _settings.mode.name)));
-    });
-  }
-}
-""";
-
-const HAS_INPUT_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class HasInputTransformer extends Transformer {
-  HasInputTransformer.asPlugin();
-
-  bool get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    return Future.wait([
-      transform.hasInput(new AssetId("foo", "lib/foo.dart")),
-      transform.hasInput(new AssetId("foo", "lib/does/not/exist.dart"))
-    ]).then((results) {
-      transform.addOutput(new Asset.fromString(
-          transform.primaryInput.id,
-          "lib/foo.dart: \${results.first}, "
-              "lib/does/not/exist.dart: \${results.last}"));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-
-  integration("caches a transformed dependency", () {
-    servePackages((builder) {
-      builder.serveRepoPackage('barback');
-
-      builder.serve("foo", "1.2.3",
-          deps: {'barback': 'any'},
-          pubspec: {'transformers': ['foo']},
-          contents: [
-        d.dir("lib", [
-          d.file("transformer.dart", replaceTransformer("Hello", "Goodbye")),
-          d.file("foo.dart", "final message = 'Hello!';")
-        ])
-      ]);
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    pubGet(output: contains("Precompiled foo."));
-
-    d.dir(appPath, [
-      d.dir(".pub/deps/debug/foo/lib", [
-        d.file("foo.dart", "final message = 'Goodbye!';")
-      ])
-    ]).validate();
-  });
-
-  integration("caches a dependency transformed by its dependency", () {
-    servePackages((builder) {
-      builder.serveRepoPackage('barback');
-
-      builder.serve("foo", "1.2.3",
-          deps: {'bar': '1.2.3'},
-          pubspec: {'transformers': ['bar']},
-          contents: [
-        d.dir("lib", [
-          d.file("foo.dart", "final message = 'Hello!';")
-        ])
-      ]);
-
-      builder.serve("bar", "1.2.3",
-          deps: {'barback': 'any'},
-          contents: [
-        d.dir("lib", [
-          d.file("transformer.dart", replaceTransformer("Hello", "Goodbye"))
-        ])
-      ]);
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    pubGet(output: contains("Precompiled foo."));
-
-    d.dir(appPath, [
-      d.dir(".pub/deps/debug/foo/lib", [
-        d.file("foo.dart", "final message = 'Goodbye!';")
-      ])
-    ]).validate();
-  });
-
-  integration("doesn't cache an untransformed dependency", () {
-    servePackages((builder) {
-      builder.serveRepoPackage('barback');
-
-      builder.serve("foo", "1.2.3",
-          contents: [
-        d.dir("lib", [
-          d.file("foo.dart", "final message = 'Hello!';")
-        ])
-      ]);
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    pubGet(output: isNot(contains("Precompiled foo.")));
-
-    d.dir(appPath, [d.nothing(".pub/deps")]).validate();
-  });
-
-  integration("recaches when the dependency is updated", () {
-    servePackages((builder) {
-      builder.serveRepoPackage('barback');
-
-      builder.serve("foo", "1.2.3",
-          deps: {'barback': 'any'},
-          pubspec: {'transformers': ['foo']},
-          contents: [
-        d.dir("lib", [
-          d.file("transformer.dart", replaceTransformer("Hello", "Goodbye")),
-          d.file("foo.dart", "final message = 'Hello!';")
-        ])
-      ]);
-
-      builder.serve("foo", "1.2.4",
-          deps: {'barback': 'any'},
-          pubspec: {'transformers': ['foo']},
-          contents: [
-        d.dir("lib", [
-          d.file("transformer.dart", replaceTransformer("Hello", "See ya")),
-          d.file("foo.dart", "final message = 'Hello!';")
-        ])
-      ]);
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    pubGet(output: contains("Precompiled foo."));
-
-    d.dir(appPath, [
-      d.dir(".pub/deps/debug/foo/lib", [
-        d.file("foo.dart", "final message = 'Goodbye!';")
-      ])
-    ]).validate();
-
-    // Upgrade to the new version of foo.
-    d.appDir({"foo": "1.2.4"}).create();
-
-    pubGet(output: contains("Precompiled foo."));
-
-    d.dir(appPath, [
-      d.dir(".pub/deps/debug/foo/lib", [
-        d.file("foo.dart", "final message = 'See ya!';")
-      ])
-    ]).validate();
-  });
-
-  integration("recaches when a transitive dependency is updated", () {
-    servePackages((builder) {
-      builder.serveRepoPackage('barback');
-
-      builder.serve("foo", "1.2.3",
-          deps: {
-            'barback': 'any',
-            'bar': 'any'
-          },
-          pubspec: {'transformers': ['foo']},
-          contents: [
-        d.dir("lib", [
-          d.file("transformer.dart", replaceTransformer("Hello", "Goodbye")),
-          d.file("foo.dart", "final message = 'Hello!';")
-        ])
-      ]);
-
-      builder.serve("bar", "5.6.7");
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-    pubGet(output: contains("Precompiled foo."));
-
-    servePackages((builder) => builder.serve("bar", "6.0.0"));
-    pubUpgrade(output: contains("Precompiled foo."));
-  });
-
-  integration("doesn't recache when an unrelated dependency is updated", () {
-    servePackages((builder) {
-      builder.serveRepoPackage('barback');
-
-      builder.serve("foo", "1.2.3",
-          deps: {'barback': 'any'},
-          pubspec: {'transformers': ['foo']},
-          contents: [
-        d.dir("lib", [
-          d.file("transformer.dart", replaceTransformer("Hello", "Goodbye")),
-          d.file("foo.dart", "final message = 'Hello!';")
-        ])
-      ]);
-
-      builder.serve("bar", "5.6.7");
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-    pubGet(output: contains("Precompiled foo."));
-
-    servePackages((builder) => builder.serve("bar", "6.0.0"));
-    pubUpgrade(output: isNot(contains("Precompiled foo.")));
-  });
-
-  integration("caches the dependency in debug mode", () {
-    servePackages((builder) {
-      builder.serveRepoPackage('barback');
-
-      builder.serve("foo", "1.2.3",
-          deps: {'barback': 'any'},
-          pubspec: {'transformers': ['foo']},
-          contents: [
-        d.dir("lib", [
-          d.file("transformer.dart", MODE_TRANSFORMER),
-          d.file("foo.dart", "final mode = 'MODE';")
-        ])
-      ]);
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    pubGet(output: contains("Precompiled foo."));
-
-    d.dir(appPath, [
-      d.dir(".pub/deps/debug/foo/lib", [
-        d.file("foo.dart", "final mode = 'debug';")
-      ])
-    ]).validate();
-  });
-
-  integration("loads code from the cache", () {
-    servePackages((builder) {
-      builder.serveRepoPackage('barback');
-
-      builder.serve("foo", "1.2.3",
-          deps: {'barback': 'any'},
-          pubspec: {'transformers': ['foo']},
-          contents: [
-        d.dir("lib", [
-          d.file("transformer.dart", replaceTransformer("Hello", "Goodbye")),
-          d.file("foo.dart", "final message = 'Hello!';")
-        ])
-      ]);
-    });
-
-    d.dir(appPath, [
-      d.appPubspec({"foo": "1.2.3"}),
-      d.dir('bin', [
-        d.file('script.dart', """
-          import 'package:foo/foo.dart';
-
-          void main() => print(message);""")
-      ])
-    ]).create();
-
-    pubGet(output: contains("Precompiled foo."));
-
-    d.dir(appPath, [
-      d.dir(".pub/deps/debug/foo/lib", [
-        d.file("foo.dart", "final message = 'Modified!';")
-      ])
-    ]).create();
-
-    var pub = pubRun(args: ["bin/script"]);
-    pub.stdout.expect("Modified!");
-    pub.shouldExit();
-  });
-
-  integration("doesn't re-transform code loaded from the cache", () {
-    servePackages((builder) {
-      builder.serveRepoPackage('barback');
-
-      builder.serve("foo", "1.2.3",
-          deps: {'barback': 'any'},
-          pubspec: {'transformers': ['foo']},
-          contents: [
-        d.dir("lib", [
-          d.file("transformer.dart", replaceTransformer("Hello", "Goodbye")),
-          d.file("foo.dart", "final message = 'Hello!';")
-        ])
-      ]);
-    });
-
-    d.dir(appPath, [
-      d.appPubspec({"foo": "1.2.3"}),
-      d.dir('bin', [
-        d.file('script.dart', """
-          import 'package:foo/foo.dart';
-
-          void main() => print(message);""")
-      ])
-    ]).create();
-
-    pubGet(output: contains("Precompiled foo."));
-
-    // Manually reset the cache to its original state to prove that the
-    // transformer won't be run again on it.
-    d.dir(appPath, [
-      d.dir(".pub/deps/debug/foo/lib", [
-        d.file("foo.dart", "final message = 'Hello!';")
-      ])
-    ]).create();
-
-    var pub = pubRun(args: ["bin/script"]);
-    pub.stdout.expect("Hello!");
-    pub.shouldExit();
-  });
-
-  // Regression test for issue 21087.
-  integration("hasInput works for static packages", () {
-    servePackages((builder) {
-      builder.serveRepoPackage('barback');
-
-      builder.serve("foo", "1.2.3",
-          deps: {'barback': 'any'},
-          pubspec: {'transformers': ['foo']},
-          contents: [
-        d.dir("lib", [
-          d.file("transformer.dart", replaceTransformer("Hello", "Goodbye")),
-          d.file("foo.dart", "void main() => print('Hello!');")
-        ])
-      ]);
-    });
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": "1.2.3"},
-        "transformers": ["myapp/src/transformer"]
-      }),
-      d.dir("lib", [d.dir("src", [
-        d.file("transformer.dart", HAS_INPUT_TRANSFORMER)
-      ])]),
-      d.dir("web", [
-        d.file("foo.txt", "foo")
-      ])
-    ]).create();
-
-    pubGet(output: contains("Precompiled foo."));
-
-    pubServe();
-    requestShouldSucceed("foo.txt",
-        "lib/foo.dart: true, lib/does/not/exist.dart: false");
-    endPubServe();
-  });
-
-  // Regression test for issue 21810.
-  integration("decaches when the dependency is updated to something "
-      "untransformed", () {
-    servePackages((builder) {
-      builder.serveRepoPackage('barback');
-
-      builder.serve("foo", "1.2.3",
-          deps: {'barback': 'any'},
-          pubspec: {'transformers': ['foo']},
-          contents: [
-        d.dir("lib", [
-          d.file("transformer.dart", replaceTransformer("Hello", "Goodbye")),
-          d.file("foo.dart", "final message = 'Hello!';")
-        ])
-      ]);
-
-      builder.serve("foo", "1.2.4",
-          deps: {'barback': 'any'},
-          contents: [
-        d.dir("lib", [
-          d.file("foo.dart", "final message = 'Hello!';")
-        ])
-      ]);
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    pubGet(output: contains("Precompiled foo."));
-
-    d.dir(appPath, [
-      d.dir(".pub/deps/debug/foo/lib", [
-        d.file("foo.dart", "final message = 'Goodbye!';")
-      ])
-    ]).validate();
-
-    // Upgrade to the new version of foo.
-    d.appDir({"foo": "1.2.4"}).create();
-
-    pubGet(output: isNot(contains("Precompiled foo.")));
-
-    d.dir(appPath, [
-      d.nothing(".pub/deps/debug/foo")
-    ]).validate();
-  });
-}
-
-String replaceTransformer(String input, String output) {
-  return """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class ReplaceTransformer extends Transformer {
-  ReplaceTransformer.asPlugin();
-
-  String get allowedExtensions => '.dart';
-
-  Future apply(Transform transform) {
-    return transform.primaryInput.readAsString().then((contents) {
-      transform.addOutput(new Asset.fromString(
-          transform.primaryInput.id,
-          contents.replaceAll("$input", "$output")));
-    });
-  }
-}
-""";
-}
diff --git a/sdk/lib/_internal/pub/test/get/dry_run_does_not_apply_changes_test.dart b/sdk/lib/_internal/pub/test/get/dry_run_does_not_apply_changes_test.dart
deleted file mode 100644
index 7a07d25..0000000
--- a/sdk/lib/_internal/pub/test/get/dry_run_does_not_apply_changes_test.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("--dry-run shows but does not apply changes", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0");
-    });
-
-    d.appDir({
-      "foo": "1.0.0"
-    }).create();
-
-    pubGet(args: ["--dry-run"], output: allOf([
-      contains("+ foo 1.0.0"),
-      contains("Would change 1 dependency.")
-    ]));
-
-    d.dir(appPath, [
-      // The lockfile should not be created.
-      d.nothing("pubspec.lock"),
-      // The "packages" directory should not have been generated.
-      d.nothing("packages")
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/check_out_and_upgrade_test.dart b/sdk/lib/_internal/pub/test/get/git/check_out_and_upgrade_test.dart
deleted file mode 100644
index f2ff3bf..0000000
--- a/sdk/lib/_internal/pub/test/get/git/check_out_and_upgrade_test.dart
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('checks out and upgrades a package from Git', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.0')
-    ]).create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-    pubGet();
-
-    d.dir(cachePath, [
-      d.dir('git', [
-        d.dir('cache', [d.gitPackageRepoCacheDir('foo')]),
-        d.gitPackageRevisionCacheDir('foo')
-      ])
-    ]).validate();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-
-    d.git('foo.git', [
-      d.libDir('foo', 'foo 2'),
-      d.libPubspec('foo', '1.0.0')
-    ]).commit();
-
-    pubUpgrade(output: contains("Changed 1 dependency!"));
-
-    // When we download a new version of the git package, we should re-use the
-    // git/cache directory but create a new git/ directory.
-    d.dir(cachePath, [
-      d.dir('git', [
-        d.dir('cache', [d.gitPackageRepoCacheDir('foo')]),
-        d.gitPackageRevisionCacheDir('foo'),
-        d.gitPackageRevisionCacheDir('foo', 2)
-      ])
-    ]).validate();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo 2";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/check_out_branch_test.dart b/sdk/lib/_internal/pub/test/get/git/check_out_branch_test.dart
deleted file mode 100644
index ad4cd8d..0000000
--- a/sdk/lib/_internal/pub/test/get/git/check_out_branch_test.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('checks out a package at a specific branch from Git', () {
-    ensureGit();
-
-    var repo = d.git('foo.git', [
-      d.libDir('foo', 'foo 1'),
-      d.libPubspec('foo', '1.0.0')
-    ]);
-    repo.create();
-    repo.runGit(["branch", "old"]);
-
-    d.git('foo.git', [
-      d.libDir('foo', 'foo 2'),
-      d.libPubspec('foo', '1.0.0')
-    ]).commit();
-
-    d.appDir({
-      "foo": {"git": {"url": "../foo.git", "ref": "old"}}
-    }).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo 1";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/check_out_revision_test.dart b/sdk/lib/_internal/pub/test/get/git/check_out_revision_test.dart
deleted file mode 100644
index bf1851e..0000000
--- a/sdk/lib/_internal/pub/test/get/git/check_out_revision_test.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('checks out a package at a specific revision from Git', () {
-    ensureGit();
-
-    var repo = d.git('foo.git', [
-      d.libDir('foo', 'foo 1'),
-      d.libPubspec('foo', '1.0.0')
-    ]);
-    repo.create();
-    var commit = repo.revParse('HEAD');
-
-    d.git('foo.git', [
-      d.libDir('foo', 'foo 2'),
-      d.libPubspec('foo', '1.0.0')
-    ]).commit();
-
-    d.appDir({
-      "foo": {"git": {"url": "../foo.git", "ref": commit}}
-    }).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo 1";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/check_out_test.dart b/sdk/lib/_internal/pub/test/get/git/check_out_test.dart
deleted file mode 100644
index a12b1be..0000000
--- a/sdk/lib/_internal/pub/test/get/git/check_out_test.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('checks out a package from Git', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.0')
-    ]).create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-    pubGet();
-
-    d.dir(cachePath, [
-      d.dir('git', [
-        d.dir('cache', [d.gitPackageRepoCacheDir('foo')]),
-        d.gitPackageRevisionCacheDir('foo')
-      ])
-    ]).validate();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/check_out_transitive_test.dart b/sdk/lib/_internal/pub/test/get/git/check_out_transitive_test.dart
deleted file mode 100644
index 24ee172..0000000
--- a/sdk/lib/_internal/pub/test/get/git/check_out_transitive_test.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('checks out packages transitively from Git', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.0', deps: {
-        "bar": {"git": "../bar.git"}
-      })
-    ]).create();
-
-    d.git('bar.git', [
-      d.libDir('bar'),
-      d.libPubspec('bar', '1.0.0')
-    ]).create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-    pubGet();
-
-    d.dir(cachePath, [
-      d.dir('git', [
-        d.dir('cache', [
-          d.gitPackageRepoCacheDir('foo'),
-          d.gitPackageRepoCacheDir('bar')
-        ]),
-        d.gitPackageRevisionCacheDir('foo'),
-        d.gitPackageRevisionCacheDir('bar')
-      ])
-    ]).validate();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ]),
-      d.dir('bar', [
-        d.file('bar.dart', 'main() => "bar";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/check_out_twice_test.dart b/sdk/lib/_internal/pub/test/get/git/check_out_twice_test.dart
deleted file mode 100644
index ee1f553..0000000
--- a/sdk/lib/_internal/pub/test/get/git/check_out_twice_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('checks out a package from Git twice', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.0')
-    ]).create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-    pubGet();
-
-    d.dir(cachePath, [
-      d.dir('git', [
-        d.dir('cache', [d.gitPackageRepoCacheDir('foo')]),
-        d.gitPackageRevisionCacheDir('foo')
-      ])
-    ]).validate();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-
-    // Verify that nothing breaks if we get a Git revision that's already
-    // in the cache.
-    pubUpgrade();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart b/sdk/lib/_internal/pub/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart
deleted file mode 100644
index 3ebc04c..0000000
--- a/sdk/lib/_internal/pub/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/io.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  // Regression test for issue 20947.
-  integration('checks out an unfetched and locked revision of a cached '
-      'repository', () {
-    ensureGit();
-
-    // In order to get a lockfile that refers to a newer revision than is in the
-    // cache, we'll switch between two caches. First we ensure that the repo is
-    // in the first cache.
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.0')
-    ]).create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-    pubGet();
-
-    // Switch to a new cache.
-    schedule(() => renameDir(
-        p.join(sandboxDir, cachePath), p.join(sandboxDir, "$cachePath.old")));
-
-    // Make the lockfile point to a new revision of the git repository.
-    d.git('foo.git', [
-      d.libDir('foo', 'foo 2'),
-      d.libPubspec('foo', '1.0.0')
-    ]).commit();
-
-    pubUpgrade(output: contains("Changed 1 dependency!"));
-
-    // Switch back to the old cache.
-    schedule(() {
-      var cacheDir = p.join(sandboxDir, cachePath);
-      deleteEntry(cacheDir);
-      renameDir(p.join(sandboxDir, "$cachePath.old"), cacheDir);
-    });
-
-    // Get the updated version of the git dependency based on the lockfile.
-    pubGet();
-
-    d.dir(cachePath, [
-      d.dir('git', [
-        d.dir('cache', [d.gitPackageRepoCacheDir('foo')]),
-        d.gitPackageRevisionCacheDir('foo'),
-        d.gitPackageRevisionCacheDir('foo', 2)
-      ])
-    ]).validate();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo 2";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/check_out_with_trailing_slash_test.dart b/sdk/lib/_internal/pub/test/get/git/check_out_with_trailing_slash_test.dart
deleted file mode 100644
index e49e508..0000000
--- a/sdk/lib/_internal/pub/test/get/git/check_out_with_trailing_slash_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  group("(regression)", () {
-    integration('checks out a package from Git with a trailing slash', () {
-      ensureGit();
-
-      d.git('foo.git', [
-        d.libDir('foo'),
-        d.libPubspec('foo', '1.0.0')
-      ]).create();
-
-      d.appDir({"foo": {"git": "../foo.git/"}}).create();
-
-      pubGet();
-
-      d.dir(cachePath, [
-        d.dir('git', [
-          d.dir('cache', [d.gitPackageRepoCacheDir('foo')]),
-          d.gitPackageRevisionCacheDir('foo')
-        ])
-      ]).validate();
-
-      d.dir(packagesPath, [
-        d.dir('foo', [
-          d.file('foo.dart', 'main() => "foo";')
-        ])
-      ]).validate();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/dependency_name_match_pubspec_test.dart b/sdk/lib/_internal/pub/test/get/git/dependency_name_match_pubspec_test.dart
deleted file mode 100644
index 880a251..0000000
--- a/sdk/lib/_internal/pub/test/get/git/dependency_name_match_pubspec_test.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('requires the dependency name to match the remote pubspec '
-      'name', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.0')
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "weirdname": {"git": "../foo.git"}
-      })
-    ]).create();
-
-    pubGet(error: contains('"name" field doesn\'t match expected name '
-        '"weirdname".'), exitCode: exit_codes.DATA);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/different_repo_name_test.dart b/sdk/lib/_internal/pub/test/get/git/different_repo_name_test.dart
deleted file mode 100644
index bafba0b..0000000
--- a/sdk/lib/_internal/pub/test/get/git/different_repo_name_test.dart
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('doesn\'t require the repository name to match the name in the '
-      'pubspec', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('weirdname'),
-      d.libPubspec('weirdname', '1.0.0')
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "weirdname": {"git": "../foo.git"}
-      })
-    ]).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('weirdname', [
-        d.file('weirdname.dart', 'main() => "weirdname";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/doesnt_fetch_if_nothing_changes_test.dart b/sdk/lib/_internal/pub/test/get/git/doesnt_fetch_if_nothing_changes_test.dart
deleted file mode 100644
index 54cd98c..0000000
--- a/sdk/lib/_internal/pub/test/get/git/doesnt_fetch_if_nothing_changes_test.dart
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/io.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("doesn't re-fetch a repository if nothing changes", () {
-    ensureGit();
-
-    var repo = d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.0')
-    ]);
-    repo.create();
-
-    d.appDir({
-      "foo": {"git": {"url": "../foo.git"}}
-    }).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-
-    // Delete the repo. This will cause "pub get" to fail if it tries to
-    // re-fetch.
-    schedule(() => deleteEntry(p.join(sandboxDir, 'foo.git')));
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/lock_version_test.dart b/sdk/lib/_internal/pub/test/get/git/lock_version_test.dart
deleted file mode 100644
index 0d76457..0000000
--- a/sdk/lib/_internal/pub/test/get/git/lock_version_test.dart
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/io.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('keeps a Git package locked to the version in the lockfile', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.0')
-    ]).create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-    // This get should lock the foo.git dependency to the current revision.
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-
-    // Delete the packages path to simulate a new checkout of the application.
-    schedule(() => deleteEntry(path.join(sandboxDir, packagesPath)));
-
-    d.git('foo.git', [
-      d.libDir('foo', 'foo 2'),
-      d.libPubspec('foo', '1.0.0')
-    ]).commit();
-
-    // This get shouldn't upgrade the foo.git dependency due to the lockfile.
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/locked_revision_without_repo_test.dart b/sdk/lib/_internal/pub/test/get/git/locked_revision_without_repo_test.dart
deleted file mode 100644
index 137e384..0000000
--- a/sdk/lib/_internal/pub/test/get/git/locked_revision_without_repo_test.dart
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/io.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-// Regression test for issue 16470.
-
-main() {
-  initConfig();
-  integration('checks out the repository for a locked revision', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.0')
-    ]).create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-    // This get should lock the foo.git dependency to the current revision.
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-
-    // Delete the packages path and the cache to simulate a brand new checkout
-    // of the application.
-    schedule(() => deleteEntry(path.join(sandboxDir, packagesPath)));
-    schedule(() => deleteEntry(path.join(sandboxDir, cachePath)));
-
-    d.git('foo.git', [
-      d.libDir('foo', 'foo 2'),
-      d.libPubspec('foo', '1.0.0')
-    ]).commit();
-
-    // This get shouldn't upgrade the foo.git dependency due to the lockfile.
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/require_pubspec_name_test.dart b/sdk/lib/_internal/pub/test/get/git/require_pubspec_name_test.dart
deleted file mode 100644
index 530cc82..0000000
--- a/sdk/lib/_internal/pub/test/get/git/require_pubspec_name_test.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('requires the dependency to have a pubspec with a name '
-      'field', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.pubspec({})
-    ]).create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-    pubGet(error: contains('Missing the required "name" field.'),
-        exitCode: exit_codes.DATA);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/require_pubspec_test.dart b/sdk/lib/_internal/pub/test/get/git/require_pubspec_test.dart
deleted file mode 100644
index 82d1c83..0000000
--- a/sdk/lib/_internal/pub/test/get/git/require_pubspec_test.dart
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('requires the dependency to have a pubspec', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo')
-    ]).create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-    pubGet(error: new RegExp(r'Could not find a file named "pubspec\.yaml" '
-        r'in "[^\n]*"\.'));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/stay_locked_if_compatible_test.dart b/sdk/lib/_internal/pub/test/get/git/stay_locked_if_compatible_test.dart
deleted file mode 100644
index ff9764f..0000000
--- a/sdk/lib/_internal/pub/test/get/git/stay_locked_if_compatible_test.dart
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("doesn't upgrade a locked Git package with a new compatible "
-      "constraint", () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo', 'foo 1.0.0'),
-      d.libPubspec("foo", "1.0.0")
-    ]).create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo 1.0.0";')
-      ])
-    ]).validate();
-
-    d.git('foo.git', [
-      d.libDir('foo', 'foo 1.0.1'),
-      d.libPubspec("foo", "1.0.1")
-    ]).commit();
-
-    d.appDir({"foo": {"git": "../foo.git", "version": ">=1.0.0"}}).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo 1.0.0";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/git/unlock_if_incompatible_test.dart b/sdk/lib/_internal/pub/test/get/git/unlock_if_incompatible_test.dart
deleted file mode 100644
index b7b3a35..0000000
--- a/sdk/lib/_internal/pub/test/get/git/unlock_if_incompatible_test.dart
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('upgrades a locked Git package with a new incompatible '
-      'constraint', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '0.5.0')
-    ]).create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-
-    d.git('foo.git', [
-      d.libDir('foo', 'foo 1.0.0'),
-      d.libPubspec("foo", "1.0.0")
-    ]).commit();
-
-    d.appDir({"foo": {"git": "../foo.git", "version": ">=1.0.0"}}).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo 1.0.0";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/hosted/avoid_network_requests_test.dart b/sdk/lib/_internal/pub/test/get/hosted/avoid_network_requests_test.dart
deleted file mode 100644
index c651b8f..0000000
--- a/sdk/lib/_internal/pub/test/get/hosted/avoid_network_requests_test.dart
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-
-  integration('only requests versions that are needed during solving', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0");
-      builder.serve("foo", "1.1.0");
-      builder.serve("foo", "1.2.0");
-      builder.serve("bar", "1.0.0");
-      builder.serve("bar", "1.1.0");
-      builder.serve("bar", "1.2.0");
-    });
-
-    d.appDir({
-      "foo": "any"
-    }).create();
-
-    // Get once so it gets cached.
-    pubGet();
-
-    // Clear the cache. We don't care about anything that was served during
-    // the initial get.
-    getRequestedPaths();
-
-    // Add "bar" to the dependencies.
-    d.appDir({
-      "foo": "any",
-      "bar": "any"
-    }).create();
-
-    // Run the solver again.
-    pubGet();
-
-    d.packagesDir({
-      "foo": "1.2.0",
-      "bar": "1.2.0"
-    }).validate();
-
-    // The get should not have done any network requests since the lock file is
-    // up to date.
-    getRequestedPaths().then((paths) {
-      expect(paths, unorderedEquals([
-        // Bar should be requested because it's new, but not foo.
-        "api/packages/bar",
-        // Need to download it.
-        "packages/bar/versions/1.2.0.tar.gz"
-      ]));
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/hosted/cached_pubspec_test.dart b/sdk/lib/_internal/pub/test/get/hosted/cached_pubspec_test.dart
deleted file mode 100644
index 77a3a3f..0000000
--- a/sdk/lib/_internal/pub/test/get/hosted/cached_pubspec_test.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-
-  integration('does not request a pubspec for a cached package', () {
-    servePackages((builder) => builder.serve("foo", "1.2.3"));
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    // Get once so it gets cached.
-    pubGet();
-
-    // Clear the cache. We don't care about anything that was served during
-    // the initial get.
-    getRequestedPaths();
-
-    d.cacheDir({"foo": "1.2.3"}).validate();
-    d.packagesDir({"foo": "1.2.3"}).validate();
-
-    // Run the solver again now that it's cached.
-    pubGet();
-
-    // The get should not have requested the pubspec since it's local already.
-    getRequestedPaths().then((paths) {
-      expect(paths, isNot(contains("packages/foo/versions/1.2.3.yaml")));
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/hosted/do_not_upgrade_on_removed_constraints_test.dart b/sdk/lib/_internal/pub/test/get/hosted/do_not_upgrade_on_removed_constraints_test.dart
deleted file mode 100644
index 9c65587..0000000
--- a/sdk/lib/_internal/pub/test/get/hosted/do_not_upgrade_on_removed_constraints_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("doesn't upgrade dependencies whose constraints have been "
-      "removed", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", deps: {"shared-dep": "any"});
-      builder.serve("bar", "1.0.0", deps: {"shared-dep": "<2.0.0"});
-      builder.serve("shared-dep", "1.0.0");
-      builder.serve("shared-dep", "2.0.0");
-    });
-
-    d.appDir({"foo": "any", "bar": "any"}).create();
-
-    pubGet();
-
-    d.packagesDir({
-      "foo": "1.0.0",
-      "bar": "1.0.0",
-      "shared-dep": "1.0.0"
-    }).validate();
-
-    d.appDir({"foo": "any"}).create();
-
-    pubGet();
-
-    d.packagesDir({
-      "foo": "1.0.0",
-      "bar": null,
-      "shared-dep": "1.0.0"
-    }).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/hosted/does_no_network_requests_when_possible_test.dart b/sdk/lib/_internal/pub/test/get/hosted/does_no_network_requests_when_possible_test.dart
deleted file mode 100644
index bb7f1be..0000000
--- a/sdk/lib/_internal/pub/test/get/hosted/does_no_network_requests_when_possible_test.dart
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-
-  integration('does not request versions if the lockfile is up to date', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0");
-      builder.serve("foo", "1.1.0");
-      builder.serve("foo", "1.2.0");
-    });
-
-    d.appDir({
-      "foo": "any"
-    }).create();
-
-    // Get once so it gets cached.
-    pubGet();
-
-    // Clear the cache. We don't care about anything that was served during
-    // the initial get.
-    getRequestedPaths();
-
-    // Run the solver again now that it's cached.
-    pubGet();
-
-    d.cacheDir({"foo": "1.2.0"}).validate();
-    d.packagesDir({"foo": "1.2.0"}).validate();
-
-    // The get should not have done any network requests since the lock file is
-    // up to date.
-    getRequestedPaths().then((paths) {
-      expect(paths, isEmpty);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/hosted/get_test.dart b/sdk/lib/_internal/pub/test/get/hosted/get_test.dart
deleted file mode 100644
index 58890c8..0000000
--- a/sdk/lib/_internal/pub/test/get/hosted/get_test.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('gets a package from a pub server', () {
-    servePackages((builder) => builder.serve("foo", "1.2.3"));
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    pubGet();
-
-    d.cacheDir({"foo": "1.2.3"}).validate();
-    d.packagesDir({"foo": "1.2.3"}).validate();
-  });
-
-  integration('URL encodes the package name', () {
-    serveNoPackages();
-
-    d.appDir({"bad name!": "1.2.3"}).create();
-
-    pubGet(
-        error: new RegExp(
-          r"Could not find package bad name! at http://localhost:\d+\."),
-        exitCode: exit_codes.UNAVAILABLE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/hosted/get_transitive_test.dart b/sdk/lib/_internal/pub/test/get/hosted/get_transitive_test.dart
deleted file mode 100644
index 7dedb6d..0000000
--- a/sdk/lib/_internal/pub/test/get/hosted/get_transitive_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('gets packages transitively from a pub server', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.3", deps: {"bar": "2.0.4"});
-      builder.serve("bar", "2.0.3");
-      builder.serve("bar", "2.0.4");
-      builder.serve("bar", "2.0.5");
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    pubGet();
-
-    d.cacheDir({"foo": "1.2.3", "bar": "2.0.4"}).validate();
-    d.packagesDir({"foo": "1.2.3", "bar": "2.0.4"}).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/hosted/gets_a_package_with_busted_dev_dependencies_test.dart b/sdk/lib/_internal/pub/test/get/hosted/gets_a_package_with_busted_dev_dependencies_test.dart
deleted file mode 100644
index 2b8f2bf..0000000
--- a/sdk/lib/_internal/pub/test/get/hosted/gets_a_package_with_busted_dev_dependencies_test.dart
+++ /dev/null
@@ -1,32 +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 pub_tests;
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-
-  // Regression test for issue 22194.
-  integration('gets a dependency with broken dev dependencies from a pub '
-      'server', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.3", pubspec: {
-        "dev_dependencies": {
-          "busted": {"not a real source": null}
-        }
-      });
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    pubGet();
-
-    d.cacheDir({"foo": "1.2.3"}).validate();
-    d.packagesDir({"foo": "1.2.3"}).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/hosted/resolve_constraints_test.dart b/sdk/lib/_internal/pub/test/get/hosted/resolve_constraints_test.dart
deleted file mode 100644
index ca7c741..0000000
--- a/sdk/lib/_internal/pub/test/get/hosted/resolve_constraints_test.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('resolves version constraints from a pub server', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.3", deps: {"baz": ">=2.0.0"});
-      builder.serve("bar", "2.3.4", deps: {"baz": "<3.0.0"});
-      builder.serve("baz", "2.0.3");
-      builder.serve("baz", "2.0.4");
-      builder.serve("baz", "3.0.1");
-    });
-
-    d.appDir({"foo": "any", "bar": "any"}).create();
-
-    pubGet();
-
-    d.cacheDir({
-      "foo": "1.2.3",
-      "bar": "2.3.4",
-      "baz": "2.0.4"
-    }).validate();
-
-    d.packagesDir({
-      "foo": "1.2.3",
-      "bar": "2.3.4",
-      "baz": "2.0.4"
-    }).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/hosted/stay_locked_if_compatible_test.dart b/sdk/lib/_internal/pub/test/get/hosted/stay_locked_if_compatible_test.dart
deleted file mode 100644
index d8c29a4..0000000
--- a/sdk/lib/_internal/pub/test/get/hosted/stay_locked_if_compatible_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("doesn't upgrade a locked pub server package with a new "
-      "compatible constraint", () {
-    servePackages((builder) => builder.serve("foo", "1.0.0"));
-
-    d.appDir({"foo": "any"}).create();
-
-    pubGet();
-
-    d.packagesDir({"foo": "1.0.0"}).validate();
-
-    servePackages((builder) => builder.serve("foo", "1.0.1"));
-
-    d.appDir({"foo": ">=1.0.0"}).create();
-
-    pubGet();
-
-    d.packagesDir({"foo": "1.0.0"}).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/hosted/stay_locked_if_new_is_satisfied_test.dart b/sdk/lib/_internal/pub/test/get/hosted/stay_locked_if_new_is_satisfied_test.dart
deleted file mode 100644
index 868f858..0000000
--- a/sdk/lib/_internal/pub/test/get/hosted/stay_locked_if_new_is_satisfied_test.dart
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("doesn't unlock dependencies if a new dependency is already "
-      "satisfied", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", deps: {"bar": "<2.0.0"});
-      builder.serve("bar", "1.0.0", deps: {"baz": "<2.0.0"});
-      builder.serve("baz", "1.0.0");
-    });
-
-    d.appDir({"foo": "any"}).create();
-
-    pubGet();
-
-    d.packagesDir({
-      "foo": "1.0.0",
-      "bar": "1.0.0",
-      "baz": "1.0.0"
-    }).validate();
-
-    servePackages((builder) {
-      builder.serve("foo", "2.0.0", deps: {"bar": "<3.0.0"});
-      builder.serve("bar", "2.0.0", deps: {"baz": "<3.0.0"});
-      builder.serve("baz", "2.0.0");
-      builder.serve("newdep", "2.0.0", deps: {"baz": ">=1.0.0"});
-    });
-
-    d.appDir({"foo": "any", "newdep": "any"}).create();
-
-    pubGet();
-
-    d.packagesDir({
-      "foo": "1.0.0",
-      "bar": "1.0.0",
-      "baz": "1.0.0",
-      "newdep": "2.0.0"
-    }).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/hosted/stay_locked_test.dart b/sdk/lib/_internal/pub/test/get/hosted/stay_locked_test.dart
deleted file mode 100644
index a43ad2e..0000000
--- a/sdk/lib/_internal/pub/test/get/hosted/stay_locked_test.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/io.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('keeps a pub server package locked to the version in the '
-      'lockfile', () {
-    servePackages((builder) => builder.serve("foo", "1.0.0"));
-
-    d.appDir({"foo": "any"}).create();
-
-    // This should lock the foo dependency to version 1.0.0.
-    pubGet();
-
-    d.packagesDir({"foo": "1.0.0"}).validate();
-
-    // Delete the packages path to simulate a new checkout of the application.
-    schedule(() => deleteEntry(path.join(sandboxDir, packagesPath)));
-
-    // Start serving a newer package as well.
-    servePackages((builder) => builder.serve("foo", "1.0.1"));
-
-    // This shouldn't upgrade the foo dependency due to the lockfile.
-    pubGet();
-
-    d.packagesDir({"foo": "1.0.0"}).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/hosted/unlock_if_incompatible_test.dart b/sdk/lib/_internal/pub/test/get/hosted/unlock_if_incompatible_test.dart
deleted file mode 100644
index 77eeca6..0000000
--- a/sdk/lib/_internal/pub/test/get/hosted/unlock_if_incompatible_test.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('upgrades a locked pub server package with a new incompatible '
-      'constraint', () {
-    servePackages((builder) => builder.serve("foo", "1.0.0"));
-
-    d.appDir({"foo": "any"}).create();
-
-    pubGet();
-
-    d.packagesDir({"foo": "1.0.0"}).validate();
-    servePackages((builder) => builder.serve("foo", "1.0.1"));
-    d.appDir({"foo": ">1.0.0"}).create();
-
-    pubGet();
-
-    d.packagesDir({"foo": "1.0.1"}).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/hosted/unlock_if_new_is_unsatisfied_test.dart b/sdk/lib/_internal/pub/test/get/hosted/unlock_if_new_is_unsatisfied_test.dart
deleted file mode 100644
index c3f1793..0000000
--- a/sdk/lib/_internal/pub/test/get/hosted/unlock_if_new_is_unsatisfied_test.dart
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("unlocks dependencies if necessary to ensure that a new "
-      "dependency is satisfied", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", deps: {"bar": "<2.0.0"});
-      builder.serve("bar", "1.0.0", deps: {"baz": "<2.0.0"});
-      builder.serve("baz", "1.0.0", deps: {"qux": "<2.0.0"});
-      builder.serve("qux", "1.0.0");
-    });
-
-    d.appDir({"foo": "any"}).create();
-
-    pubGet();
-
-    d.packagesDir({
-      "foo": "1.0.0",
-      "bar": "1.0.0",
-      "baz": "1.0.0",
-      "qux": "1.0.0"
-    }).validate();
-
-    servePackages((builder) {
-      builder.serve("foo", "2.0.0", deps: {"bar": "<3.0.0"});
-      builder.serve("bar", "2.0.0", deps: {"baz": "<3.0.0"});
-      builder.serve("baz", "2.0.0", deps: {"qux": "<3.0.0"});
-      builder.serve("qux", "2.0.0");
-      builder.serve("newdep", "2.0.0", deps: {"baz": ">=1.5.0"});
-    });
-
-    d.appDir({"foo": "any", "newdep": "any"}).create();
-
-    pubGet();
-
-    d.packagesDir({
-      "foo": "2.0.0",
-      "bar": "2.0.0",
-      "baz": "2.0.0",
-      "qux": "1.0.0",
-      "newdep": "2.0.0"
-    }).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/hosted/unlock_if_version_doesnt_exist_test.dart b/sdk/lib/_internal/pub/test/get/hosted/unlock_if_version_doesnt_exist_test.dart
deleted file mode 100644
index a3f57ff..0000000
--- a/sdk/lib/_internal/pub/test/get/hosted/unlock_if_version_doesnt_exist_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/io.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('upgrades a locked pub server package with a nonexistent version',
-      () {
-    servePackages((builder) => builder.serve("foo", "1.0.0"));
-
-    d.appDir({"foo": "any"}).create();
-    pubGet();
-    d.packagesDir({"foo": "1.0.0"}).validate();
-
-    schedule(() => deleteEntry(p.join(sandboxDir, cachePath)));
-
-    servePackages((builder) => builder.serve("foo", "1.0.1"), replace: true);
-    pubGet();
-    d.packagesDir({"foo": "1.0.1"}).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/path/absolute_path_test.dart b/sdk/lib/_internal/pub/test/get/path/absolute_path_test.dart
deleted file mode 100644
index 1f9d71f..0000000
--- a/sdk/lib/_internal/pub/test/get/path/absolute_path_test.dart
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'package:path/path.dart' as path;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('path dependency with absolute path', () {
-    d.dir('foo', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '0.0.1')
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": path.join(sandboxDir, "foo")}
-      })
-    ]).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir("foo", [
-        d.file("foo.dart", 'main() => "foo";')
-      ])
-    ]).validate();
-
-    // Move the packages directory and ensure the symlink still works. That
-    // will validate that we actually created an absolute symlink.
-    d.dir("moved").create();
-    scheduleRename(packagesPath, "moved/packages");
-
-    d.dir("moved/packages", [
-      d.dir("foo", [
-        d.file("foo.dart", 'main() => "foo";')
-      ])
-    ]).validate();
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/get/path/absolute_symlink_test.dart b/sdk/lib/_internal/pub/test/get/path/absolute_symlink_test.dart
deleted file mode 100644
index 0ee2adc..0000000
--- a/sdk/lib/_internal/pub/test/get/path/absolute_symlink_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'package:path/path.dart' as path;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("generates a symlink with an absolute path if the dependency "
-              "path was absolute", () {
-    d.dir("foo", [
-      d.libDir("foo"),
-      d.libPubspec("foo", "0.0.1")
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": path.join(sandboxDir, "foo")}
-      })
-    ]).create();
-
-    pubGet();
-
-    d.dir("moved").create();
-
-    // Move the app but not the package. Since the symlink is absolute, it
-    // should still be able to find it.
-    scheduleRename(appPath, path.join("moved", appPath));
-
-    d.dir("moved", [
-      d.dir(packagesPath, [
-        d.dir("foo", [
-          d.file("foo.dart", 'main() => "foo";')
-        ])
-      ])
-    ]).validate();
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/get/path/empty_pubspec_test.dart b/sdk/lib/_internal/pub/test/get/path/empty_pubspec_test.dart
deleted file mode 100644
index 4950bec..0000000
--- a/sdk/lib/_internal/pub/test/get/path/empty_pubspec_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'package:path/path.dart' as p;
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  // Regression test for issue 20103.
-  integration('path dependency to an empty pubspec', () {
-    d.dir('foo', [
-      d.libDir('foo'),
-      d.file('pubspec.yaml', '')
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      })
-    ]).create();
-
-    pubGet(exitCode: exit_codes.DATA, error:
-        'Error on line 1, column 1 of ${p.join('..', 'foo', 'pubspec.yaml')}: '
-            'Missing the required "name" field.');
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/get/path/no_pubspec_test.dart b/sdk/lib/_internal/pub/test/get/path/no_pubspec_test.dart
deleted file mode 100644
index 0d858c0..0000000
--- a/sdk/lib/_internal/pub/test/get/path/no_pubspec_test.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'package:path/path.dart' as path;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('path dependency to non-package directory', () {
-    // Make an empty directory.
-    d.dir('foo').create();
-    var fooPath = path.join(sandboxDir, "foo");
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": fooPath}
-      })
-    ]).create();
-
-    pubGet(error: new RegExp(r'Could not find a file named "pubspec.yaml" '
-        r'in "[^\n]*"\.'));
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/get/path/nonexistent_dir_test.dart b/sdk/lib/_internal/pub/test/get/path/nonexistent_dir_test.dart
deleted file mode 100644
index 0bdfc63..0000000
--- a/sdk/lib/_internal/pub/test/get/path/nonexistent_dir_test.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'package:path/path.dart' as path;
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('path dependency to non-existent directory', () {
-    var badPath = path.join(sandboxDir, "bad_path");
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": badPath}
-      })
-    ]).create();
-
-    pubGet(error: """
-        Could not find package foo at "$badPath".
-        Depended on by:
-        - myapp""",
-        exitCode: exit_codes.UNAVAILABLE);
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/get/path/path_is_file_test.dart b/sdk/lib/_internal/pub/test/get/path/path_is_file_test.dart
deleted file mode 100644
index 81524c8..0000000
--- a/sdk/lib/_internal/pub/test/get/path/path_is_file_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'package:path/path.dart' as path;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('path dependency when path is a file', () {
-    d.dir('foo', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '0.0.1')
-    ]).create();
-
-    d.file('dummy.txt', '').create();
-    var dummyPath = path.join(sandboxDir, 'dummy.txt');
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": dummyPath}
-      })
-    ]).create();
-
-    pubGet(error: 'Path dependency for package foo must refer to a '
-                  'directory, not a file. Was "$dummyPath".');
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/get/path/relative_path_test.dart b/sdk/lib/_internal/pub/test/get/path/relative_path_test.dart
deleted file mode 100644
index d9f8ce8..0000000
--- a/sdk/lib/_internal/pub/test/get/path/relative_path_test.dart
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:unittest/unittest.dart';
-
-import '../../../lib/src/lock_file.dart';
-import '../../../lib/src/source_registry.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("can use relative path", () {
-    d.dir("foo", [
-      d.libDir("foo"),
-      d.libPubspec("foo", "0.0.1")
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      })
-    ]).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir("foo", [
-        d.file("foo.dart", 'main() => "foo";')
-      ])
-    ]).validate();
-  });
-
-  integration("path is relative to containing d.pubspec", () {
-    d.dir("relative", [
-      d.dir("foo", [
-        d.libDir("foo"),
-        d.libPubspec("foo", "0.0.1", deps: {
-          "bar": {"path": "../bar"}
-        })
-      ]),
-      d.dir("bar", [
-        d.libDir("bar"),
-        d.libPubspec("bar", "0.0.1")
-      ])
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../relative/foo"}
-      })
-    ]).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir("foo", [
-        d.file("foo.dart", 'main() => "foo";')
-      ]),
-      d.dir("bar", [
-        d.file("bar.dart", 'main() => "bar";')
-      ])
-    ]).validate();
-  });
-
-  integration("relative path preserved in the lockfile", () {
-    d.dir("foo", [
-      d.libDir("foo"),
-      d.libPubspec("foo", "0.0.1")
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      })
-    ]).create();
-
-    pubGet();
-
-    schedule(() {
-      var lockfilePath = path.join(sandboxDir, appPath, "pubspec.lock");
-      var lockfile = new LockFile.load(lockfilePath, new SourceRegistry());
-      var description = lockfile.packages["foo"].description;
-
-      expect(path.isRelative(description["path"]), isTrue);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/path/relative_symlink_test.dart b/sdk/lib/_internal/pub/test/get/path/relative_symlink_test.dart
deleted file mode 100644
index ab1b99f..0000000
--- a/sdk/lib/_internal/pub/test/get/path/relative_symlink_test.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'dart:io';
-
-import 'package:path/path.dart' as path;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  // Pub uses NTFS junction points to create links in the packages directory.
-  // These (unlike the symlinks that are supported in Vista and later) do not
-  // support relative paths. So this test, by design, will not pass on Windows.
-  // So just skip it.
-  if (Platform.operatingSystem == "windows") return;
-
-  initConfig();
-  integration("generates a symlink with a relative path if the dependency "
-              "path was relative", () {
-    d.dir("foo", [
-      d.libDir("foo"),
-      d.libPubspec("foo", "0.0.1")
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      })
-    ]).create();
-
-    pubGet();
-
-    d.dir("moved").create();
-
-    // Move the app and package. Since they are still next to each other, it
-    // should still be found.
-    scheduleRename("foo", path.join("moved", "foo"));
-    scheduleRename(appPath, path.join("moved", appPath));
-
-    d.dir("moved", [
-      d.dir(packagesPath, [
-        d.dir("foo", [
-          d.file("foo.dart", 'main() => "foo";')
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/path/shared_dependency_symlink_test.dart b/sdk/lib/_internal/pub/test/get/path/shared_dependency_symlink_test.dart
deleted file mode 100644
index d02190f..0000000
--- a/sdk/lib/_internal/pub/test/get/path/shared_dependency_symlink_test.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'package:path/path.dart' as path;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("shared dependency with symlink", () {
-    d.dir("shared", [
-      d.libDir("shared"),
-      d.libPubspec("shared", "0.0.1")
-    ]).create();
-
-    d.dir("foo", [
-      d.libDir("foo"),
-      d.libPubspec("foo", "0.0.1", deps: {
-        "shared": {"path": "../shared"}
-      })
-    ]).create();
-
-    d.dir("bar", [
-      d.libDir("bar"),
-      d.libPubspec("bar", "0.0.1", deps: {
-        "shared": {"path": "../link/shared"}
-      })
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"},
-        "bar": {"path": "../bar"}
-      })
-    ]).create();
-
-    d.dir("link").create();
-    scheduleSymlink("shared", path.join("link", "shared"));
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir("foo", [d.file("foo.dart", 'main() => "foo";')]),
-      d.dir("bar", [d.file("bar.dart", 'main() => "bar";')]),
-      d.dir("shared", [d.file("shared.dart", 'main() => "shared";')])
-    ]).validate();
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/get/path/shared_dependency_test.dart b/sdk/lib/_internal/pub/test/get/path/shared_dependency_test.dart
deleted file mode 100644
index f01c681..0000000
--- a/sdk/lib/_internal/pub/test/get/path/shared_dependency_test.dart
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'package:path/path.dart' as path;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("shared dependency with same path", () {
-    d.dir("shared", [
-      d.libDir("shared"),
-      d.libPubspec("shared", "0.0.1")
-    ]).create();
-
-    d.dir("foo", [
-      d.libDir("foo"),
-      d.libPubspec("foo", "0.0.1", deps: {
-        "shared": {"path": "../shared"}
-      })
-    ]).create();
-
-    d.dir("bar", [
-      d.libDir("bar"),
-      d.libPubspec("bar", "0.0.1", deps: {
-        "shared": {"path": "../shared"}
-      })
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"},
-        "bar": {"path": "../bar"}
-      })
-    ]).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir("foo", [d.file("foo.dart", 'main() => "foo";')]),
-      d.dir("bar", [d.file("bar.dart", 'main() => "bar";')]),
-      d.dir("shared", [d.file("shared.dart", 'main() => "shared";')])
-    ]).validate();
-  });
-
-  integration("shared dependency with paths that normalize the same", () {
-    d.dir("shared", [
-      d.libDir("shared"),
-      d.libPubspec("shared", "0.0.1")
-    ]).create();
-
-    d.dir("foo", [
-      d.libDir("foo"),
-      d.libPubspec("foo", "0.0.1", deps: {
-        "shared": {"path": "../shared"}
-      })
-    ]).create();
-
-    d.dir("bar", [
-      d.libDir("bar"),
-      d.libPubspec("bar", "0.0.1", deps: {
-        "shared": {"path": "../././shared"}
-      })
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"},
-        "bar": {"path": "../bar"}
-      })
-    ]).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir("foo", [d.file("foo.dart", 'main() => "foo";')]),
-      d.dir("bar", [d.file("bar.dart", 'main() => "bar";')]),
-      d.dir("shared", [d.file("shared.dart", 'main() => "shared";')])
-    ]).validate();
-  });
-
-  integration("shared dependency with absolute and relative path", () {
-    d.dir("shared", [
-      d.libDir("shared"),
-      d.libPubspec("shared", "0.0.1")
-    ]).create();
-
-    d.dir("foo", [
-      d.libDir("foo"),
-      d.libPubspec("foo", "0.0.1", deps: {
-        "shared": {"path": "../shared"}
-      })
-    ]).create();
-
-    d.dir("bar", [
-      d.libDir("bar"),
-      d.libPubspec("bar", "0.0.1", deps: {
-        "shared": {"path": path.join(sandboxDir, "shared")}
-      })
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"},
-        "bar": {"path": "../bar"}
-      })
-    ]).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir("foo", [d.file("foo.dart", 'main() => "foo";')]),
-      d.dir("bar", [d.file("bar.dart", 'main() => "bar";')]),
-      d.dir("shared", [d.file("shared.dart", 'main() => "shared";')])
-    ]).validate();
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/get/relative_symlink_test.dart b/sdk/lib/_internal/pub/test/get/relative_symlink_test.dart
deleted file mode 100644
index d593000..0000000
--- a/sdk/lib/_internal/pub/test/get/relative_symlink_test.dart
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'dart:io';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  // Pub uses NTFS junction points to create links in the packages directory.
-  // These (unlike the symlinks that are supported in Vista and later) do not
-  // support relative paths. So this test, by design, will not pass on Windows.
-  // So just skip it.
-  if (Platform.operatingSystem == "windows") return;
-
-  initConfig();
-  integration('uses a relative symlink for the self link', () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.libDir('foo')
-    ]).create();
-
-    pubGet();
-
-    scheduleRename(appPath, "moved");
-
-    d.dir("moved", [
-      d.dir("packages", [
-        d.dir("myapp", [
-          d.file('foo.dart', 'main() => "foo";')
-        ])
-      ])
-    ]).validate();
-  });
-
-  integration('uses a relative symlink for secondary packages directory', () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.libDir('foo'),
-      d.dir("bin")
-    ]).create();
-
-    pubGet();
-
-    scheduleRename(appPath, "moved");
-
-    d.dir("moved", [
-      d.dir("bin", [
-        d.dir("packages", [
-          d.dir("myapp", [
-            d.file('foo.dart', 'main() => "foo";')
-          ])
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/get/switch_source_test.dart b/sdk/lib/_internal/pub/test/get/switch_source_test.dart
deleted file mode 100644
index 4b8ad77..0000000
--- a/sdk/lib/_internal/pub/test/get/switch_source_test.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-library pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('re-gets a package if its source has changed', () {
-    servePackages((builder) => builder.serve("foo", "1.2.3"));
-
-    d.dir('foo', [
-      d.libDir('foo', 'foo 0.0.1'),
-      d.libPubspec('foo', '0.0.1')
-    ]).create();
-
-    d.appDir({"foo": {"path": "../foo"}}).create();
-
-    pubGet();
-
-    d.packagesDir({"foo": "0.0.1"}).validate();
-    d.appDir({"foo": "any"}).create();
-
-    pubGet();
-
-    d.packagesDir({"foo": "1.2.3"}).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/activate_git_after_hosted_test.dart b/sdk/lib/_internal/pub/test/global/activate/activate_git_after_hosted_test.dart
deleted file mode 100644
index e524cbf..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/activate_git_after_hosted_test.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('activating a Git package deactivates the hosted one', () {
-    ensureGit();
-
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", contents: [
-        d.dir("bin", [
-          d.file("foo.dart", "main(args) => print('hosted');")
-        ])
-      ]);
-    });
-
-    d.git('foo.git', [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('git');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    schedulePub(args: ["global", "activate", "-sgit", "../foo.git"],
-        output: allOf(
-            startsWith(
-                'Package foo is currently active at version 1.0.0.\n'
-                'Resolving dependencies...\n'
-                '+ foo 1.0.0 from git ../foo.git at '),
-            // Specific revision number goes here.
-            endsWith(
-                'Precompiling executables...\n'
-                'Loading source assets...\n'
-                'Precompiled foo:foo.\n'
-                'Activated foo 1.0.0 from Git repository "../foo.git".')));
-
-    // Should now run the git one.
-    var pub = pubRun(global: true, args: ["foo"]);
-    pub.stdout.expect("git");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/activate_hosted_after_git_test.dart b/sdk/lib/_internal/pub/test/global/activate/activate_hosted_after_git_test.dart
deleted file mode 100644
index 88e9913..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/activate_hosted_after_git_test.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// 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:path/path.dart' as p;
-
-import '../../../lib/src/io.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('activating a hosted package deactivates the Git one', () {
-    servePackages((builder) {
-      builder.serve("foo", "2.0.0", contents: [
-        d.dir("bin", [
-          d.file("foo.dart", "main(args) => print('hosted');")
-        ])
-      ]);
-    });
-
-    d.git('foo.git', [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('git');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "-sgit", "../foo.git"]);
-
-    var path = canonicalize(p.join(sandboxDir, "foo"));
-    schedulePub(args: ["global", "activate", "foo"], output: """
-        Package foo is currently active from Git repository "../foo.git".
-        Resolving dependencies...
-        + foo 2.0.0
-        Downloading foo 2.0.0...
-        Precompiling executables...
-        Loading source assets...
-        Precompiled foo:foo.
-        Activated foo 2.0.0.""");
-
-    // Should now run the hosted one.
-    var pub = pubRun(global: true, args: ["foo"]);
-    pub.stdout.expect("hosted");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/activate_hosted_after_path_test.dart b/sdk/lib/_internal/pub/test/global/activate/activate_hosted_after_path_test.dart
deleted file mode 100644
index a3d4259..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/activate_hosted_after_path_test.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// 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:path/path.dart' as p;
-
-import '../../../lib/src/io.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('activating a hosted package deactivates the path one', () {
-    servePackages((builder) {
-      builder.serve("foo", "2.0.0", contents: [
-        d.dir("bin", [
-          d.file("foo.dart", "main(args) => print('hosted');")
-        ])
-      ]);
-    });
-
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('path');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "-spath", "../foo"]);
-
-    var path = canonicalize(p.join(sandboxDir, "foo"));
-    schedulePub(args: ["global", "activate", "foo"], output: """
-        Package foo is currently active at path "$path".
-        Resolving dependencies...
-        + foo 2.0.0
-        Downloading foo 2.0.0...
-        Precompiling executables...
-        Loading source assets...
-        Precompiled foo:foo.
-        Activated foo 2.0.0.""");
-
-    // Should now run the hosted one.
-    var pub = pubRun(global: true, args: ["foo"]);
-    pub.stdout.expect("hosted");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/activate_path_after_hosted_test.dart b/sdk/lib/_internal/pub/test/global/activate/activate_path_after_hosted_test.dart
deleted file mode 100644
index 30bfbd7..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/activate_path_after_hosted_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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:path/path.dart' as p;
-
-import '../../../lib/src/io.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('activating a hosted package deactivates the path one', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", contents: [
-        d.dir("bin", [
-          d.file("foo.dart", "main(args) => print('hosted');")
-        ])
-      ]);
-    });
-
-    d.dir("foo", [
-      d.libPubspec("foo", "2.0.0"),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('path');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    var path = canonicalize(p.join(sandboxDir, "foo"));
-    schedulePub(args: ["global", "activate", "-spath", "../foo"], output: """
-        Package foo is currently active at version 1.0.0.
-        Activated foo 2.0.0 at path "$path".""");
-
-    // Should now run the path one.
-    var pub = pubRun(global: true, args: ["foo"]);
-    pub.stdout.expect("path");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/bad_version_test.dart b/sdk/lib/_internal/pub/test/global/activate/bad_version_test.dart
deleted file mode 100644
index 9db057a..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/bad_version_test.dart
+++ /dev/null
@@ -1,18 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('fails if the version constraint cannot be parsed', () {
-    schedulePub(args: ["global", "activate", "foo", "1.0"],
-        error: contains(
-            'Could not parse version "1.0". Unknown text at "1.0".'),
-        exitCode: exit_codes.USAGE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/cached_package_test.dart b/sdk/lib/_internal/pub/test/global/activate/cached_package_test.dart
deleted file mode 100644
index 7267171..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/cached_package_test.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('can activate an already cached package', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0");
-    });
-
-    schedulePub(args: ["cache", "add", "foo"]);
-
-    schedulePub(args: ["global", "activate", "foo"], output: """
-        Resolving dependencies...
-        + foo 1.0.0
-        Precompiling executables...
-        Loading source assets...
-        Activated foo 1.0.0.""");
-
-    // Should be in global package cache.
-    d.dir(cachePath, [
-      d.dir('global_packages', [
-        d.dir('foo', [d.matcherFile('pubspec.lock', contains('1.0.0'))])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/constraint_test.dart b/sdk/lib/_internal/pub/test/global/activate/constraint_test.dart
deleted file mode 100644
index d651709..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/constraint_test.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('chooses the highest version that matches the constraint', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0");
-      builder.serve("foo", "1.0.1");
-      builder.serve("foo", "1.1.0");
-      builder.serve("foo", "1.2.3");
-    });
-
-    schedulePub(args: ["global", "activate", "foo", "<1.1.0"]);
-
-    d.dir(cachePath, [
-      d.dir('global_packages', [
-        d.dir('foo', [d.matcherFile('pubspec.lock', contains('1.0.1'))])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/constraint_with_path_test.dart b/sdk/lib/_internal/pub/test/global/activate/constraint_with_path_test.dart
deleted file mode 100644
index 1e5412f..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/constraint_with_path_test.dart
+++ /dev/null
@@ -1,17 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('fails if a version is passed with the path source', () {
-    schedulePub(args: ["global", "activate", "-spath", "foo", "1.2.3"],
-        error: contains('Unexpected argument "1.2.3".'),
-        exitCode: exit_codes.USAGE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/different_version_test.dart b/sdk/lib/_internal/pub/test/global/activate/different_version_test.dart
deleted file mode 100644
index 6a406ea..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/different_version_test.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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 '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("discards the previous active version if it doesn't match the "
-      "constraint", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0");
-      builder.serve("foo", "2.0.0");
-    });
-
-    // Activate 1.0.0.
-    schedulePub(args: ["global", "activate", "foo", "1.0.0"]);
-
-    // Activating it again with a different constraint changes the version.
-    schedulePub(args: ["global", "activate", "foo", ">1.0.0"], output: """
-        Package foo is currently active at version 1.0.0.
-        Resolving dependencies...
-        + foo 2.0.0
-        Downloading foo 2.0.0...
-        Precompiling executables...
-        Loading source assets...
-        Activated foo 2.0.0.""");
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/doesnt_snapshot_path_executables_test.dart b/sdk/lib/_internal/pub/test/global/activate/doesnt_snapshot_path_executables_test.dart
deleted file mode 100644
index fafc6df3..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/doesnt_snapshot_path_executables_test.dart
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("doesn't snapshots the executables for a path package", () {
-    d.dir('foo', [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("hello.dart", "void main() => print('hello!');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "-spath", "../foo"],
-        output: isNot(contains('Precompiled foo:hello.')));
-
-    d.dir(cachePath, [
-      d.dir('global_packages', [
-        d.dir('foo', [
-          d.matcherFile('pubspec.lock', contains('1.0.0')),
-          d.nothing('bin')
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/empty_constraint_test.dart b/sdk/lib/_internal/pub/test/global/activate/empty_constraint_test.dart
deleted file mode 100644
index c1f6f02..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/empty_constraint_test.dart
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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 '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('errors if the constraint matches no versions', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0");
-      builder.serve("foo", "1.0.1");
-    });
-
-    schedulePub(args: ["global", "activate", "foo", ">1.1.0"],
-        error: """
-            Package foo has no versions that match >1.1.0 derived from:
-            - pub global activate depends on version >1.1.0""",
-        exitCode: exit_codes.DATA);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/git_package_test.dart b/sdk/lib/_internal/pub/test/global/activate/git_package_test.dart
deleted file mode 100644
index ad52145..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/git_package_test.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('activates a package from a Git repo', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "-sgit", "../foo.git"],
-        output: allOf(
-            startsWith(
-                'Resolving dependencies...\n'
-                '+ foo 1.0.0 from git ../foo.git at '),
-            // Specific revision number goes here.
-            endsWith(
-                'Precompiling executables...\n'
-                'Loading source assets...\n'
-                'Precompiled foo:foo.\n'
-                'Activated foo 1.0.0 from Git repository "../foo.git".')));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/ignores_active_version_test.dart b/sdk/lib/_internal/pub/test/global/activate/ignores_active_version_test.dart
deleted file mode 100644
index 3905f5f..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/ignores_active_version_test.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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 '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('ignores previously activated version',
-        () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.3");
-      builder.serve("foo", "1.3.0");
-    });
-
-    // Activate 1.2.3.
-    schedulePub(args: ["global", "activate", "foo", "1.2.3"]);
-
-    // Activating it again resolves to the new best version.
-    schedulePub(args: ["global", "activate", "foo", ">1.0.0"], output: """
-        Package foo is currently active at version 1.2.3.
-        Resolving dependencies...
-        + foo 1.3.0
-        Downloading foo 1.3.0...
-        Precompiling executables...
-        Loading source assets...
-        Activated foo 1.3.0.""");
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/installs_dependencies_for_git_test.dart b/sdk/lib/_internal/pub/test/global/activate/installs_dependencies_for_git_test.dart
deleted file mode 100644
index f716c91..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/installs_dependencies_for_git_test.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('activating a Git package installs its dependencies', () {
-    servePackages((builder) {
-      builder.serve("bar", "1.0.0", deps: {"baz": "any"});
-      builder.serve("baz", "1.0.0");
-    });
-
-    d.git('foo.git', [
-      d.libPubspec("foo", "1.0.0", deps: {
-        "bar": "any"
-      }),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "-sgit", "../foo.git"],
-        output: allOf([
-      contains("Downloading bar 1.0.0..."),
-      contains("Downloading baz 1.0.0...")
-    ]));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/installs_dependencies_for_path_test.dart b/sdk/lib/_internal/pub/test/global/activate/installs_dependencies_for_path_test.dart
deleted file mode 100644
index ad98735..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/installs_dependencies_for_path_test.dart
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('activating a path package installs dependencies', () {
-    servePackages((builder) {
-      builder.serve("bar", "1.0.0", deps: {"baz": "any"});
-      builder.serve("baz", "2.0.0");
-    });
-
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.0", deps: {
-        "bar": "any"
-      }),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    var pub = startPub(args: ["global", "activate", "-spath", "../foo"]);
-    pub.stdout.expect(consumeThrough("Resolving dependencies..."));
-    pub.stdout.expect(consumeThrough("Downloading bar 1.0.0..."));
-    pub.stdout.expect(consumeThrough("Downloading baz 2.0.0..."));
-    pub.stdout.expect(consumeThrough(
-        startsWith("Activated foo 0.0.0 at path")));
-    pub.shouldExit();
-
-    // Puts the lockfile in the linked package itself.
-    d.dir("foo", [
-      d.matcherFile("pubspec.lock", allOf([
-        contains("bar"), contains("1.0.0"),
-        contains("baz"), contains("2.0.0")
-      ]))
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/installs_dependencies_test.dart b/sdk/lib/_internal/pub/test/global/activate/installs_dependencies_test.dart
deleted file mode 100644
index add1b82..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/installs_dependencies_test.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('activating a package installs its dependencies', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", deps: {"bar": "any"});
-      builder.serve("bar", "1.0.0", deps: {"baz": "any"});
-      builder.serve("baz", "1.0.0");
-    });
-
-    schedulePub(args: ["global", "activate", "foo"], output: allOf([
-      contains("Downloading bar 1.0.0..."),
-      contains("Downloading baz 1.0.0...")
-    ]));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/missing_git_repo_test.dart b/sdk/lib/_internal/pub/test/global/activate/missing_git_repo_test.dart
deleted file mode 100644
index 6b840b8..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/missing_git_repo_test.dart
+++ /dev/null
@@ -1,18 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('fails if the Git repo does not exist', () {
-    ensureGit();
-
-    schedulePub(args: ["global", "activate", "-sgit", "../nope.git"],
-        error: contains("repository '../nope.git' does not exist"),
-        exitCode: 1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/missing_package_arg_test.dart b/sdk/lib/_internal/pub/test/global/activate/missing_package_arg_test.dart
deleted file mode 100644
index 72fbc97..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/missing_package_arg_test.dart
+++ /dev/null
@@ -1,17 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('fails if no package was given', () {
-    schedulePub(args: ["global", "activate"],
-        error: contains("No package to activate given."),
-        exitCode: exit_codes.USAGE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/outdated_binstub_test.dart b/sdk/lib/_internal/pub/test/global/activate/outdated_binstub_test.dart
deleted file mode 100644
index 51780ce..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/outdated_binstub_test.dart
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:io';
-import 'dart:async';
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_process.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-const _OUTDATED_BINSTUB = """
-#!/usr/bin/env sh
-# This file was created by pub v0.1.2-3.
-# Package: foo
-# Version: 1.0.0
-# Executable: foo-script
-# Script: script
-dart "/path/to/.pub-cache/global_packages/foo/bin/script.dart.snapshot" "\$@"
-""";
-
-main() {
-  initConfig();
-  integration("an outdated binstub is replaced", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", pubspec: {
-        "executables": {
-          "foo-script": "script"
-        }
-      }, contents: [
-        d.dir("bin", [
-          d.file("script.dart", "main(args) => print('ok \$args');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    d.dir(cachePath, [
-      d.dir('bin', [
-        d.file(binStubName('foo-script'), _OUTDATED_BINSTUB)
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    d.dir(cachePath, [
-      d.dir('bin', [
-        // 253 is the VM's exit code upon seeing an out-of-date snapshot.
-        d.matcherFile(binStubName('foo-script'), contains("253"))
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/path_package_test.dart b/sdk/lib/_internal/pub/test/global/activate/path_package_test.dart
deleted file mode 100644
index 8f5a2d3..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/path_package_test.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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:path/path.dart' as p;
-
-import '../../../lib/src/io.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('activates a package at a local path', () {
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    var path = canonicalize(p.join(sandboxDir, "foo"));
-    schedulePub(args: ["global", "activate", "--source", "path", "../foo"],
-        output: 'Activated foo 1.0.0 at path "$path".');
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/reactivating_git_upgrades_test.dart b/sdk/lib/_internal/pub/test/global/activate/reactivating_git_upgrades_test.dart
deleted file mode 100644
index 19f895f..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/reactivating_git_upgrades_test.dart
+++ /dev/null
@@ -1,49 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('ignores previously activated git commit',
-        () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libPubspec("foo", "1.0.0")
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "-sgit", "../foo.git"],
-        output: allOf(
-            startsWith(
-                'Resolving dependencies...\n'
-                '+ foo 1.0.0 from git ../foo.git at '),
-            // Specific revision number goes here.
-            endsWith(
-                'Precompiling executables...\n'
-                'Loading source assets...\n'
-                'Activated foo 1.0.0 from Git repository "../foo.git".')));
-
-    d.git('foo.git', [
-      d.libPubspec("foo", "1.0.1")
-    ]).commit();
-
-    // Activating it again pulls down the latest commit.
-    schedulePub(args: ["global", "activate", "-sgit", "../foo.git"],
-        output: allOf(
-            startsWith(
-                'Package foo is currently active from Git repository '
-                  '"../foo.git".\n'
-                'Resolving dependencies...\n'
-                '+ foo 1.0.1 from git ../foo.git at '),
-            // Specific revision number goes here.
-            endsWith(
-                'Precompiling executables...\n'
-                'Loading source assets...\n'
-                'Activated foo 1.0.1 from Git repository "../foo.git".')));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/removes_old_lockfile_test.dart b/sdk/lib/_internal/pub/test/global/activate/removes_old_lockfile_test.dart
deleted file mode 100644
index 8816bcd..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/removes_old_lockfile_test.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('removes the 1.6-style lockfile', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0");
-    });
-
-    d.dir(cachePath, [
-      d.dir('global_packages', [
-        d.file('foo.lock', 'packages: {foo: {description: foo, source: hosted, '
-            'version: "1.0.0"}}}')
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    d.dir(cachePath, [
-      d.dir('global_packages', [
-        d.nothing('foo.lock'),
-        d.dir('foo', [d.matcherFile('pubspec.lock', contains('1.0.0'))])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/snapshots_git_executables_test.dart b/sdk/lib/_internal/pub/test/global/activate/snapshots_git_executables_test.dart
deleted file mode 100644
index cfabaa9..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/snapshots_git_executables_test.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('snapshots the executables for a Git repo', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("hello.dart", "void main() => print('hello!');"),
-        d.file("goodbye.dart", "void main() => print('goodbye!');"),
-        d.file("shell.sh", "echo shell"),
-        d.dir("subdir", [
-          d.file("sub.dart", "void main() => print('sub!');")
-        ])
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "-sgit", "../foo.git"],
-        output: allOf([
-      contains('Precompiled foo:hello.'),
-      contains("Precompiled foo:goodbye.")
-    ]));
-
-    d.dir(cachePath, [
-      d.dir('global_packages', [
-        d.dir('foo', [
-          d.matcherFile('pubspec.lock', contains('1.0.0')),
-          d.dir('bin', [
-            d.matcherFile('hello.dart.snapshot', contains('hello!')),
-            d.matcherFile('goodbye.dart.snapshot', contains('goodbye!')),
-            d.nothing('shell.sh.snapshot'),
-            d.nothing('subdir')
-          ])
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/snapshots_hosted_executables_test.dart b/sdk/lib/_internal/pub/test/global/activate/snapshots_hosted_executables_test.dart
deleted file mode 100644
index 5bd0257..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/snapshots_hosted_executables_test.dart
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('snapshots the executables for a hosted package', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", contents: [
-        d.dir('bin', [
-          d.file("hello.dart", "void main() => print('hello!');"),
-          d.file("goodbye.dart", "void main() => print('goodbye!');"),
-          d.file("shell.sh", "echo shell"),
-          d.dir("subdir", [
-            d.file("sub.dart", "void main() => print('sub!');")
-          ])
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"], output: allOf([
-      contains('Precompiled foo:hello.'),
-      contains("Precompiled foo:goodbye.")
-    ]));
-
-    d.dir(cachePath, [
-      d.dir('global_packages', [
-        d.dir('foo', [
-          d.matcherFile('pubspec.lock', contains('1.0.0')),
-          d.dir('bin', [
-            d.matcherFile('hello.dart.snapshot', contains('hello!')),
-            d.matcherFile('goodbye.dart.snapshot', contains('goodbye!')),
-            d.nothing('shell.sh.snapshot'),
-            d.nothing('subdir')
-          ])
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/supports_version_solver_backtracking_test.dart b/sdk/lib/_internal/pub/test/global/activate/supports_version_solver_backtracking_test.dart
deleted file mode 100644
index 97d83de..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/supports_version_solver_backtracking_test.dart
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('performs verison solver backtracking if necessary', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.1.0", pubspec: {
-        "environment": {"sdk": ">=0.1.2 <0.2.0"}
-      });
-      builder.serve("foo", "1.2.0", pubspec: {
-        "environment": {"sdk": ">=0.1.3 <0.2.0"}
-      });
-    });
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    // foo 1.2.0 won't be picked because its SDK constraint conflicts with the
-    // dummy SDK version 0.1.2+3.
-    d.dir(cachePath, [
-      d.dir('global_packages', [
-        d.dir('foo', [d.matcherFile('pubspec.lock', contains('1.1.0'))])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/uncached_package_test.dart b/sdk/lib/_internal/pub/test/global/activate/uncached_package_test.dart
deleted file mode 100644
index 92b27ff..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/uncached_package_test.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('installs and activates the best version of a package', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0");
-      builder.serve("foo", "1.2.3");
-      builder.serve("foo", "2.0.0-wildly.unstable");
-    });
-
-    schedulePub(args: ["global", "activate", "foo"], output: """
-        Resolving dependencies...
-        + foo 1.2.3 (2.0.0-wildly.unstable available)
-        Downloading foo 1.2.3...
-        Precompiling executables...
-        Loading source assets...
-        Activated foo 1.2.3.""");
-
-    // Should be in global package cache.
-    d.dir(cachePath, [
-      d.dir('global_packages', [
-        d.dir('foo', [d.matcherFile('pubspec.lock', contains('1.2.3'))])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/unexpected_arguments_test.dart b/sdk/lib/_internal/pub/test/global/activate/unexpected_arguments_test.dart
deleted file mode 100644
index 24d0e2c..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/unexpected_arguments_test.dart
+++ /dev/null
@@ -1,17 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('fails if there are extra arguments', () {
-    schedulePub(args: ["global", "activate", "foo", "1.0.0", "bar", "baz"],
-        error: contains('Unexpected arguments "bar" and "baz".'),
-        exitCode: exit_codes.USAGE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/activate/unknown_package_test.dart b/sdk/lib/_internal/pub/test/global/activate/unknown_package_test.dart
deleted file mode 100644
index 70e0b97..0000000
--- a/sdk/lib/_internal/pub/test/global/activate/unknown_package_test.dart
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('errors if the package could not be found', () {
-    serveNoPackages();
-
-    schedulePub(args: ["global", "activate", "foo"],
-        error: startsWith("Could not find package foo at"),
-        exitCode: exit_codes.UNAVAILABLE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_executable_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_executable_test.dart
deleted file mode 100644
index a3353e9..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_executable_test.dart
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:io';
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_process.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("the generated binstub runs a snapshotted executable", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", pubspec: {
-        "executables": {
-          "foo-script": "script"
-        }
-      }, contents: [
-        d.dir("bin", [
-          d.file("script.dart", "main(args) => print('ok \$args');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    var process = new ScheduledProcess.start(
-        p.join(sandboxDir, cachePath, "bin", binStubName("foo-script")),
-        ["arg1", "arg2"],
-        environment: getEnvironment());
-
-    process.stdout.expect("ok [arg1, arg2]");
-    process.shouldExit();
-  });
-
-  integration("the generated binstub runs a non-snapshotted executable", () {
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "executables": {
-          "foo-script": "script"
-        }
-      }),
-      d.dir("bin", [
-          d.file("script.dart", "main(args) => print('ok \$args');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "-spath", "../foo"]);
-
-    var process = new ScheduledProcess.start(
-        p.join(sandboxDir, cachePath, "bin", binStubName("foo-script")),
-        ["arg1", "arg2"],
-        environment: getEnvironment());
-
-    process.stdout.expect("ok [arg1, arg2]");
-    process.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_global_run_if_no_snapshot_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_global_run_if_no_snapshot_test.dart
deleted file mode 100644
index a5d02be..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_global_run_if_no_snapshot_test.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("the binstubs runs pub global run if there is no snapshot", () {
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "executables": {
-          "foo-script": "script"
-        }
-      }),
-      d.dir("bin", [
-        d.file("script.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    // Path packages are mutable, so no snapshot is created.
-    schedulePub(args: ["global", "activate", "--source", "path", "../foo"],
-        output: contains("Installed executable foo-script."));
-
-    d.dir(cachePath, [
-      d.dir("bin", [
-        d.matcherFile(binStubName("foo-script"),
-            contains("pub global run foo:script"))
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_precompiled_snapshot_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_precompiled_snapshot_test.dart
deleted file mode 100644
index 9e75382..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_precompiled_snapshot_test.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("the binstubs runs a precompiled snapshot if present", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", pubspec: {
-        "executables": {
-          "foo-script": "script"
-        }
-      }, contents: [
-        d.dir("bin", [
-          d.file("script.dart", "main(args) => print('ok');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    d.dir(cachePath, [
-      d.dir("bin", [
-        d.matcherFile(binStubName("foo-script"),
-            contains("script.dart.snapshot"))
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/creates_executables_in_pubspec_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/creates_executables_in_pubspec_test.dart
deleted file mode 100644
index ca0f42b..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/creates_executables_in_pubspec_test.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("creates binstubs for each executable in the pubspec", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", pubspec: {
-        "executables": {
-          "one": null,
-          "two-renamed": "second"
-        }
-      }, contents: [
-        d.dir("bin", [
-          d.file("one.dart", "main(args) => print('one');"),
-          d.file("second.dart", "main(args) => print('two');"),
-          d.file("nope.dart", "main(args) => print('nope');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"], output:
-        contains("Installed executables one and two-renamed."));
-
-    d.dir(cachePath, [
-      d.dir("bin", [
-        d.matcherFile(binStubName("one"), contains("one")),
-        d.matcherFile(binStubName("two-renamed"), contains("second")),
-        d.nothing(binStubName("two")),
-        d.nothing(binStubName("nope"))
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/does_not_warn_if_no_executables_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/does_not_warn_if_no_executables_test.dart
deleted file mode 100644
index 565e23a..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/does_not_warn_if_no_executables_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:io';
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("does not warn if the package has no executables", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", contents: [
-        d.dir("bin", [
-          d.file("script.dart", "main(args) => print('ok \$args');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"],
-        output: isNot(contains("is not on your path")));
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/does_not_warn_if_on_path_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/does_not_warn_if_on_path_test.dart
deleted file mode 100644
index 124d167..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/does_not_warn_if_on_path_test.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:io';
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("does not warn if the binstub directory is on the path", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", pubspec: {
-        "executables": {
-          "script": null
-        }
-      }, contents: [
-        d.dir("bin", [
-          d.file("script.dart", "main(args) => print('ok \$args');")
-        ])
-      ]);
-    });
-
-    // Add the test's cache bin directory to the path.
-    var binDir = p.dirname(Platform.executable);
-    var separator = Platform.operatingSystem == "windows" ? ";" : ":";
-    var path = "${Platform.environment["PATH"]}$separator$binDir";
-
-    schedulePub(args: ["global", "activate", "foo"],
-        output: isNot(contains("is not on your path")),
-        environment: {"PATH": path});
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/explicit_and_no_executables_options_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/explicit_and_no_executables_options_test.dart
deleted file mode 100644
index 65c67ad..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/explicit_and_no_executables_options_test.dart
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("errors if -x and --no-executables are both passed", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0")
-    ]).create();
-
-    schedulePub(args: [
-      "global", "activate", "--source", "path", "../foo",
-      "-x", "anything", "--no-executables"
-    ], error: contains("Cannot pass both --no-executables and --executable."),
-        exitCode: exit_codes.USAGE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/explicit_executables_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/explicit_executables_test.dart
deleted file mode 100644
index 14ba50a..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/explicit_executables_test.dart
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("only creates binstubs for the listed executables", () {
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "executables": {
-          "one": "script",
-          "two": "script",
-          "three": "script"
-        }
-      }),
-      d.dir("bin", [
-        d.file("script.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    schedulePub(args: [
-      "global", "activate", "--source", "path", "../foo",
-      "-x", "one", "--executable", "three"
-    ], output: contains("Installed executables one and three."));
-
-    d.dir(cachePath, [
-      d.dir("bin", [
-        d.matcherFile(binStubName("one"),
-            contains("pub global run foo:script")),
-        d.nothing(binStubName("two")),
-        d.matcherFile(binStubName("three"),
-            contains("pub global run foo:script"))
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/missing_script_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/missing_script_test.dart
deleted file mode 100644
index bcd30b1..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/missing_script_test.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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:path/path.dart' as p;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("errors if an executable's script can't be found", () {
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "executables": {
-          "missing": "not_here",
-          "nope": null
-        }
-      })
-    ]).create();
-
-    var pub = startPub(args: ["global", "activate", "-spath", "../foo"]);
-
-    pub.stderr.expect('Warning: Executable "missing" runs '
-        '"${p.join('bin', 'not_here.dart')}", which was not found in foo.');
-    pub.stderr.expect('Warning: Executable "nope" runs '
-        '"${p.join('bin', 'nope.dart')}", which was not found in foo.');
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/name_collision_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/name_collision_test.dart
deleted file mode 100644
index e07975a..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/name_collision_test.dart
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("does not overwrite an existing binstub", () {
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "executables": {
-          "foo": "foo",
-          "collide1": "foo",
-          "collide2": "foo"
-        }
-      }),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    d.dir("bar", [
-      d.pubspec({
-        "name": "bar",
-        "executables": {
-          "bar": "bar",
-          "collide1": "bar",
-          "collide2": "bar"
-        }
-      }),
-      d.dir("bin", [
-        d.file("bar.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "-spath", "../foo"]);
-
-    var pub = startPub(args: ["global", "activate", "-spath", "../bar"]);
-    pub.stdout.expect(consumeThrough("Installed executable bar."));
-    pub.stderr.expect("Executable collide1 was already installed from foo.");
-    pub.stderr.expect("Executable collide2 was already installed from foo.");
-    pub.stderr.expect("Deactivate the other package(s) or activate bar using "
-        "--overwrite.");
-    pub.shouldExit();
-
-    d.dir(cachePath, [
-      d.dir("bin", [
-        d.matcherFile(binStubName("foo"), contains("foo:foo")),
-        d.matcherFile(binStubName("bar"), contains("bar:bar")),
-        d.matcherFile(binStubName("collide1"), contains("foo:foo")),
-        d.matcherFile(binStubName("collide2"), contains("foo:foo"))
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/name_collision_with_overwrite_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/name_collision_with_overwrite_test.dart
deleted file mode 100644
index 3752525..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/name_collision_with_overwrite_test.dart
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("overwrites an existing binstub if --overwrite is passed", () {
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "executables": {
-          "foo": "foo",
-          "collide1": "foo",
-          "collide2": "foo"
-        }
-      }),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    d.dir("bar", [
-      d.pubspec({
-        "name": "bar",
-        "executables": {
-          "bar": "bar",
-          "collide1": "bar",
-          "collide2": "bar"
-        }
-      }),
-      d.dir("bin", [
-        d.file("bar.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "-spath", "../foo"]);
-
-    var pub = startPub(args: [
-      "global", "activate", "-spath", "../bar", "--overwrite"
-    ]);
-    pub.stdout.expect(consumeThrough(
-        "Installed executables bar, collide1 and collide2."));
-    pub.stderr.expect("Replaced collide1 previously installed from foo.");
-    pub.stderr.expect("Replaced collide2 previously installed from foo.");
-    pub.shouldExit();
-
-    d.dir(cachePath, [
-      d.dir("bin", [
-        d.matcherFile(binStubName("foo"), contains("foo:foo")),
-        d.matcherFile(binStubName("bar"), contains("bar:bar")),
-        d.matcherFile(binStubName("collide1"), contains("bar:bar")),
-        d.matcherFile(binStubName("collide2"), contains("bar:bar"))
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/no_executables_flag_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/no_executables_flag_test.dart
deleted file mode 100644
index 4b1bf33..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/no_executables_flag_test.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("does not create binstubs if --no-executables is passed", () {
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "executables": {
-          "one": null
-        }
-      }),
-      d.dir("bin", [
-        d.file("one.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "--source", "path", "../foo"]);
-
-    schedulePub(args: [
-      "global", "activate", "--source", "path", "../foo", "--no-executables"
-    ]);
-
-    // Should still delete old one.
-    d.dir(cachePath, [
-      d.dir("bin", [
-        d.nothing(binStubName("one"))
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/outdated_binstub_runs_pub_global_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/outdated_binstub_runs_pub_global_test.dart
deleted file mode 100644
index e2f276d..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/outdated_binstub_runs_pub_global_test.dart
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:io';
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_process.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("an outdated binstub runs 'pub global run'", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", pubspec: {
-        "executables": {
-          "foo-script": "script"
-        }
-      }, contents: [
-        d.dir("bin", [
-          d.file("script.dart", "main(args) => print('ok');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    d.dir(cachePath, [
-      d.dir('global_packages', [
-        d.dir('foo', [
-          d.dir('bin', [d.outOfDateSnapshot('script.dart.snapshot')])
-        ])
-      ])
-    ]).create();
-
-    var process = new ScheduledProcess.start(
-        p.join(sandboxDir, cachePath, "bin", binStubName("foo-script")),
-        ["arg1", "arg2"],
-        environment: getEnvironment());
-
-    process.stdout.expect(consumeThrough("ok"));
-    process.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/outdated_snapshot_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/outdated_snapshot_test.dart
deleted file mode 100644
index 9e6acc9..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/outdated_snapshot_test.dart
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:io';
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_process.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/io.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("a binstub runs 'pub global run' for an outdated snapshot", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", pubspec: {
-        "executables": {
-          "foo-script": "script"
-        }
-      }, contents: [
-        d.dir("bin", [
-          d.file("script.dart", "main(args) => print('ok \$args');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    d.dir(cachePath, [
-      d.dir('global_packages', [
-        d.dir('foo', [
-          d.dir('bin', [d.outOfDateSnapshot('script.dart.snapshot')])
-        ])
-      ])
-    ]).create();
-
-    var process = new ScheduledProcess.start(
-        p.join(sandboxDir, cachePath, "bin", binStubName("foo-script")),
-        ["arg1", "arg2"],
-        environment: getEnvironment());
-
-    process.stderr.expect(startsWith("Wrong script snapshot version"));
-    process.stdout.expect(consumeThrough("ok [arg1, arg2]"));
-    process.shouldExit();
-
-    d.dir(cachePath, [
-      d.dir('global_packages/foo/bin', [
-        d.binaryMatcherFile('script.dart.snapshot', isNot(equals(
-            readBinaryFile(testAssetPath('out-of-date.snapshot')))))
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/path_package_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/path_package_test.dart
deleted file mode 100644
index 901c0f8..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/path_package_test.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("creates binstubs when activating a path package", () {
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "executables": {
-          "foo": null
-        }
-      }),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "--source", "path", "../foo"],
-        output: contains("Installed executable foo."));
-
-    d.dir(cachePath, [
-      d.dir("bin", [
-        d.matcherFile(binStubName("foo"), contains("pub global run foo:foo"))
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/reactivate_removes_old_executables_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/reactivate_removes_old_executables_test.dart
deleted file mode 100644
index bf1365c..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/reactivate_removes_old_executables_test.dart
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("removes previous binstubs when reactivating a package", () {
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "executables": {
-          "one": null,
-          "two": null
-        }
-      }),
-      d.dir("bin", [
-        d.file("one.dart", "main() => print('ok');"),
-        d.file("two.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "--source", "path", "../foo"]);
-
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "executables": {
-          // Remove "one".
-          "two": null
-        }
-      }),
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "--source", "path", "../foo"]);
-
-    d.dir(cachePath, [
-      d.dir("bin", [
-        d.nothing(binStubName("one")),
-        d.matcherFile(binStubName("two"), contains("two"))
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/removes_even_if_not_in_pubspec_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/removes_even_if_not_in_pubspec_test.dart
deleted file mode 100644
index a37133f..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/removes_even_if_not_in_pubspec_test.dart
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("removes all binstubs for package", () {
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "executables": {
-          "foo": null
-        }
-      }),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    // Create the binstub for foo.
-    schedulePub(args: ["global", "activate", "--source", "path", "../foo"]);
-
-    // Remove it from the pubspec.
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo"
-      })
-    ]).create();
-
-    // Deactivate.
-    schedulePub(args: ["global", "deactivate", "foo"]);
-
-    // It should still be deleted.
-    d.dir(cachePath, [
-      d.dir("bin", [
-        d.nothing(binStubName("foo"))
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/removes_when_deactivated_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/removes_when_deactivated_test.dart
deleted file mode 100644
index 5580a53..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/removes_when_deactivated_test.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("removes binstubs when the package is deactivated", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", pubspec: {
-        "executables": {
-          "one": null,
-          "two": null
-        }
-      }, contents: [
-        d.dir("bin", [
-          d.file("one.dart", "main(args) => print('one');"),
-          d.file("two.dart", "main(args) => print('two');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"]);
-    schedulePub(args: ["global", "deactivate", "foo"]);
-
-    d.dir(cachePath, [
-      d.dir("bin", [
-        d.nothing(binStubName("one")),
-        d.nothing(binStubName("two"))
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/unknown_explicit_executable_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/unknown_explicit_executable_test.dart
deleted file mode 100644
index ae1e0e0..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/unknown_explicit_executable_test.dart
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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:scheduled_test/scheduled_stream.dart';
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("errors on an unknown explicit executable", () {
-    d.dir("foo", [
-      d.pubspec({
-        "name": "foo",
-        "executables": {
-          "one": "one"
-        }
-      }),
-      d.dir("bin", [
-        d.file("one.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    var pub = startPub(args: [
-      "global", "activate", "--source", "path", "../foo",
-      "-x", "who", "-x", "one", "--executable", "wat"
-    ]);
-
-    pub.stdout.expect(consumeThrough("Installed executable one."));
-    pub.stderr.expect("Unknown executables wat and who.");
-    pub.shouldExit(exit_codes.DATA);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/utils.dart b/sdk/lib/_internal/pub/test/global/binstubs/utils.dart
deleted file mode 100644
index ca70df8..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/utils.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:path/path.dart' as p;
-
-import '../../test_pub.dart';
-
-/// The buildbots do not have the Dart SDK (containing "dart" and "pub") on
-/// their PATH, so we need to spawn the binstub process with a PATH that
-/// explicitly includes it.
-Future<Map> getEnvironment() async {
-  var binDir = p.dirname(Platform.executable);
-  var separator = Platform.operatingSystem == "windows" ? ";" : ":";
-  var path = "${Platform.environment["PATH"]}$separator$binDir";
-
-  var environment = await getPubTestEnvironment();
-  environment["PATH"] = path;
-  return environment;
-}
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/warns_if_not_on_path_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/warns_if_not_on_path_test.dart
deleted file mode 100644
index ec3fedb..0000000
--- a/sdk/lib/_internal/pub/test/global/binstubs/warns_if_not_on_path_test.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("warns if the binstub directory is not on the path", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", pubspec: {
-        "executables": {
-          "some-dart-script": "script"
-        }
-      }, contents: [
-        d.dir("bin", [
-          d.file("script.dart", "main(args) => print('ok \$args');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"],
-        error: contains("is not on your path"));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/deactivate/deactivate_and_reactivate_package_test.dart b/sdk/lib/_internal/pub/test/global/deactivate/deactivate_and_reactivate_package_test.dart
deleted file mode 100644
index 1e8a37c..0000000
--- a/sdk/lib/_internal/pub/test/global/deactivate/deactivate_and_reactivate_package_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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 '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('activates a different version after deactivating', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0");
-      builder.serve("foo", "2.0.0");
-    });
-
-    // Activate an old version.
-    schedulePub(args: ["global", "activate", "foo", "1.0.0"]);
-
-    schedulePub(args: ["global", "deactivate", "foo"],
-        output: "Deactivated package foo 1.0.0.");
-
-    // Activating again should forget the old version.
-    schedulePub(args: ["global", "activate", "foo"], output: """
-        Resolving dependencies...
-        + foo 2.0.0
-        Downloading foo 2.0.0...
-        Precompiling executables...
-        Loading source assets...
-        Activated foo 2.0.0.""");
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/deactivate/git_package_test.dart b/sdk/lib/_internal/pub/test/global/deactivate/git_package_test.dart
deleted file mode 100644
index 3d14d91..0000000
--- a/sdk/lib/_internal/pub/test/global/deactivate/git_package_test.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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 '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('deactivates an active Git package', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "-sgit", "../foo.git"]);
-
-    schedulePub(args: ["global", "deactivate", "foo"],
-        output: 'Deactivated package foo 1.0.0 from Git repository "../foo.git".');
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/deactivate/hosted_package_test.dart b/sdk/lib/_internal/pub/test/global/deactivate/hosted_package_test.dart
deleted file mode 100644
index 240a11b..0000000
--- a/sdk/lib/_internal/pub/test/global/deactivate/hosted_package_test.dart
+++ /dev/null
@@ -1,17 +0,0 @@
-// 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 '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('deactivates an active hosted package', () {
-    servePackages((builder) => builder.serve("foo", "1.0.0"));
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    schedulePub(args: ["global", "deactivate", "foo"],
-        output: "Deactivated package foo 1.0.0.");
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/deactivate/missing_package_arg_test.dart b/sdk/lib/_internal/pub/test/global/deactivate/missing_package_arg_test.dart
deleted file mode 100644
index 482947d..0000000
--- a/sdk/lib/_internal/pub/test/global/deactivate/missing_package_arg_test.dart
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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 '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('fails if no package was given', () {
-    schedulePub(args: ["global", "deactivate"],
-        error: """
-            No package to deactivate given.
-
-            Usage: pub global deactivate <package>
-            -h, --help    Print this usage information.
-
-            Run "pub help" to see global options.
-            """,
-        exitCode: exit_codes.USAGE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/deactivate/path_package_test.dart b/sdk/lib/_internal/pub/test/global/deactivate/path_package_test.dart
deleted file mode 100644
index 3241efc..0000000
--- a/sdk/lib/_internal/pub/test/global/deactivate/path_package_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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:path/path.dart' as p;
-
-import '../../../lib/src/io.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('deactivates an active path package', () {
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "--source", "path", "../foo"]);
-
-    var path = canonicalize(p.join(sandboxDir, "foo"));
-    schedulePub(args: ["global", "deactivate", "foo"],
-        output: 'Deactivated package foo 1.0.0 at path "$path".');
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/deactivate/removes_precompiled_snapshots_test.dart b/sdk/lib/_internal/pub/test/global/deactivate/removes_precompiled_snapshots_test.dart
deleted file mode 100644
index 482a3f4..0000000
--- a/sdk/lib/_internal/pub/test/global/deactivate/removes_precompiled_snapshots_test.dart
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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 '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('removes precompiled snapshots', () {
-    servePackages((builder) => builder.serve("foo", "1.0.0"));
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    schedulePub(args: ["global", "deactivate", "foo"],
-        output: "Deactivated package foo 1.0.0.");
-
-    d.dir(cachePath, [
-      d.dir('global_packages', [d.nothing('foo')])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/deactivate/unexpected_arguments_test.dart b/sdk/lib/_internal/pub/test/global/deactivate/unexpected_arguments_test.dart
deleted file mode 100644
index f57fccc..0000000
--- a/sdk/lib/_internal/pub/test/global/deactivate/unexpected_arguments_test.dart
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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 '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('fails if there are extra arguments', () {
-    schedulePub(args: ["global", "deactivate", "foo", "bar", "baz"],
-        error: """
-            Unexpected arguments "bar" and "baz".
-
-            Usage: pub global deactivate <package>
-            -h, --help    Print this usage information.
-
-            Run "pub help" to see global options.
-            """,
-        exitCode: exit_codes.USAGE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/deactivate/unknown_package_test.dart b/sdk/lib/_internal/pub/test/global/deactivate/unknown_package_test.dart
deleted file mode 100644
index 2886430..0000000
--- a/sdk/lib/_internal/pub/test/global/deactivate/unknown_package_test.dart
+++ /dev/null
@@ -1,17 +0,0 @@
-// 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 '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('errors if the package is not activated', () {
-    serveNoPackages();
-
-    schedulePub(args: ["global", "deactivate", "foo"],
-        error: "No active package foo.",
-        exitCode: exit_codes.DATA);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/list_test.dart b/sdk/lib/_internal/pub/test/global/list_test.dart
deleted file mode 100644
index 782c9b0..0000000
--- a/sdk/lib/_internal/pub/test/global/list_test.dart
+++ /dev/null
@@ -1,76 +0,0 @@
-// 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:path/path.dart' as p;
-
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  integration('lists an activated hosted package', () {
-    servePackages((builder) {
-      builder.serve('foo', '1.0.0');
-    });
-
-    schedulePub(args: ['global', 'activate', 'foo']);
-
-    schedulePub(args: ['global', 'list'], output: 'foo 1.0.0');
-  });
-
-  integration('lists an activated Git package', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libPubspec('foo', '1.0.0'),
-      d.dir('bin', [
-        d.file('foo.dart', 'main() => print("ok");')
-      ])
-    ]).create();
-
-    schedulePub(args: ['global', 'activate', '-sgit', '../foo.git']);
-
-    schedulePub(args: ['global', 'list'],
-        output: 'foo 1.0.0 from Git repository "../foo.git"');
-  });
-
-  integration('lists an activated Path package', () {
-    d.dir('foo', [
-      d.libPubspec('foo', '1.0.0'),
-      d.dir('bin', [
-        d.file('foo.dart', 'main() => print("ok");')
-      ])
-    ]).create();
-
-    schedulePub(args: ['global', 'activate', '-spath', '../foo']);
-
-    var path = canonicalize(p.join(sandboxDir, 'foo'));
-    schedulePub(args: ['global', 'list'],
-        output: 'foo 1.0.0 at path "$path"');
-  });
-
-  integration('lists activated packages in alphabetical order', () {
-    servePackages((builder) {
-      builder.serve('aaa', '1.0.0');
-      builder.serve('bbb', '1.0.0');
-      builder.serve('ccc', '1.0.0');
-    });
-
-    schedulePub(args: ['global', 'activate', 'ccc']);
-    schedulePub(args: ['global', 'activate', 'aaa']);
-    schedulePub(args: ['global', 'activate', 'bbb']);
-
-    schedulePub(args: ['global', 'list'], output: '''
-aaa 1.0.0
-bbb 1.0.0
-ccc 1.0.0
-''');
-  });
-
-  integration('lists nothing when no packages activated', () {
-    schedulePub(args: ['global', 'list'], output: '\n');
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/run/errors_if_outside_bin_test.dart b/sdk/lib/_internal/pub/test/global/run/errors_if_outside_bin_test.dart
deleted file mode 100644
index cb149bb..0000000
--- a/sdk/lib/_internal/pub/test/global/run/errors_if_outside_bin_test.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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:path/path.dart' as p;
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('errors if the script is in a subdirectory.', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", contents: [
-        d.dir("example", [
-          d.file("script.dart", "main(args) => print('ok');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"]);
-    schedulePub(args: ["global", "run", "foo:example/script"],
-        error: """
-Cannot run an executable in a subdirectory of a global package.
-
-Usage: pub global run <package>:<executable> [args...]
--h, --help    Print this usage information.
-    --mode    Mode to run transformers in.
-              (defaults to "release")
-
-Run "pub help" to see global options.
-""",
-        exitCode: exit_codes.USAGE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/run/implicit_executable_name_test.dart b/sdk/lib/_internal/pub/test/global/run/implicit_executable_name_test.dart
deleted file mode 100644
index da68c8e..0000000
--- a/sdk/lib/_internal/pub/test/global/run/implicit_executable_name_test.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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 '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('defaults to the package name if the script is omitted', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", contents: [
-        d.dir("bin", [
-          d.file("foo.dart", "main(args) => print('foo');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    var pub = pubRun(global: true, args: ["foo"]);
-    pub.stdout.expect("foo");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/run/missing_executable_arg_test.dart b/sdk/lib/_internal/pub/test/global/run/missing_executable_arg_test.dart
deleted file mode 100644
index 01c798d..0000000
--- a/sdk/lib/_internal/pub/test/global/run/missing_executable_arg_test.dart
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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 '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('fails if no executable was given', () {
-    schedulePub(args: ["global", "run"],
-        error: """
-            Must specify an executable to run.
-
-            Usage: pub global run <package>:<executable> [args...]
-            -h, --help    Print this usage information.
-                --mode    Mode to run transformers in.
-                          (defaults to "release")
-
-            Run "pub help" to see global options.
-            """,
-        exitCode: exit_codes.USAGE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/run/missing_path_package_test.dart b/sdk/lib/_internal/pub/test/global/run/missing_path_package_test.dart
deleted file mode 100644
index a8be8c8..0000000
--- a/sdk/lib/_internal/pub/test/global/run/missing_path_package_test.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/io.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('errors if the local package does not exist', () {
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "--source", "path", "../foo"]);
-
-    schedule(() => deleteEntry(p.join(sandboxDir, "foo")));
-
-    var pub = pubRun(global: true, args: ["foo"]);
-    var path = canonicalize(p.join(sandboxDir, "foo"));
-    pub.stderr.expect('Could not find a file named "pubspec.yaml" in "$path".');
-    pub.shouldExit(1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/run/mode_test.dart b/sdk/lib/_internal/pub/test/global/run/mode_test.dart
deleted file mode 100644
index 9a5a838..0000000
--- a/sdk/lib/_internal/pub/test/global/run/mode_test.dart
+++ /dev/null
@@ -1,58 +0,0 @@
-// 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 '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class DartTransformer extends Transformer {
-  final BarbackSettings _settings;
-
-  DartTransformer.asPlugin(this._settings);
-
-  String get allowedExtensions => '.in';
-
-  void apply(Transform transform) {
-    transform.addOutput(new Asset.fromString(
-        new AssetId(transform.primaryInput.id.package, "bin/script.dart"),
-        "void main() => print('\${_settings.mode.name}');"));
-  }
-}
-""";
-
-main() {
-  initConfig();
-  integration('runs a script in an activated package with customizable modes',
-      () {
-    servePackages((builder) {
-      builder.serveRepoPackage("barback");
-
-      builder.serve("foo", "1.0.0",
-          deps: {"barback": "any"},
-          pubspec: {"transformers": ["foo/src/transformer"]},
-          contents: [
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", TRANSFORMER),
-          d.file("primary.in", "")
-        ])])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    // By default it should run in release mode.
-    var pub = pubRun(global: true, args: ["foo:script"]);
-    pub.stdout.expect("release");
-    pub.shouldExit();
-
-    // A custom mode should be specifiable.
-    pub = pubRun(global: true, args: ["--mode", "custom-mode", "foo:script"]);
-    pub.stdout.expect("custom-mode");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/run/nonexistent_script_test.dart b/sdk/lib/_internal/pub/test/global/run/nonexistent_script_test.dart
deleted file mode 100644
index d69c65a..0000000
--- a/sdk/lib/_internal/pub/test/global/run/nonexistent_script_test.dart
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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:path/path.dart' as p;
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('errors if the script does not exist.', () {
-    servePackages((builder) => builder.serve("foo", "1.0.0"));
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    var pub = pubRun(global: true, args: ["foo:script"]);
-    pub.stderr.expect("Could not find ${p.join("bin", "script.dart")}.");
-    pub.shouldExit(exit_codes.NO_INPUT);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/run/recompiles_if_sdk_is_out_of_date_test.dart b/sdk/lib/_internal/pub/test/global/run/recompiles_if_sdk_is_out_of_date_test.dart
deleted file mode 100644
index bb38dd7..0000000
--- a/sdk/lib/_internal/pub/test/global/run/recompiles_if_sdk_is_out_of_date_test.dart
+++ /dev/null
@@ -1,49 +0,0 @@
-// 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:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('recompiles a script if the SDK version is out-of-date', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", contents: [
-        d.dir("bin", [
-          d.file("script.dart", "main(args) => print('ok');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    d.dir(cachePath, [
-      d.dir('global_packages', [
-        d.dir('foo', [
-          d.dir('bin', [d.outOfDateSnapshot('script.dart.snapshot')])
-        ])
-      ])
-    ]).create();
-
-    var pub = pubRun(global: true, args: ["foo:script"]);
-    // In the real world this would just print "hello!", but since we collect
-    // all output we see the precompilation messages as well.
-    pub.stdout.expect("Precompiling executables...");
-    pub.stdout.expect(consumeThrough("ok"));
-    pub.shouldExit();
-
-    d.dir(cachePath, [
-      d.dir('global_packages', [
-        d.dir('foo', [
-          d.dir('bin', [
-            d.matcherFile('script.dart.snapshot', contains('ok'))
-          ])
-        ])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/run/reflects_changes_to_local_package_test.dart b/sdk/lib/_internal/pub/test/global/run/reflects_changes_to_local_package_test.dart
deleted file mode 100644
index 9fc5b4e..0000000
--- a/sdk/lib/_internal/pub/test/global/run/reflects_changes_to_local_package_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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 '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('changes in a path package are immediately reflected',
-      () {
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "--source", "path", "../foo"]);
-
-    d.file("foo/bin/foo.dart", "main() => print('changed');").create();
-
-    var pub = pubRun(global: true, args: ["foo"]);
-    pub.stdout.expect("changed");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/run/runs_git_script_test.dart b/sdk/lib/_internal/pub/test/global/run/runs_git_script_test.dart
deleted file mode 100644
index f9c1c5c..0000000
--- a/sdk/lib/_internal/pub/test/global/run/runs_git_script_test.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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 '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('runs a script in a git package', () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "-sgit", "../foo.git"]);
-
-    var pub = pubRun(global: true, args: ["foo"]);
-    pub.stdout.expect("ok");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/run/runs_path_script_test.dart b/sdk/lib/_internal/pub/test/global/run/runs_path_script_test.dart
deleted file mode 100644
index b8d9b2c..0000000
--- a/sdk/lib/_internal/pub/test/global/run/runs_path_script_test.dart
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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 '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('runs a script in a path package', () {
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('ok');")
-      ])
-    ]).create();
-
-    schedulePub(args: ["global", "activate", "--source", "path", "../foo"]);
-
-    var pub = pubRun(global: true, args: ["foo"]);
-    pub.stdout.expect("ok");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/run/runs_script_test.dart b/sdk/lib/_internal/pub/test/global/run/runs_script_test.dart
deleted file mode 100644
index bfd8bcb..0000000
--- a/sdk/lib/_internal/pub/test/global/run/runs_script_test.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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 '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('runs a script in an activated package', () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", contents: [
-        d.dir("bin", [
-          d.file("script.dart", "main(args) => print('ok');")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["global", "activate", "foo"]);
-
-    var pub = pubRun(global: true, args: ["foo:script"]);
-    pub.stdout.expect("ok");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/run/runs_transformer_test.dart b/sdk/lib/_internal/pub/test/global/run/runs_transformer_test.dart
deleted file mode 100644
index 8353ac9..0000000
--- a/sdk/lib/_internal/pub/test/global/run/runs_transformer_test.dart
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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 '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class DartTransformer extends Transformer {
-  DartTransformer.asPlugin();
-
-  String get allowedExtensions => '.in';
-
-  void apply(Transform transform) {
-    transform.addOutput(new Asset.fromString(
-        new AssetId("foo", "bin/script.dart"),
-        "void main() => print('generated');"));
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration('runs a global script generated by a transformer', () {
-      makeGlobalPackage("foo", "1.0.0", [
-        d.pubspec({
-          "name": "foo",
-          "version": "1.0.0",
-          "transformers": ["foo/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", TRANSFORMER),
-          d.file("primary.in", "")
-        ])])
-      ], pkg: ['barback']);
-
-      var pub = pubRun(global: true, args: ["foo:script"]);
-
-      pub.stdout.expect("generated");
-      pub.shouldExit();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/run/unknown_package_test.dart b/sdk/lib/_internal/pub/test/global/run/unknown_package_test.dart
deleted file mode 100644
index 291577a..0000000
--- a/sdk/lib/_internal/pub/test/global/run/unknown_package_test.dart
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('errors if the package is not activated', () {
-    serveNoPackages();
-
-    schedulePub(args: ["global", "run", "foo:bar"],
-        error: startsWith("No active package foo."),
-        exitCode: exit_codes.DATA);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/global/run/uses_old_lockfile_test.dart b/sdk/lib/_internal/pub/test/global/run/uses_old_lockfile_test.dart
deleted file mode 100644
index 21b41ea..0000000
--- a/sdk/lib/_internal/pub/test/global/run/uses_old_lockfile_test.dart
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('uses the 1.6-style lockfile if necessary', () {
-    servePackages((builder) {
-      builder.serve("bar", "1.0.0");
-      builder.serve("foo", "1.0.0", deps: {"bar": "any"}, contents: [
-        d.dir("bin", [
-          d.file("script.dart", """
-              import 'package:bar/bar.dart' as bar;
-
-              main(args) => print(bar.main());""")
-        ])
-      ]);
-    });
-
-    schedulePub(args: ["cache", "add", "foo"]);
-    schedulePub(args: ["cache", "add", "bar"]);
-
-    d.dir(cachePath, [
-      d.dir('global_packages', [
-        d.file('foo.lock', '''
-packages:
-  foo:
-    description: foo
-    source: hosted
-    version: "1.0.0"
-  bar:
-    description: bar
-    source: hosted
-    version: "1.0.0"''')
-      ])
-    ]).create();
-
-    var pub = pubRun(global: true, args: ["foo:script"]);
-    pub.stdout.expect("bar 1.0.0");
-    pub.shouldExit();
-
-    d.dir(cachePath, [
-      d.dir('global_packages', [
-        d.nothing('foo.lock'),
-        d.dir('foo', [d.matcherFile('pubspec.lock', contains('1.0.0'))])
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/hosted/fail_gracefully_on_missing_package_test.dart b/sdk/lib/_internal/pub/test/hosted/fail_gracefully_on_missing_package_test.dart
deleted file mode 100644
index df53819..0000000
--- a/sdk/lib/_internal/pub/test/hosted/fail_gracefully_on_missing_package_test.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  forBothPubGetAndUpgrade((command) {
-    integration('fails gracefully if the package does not exist', () {
-      serveNoPackages();
-
-      d.appDir({"foo": "1.2.3"}).create();
-
-      pubCommand(command, error: new RegExp(r"""
-Could not find package foo at http://localhost:\d+\.
-Depended on by:
-- myapp""", multiLine: true),
-          exitCode: exit_codes.UNAVAILABLE);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/hosted/fail_gracefully_on_url_resolve_test.dart b/sdk/lib/_internal/pub/test/hosted/fail_gracefully_on_url_resolve_test.dart
deleted file mode 100644
index 2936829..0000000
--- a/sdk/lib/_internal/pub/test/hosted/fail_gracefully_on_url_resolve_test.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  forBothPubGetAndUpgrade((command) {
-    integration('fails gracefully if the url does not resolve', () {
-      d.dir(appPath, [
-        d.appPubspec({
-          "foo": {
-            "hosted": {
-              "name": "foo",
-              "url": "http://pub.invalid"
-            }
-          }
-        })
-      ]).create();
-
-      pubCommand(command, error: 'Could not resolve URL "http://pub.invalid".',
-          exitCode: exit_codes.UNAVAILABLE);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/hosted/offline_test.dart b/sdk/lib/_internal/pub/test/hosted/offline_test.dart
deleted file mode 100644
index 3bbc9a7..0000000
--- a/sdk/lib/_internal/pub/test/hosted/offline_test.dart
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  forBothPubGetAndUpgrade((command) {
-    integration('upgrades a package using the cache', () {
-      // Run the server so that we know what URL to use in the system cache.
-      serveNoPackages();
-
-      d.cacheDir({
-        "foo": ["1.2.2", "1.2.3"],
-        "bar": ["1.2.3"]
-      }, includePubspecs: true).create();
-
-      d.appDir({
-        "foo": "any",
-        "bar": "any"
-      }).create();
-
-      var warning = null;
-      if (command == RunCommand.upgrade) {
-        warning = "Warning: Upgrading when offline may not update you "
-                  "to the latest versions of your dependencies.";
-      }
-
-      pubCommand(command, args: ['--offline'], warning: warning);
-
-      d.packagesDir({
-        "foo": "1.2.3",
-        "bar": "1.2.3"
-      }).validate();
-    });
-
-    integration('fails gracefully if a dependency is not cached', () {
-      // Run the server so that we know what URL to use in the system cache.
-      serveNoPackages();
-
-      d.appDir({"foo": "any"}).create();
-
-      pubCommand(command, args: ['--offline'],
-          error: "Could not find package foo in cache.");
-    });
-
-    integration('fails gracefully no cached versions match', () {
-      // Run the server so that we know what URL to use in the system cache.
-      serveNoPackages();
-
-      d.cacheDir({
-        "foo": ["1.2.2", "1.2.3"]
-      }, includePubspecs: true).create();
-
-      d.appDir({"foo": ">2.0.0"}).create();
-
-      pubCommand(command, args: ['--offline'], error:
-          "Package foo has no versions that match >2.0.0 derived from:\n"
-          "- myapp depends on version >2.0.0");
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/hosted/remove_removed_dependency_test.dart b/sdk/lib/_internal/pub/test/hosted/remove_removed_dependency_test.dart
deleted file mode 100644
index 36280c9..0000000
--- a/sdk/lib/_internal/pub/test/hosted/remove_removed_dependency_test.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  forBothPubGetAndUpgrade((command) {
-    integration("removes a dependency that's removed from the pubspec", () {
-      servePackages((builder) {
-        builder.serve("foo", "1.0.0");
-        builder.serve("bar", "1.0.0");
-      });
-
-      d.appDir({"foo": "any", "bar": "any"}).create();
-
-      pubCommand(command);
-
-      d.packagesDir({
-        "foo": "1.0.0",
-        "bar": "1.0.0"
-      }).validate();
-
-      d.appDir({"foo": "any"}).create();
-
-      pubCommand(command);
-
-      d.packagesDir({
-        "foo": "1.0.0",
-        "bar": null
-      }).validate();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/hosted/remove_removed_transitive_dependency_test.dart b/sdk/lib/_internal/pub/test/hosted/remove_removed_transitive_dependency_test.dart
deleted file mode 100644
index f679225..0000000
--- a/sdk/lib/_internal/pub/test/hosted/remove_removed_transitive_dependency_test.dart
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  forBothPubGetAndUpgrade((command) {
-    integration("removes a transitive dependency that's no longer depended "
-        "on", () {
-      servePackages((builder) {
-        builder.serve("foo", "1.0.0", deps: {
-          "shared-dep": "any"
-        });
-        builder.serve("bar", "1.0.0", deps: {
-          "shared-dep": "any",
-          "bar-dep": "any"
-        });
-        builder.serve("shared-dep", "1.0.0");
-        builder.serve("bar-dep", "1.0.0");
-      });
-
-      d.appDir({
-        "foo": "any",
-        "bar": "any"
-      }).create();
-
-      pubCommand(command);
-
-      d.packagesDir({
-        "foo": "1.0.0",
-        "bar": "1.0.0",
-        "shared-dep": "1.0.0",
-        "bar-dep": "1.0.0",
-      }).validate();
-
-      d.appDir({"foo": "any"}).create();
-
-      pubCommand(command);
-
-      d.packagesDir({
-        "foo": "1.0.0",
-        "bar": null,
-        "shared-dep": "1.0.0",
-        "bar-dep": null,
-      }).validate();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/hosted/version_negotiation_test.dart b/sdk/lib/_internal/pub/test/hosted/version_negotiation_test.dart
deleted file mode 100644
index f602618..0000000
--- a/sdk/lib/_internal/pub/test/hosted/version_negotiation_test.dart
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-
-  forBothPubGetAndUpgrade((command) {
-    integration('sends the correct Accept header', () {
-      var server = new ScheduledServer();
-
-      d.appDir({
-        "foo": {
-          "hosted": {
-            "name": "foo",
-            "url": server.url.then((url) => url.toString())
-          }
-        }
-      }).create();
-
-      var pub = startPub(args: [command.name]);
-
-      server.handle('GET', '/api/packages/foo', (request) {
-        expect(request.headers['accept'],
-            equals('application/vnd.pub.v2+json'));
-        return new shelf.Response(200);
-      });
-
-      pub.kill();
-    });
-
-    integration('prints a friendly error if the version is out-of-date', () {
-      var server = new ScheduledServer();
-
-      d.appDir({
-        "foo": {
-          "hosted": {
-            "name": "foo",
-            "url": server.url.then((url) => url.toString())
-          }
-        }
-      }).create();
-
-      var pub = startPub(args: [command.name]);
-
-      server.handle('GET', '/api/packages/foo',
-          (request) => new shelf.Response(406));
-
-      pub.shouldExit(1);
-
-      pub.stderr.expect(emitsLines(
-          "Pub 0.1.2+3 is incompatible with the current version of localhost.\n"
-          "Upgrade pub to the latest version and try again."));
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/implicit_barback_dependency_test.dart b/sdk/lib/_internal/pub/test/implicit_barback_dependency_test.dart
deleted file mode 100644
index 0d16e51..0000000
--- a/sdk/lib/_internal/pub/test/implicit_barback_dependency_test.dart
+++ /dev/null
@@ -1,159 +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 'package:pub_semver/pub_semver.dart';
-
-import 'descriptor.dart' as d;
-import 'test_pub.dart';
-import '../lib/src/barback.dart' as barback;
-
-main() {
-  initConfig();
-
-  var constraint = barback.pubConstraints["barback"];
-  var current = constraint.min.toString();
-  var previous = new Version(constraint.min.major, constraint.min.minor - 1, 0)
-      .toString();
-  var nextPatch = constraint.min.nextPatch.toString();
-  var max = constraint.max.toString();
-
-  var sourceSpanVersion = barback.pubConstraints["source_span"].min.toString();
-  var stackTraceVersion = barback.pubConstraints["stack_trace"].min.toString();
-
-  forBothPubGetAndUpgrade((command) {
-    integration("implicitly constrains barback to versions pub supports", () {
-      servePackages((builder) {
-        builder.serve("barback", previous);
-        builder.serve("barback", current);
-        builder.serve("barback", nextPatch);
-        builder.serve("barback", max);
-        builder.serve("source_span", sourceSpanVersion);
-        builder.serve("stack_trace", stackTraceVersion);
-      });
-
-      d.appDir({
-        "barback": "any"
-      }).create();
-
-      pubCommand(command);
-
-      d.packagesDir({
-        "barback": nextPatch
-      }).validate();
-    });
-
-    integration("discovers transitive dependency on barback", () {
-      servePackages((builder) {
-        builder.serve("barback", previous);
-        builder.serve("barback", current);
-        builder.serve("barback", nextPatch);
-        builder.serve("barback", max);
-        builder.serve("source_span", sourceSpanVersion);
-        builder.serve("stack_trace", stackTraceVersion);
-      });
-
-      d.dir("foo", [
-        d.libDir("foo", "foo 0.0.1"),
-        d.libPubspec("foo", "0.0.1", deps: {
-          "barback": "any"
-        })
-      ]).create();
-
-      d.appDir({
-        "foo": {"path": "../foo"}
-      }).create();
-
-      pubCommand(command);
-
-      d.packagesDir({
-        "barback": nextPatch,
-        "foo": "0.0.1"
-      }).validate();
-    });
-
-    integration("pub's implicit constraint uses the same source and "
-        "description as a dependency override", () {
-      servePackages((builder) {
-        builder.serve("source_span", sourceSpanVersion);
-        builder.serve("stack_trace", stackTraceVersion);
-      });
-
-      d.dir('barback', [
-        d.libDir('barback', 'barback $current'),
-        d.libPubspec('barback', current),
-      ]).create();
-
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "dependency_overrides": {
-            "barback": {"path": "../barback"}
-          }
-        })
-      ]).create();
-
-      pubCommand(command);
-
-      d.packagesDir({
-        "barback": current
-      }).validate();
-    });
-  });
-
-  integration("unlock if the locked version doesn't meet pub's constraint", () {
-    servePackages((builder) {
-      builder.serve("barback", previous);
-      builder.serve("barback", current);
-      builder.serve("source_span", sourceSpanVersion);
-      builder.serve("stack_trace", stackTraceVersion);
-    });
-
-    d.appDir({"barback": "any"}).create();
-
-    // Hand-create a lockfile to pin barback to an older version.
-    createLockFile("myapp", hosted: {
-      "barback": previous
-    });
-
-    pubGet();
-
-    // It should be upgraded.
-    d.packagesDir({
-      "barback": current
-    }).validate();
-  });
-
-  integration("includes pub in the error if a solve failed because there "
-      "is no version available", () {
-    servePackages((builder) {
-      builder.serve("barback", previous);
-      builder.serve("source_span", sourceSpanVersion);
-      builder.serve("stack_trace", stackTraceVersion);
-    });
-
-    d.appDir({"barback": "any"}).create();
-
-    pubGet(error: """
-Package barback has no versions that match >=$current <$max derived from:
-- myapp depends on version any
-- pub itself depends on version >=$current <$max""");
-  });
-
-  integration("includes pub in the error if a solve failed because there "
-      "is a disjoint constraint", () {
-    servePackages((builder) {
-      builder.serve("barback", previous);
-      builder.serve("barback", current);
-      builder.serve("source_span", sourceSpanVersion);
-      builder.serve("stack_trace", stackTraceVersion);
-    });
-
-    d.appDir({"barback": previous}).create();
-
-    pubGet(error: """
-Incompatible version constraints on barback:
-- myapp depends on version $previous
-- pub itself depends on version >=$current <$max""");
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/implicit_dependency_test.dart b/sdk/lib/_internal/pub/test/implicit_dependency_test.dart
deleted file mode 100644
index 0a67566..0000000
--- a/sdk/lib/_internal/pub/test/implicit_dependency_test.dart
+++ /dev/null
@@ -1,125 +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 'package:pub_semver/pub_semver.dart';
-
-import 'descriptor.dart' as d;
-import 'test_pub.dart';
-import '../lib/src/barback.dart' as barback;
-
-main() {
-  initConfig();
-
-  forBothPubGetAndUpgrade((command) {
-    integration("implicitly constrains it to versions pub supports", () {
-      servePackages((builder) {
-        builder.serve("barback", current("barback"));
-        builder.serve("stack_trace", previous("stack_trace"));
-        builder.serve("stack_trace", current("stack_trace"));
-        builder.serve("stack_trace", nextPatch("stack_trace"));
-        builder.serve("stack_trace", max("stack_trace"));
-        builder.serve("source_span", current("source_span"));
-      });
-
-      d.appDir({
-        "barback": "any"
-      }).create();
-
-      pubCommand(command);
-
-      d.packagesDir({"stack_trace": nextPatch("stack_trace")}).validate();
-    });
-
-    integration("pub's implicit constraint uses the same source and "
-        "description as a dependency override", () {
-      servePackages((builder) {
-        builder.serve("barback", current("barback"));
-        builder.serve("stack_trace", nextPatch("stack_trace"));
-        builder.serve("source_span", current("source_span"));
-      });
-
-      d.dir("stack_trace", [
-        d.libDir("stack_trace", 'stack_trace ${current("stack_trace")}'),
-        d.libPubspec("stack_trace", current("stack_trace"))
-      ]).create();
-
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "dependencies": {"barback": "any"},
-          "dependency_overrides": {
-            "stack_trace": {"path": "../stack_trace"},
-          }
-        })
-      ]).create();
-
-      pubCommand(command);
-
-      // Validate that we're using the path dependency version of stack_trace
-      // rather than the hosted version.
-      d.packagesDir({
-        "stack_trace": current("stack_trace")
-      }).validate();
-    });
-
-    integration("doesn't add a constraint if barback isn't in the package "
-        "graph", () {
-      servePackages((builder) {
-        builder.serve("stack_trace", previous("stack_trace"));
-        builder.serve("stack_trace", current("stack_trace"));
-        builder.serve("stack_trace", nextPatch("stack_trace"));
-        builder.serve("stack_trace", max("stack_trace"));
-        builder.serve("source_span", current("source_span"));
-      });
-
-      d.appDir({
-        "stack_trace": "any"
-      }).create();
-
-      pubCommand(command);
-
-      d.packagesDir({"stack_trace": max("stack_trace")}).validate();
-    });
-  });
-
-  integration("unlocks if the locked version doesn't meet pub's "
-      "constraint", () {
-    servePackages((builder) {
-      builder.serve("barback", current("barback"));
-      builder.serve("stack_trace", previous("stack_trace"));
-      builder.serve("stack_trace", current("stack_trace"));
-      builder.serve("source_span", current("source_span"));
-    });
-
-    d.appDir({"barback": "any"}).create();
-
-    // Hand-create a lockfile to pin the package to an older version.
-    createLockFile("myapp", hosted: {
-      "barback": current("barback"),
-      "stack_trace": previous("stack_trace")
-    });
-
-    pubGet();
-
-    // It should be upgraded.
-    d.packagesDir({
-      "stack_trace": current("stack_trace")
-    }).validate();
-  });
-}
-
-String current(String packageName) =>
-    barback.pubConstraints[packageName].min.toString();
-
-String previous(String packageName) {
-  var constraint = barback.pubConstraints[packageName];
-  return new Version(constraint.min.major, constraint.min.minor - 1, 0)
-      .toString();
-}
-
-String nextPatch(String packageName) =>
-    barback.pubConstraints[packageName].min.nextPatch.toString();
-
-String max(String packageName) =>
-    barback.pubConstraints[packageName].max.toString();
diff --git a/sdk/lib/_internal/pub/test/io_test.dart b/sdk/lib/_internal/pub/test/io_test.dart
deleted file mode 100644
index cc5d2c4..0000000
--- a/sdk/lib/_internal/pub/test/io_test.dart
+++ /dev/null
@@ -1,365 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library io_test;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:path/path.dart' as path;
-import 'package:unittest/unittest.dart';
-
-import '../lib/src/io.dart';
-import 'test_pub.dart';
-
-main() {
-  initConfig();
-
-  group('listDir', () {
-    test('ignores hidden files by default', () {
-      expect(withTempDir((temp) {
-        writeTextFile(path.join(temp, 'file1.txt'), '');
-        writeTextFile(path.join(temp, 'file2.txt'), '');
-        writeTextFile(path.join(temp, '.file3.txt'), '');
-        createDir(path.join(temp, '.subdir'));
-        writeTextFile(path.join(temp, '.subdir', 'file3.txt'), '');
-
-        expect(listDir(temp, recursive: true), unorderedEquals([
-          path.join(temp, 'file1.txt'),
-          path.join(temp, 'file2.txt')
-        ]));
-      }), completes);
-    });
-
-    test('includes hidden files when told to', () {
-      expect(withTempDir((temp) {
-        writeTextFile(path.join(temp, 'file1.txt'), '');
-        writeTextFile(path.join(temp, 'file2.txt'), '');
-        writeTextFile(path.join(temp, '.file3.txt'), '');
-        createDir(path.join(temp, '.subdir'));
-        writeTextFile(path.join(temp, '.subdir', 'file3.txt'), '');
-
-        expect(listDir(temp, recursive: true, includeHidden: true),
-            unorderedEquals([
-          path.join(temp, 'file1.txt'),
-          path.join(temp, 'file2.txt'),
-          path.join(temp, '.file3.txt'),
-          path.join(temp, '.subdir'),
-          path.join(temp, '.subdir', 'file3.txt')
-        ]));
-      }), completes);
-    });
-
-    test("doesn't ignore hidden files above the directory being listed", () {
-      expect(withTempDir((temp) {
-        var dir = path.join(temp, '.foo', 'bar');
-        ensureDir(dir);
-        writeTextFile(path.join(dir, 'file1.txt'), '');
-        writeTextFile(path.join(dir, 'file2.txt'), '');
-        writeTextFile(path.join(dir, 'file3.txt'), '');
-
-        expect(listDir(dir, recursive: true), unorderedEquals([
-          path.join(dir, 'file1.txt'),
-          path.join(dir, 'file2.txt'),
-          path.join(dir, 'file3.txt')
-        ]));
-      }), completes);
-    });
-  });
-
-  group('canonicalize', () {
-    test('resolves a non-link', () {
-      expect(withCanonicalTempDir((temp) {
-        var filePath = path.join(temp, 'file');
-        writeTextFile(filePath, '');
-        expect(canonicalize(filePath), equals(filePath));
-      }), completes);
-    });
-
-    test('resolves a non-existent file', () {
-      expect(withCanonicalTempDir((temp) {
-        expect(canonicalize(path.join(temp, 'nothing')),
-            equals(path.join(temp, 'nothing')));
-      }), completes);
-    });
-
-    test('resolves a symlink', () {
-      expect(withCanonicalTempDir((temp) {
-        createDir(path.join(temp, 'linked-dir'));
-        createSymlink(
-            path.join(temp, 'linked-dir'),
-            path.join(temp, 'dir'));
-        expect(
-            canonicalize(path.join(temp, 'dir')),
-            equals(path.join(temp, 'linked-dir')));
-      }), completes);
-    });
-
-    test('resolves a relative symlink', () {
-      expect(withCanonicalTempDir((temp) {
-        createDir(path.join(temp, 'linked-dir'));
-        createSymlink(
-            path.join(temp, 'linked-dir'),
-            path.join(temp, 'dir'),
-            relative: true);
-        expect(
-            canonicalize(path.join(temp, 'dir')),
-            equals(path.join(temp, 'linked-dir')));
-      }), completes);
-    });
-
-    test('resolves a single-level horizontally recursive symlink', () {
-      expect(withCanonicalTempDir((temp) {
-        var linkPath = path.join(temp, 'foo');
-        createSymlink(linkPath, linkPath);
-        expect(canonicalize(linkPath), equals(linkPath));
-      }), completes);
-    });
-
-    test('resolves a multi-level horizontally recursive symlink', () {
-      expect(withCanonicalTempDir((temp) {
-        var fooPath = path.join(temp, 'foo');
-        var barPath = path.join(temp, 'bar');
-        var bazPath = path.join(temp, 'baz');
-        createSymlink(barPath, fooPath);
-        createSymlink(bazPath, barPath);
-        createSymlink(fooPath, bazPath);
-        expect(canonicalize(fooPath), equals(fooPath));
-        expect(canonicalize(barPath), equals(barPath));
-        expect(canonicalize(bazPath), equals(bazPath));
-
-        createSymlink(fooPath, path.join(temp, 'outer'));
-        expect(canonicalize(path.join(temp, 'outer')), equals(fooPath));
-      }), completes);
-    });
-
-    test('resolves a broken symlink', () {
-      expect(withCanonicalTempDir((temp) {
-        createSymlink(path.join(temp, 'nonexistent'), path.join(temp, 'foo'));
-        expect(
-            canonicalize(path.join(temp, 'foo')),
-            equals(path.join(temp, 'nonexistent')));
-      }), completes);
-    });
-
-    test('resolves multiple nested symlinks', () {
-      expect(withCanonicalTempDir((temp) {
-        var dir1 = path.join(temp, 'dir1');
-        var dir2 = path.join(temp, 'dir2');
-        var subdir1 = path.join(dir1, 'subdir1');
-        var subdir2 = path.join(dir2, 'subdir2');
-        createDir(dir2);
-        createDir(subdir2);
-        createSymlink(dir2, dir1);
-        createSymlink(subdir2, subdir1);
-        expect(
-            canonicalize(path.join(subdir1, 'file')),
-            equals(path.join(subdir2, 'file')));
-      }), completes);
-    });
-
-    test('resolves a nested vertical symlink', () {
-      expect(withCanonicalTempDir((temp) {
-        var dir1 = path.join(temp, 'dir1');
-        var dir2 = path.join(temp, 'dir2');
-        var subdir = path.join(dir1, 'subdir');
-        createDir(dir1);
-        createDir(dir2);
-        createSymlink(dir2, subdir);
-        expect(
-            canonicalize(path.join(subdir, 'file')),
-            equals(path.join(dir2, 'file')));
-      }), completes);
-    });
-
-    test('resolves a vertically recursive symlink', () {
-      expect(withCanonicalTempDir((temp) {
-        var dir = path.join(temp, 'dir');
-        var subdir = path.join(dir, 'subdir');
-        createDir(dir);
-        createSymlink(dir, subdir);
-        expect(
-            canonicalize(path.join(temp, 'dir', 'subdir', 'subdir', 'subdir',
-                                   'subdir', 'file')),
-            equals(path.join(dir, 'file')));
-      }), completes);
-    });
-
-    test('resolves a symlink that links to a path that needs more resolving',
-        () {
-      expect(withCanonicalTempDir((temp) {
-        var dir = path.join(temp, 'dir');
-        var linkdir = path.join(temp, 'linkdir');
-        var linkfile = path.join(dir, 'link');
-        createDir(dir);
-        createSymlink(dir, linkdir);
-        createSymlink(path.join(linkdir, 'file'), linkfile);
-        expect(
-            canonicalize(linkfile),
-            equals(path.join(dir, 'file')));
-      }), completes);
-    });
-
-    test('resolves a pair of pathologically-recursive symlinks', () {
-      expect(withCanonicalTempDir((temp) {
-        var foo = path.join(temp, 'foo');
-        var subfoo = path.join(foo, 'subfoo');
-        var bar = path.join(temp, 'bar');
-        var subbar = path.join(bar, 'subbar');
-        createSymlink(subbar, foo);
-        createSymlink(subfoo, bar);
-        expect(
-            canonicalize(subfoo),
-            equals(path.join(subfoo, 'subbar', 'subfoo')));
-      }), completes);
-    });
-  });
-
-  testExistencePredicate("entryExists", entryExists,
-      forFile: true,
-      forFileSymlink: true,
-      forMultiLevelFileSymlink: true,
-      forDirectory: true,
-      forDirectorySymlink: true,
-      forMultiLevelDirectorySymlink: true,
-      forBrokenSymlink: true,
-      forMultiLevelBrokenSymlink: true);
-
-  testExistencePredicate("linkExists", linkExists,
-      forFile: false,
-      forFileSymlink: true,
-      forMultiLevelFileSymlink: true,
-      forDirectory: false,
-      forDirectorySymlink: true,
-      forMultiLevelDirectorySymlink: true,
-      forBrokenSymlink: true,
-      forMultiLevelBrokenSymlink: true);
-
-  testExistencePredicate("fileExists", fileExists,
-      forFile: true,
-      forFileSymlink: true,
-      forMultiLevelFileSymlink: true,
-      forDirectory: false,
-      forDirectorySymlink: false,
-      forMultiLevelDirectorySymlink: false,
-      forBrokenSymlink: false,
-      forMultiLevelBrokenSymlink: false);
-
-  testExistencePredicate("dirExists", dirExists,
-      forFile: false,
-      forFileSymlink: false,
-      forMultiLevelFileSymlink: false,
-      forDirectory: true,
-      forDirectorySymlink: true,
-      forMultiLevelDirectorySymlink: true,
-      forBrokenSymlink: false,
-      forMultiLevelBrokenSymlink: false);
-}
-
-void testExistencePredicate(String name, bool predicate(String path),
-    {bool forFile,
-     bool forFileSymlink,
-     bool forMultiLevelFileSymlink,
-     bool forDirectory,
-     bool forDirectorySymlink,
-     bool forMultiLevelDirectorySymlink,
-     bool forBrokenSymlink,
-     bool forMultiLevelBrokenSymlink}) {
-  group(name, () {
-    test('returns $forFile for a file', () {
-      expect(withTempDir((temp) {
-        var file = path.join(temp, "test.txt");
-        writeTextFile(file, "contents");
-        expect(predicate(file), equals(forFile));
-      }), completes);
-    });
-
-    test('returns $forDirectory for a directory', () {
-      expect(withTempDir((temp) {
-        var file = path.join(temp, "dir");
-        createDir(file);
-        expect(predicate(file), equals(forDirectory));
-      }), completes);
-    });
-
-    test('returns $forDirectorySymlink for a symlink to a directory', () {
-      expect(withTempDir((temp) {
-        var targetPath = path.join(temp, "dir");
-        var symlinkPath = path.join(temp, "linkdir");
-        createDir(targetPath);
-        createSymlink(targetPath, symlinkPath);
-        expect(predicate(symlinkPath), equals(forDirectorySymlink));
-      }), completes);
-    });
-
-    test('returns $forMultiLevelDirectorySymlink for a multi-level symlink to '
-        'a directory', () {
-      expect(withTempDir((temp) {
-        var targetPath = path.join(temp, "dir");
-        var symlink1Path = path.join(temp, "link1dir");
-        var symlink2Path = path.join(temp, "link2dir");
-        createDir(targetPath);
-        createSymlink(targetPath, symlink1Path);
-        createSymlink(symlink1Path, symlink2Path);
-        expect(predicate(symlink2Path),
-              equals(forMultiLevelDirectorySymlink));
-      }), completes);
-    });
-
-    test('returns $forBrokenSymlink for a broken symlink', () {
-      expect(withTempDir((temp) {
-        var targetPath = path.join(temp, "dir");
-        var symlinkPath = path.join(temp, "linkdir");
-        createDir(targetPath);
-        createSymlink(targetPath, symlinkPath);
-        deleteEntry(targetPath);
-        expect(predicate(symlinkPath), equals(forBrokenSymlink));
-      }), completes);
-    });
-
-    test('returns $forMultiLevelBrokenSymlink for a multi-level broken symlink',
-        () {
-      expect(withTempDir((temp) {
-        var targetPath = path.join(temp, "dir");
-        var symlink1Path = path.join(temp, "link1dir");
-        var symlink2Path = path.join(temp, "link2dir");
-        createDir(targetPath);
-        createSymlink(targetPath, symlink1Path);
-        createSymlink(symlink1Path, symlink2Path);
-        deleteEntry(targetPath);
-        expect(predicate(symlink2Path), equals(forMultiLevelBrokenSymlink));
-      }), completes);
-    });
-
-    // Windows doesn't support symlinking to files.
-    if (Platform.operatingSystem != 'windows') {
-      test('returns $forFileSymlink for a symlink to a file', () {
-        expect(withTempDir((temp) {
-          var targetPath = path.join(temp, "test.txt");
-          var symlinkPath = path.join(temp, "link.txt");
-          writeTextFile(targetPath, "contents");
-          createSymlink(targetPath, symlinkPath);
-          expect(predicate(symlinkPath), equals(forFileSymlink));
-        }), completes);
-      });
-
-      test('returns $forMultiLevelFileSymlink for a multi-level symlink to a '
-          'file', () {
-        expect(withTempDir((temp) {
-          var targetPath = path.join(temp, "test.txt");
-          var symlink1Path = path.join(temp, "link1.txt");
-          var symlink2Path = path.join(temp, "link2.txt");
-          writeTextFile(targetPath, "contents");
-          createSymlink(targetPath, symlink1Path);
-          createSymlink(symlink1Path, symlink2Path);
-          expect(predicate(symlink2Path), equals(forMultiLevelFileSymlink));
-        }), completes);
-      });
-    }
-  });
-}
-
-/// Like [withTempDir], but canonicalizes the path before passing it to [fn].
-Future withCanonicalTempDir(Future fn(String path)) =>
-  withTempDir((temp) => fn(canonicalize(temp)));
diff --git a/sdk/lib/_internal/pub/test/lish/archives_and_uploads_a_package_test.dart b/sdk/lib/_internal/pub/test/lish/archives_and_uploads_a_package_test.dart
deleted file mode 100644
index 114159f..0000000
--- a/sdk/lib/_internal/pub/test/lish/archives_and_uploads_a_package_test.dart
+++ /dev/null
@@ -1,42 +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:convert';
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('archives and uploads a package', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-    handleUploadForm(server);
-    handleUpload(server);
-
-    server.handle('GET', '/create', (request) {
-      return new shelf.Response.ok(JSON.encode({
-        'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
-      }));
-    });
-
-    pub.stdout.expect(startsWith('Uploading...'));
-    pub.stdout.expect('Package test_pkg 1.0.0 uploaded!');
-    pub.shouldExit(exit_codes.SUCCESS);
-  });
-
-  // TODO(nweiz): Once a multipart/form-data parser in Dart exists, we should
-  // test that "pub lish" chooses the correct files to publish.
-}
diff --git a/sdk/lib/_internal/pub/test/lish/cloud_storage_upload_doesnt_redirect_test.dart b/sdk/lib/_internal/pub/test/lish/cloud_storage_upload_doesnt_redirect_test.dart
deleted file mode 100644
index faef7ca..0000000
--- a/sdk/lib/_internal/pub/test/lish/cloud_storage_upload_doesnt_redirect_test.dart
+++ /dev/null
@@ -1,33 +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 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration("cloud storage upload doesn't redirect", () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-    handleUploadForm(server);
-
-    server.handle('POST', '/upload', (request) {
-      return drainStream(request.read()).then((_) => new shelf.Response(200));
-    });
-
-    pub.stderr.expect('Failed to upload the package.');
-    pub.shouldExit(1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/cloud_storage_upload_provides_an_error_test.dart b/sdk/lib/_internal/pub/test/lish/cloud_storage_upload_provides_an_error_test.dart
deleted file mode 100644
index fd0dda8..0000000
--- a/sdk/lib/_internal/pub/test/lish/cloud_storage_upload_provides_an_error_test.dart
+++ /dev/null
@@ -1,39 +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 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('cloud storage upload provides an error', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-    handleUploadForm(server);
-
-    server.handle('POST', '/upload', (request) {
-      return drainStream(request.read()).then((_) {
-        return new shelf.Response.notFound(
-            '<Error><Message>Your request sucked.</Message></Error>',
-            headers: {'content-type': 'application/xml'});
-      });
-    });
-
-    // TODO(nweiz): This should use the server's error message once the client
-    // can parse the XML.
-    pub.stderr.expect('Failed to upload the package.');
-    pub.shouldExit(1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/does_not_publish_if_private_test.dart b/sdk/lib/_internal/pub/test/lish/does_not_publish_if_private_test.dart
deleted file mode 100644
index a732d20..0000000
--- a/sdk/lib/_internal/pub/test/lish/does_not_publish_if_private_test.dart
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('does not publish if the package is private', () {
-    var pkg = packageMap("test_pkg", "1.0.0");
-    pkg["publish_to"] = "none";
-    d.dir(appPath, [d.pubspec(pkg)]).create();
-
-    schedulePub(args: ["lish"],
-        error: startsWith("A private package cannot be published."),
-        exitCode: exit_codes.DATA);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/does_not_publish_if_private_with_server_arg_test.dart b/sdk/lib/_internal/pub/test/lish/does_not_publish_if_private_with_server_arg_test.dart
deleted file mode 100644
index 989d506..0000000
--- a/sdk/lib/_internal/pub/test/lish/does_not_publish_if_private_with_server_arg_test.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('does not publish if the package is private even if a server '
-      'argument is provided', () {
-    var pkg = packageMap("test_pkg", "1.0.0");
-    pkg["publish_to"] = "none";
-    d.dir(appPath, [d.pubspec(pkg)]).create();
-
-    schedulePub(args: ["lish", "--server", "http://example.com"],
-        error: startsWith("A private package cannot be published."),
-        exitCode: exit_codes.DATA);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/force_cannot_be_combined_with_dry_run_test.dart b/sdk/lib/_internal/pub/test/lish/force_cannot_be_combined_with_dry_run_test.dart
deleted file mode 100644
index 331d799..0000000
--- a/sdk/lib/_internal/pub/test/lish/force_cannot_be_combined_with_dry_run_test.dart
+++ /dev/null
@@ -1,32 +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 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('--force cannot be combined with --dry-run', () {
-    schedulePub(args: ['lish', '--force', '--dry-run'],
-        error: """
-          Cannot use both --force and --dry-run.
-          
-          Usage: pub publish [options]
-          -h, --help       Print this usage information.
-          -n, --dry-run    Validate but do not publish the package.
-          -f, --force      Publish without confirmation if there are no errors.
-              --server     The package server to which to upload this package.
-                           (defaults to "https://pub.dartlang.org")
-
-          Run "pub help" to see global options.
-          See http://dartlang.org/tools/pub/cmd/pub-lish.html for detailed documentation.
-          """,
-        exitCode: exit_codes.USAGE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/force_does_not_publish_if_private_test.dart b/sdk/lib/_internal/pub/test/lish/force_does_not_publish_if_private_test.dart
deleted file mode 100644
index 53824f0..0000000
--- a/sdk/lib/_internal/pub/test/lish/force_does_not_publish_if_private_test.dart
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('force does not publish if the package is private', () {
-    var pkg = packageMap("test_pkg", "1.0.0");
-    pkg["publish_to"] = "none";
-    d.dir(appPath, [d.pubspec(pkg)]).create();
-
-    schedulePub(args: ["lish", "--force"],
-        error: startsWith("A private package cannot be published."),
-        exitCode: exit_codes.DATA);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/force_does_not_publish_if_there_are_errors_test.dart b/sdk/lib/_internal/pub/test/lish/force_does_not_publish_if_there_are_errors_test.dart
deleted file mode 100644
index 4805cd5..0000000
--- a/sdk/lib/_internal/pub/test/lish/force_does_not_publish_if_there_are_errors_test.dart
+++ /dev/null
@@ -1,29 +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 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('--force does not publish if there are errors', () {
-    var pkg = packageMap("test_pkg", "1.0.0");
-    pkg.remove("homepage");
-    d.dir(appPath, [d.pubspec(pkg)]).create();
-
-    var server = new ScheduledServer();
-    var pub = startPublish(server, args: ['--force']);
-
-    pub.shouldExit(exit_codes.SUCCESS);
-    pub.stderr.expect(consumeThrough("Sorry, your package is missing a "
-        "requirement and can't be published yet."));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/force_publishes_if_tests_are_no_warnings_or_errors_test.dart b/sdk/lib/_internal/pub/test/lish/force_publishes_if_tests_are_no_warnings_or_errors_test.dart
deleted file mode 100644
index c0a1575..0000000
--- a/sdk/lib/_internal/pub/test/lish/force_publishes_if_tests_are_no_warnings_or_errors_test.dart
+++ /dev/null
@@ -1,38 +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:convert';
-
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('--force publishes if there are no warnings or errors', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server, args: ['--force']);
-
-    handleUploadForm(server);
-    handleUpload(server);
-
-    server.handle('GET', '/create', (request) {
-      return new shelf.Response.ok(JSON.encode({
-        'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
-      }));
-    });
-
-    pub.shouldExit(exit_codes.SUCCESS);
-    pub.stdout.expect(consumeThrough('Package test_pkg 1.0.0 uploaded!'));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/force_publishes_if_there_are_warnings_test.dart b/sdk/lib/_internal/pub/test/lish/force_publishes_if_there_are_warnings_test.dart
deleted file mode 100644
index 092855d..0000000
--- a/sdk/lib/_internal/pub/test/lish/force_publishes_if_there_are_warnings_test.dart
+++ /dev/null
@@ -1,47 +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:convert';
-
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('--force publishes if there are warnings', () {
-    var pkg = packageMap("test_pkg", "1.0.0");
-    pkg["author"] = "Natalie Weizenbaum";
-    d.dir(appPath, [d.pubspec(pkg)]).create();
-
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server, args: ['--force']);
-
-    handleUploadForm(server);
-    handleUpload(server);
-
-    server.handle('GET', '/create', (request) {
-      return new shelf.Response.ok(JSON.encode({
-        'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
-      }));
-    });
-
-    pub.shouldExit(exit_codes.SUCCESS);
-    pub.stderr.expect(consumeThrough('Suggestions:'));
-    pub.stderr.expect(emitsLines(
-        '* Author "Natalie Weizenbaum" in pubspec.yaml should have an email '
-            'address\n'
-        '  (e.g. "name <email>").'));
-    pub.stdout.expect(consumeThrough('Package test_pkg 1.0.0 uploaded!'));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/many_files_test.dart b/sdk/lib/_internal/pub/test/lish/many_files_test.dart
deleted file mode 100644
index 776779a..0000000
--- a/sdk/lib/_internal/pub/test/lish/many_files_test.dart
+++ /dev/null
@@ -1,98 +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:convert';
-import 'dart:io';
-import 'dart:math' as math;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-/// The maximum number of bytes in an entire path.
-///
-/// This is [Windows's number][MAX_PATH], which is a much tighter constraint
-/// than OS X or Linux. We subtract one because Windows counts it as the number
-/// of bytes in a path C string including the terminating NUL but we only count
-/// characters here.
-///
-/// We use this limit on all platforms for consistency.
-///
-/// [MAX_PATH]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa383130(v=vs.85).aspx
-const _pathMax = 260 - 1;
-
-main() {
-  initConfig();
-
-  integration('archives and uploads a package with more files than can fit on '
-      'the command line', () {
-    d.validPackage.create();
-
-    var argMax;
-    if (Platform.isWindows) {
-      // On Windows, the maximum argument list length is 8^5 bytes.
-      argMax = math.pow(8, 5);
-    } else {
-      // On POSIX, the maximum argument list length can be retrieved
-      // automatically.
-      var result = Process.runSync("getconf", ["ARG_MAX"]);
-      if (result.exitCode != 0) {
-        fail("getconf failed with exit code ${result.exitCode}:\n"
-            "${result.stderr}");
-      }
-
-      argMax = int.parse(result.stdout);
-    }
-
-    schedule(() {
-      var appRoot = p.join(sandboxDir, appPath);
-
-      // We'll make the filenames as long as possible to reduce the number of
-      // files we have to create to hit the maximum. However, the tar process
-      // uses relative paths, which means we can't count the root as part of the
-      // length.
-      var lengthPerFile = _pathMax - appRoot.length;
-
-      // Create enough files to hit [argMax]. This may be a slight overestimate,
-      // since other options are passed to the tar command line, but we don't
-      // know how long those will be.
-      var filesToCreate = (argMax / lengthPerFile).ceil();
-
-      for (var i = 0; i < filesToCreate; i++) {
-        var iString = i.toString();
-
-        // The file name contains "x"s to make the path hit [_pathMax],
-        // followed by a number to distinguish different files.
-        var fileName =
-          "x" * (_pathMax - appRoot.length - iString.length - 1) + iString;
-
-        new File(p.join(appRoot, fileName)).writeAsStringSync("");
-      }
-    });
-
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-    handleUploadForm(server);
-    handleUpload(server);
-
-    server.handle('GET', '/create', (request) {
-      return new shelf.Response.ok(JSON.encode({
-        'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
-      }));
-    });
-
-    pub.stdout.expect(startsWith('Uploading...'));
-    pub.stdout.expect('Package test_pkg 1.0.0 uploaded!');
-    pub.shouldExit(exit_codes.SUCCESS);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/package_creation_provides_a_malformed_error_test.dart b/sdk/lib/_internal/pub/test/lish/package_creation_provides_a_malformed_error_test.dart
deleted file mode 100644
index 6be2b76..0000000
--- a/sdk/lib/_internal/pub/test/lish/package_creation_provides_a_malformed_error_test.dart
+++ /dev/null
@@ -1,37 +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:convert';
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('package creation provides a malformed error', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-    handleUploadForm(server);
-    handleUpload(server);
-
-    var body = {'error': 'Your package was too boring.'};
-    server.handle('GET', '/create', (request) {
-      return new shelf.Response.notFound(JSON.encode(body));
-    });
-
-    pub.stderr.expect('Invalid server response:');
-    pub.stderr.expect(JSON.encode(body));
-    pub.shouldExit(1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/package_creation_provides_a_malformed_success_test.dart b/sdk/lib/_internal/pub/test/lish/package_creation_provides_a_malformed_success_test.dart
deleted file mode 100644
index 4f99dfb..0000000
--- a/sdk/lib/_internal/pub/test/lish/package_creation_provides_a_malformed_success_test.dart
+++ /dev/null
@@ -1,37 +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:convert';
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('package creation provides a malformed success', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-    handleUploadForm(server);
-    handleUpload(server);
-
-    var body = {'success': 'Your package was awesome.'};
-    server.handle('GET', '/create', (request) {
-      return new shelf.Response.ok(JSON.encode(body));
-    });
-
-    pub.stderr.expect('Invalid server response:');
-    pub.stderr.expect(JSON.encode(body));
-    pub.shouldExit(1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/package_creation_provides_an_error_test.dart b/sdk/lib/_internal/pub/test/lish/package_creation_provides_an_error_test.dart
deleted file mode 100644
index 1a1d1b8..0000000
--- a/sdk/lib/_internal/pub/test/lish/package_creation_provides_an_error_test.dart
+++ /dev/null
@@ -1,37 +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:convert';
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('package creation provides an error', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-    handleUploadForm(server);
-    handleUpload(server);
-
-    server.handle('GET', '/create', (request) {
-      return new shelf.Response.notFound(JSON.encode({
-        'error': {'message': 'Your package was too boring.'}
-      }));
-    });
-
-    pub.stderr.expect('Your package was too boring.');
-    pub.shouldExit(1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/package_creation_provides_invalid_json_test.dart b/sdk/lib/_internal/pub/test/lish/package_creation_provides_invalid_json_test.dart
deleted file mode 100644
index 822eaa0..0000000
--- a/sdk/lib/_internal/pub/test/lish/package_creation_provides_invalid_json_test.dart
+++ /dev/null
@@ -1,35 +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 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('package creation provides invalid JSON', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-    handleUploadForm(server);
-    handleUpload(server);
-
-    server.handle('GET', '/create', (request) {
-      return new shelf.Response.ok('{not json');
-    });
-
-    pub.stderr.expect(emitsLines(
-        'Invalid server response:\n'
-        '{not json'));
-    pub.shouldExit(1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/package_validation_has_a_warning_and_continues_test.dart b/sdk/lib/_internal/pub/test/lish/package_validation_has_a_warning_and_continues_test.dart
deleted file mode 100644
index 89d84e7..0000000
--- a/sdk/lib/_internal/pub/test/lish/package_validation_has_a_warning_and_continues_test.dart
+++ /dev/null
@@ -1,42 +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:convert';
-
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('package validation has a warning and continues', () {
-    var pkg = packageMap("test_pkg", "1.0.0");
-    pkg["author"] = "Natalie Weizenbaum";
-    d.dir(appPath, [d.pubspec(pkg)]).create();
-
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-    pub.writeLine("y");
-    handleUploadForm(server);
-    handleUpload(server);
-
-    server.handle('GET', '/create', (request) {
-      return new shelf.Response.ok(JSON.encode({
-        'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
-      }));
-    });
-
-    pub.shouldExit(exit_codes.SUCCESS);
-    pub.stdout.expect(consumeThrough('Package test_pkg 1.0.0 uploaded!'));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/package_validation_has_a_warning_and_is_canceled_test.dart b/sdk/lib/_internal/pub/test/lish/package_validation_has_a_warning_and_is_canceled_test.dart
deleted file mode 100644
index 314c528e9..0000000
--- a/sdk/lib/_internal/pub/test/lish/package_validation_has_a_warning_and_is_canceled_test.dart
+++ /dev/null
@@ -1,29 +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 'package:scheduled_test/scheduled_server.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('package validation has a warning and is canceled', () {
-    var pkg = packageMap("test_pkg", "1.0.0");
-    pkg["author"] = "Natalie Weizenbaum";
-    d.dir(appPath, [d.pubspec(pkg)]).create();
-
-    var server = new ScheduledServer();
-    var pub = startPublish(server);
-
-    pub.writeLine("n");
-    pub.shouldExit(exit_codes.SUCCESS);
-    pub.stderr.expect(consumeThrough("Package upload canceled."));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/package_validation_has_an_error_test.dart b/sdk/lib/_internal/pub/test/lish/package_validation_has_an_error_test.dart
deleted file mode 100644
index 9eeae1a..0000000
--- a/sdk/lib/_internal/pub/test/lish/package_validation_has_an_error_test.dart
+++ /dev/null
@@ -1,29 +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 'package:scheduled_test/scheduled_server.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('package validation has an error', () {
-    var pkg = packageMap("test_pkg", "1.0.0");
-    pkg.remove("homepage");
-    d.dir(appPath, [d.pubspec(pkg)]).create();
-
-    var server = new ScheduledServer();
-    var pub = startPublish(server);
-
-    pub.shouldExit(exit_codes.SUCCESS);
-    pub.stderr.expect(consumeThrough("Sorry, your package is missing a "
-        "requirement and can't be published yet."));
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/lish/preview_errors_if_private_test.dart b/sdk/lib/_internal/pub/test/lish/preview_errors_if_private_test.dart
deleted file mode 100644
index 5884c1e..0000000
--- a/sdk/lib/_internal/pub/test/lish/preview_errors_if_private_test.dart
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('preview shows an error if the package is private', () {
-    var pkg = packageMap("test_pkg", "1.0.0");
-    pkg["publish_to"] = "none";
-    d.dir(appPath, [d.pubspec(pkg)]).create();
-
-    schedulePub(args: ["lish", "--dry-run"],
-        error: startsWith("A private package cannot be published."),
-        exitCode: exit_codes.DATA);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/preview_package_validation_has_a_warning_test.dart b/sdk/lib/_internal/pub/test/lish/preview_package_validation_has_a_warning_test.dart
deleted file mode 100644
index cbc94fb..0000000
--- a/sdk/lib/_internal/pub/test/lish/preview_package_validation_has_a_warning_test.dart
+++ /dev/null
@@ -1,34 +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 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('preview package validation has a warning', () {
-    var pkg = packageMap("test_pkg", "1.0.0");
-    pkg["author"] = "Natalie Weizenbaum";
-    d.dir(appPath, [d.pubspec(pkg)]).create();
-
-    var server = new ScheduledServer();
-    var pub = startPublish(server, args: ['--dry-run']);
-
-    pub.shouldExit(exit_codes.SUCCESS);
-    pub.stderr.expect(consumeThrough('Suggestions:'));
-    pub.stderr.expect(emitsLines(
-        '* Author "Natalie Weizenbaum" in pubspec.yaml should have an email '
-            'address\n'
-        '  (e.g. "name <email>").\n'
-        '\n'
-        'Package has 1 warning.'));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/preview_package_validation_has_no_warnings_test.dart b/sdk/lib/_internal/pub/test/lish/preview_package_validation_has_no_warnings_test.dart
deleted file mode 100644
index 66f092e..0000000
--- a/sdk/lib/_internal/pub/test/lish/preview_package_validation_has_no_warnings_test.dart
+++ /dev/null
@@ -1,28 +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 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('preview package validation has no warnings', () {
-    var pkg = packageMap("test_pkg", "1.0.0");
-    pkg["author"] = "Natalie Weizenbaum <nweiz@google.com>";
-    d.dir(appPath, [d.pubspec(pkg)]).create();
-
-    var server = new ScheduledServer();
-    var pub = startPublish(server, args: ['--dry-run']);
-
-    pub.shouldExit(exit_codes.SUCCESS);
-    pub.stderr.expect(consumeThrough('Package has 0 warnings.'));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/server_arg_does_not_override_private_test.dart b/sdk/lib/_internal/pub/test/lish/server_arg_does_not_override_private_test.dart
deleted file mode 100644
index 5be6bfc..0000000
--- a/sdk/lib/_internal/pub/test/lish/server_arg_does_not_override_private_test.dart
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('an explicit --server argument does not override privacy', () {
-    var pkg = packageMap("test_pkg", "1.0.0");
-    pkg["publish_to"] = "none";
-    d.dir(appPath, [d.pubspec(pkg)]).create();
-
-    schedulePub(args: ["lish", "--server", "http://arg.com"],
-        error: startsWith("A private package cannot be published."),
-        exitCode: exit_codes.DATA);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/server_arg_overrides_publish_to_url_test.dart b/sdk/lib/_internal/pub/test/lish/server_arg_overrides_publish_to_url_test.dart
deleted file mode 100644
index b5c9a14..0000000
--- a/sdk/lib/_internal/pub/test/lish/server_arg_overrides_publish_to_url_test.dart
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('an explicit --server argument overrides a "publish_to" url', () {
-    var pkg = packageMap("test_pkg", "1.0.0");
-    pkg["publish_to"] = "http://pubspec.com";
-    d.dir(appPath, [d.pubspec(pkg)]).create();
-
-    schedulePub(args: ["lish", "--dry-run", "--server", "http://arg.com"],
-        output: contains("http://arg.com"));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/upload_form_fields_has_a_non_string_value_test.dart b/sdk/lib/_internal/pub/test/lish/upload_form_fields_has_a_non_string_value_test.dart
deleted file mode 100644
index b241a16..0000000
--- a/sdk/lib/_internal/pub/test/lish/upload_form_fields_has_a_non_string_value_test.dart
+++ /dev/null
@@ -1,34 +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:convert';
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('upload form fields has a non-string value', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-
-    var body = {
-      'url': 'http://example.com/upload',
-      'fields': {'field': 12}
-    };
-    handleUploadForm(server, body);
-    pub.stderr.expect('Invalid server response:');
-    pub.stderr.expect(JSON.encode(body));
-    pub.shouldExit(1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/upload_form_fields_is_not_a_map_test.dart b/sdk/lib/_internal/pub/test/lish/upload_form_fields_is_not_a_map_test.dart
deleted file mode 100644
index 260f1f3..0000000
--- a/sdk/lib/_internal/pub/test/lish/upload_form_fields_is_not_a_map_test.dart
+++ /dev/null
@@ -1,31 +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:convert';
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('upload form fields is not a map', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-
-    var body = {'url': 'http://example.com/upload', 'fields': 12};
-    handleUploadForm(server, body);
-    pub.stderr.expect('Invalid server response:');
-    pub.stderr.expect(JSON.encode(body));
-    pub.shouldExit(1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/upload_form_is_missing_fields_test.dart b/sdk/lib/_internal/pub/test/lish/upload_form_is_missing_fields_test.dart
deleted file mode 100644
index 3513df5..0000000
--- a/sdk/lib/_internal/pub/test/lish/upload_form_is_missing_fields_test.dart
+++ /dev/null
@@ -1,31 +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:convert';
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('upload form is missing fields', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-
-    var body = {'url': 'http://example.com/upload'};
-    handleUploadForm(server, body);
-    pub.stderr.expect('Invalid server response:');
-    pub.stderr.expect(JSON.encode(body));
-    pub.shouldExit(1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/upload_form_is_missing_url_test.dart b/sdk/lib/_internal/pub/test/lish/upload_form_is_missing_url_test.dart
deleted file mode 100644
index a08b581..0000000
--- a/sdk/lib/_internal/pub/test/lish/upload_form_is_missing_url_test.dart
+++ /dev/null
@@ -1,37 +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:convert';
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('upload form is missing url', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-
-    var body = {
-      'fields': {
-        'field1': 'value1',
-        'field2': 'value2'
-      }
-    };
-
-    handleUploadForm(server, body);
-    pub.stderr.expect('Invalid server response:');
-    pub.stderr.expect(JSON.encode(body));
-    pub.shouldExit(1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/upload_form_provides_an_error_test.dart b/sdk/lib/_internal/pub/test/lish/upload_form_provides_an_error_test.dart
deleted file mode 100644
index 4df0129..0000000
--- a/sdk/lib/_internal/pub/test/lish/upload_form_provides_an_error_test.dart
+++ /dev/null
@@ -1,34 +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:convert';
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('upload form provides an error', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-
-    server.handle('GET', '/api/packages/versions/new', (request) {
-      return new shelf.Response.notFound(JSON.encode({
-        'error': {'message': 'your request sucked'}
-      }));
-    });
-
-    pub.stderr.expect('your request sucked');
-    pub.shouldExit(1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/upload_form_provides_invalid_json_test.dart b/sdk/lib/_internal/pub/test/lish/upload_form_provides_invalid_json_test.dart
deleted file mode 100644
index 60b1f14..0000000
--- a/sdk/lib/_internal/pub/test/lish/upload_form_provides_invalid_json_test.dart
+++ /dev/null
@@ -1,31 +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 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('upload form provides invalid JSON', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-
-    server.handle('GET', '/api/packages/versions/new',
-        (request) => new shelf.Response.ok('{not json'));
-
-    pub.stderr.expect(emitsLines(
-        'Invalid server response:\n'
-        '{not json'));
-    pub.shouldExit(1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/upload_form_url_is_not_a_string_test.dart b/sdk/lib/_internal/pub/test/lish/upload_form_url_is_not_a_string_test.dart
deleted file mode 100644
index 2f32df4..0000000
--- a/sdk/lib/_internal/pub/test/lish/upload_form_url_is_not_a_string_test.dart
+++ /dev/null
@@ -1,38 +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:convert';
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(d.validPackage.create);
-
-  integration('upload form url is not a string', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-
-    var body = {
-      'url': 12,
-      'fields': {
-        'field1': 'value1',
-        'field2': 'value2'
-      }
-    };
-
-    handleUploadForm(server, body);
-    pub.stderr.expect('Invalid server response:');
-    pub.stderr.expect(JSON.encode(body));
-    pub.shouldExit(1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/uses_publish_to_url_test.dart b/sdk/lib/_internal/pub/test/lish/uses_publish_to_url_test.dart
deleted file mode 100644
index 4d6d1e7..0000000
--- a/sdk/lib/_internal/pub/test/lish/uses_publish_to_url_test.dart
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('preview shows an error if the package is private', () {
-    var pkg = packageMap("test_pkg", "1.0.0");
-    pkg["publish_to"] = "http://example.com";
-    d.dir(appPath, [d.pubspec(pkg)]).create();
-
-    schedulePub(args: ["lish", "--dry-run"],
-        output: contains("Publishing test_pkg 1.0.0 to http://example.com"));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/lish/utils.dart b/sdk/lib/_internal/pub/test/lish/utils.dart
deleted file mode 100644
index 00127c1..0000000
--- a/sdk/lib/_internal/pub/test/lish/utils.dart
+++ /dev/null
@@ -1,46 +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 lish.utils;
-
-import 'dart:convert';
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../../lib/src/io.dart';
-
-void handleUploadForm(ScheduledServer server, [Map body]) {
-  server.handle('GET', '/api/packages/versions/new', (request) {
-    return server.url.then((url) {
-      expect(request.headers,
-          containsPair('authorization', 'Bearer access token'));
-
-      if (body == null) {
-        body = {
-          'url': url.resolve('/upload').toString(),
-          'fields': {
-            'field1': 'value1',
-            'field2': 'value2'
-          }
-        };
-      }
-
-      return new shelf.Response.ok(JSON.encode(body),
-          headers: {'content-type': 'application/json'});
-    });
-  });
-}
-
-void handleUpload(ScheduledServer server) {
-  server.handle('POST', '/upload', (request) {
-    // TODO(nweiz): Once a multipart/form-data parser in Dart exists, validate
-    // that the request body is correctly formatted. See issue 6952.
-    return drainStream(request.read())
-        .then((_) => server.url)
-        .then((url) => new shelf.Response.found(url.resolve('/create')));
-  });
-}
-
diff --git a/sdk/lib/_internal/pub/test/list_package_dirs/ignores_updated_pubspec_test.dart b/sdk/lib/_internal/pub/test/list_package_dirs/ignores_updated_pubspec_test.dart
deleted file mode 100644
index 33d5065..0000000
--- a/sdk/lib/_internal/pub/test/list_package_dirs/ignores_updated_pubspec_test.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'package:path/path.dart' as path;
-
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("uses what's in the lockfile regardless of the pubspec", () {
-    d.dir("foo", [
-      d.libDir("foo"),
-      d.libPubspec("foo", "1.0.0")
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": path.join(sandboxDir, "foo")}
-      })
-    ]).create();
-
-    pubGet();
-
-    // Add a dependency on "bar" and remove "foo", but don't run "pub get".
-    d.dir(appPath, [
-      d.appPubspec({
-        "bar": "any"
-      })
-    ]).create();
-
-    // Note: Using canonicalize here because pub gets the path to the
-    // entrypoint package from the working directory, which has had symlinks
-    // resolve. On Mac, "/tmp" is actually a symlink to "/private/tmp", so we
-    // need to accomodate that.
-    schedulePub(args: ["list-package-dirs", "--format=json"],
-        outputJson: {
-          "packages": {
-            "foo": path.join(sandboxDir, "foo", "lib"),
-            "myapp": canonicalize(path.join(sandboxDir, appPath, "lib"))
-          },
-          "input_files": [
-            canonicalize(path.join(sandboxDir, appPath, "pubspec.lock")),
-            canonicalize(path.join(sandboxDir, appPath, "pubspec.yaml"))
-          ]
-        });
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/list_package_dirs/includes_dev_dependencies_test.dart b/sdk/lib/_internal/pub/test/list_package_dirs/includes_dev_dependencies_test.dart
deleted file mode 100644
index 69bbe4544..0000000
--- a/sdk/lib/_internal/pub/test/list_package_dirs/includes_dev_dependencies_test.dart
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'package:path/path.dart' as path;
-
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('includes dev dependencies in the results', () {
-    d.dir("foo", [
-      d.libDir("foo"),
-      d.libPubspec("foo", "1.0.0")
-    ]).create();
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dev_dependencies": {
-          "foo": {"path": path.join(sandboxDir, "foo")}
-        }
-      })
-    ]).create();
-
-    pubGet();
-
-    // Note: Using canonicalize here because pub gets the path to the
-    // entrypoint package from the working directory, which has had symlinks
-    // resolve. On Mac, "/tmp" is actually a symlink to "/private/tmp", so we
-    // need to accomodate that.
-    schedulePub(args: ["list-package-dirs", "--format=json"],
-        outputJson: {
-          "packages": {
-            "foo": path.join(sandboxDir, "foo", "lib"),
-            "myapp": canonicalize(path.join(sandboxDir, appPath, "lib"))
-          },
-          "input_files": [
-            canonicalize(path.join(sandboxDir, appPath, "pubspec.lock")),
-            canonicalize(path.join(sandboxDir, appPath, "pubspec.yaml"))
-          ]
-        });
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/list_package_dirs/lists_dependency_directories_test.dart b/sdk/lib/_internal/pub/test/list_package_dirs/lists_dependency_directories_test.dart
deleted file mode 100644
index fe29d81..0000000
--- a/sdk/lib/_internal/pub/test/list_package_dirs/lists_dependency_directories_test.dart
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'package:path/path.dart' as path;
-
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('prints the local paths to all packages in the lockfile', () {
-    servePackages((builder) => builder.serve("bar", "1.0.0"));
-
-    d.dir("foo", [
-      d.libDir("foo"),
-      d.libPubspec("foo", "1.0.0")
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": path.join(sandboxDir, "foo")},
-        "bar": "any"
-      })
-    ]).create();
-
-    pubGet();
-
-    // Note: Using canonicalize here because pub gets the path to the
-    // entrypoint package from the working directory, which has had symlinks
-    // resolve. On Mac, "/tmp" is actually a symlink to "/private/tmp", so we
-    // need to accomodate that.
-    schedulePub(args: ["list-package-dirs", "--format=json"],
-        outputJson: {
-          "packages": {
-            "foo": path.join(sandboxDir, "foo", "lib"),
-            "bar": port.then((p) => path.join(sandboxDir, cachePath, "hosted",
-                "localhost%58$p", "bar-1.0.0", "lib")),
-            "myapp": canonicalize(path.join(sandboxDir, appPath, "lib"))
-          },
-          "input_files": [
-            canonicalize(path.join(sandboxDir, appPath, "pubspec.lock")),
-            canonicalize(path.join(sandboxDir, appPath, "pubspec.yaml"))
-          ]
-        });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/list_package_dirs/lockfile_error_test.dart b/sdk/lib/_internal/pub/test/list_package_dirs/lockfile_error_test.dart
deleted file mode 100644
index 893e206..0000000
--- a/sdk/lib/_internal/pub/test/list_package_dirs/lockfile_error_test.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("reports the lockfile path when there is an error in it", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.file("pubspec.lock", "some bad yaml")
-    ]).create();
-
-    schedulePub(args: ["list-package-dirs", "--format=json"],
-        outputJson: {
-          "error": contains('The lockfile must be a YAML mapping.'),
-          "path": canonicalize(path.join(sandboxDir, appPath, "pubspec.lock"))
-        },
-        exitCode: exit_codes.DATA);
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/list_package_dirs/missing_pubspec_test.dart b/sdk/lib/_internal/pub/test/list_package_dirs/missing_pubspec_test.dart
deleted file mode 100644
index ea32e58..0000000
--- a/sdk/lib/_internal/pub/test/list_package_dirs/missing_pubspec_test.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'package:path/path.dart' as path;
-
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  // This is a regression test for #20065.
-  integration("reports a missing pubspec error using JSON", () {
-    d.dir(appPath).create();
-
-    schedulePub(args: ["list-package-dirs", "--format=json"],
-        outputJson: {
-          "error":
-            'Could not find a file named "pubspec.yaml" in "'
-                '${canonicalize(path.join(sandboxDir, appPath))}".',
-          "path": canonicalize(path.join(sandboxDir, appPath, "pubspec.yaml"))
-        },
-        exitCode: 1);
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/list_package_dirs/no_lockfile_test.dart b/sdk/lib/_internal/pub/test/list_package_dirs/no_lockfile_test.dart
deleted file mode 100644
index 397e4a2..0000000
--- a/sdk/lib/_internal/pub/test/list_package_dirs/no_lockfile_test.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('with no lockfile, exits with error', () {
-    d.dir(appPath, [
-      d.appPubspec()
-    ]).create();
-
-    schedulePub(args: ["list-package-dirs", "--format=json"],
-        outputJson: {
-          "error":
-            'Package "myapp" has no lockfile. Please run "pub get" first.'
-        },
-        exitCode: exit_codes.DATA);
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/list_package_dirs/pubspec_error_test.dart b/sdk/lib/_internal/pub/test/list_package_dirs/pubspec_error_test.dart
deleted file mode 100644
index 6e4a4ee..0000000
--- a/sdk/lib/_internal/pub/test/list_package_dirs/pubspec_error_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("reports the pubspec path when there is an error in it", () {
-    d.dir(appPath, [
-      d.file("pubspec.yaml", "some bad yaml")
-    ]).create();
-
-    schedulePub(args: ["list-package-dirs", "--format=json"],
-        outputJson: {
-          "error": contains('Error on line 1'),
-          "path": canonicalize(path.join(sandboxDir, appPath, "pubspec.yaml"))
-        },
-        exitCode: exit_codes.DATA);
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/lock_file_test.dart b/sdk/lib/_internal/pub/test/lock_file_test.dart
deleted file mode 100644
index a2ce2f7..0000000
--- a/sdk/lib/_internal/pub/test/lock_file_test.dart
+++ /dev/null
@@ -1,229 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library lock_file_test;
-
-import 'dart:async';
-
-import 'package:pub_semver/pub_semver.dart';
-import 'package:unittest/unittest.dart';
-import 'package:yaml/yaml.dart';
-
-import '../lib/src/lock_file.dart';
-import '../lib/src/package.dart';
-import '../lib/src/pubspec.dart';
-import '../lib/src/source.dart';
-import '../lib/src/source_registry.dart';
-import 'test_pub.dart';
-
-class MockSource extends Source {
-  final String name = 'mock';
-
-  Future<Pubspec> doDescribe(PackageId id) => throw new UnsupportedError(
-      "Cannot describe mock packages.");
-
-  Future get(PackageId id, String symlink) => throw new UnsupportedError(
-      "Cannot get a mock package.");
-
-  Future<String> getDirectory(PackageId id) => throw new UnsupportedError(
-      "Cannot get the directory for mock packages.");
-
-  dynamic parseDescription(String filePath, String description,
-                           {bool fromLockFile: false}) {
-    if (!description.endsWith(' desc')) throw new FormatException();
-    return description;
-  }
-
-  bool descriptionsEqual(description1, description2) =>
-      description1 == description2;
-
-  String packageName(String description) {
-    // Strip off ' desc'.
-    return description.substring(0, description.length - 5);
-  }
-}
-
-main() {
-  initConfig();
-
-  var sources = new SourceRegistry();
-  var mockSource = new MockSource();
-  sources.register(mockSource);
-
-  group('LockFile', () {
-    group('parse()', () {
-      test('returns an empty lockfile if the contents are empty', () {
-        var lockFile = new LockFile.parse('', sources);
-        expect(lockFile.packages.length, equals(0));
-      });
-
-      test('returns an empty lockfile if the contents are whitespace', () {
-        var lockFile = new LockFile.parse('  \t\n  ', sources);
-        expect(lockFile.packages.length, equals(0));
-      });
-
-      test('parses a series of package descriptions', () {
-        var lockFile = new LockFile.parse('''
-packages:
-  bar:
-    version: 1.2.3
-    source: mock
-    description: bar desc
-  foo:
-    version: 2.3.4
-    source: mock
-    description: foo desc
-''', sources);
-
-        expect(lockFile.packages.length, equals(2));
-
-        var bar = lockFile.packages['bar'];
-        expect(bar.name, equals('bar'));
-        expect(bar.version, equals(new Version(1, 2, 3)));
-        expect(bar.source, equals(mockSource.name));
-        expect(bar.description, equals('bar desc'));
-
-        var foo = lockFile.packages['foo'];
-        expect(foo.name, equals('foo'));
-        expect(foo.version, equals(new Version(2, 3, 4)));
-        expect(foo.source, equals(mockSource.name));
-        expect(foo.description, equals('foo desc'));
-      });
-
-      test("allows an unknown source", () {
-        var lockFile = new LockFile.parse('''
-packages:
-  foo:
-    source: bad
-    version: 1.2.3
-    description: foo desc
-''', sources);
-        var foo = lockFile.packages['foo'];
-        expect(foo.source, equals('bad'));
-      });
-
-      test("allows an empty dependency map", () {
-        var lockFile = new LockFile.parse('''
-packages:
-''', sources);
-        expect(lockFile.packages, isEmpty);
-      });
-
-      test("throws if the top level is not a map", () {
-        expect(() {
-          new LockFile.parse('''
-not a map
-''', sources);
-        }, throwsFormatException);
-      });
-
-      test("throws if the contents of 'packages' is not a map", () {
-        expect(() {
-          new LockFile.parse('''
-packages: not a map
-''', sources);
-        }, throwsFormatException);
-      });
-
-      test("throws if the version is missing", () {
-        expect(() {
-          new LockFile.parse('''
-packages:
-  foo:
-    source: mock
-    description: foo desc
-''', sources);
-        }, throwsFormatException);
-      });
-
-      test("throws if the version is invalid", () {
-        expect(() {
-          new LockFile.parse('''
-packages:
-  foo:
-    version: vorpal
-    source: mock
-    description: foo desc
-''', sources);
-        }, throwsFormatException);
-      });
-
-      test("throws if the source is missing", () {
-        expect(() {
-          new LockFile.parse('''
-packages:
-  foo:
-    version: 1.2.3
-    description: foo desc
-''', sources);
-        }, throwsFormatException);
-      });
-
-      test("throws if the description is missing", () {
-        expect(() {
-          new LockFile.parse('''
-packages:
-  foo:
-    version: 1.2.3
-    source: mock
-''', sources);
-        }, throwsFormatException);
-      });
-
-      test("throws if the description is invalid", () {
-        expect(() {
-          new LockFile.parse('''
-packages:
-  foo:
-    version: 1.2.3
-    source: mock
-    description: foo desc is bad
-''', sources);
-        }, throwsFormatException);
-      });
-
-      test("ignores extra stuff in file", () {
-        var lockFile = new LockFile.parse('''
-extra:
-  some: stuff
-packages:
-  foo:
-    bonus: not used
-    version: 1.2.3
-    source: mock
-    description: foo desc
-''', sources);
-      });
-    });
-
-    group('serialize()', () {
-      var lockfile;
-      setUp(() {
-        lockfile = new LockFile.empty();
-      });
-
-      test('dumps the lockfile to YAML', () {
-        lockfile.packages['foo'] = new PackageId(
-            'foo', mockSource.name, new Version.parse('1.2.3'), 'foo desc');
-        lockfile.packages['bar'] = new PackageId(
-            'bar', mockSource.name, new Version.parse('3.2.1'), 'bar desc');
-
-        expect(loadYaml(lockfile.serialize(null, sources)), equals({
-          'packages': {
-            'foo': {
-              'version': '1.2.3',
-              'source': 'mock',
-              'description': 'foo desc'
-            },
-            'bar': {
-              'version': '3.2.1',
-              'source': 'mock',
-              'description': 'bar desc'
-            }
-          }
-        }));
-      });
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/no_package_symlinks_test.dart b/sdk/lib/_internal/pub/test/no_package_symlinks_test.dart
deleted file mode 100644
index 2911deb..0000000
--- a/sdk/lib/_internal/pub/test/no_package_symlinks_test.dart
+++ /dev/null
@@ -1,115 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import 'descriptor.dart' as d;
-import 'test_pub.dart';
-
-main() {
-  initConfig();
-
-  forBothPubGetAndUpgrade((command) {
-    group("with --no-package-symlinks", () {
-      integration("installs hosted dependencies to the cache", () {
-        servePackages((builder) {
-          builder.serve("foo", "1.0.0");
-          builder.serve("bar", "1.0.0");
-        });
-
-        d.appDir({"foo": "any", "bar": "any"}).create();
-
-        pubCommand(command, args: ["--no-package-symlinks"]);
-
-        d.nothing("$appPath/packages").validate();
-
-        d.hostedCache([
-          d.dir("foo-1.0.0", [
-            d.dir("lib", [d.file("foo.dart", 'main() => "foo 1.0.0";')])
-          ]),
-          d.dir("bar-1.0.0", [
-            d.dir("lib", [d.file("bar.dart", 'main() => "bar 1.0.0";')])
-          ])
-        ]).validate();
-      });
-
-      integration("installs git dependencies to the cache", () {
-        ensureGit();
-
-        d.git('foo.git', [
-          d.libDir('foo'),
-          d.libPubspec('foo', '1.0.0')
-        ]).create();
-
-        d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-        pubCommand(command, args: ["--no-package-symlinks"]);
-
-        d.nothing("$appPath/packages").validate();
-
-        d.dir(cachePath, [
-          d.dir('git', [
-            d.dir('cache', [d.gitPackageRepoCacheDir('foo')]),
-            d.gitPackageRevisionCacheDir('foo')
-          ])
-        ]).validate();
-      });
-
-      integration("locks path dependencies", () {
-        d.dir("foo", [
-          d.libDir("foo"),
-          d.libPubspec("foo", "0.0.1")
-        ]).create();
-
-        d.dir(appPath, [
-          d.appPubspec({
-            "foo": {"path": "../foo"}
-          })
-        ]).create();
-
-        pubCommand(command, args: ["--no-package-symlinks"]);
-
-        d.nothing("$appPath/packages").validate();
-        d.matcherFile("$appPath/pubspec.lock", contains("foo"));
-      });
-
-      integration("removes package directories near entrypoints", () {
-        d.dir(appPath, [
-          d.appPubspec(),
-          d.dir("packages"),
-          d.dir("bin/packages"),
-          d.dir("web/packages"),
-          d.dir("web/subdir/packages")
-        ]).create();
-
-        pubCommand(command, args: ["--no-package-symlinks"]);
-
-        d.dir(appPath, [
-          d.nothing("packages"),
-          d.nothing("bin/packages"),
-          d.nothing("web/packages"),
-          d.nothing("web/subdir/packages")
-        ]).validate();
-      });
-
-      integration("doesn't remove package directories that pub wouldn't "
-          "generate", () {
-        d.dir(appPath, [
-          d.appPubspec(),
-          d.dir("packages"),
-          d.dir("bin/subdir/packages"),
-          d.dir("lib/packages")
-        ]).create();
-
-        pubCommand(command, args: ["--no-package-symlinks"]);
-
-        d.dir(appPath, [
-          d.nothing("packages"),
-          d.dir("bin/subdir/packages"),
-          d.dir("lib/packages")
-        ]).validate();
-      });
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/oauth2/utils.dart b/sdk/lib/_internal/pub/test/oauth2/utils.dart
deleted file mode 100644
index d69941b..0000000
--- a/sdk/lib/_internal/pub/test/oauth2/utils.dart
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library oauth2.utils;
-
-import 'dart:convert';
-
-import 'package:http/http.dart' as http;
-import 'package:scheduled_test/scheduled_process.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../../lib/src/utils.dart';
-
-void authorizePub(ScheduledProcess pub, ScheduledServer server,
-    [String accessToken="access token"]) {
-  pub.stdout.expect('Pub needs your authorization to upload packages on your '
-      'behalf.');
-
-  schedule(() {
-    return pub.stdout.next().then((line) {
-      var match = new RegExp(r'[?&]redirect_uri=([0-9a-zA-Z.%+-]+)[$&]')
-          .firstMatch(line);
-      expect(match, isNotNull);
-
-      var redirectUrl = Uri.parse(Uri.decodeComponent(match.group(1)));
-      redirectUrl = addQueryParameters(redirectUrl, {'code': 'access code'});
-      return (new http.Request('GET', redirectUrl)..followRedirects = false)
-        .send();
-    }).then((response) {
-      expect(response.headers['location'],
-          equals('http://pub.dartlang.org/authorized'));
-    });
-  });
-
-  handleAccessTokenRequest(server, accessToken);
-}
-
-void handleAccessTokenRequest(ScheduledServer server, String accessToken) {
-  server.handle('POST', '/token', (request) {
-    return request.readAsString().then((body) {
-      expect(body, matches(new RegExp(r'(^|&)code=access\+code(&|$)')));
-
-      return new shelf.Response.ok(JSON.encode({
-        "access_token": accessToken,
-        "token_type": "bearer"
-      }), headers: {'content-type': 'application/json'});
-    });
-  });
-}
-
diff --git a/sdk/lib/_internal/pub/test/oauth2/with_a_malformed_credentials_authenticates_again_test.dart b/sdk/lib/_internal/pub/test/oauth2/with_a_malformed_credentials_authenticates_again_test.dart
deleted file mode 100644
index c0b2d53..0000000
--- a/sdk/lib/_internal/pub/test/oauth2/with_a_malformed_credentials_authenticates_again_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration('with a malformed credentials.json, authenticates again and '
-      'saves credentials.json', () {
-    d.validPackage.create();
-
-    var server = new ScheduledServer();
-    d.dir(cachePath, [
-      d.file('credentials.json', '{bad json')
-    ]).create();
-
-    var pub = startPublish(server);
-    confirmPublish(pub);
-    authorizePub(pub, server, "new access token");
-
-    server.handle('GET', '/api/packages/versions/new', (request) {
-      expect(request.headers,
-          containsPair('authorization', 'Bearer new access token'));
-
-      return new shelf.Response(200);
-    });
-
-    // After we give pub an invalid response, it should crash. We wait for it to
-    // do so rather than killing it so it'll write out the credentials file.
-    pub.shouldExit(1);
-
-    d.credentialsFile(server, 'new access token').validate();
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/oauth2/with_a_pre_existing_credentials_does_not_authenticate_test.dart b/sdk/lib/_internal/pub/test/oauth2/with_a_pre_existing_credentials_does_not_authenticate_test.dart
deleted file mode 100644
index fc39458..0000000
--- a/sdk/lib/_internal/pub/test/oauth2/with_a_pre_existing_credentials_does_not_authenticate_test.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('with a pre-existing credentials.json does not authenticate', () {
-    d.validPackage.create();
-
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-    confirmPublish(pub);
-
-    server.handle('GET', '/api/packages/versions/new', (request) {
-      expect(request.headers,
-          containsPair('authorization', 'Bearer access token'));
-
-      return new shelf.Response(200);
-    });
-
-    pub.kill();
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/oauth2/with_a_server_rejected_refresh_token_authenticates_again_test.dart b/sdk/lib/_internal/pub/test/oauth2/with_a_server_rejected_refresh_token_authenticates_again_test.dart
deleted file mode 100644
index 25ca1ca..0000000
--- a/sdk/lib/_internal/pub/test/oauth2/with_a_server_rejected_refresh_token_authenticates_again_test.dart
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:convert';
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  // Regression test for issue 8849.
-  integration('with a server-rejected refresh token, authenticates again and '
-      'saves credentials.json', () {
-    d.validPackage.create();
-
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token',
-        refreshToken: 'bad refresh token',
-        expiration: new DateTime.now().subtract(new Duration(hours: 1)))
-        .create();
-
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-
-    server.handle('POST', '/token', (request) {
-      return drainStream(request.read()).then((_) {
-        return new shelf.Response(400,
-            body: JSON.encode({"error": "invalid_request"}),
-            headers: {'content-type': 'application/json'});
-      });
-    });
-
-    pub.stdout.expect(startsWith('Uploading...'));
-    authorizePub(pub, server, 'new access token');
-
-    server.handle('GET', '/api/packages/versions/new', (request) {
-      expect(request.headers,
-          containsPair('authorization', 'Bearer new access token'));
-
-      return new shelf.Response(200);
-    });
-
-    pub.kill();
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart b/sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart
deleted file mode 100644
index b34b447..0000000
--- a/sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:convert';
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('with an expired credentials.json, refreshes and saves the '
-      'refreshed access token to credentials.json', () {
-    d.validPackage.create();
-
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token',
-        refreshToken: 'refresh token',
-        expiration: new DateTime.now().subtract(new Duration(hours: 1)))
-        .create();
-
-    var pub = startPublish(server);
-    confirmPublish(pub);
-
-    server.handle('POST', '/token', (request) {
-      return request.readAsString().then((body) {
-        expect(body, matches(
-            new RegExp(r'(^|&)refresh_token=refresh\+token(&|$)')));
-
-        return new shelf.Response.ok(JSON.encode({
-          "access_token": "new access token",
-          "token_type": "bearer"
-        }), headers: {'content-type': 'application/json'});
-      });
-    });
-
-    server.handle('GET', '/api/packages/versions/new', (request) {
-      expect(request.headers,
-          containsPair('authorization', 'Bearer new access token'));
-
-      return new shelf.Response(200);
-    });
-
-    pub.shouldExit();
-
-    d.credentialsFile(server, 'new access token', refreshToken: 'refresh token')
-        .validate();
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_without_a_refresh_token_authenticates_again_test.dart b/sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_without_a_refresh_token_authenticates_again_test.dart
deleted file mode 100644
index 18e4089..0000000
--- a/sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_without_a_refresh_token_authenticates_again_test.dart
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration('with an expired credentials.json without a refresh token, '
-       'authenticates again and saves credentials.json', () {
-    d.validPackage.create();
-
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token',
-        expiration: new DateTime.now().subtract(new Duration(hours: 1)))
-        .create();
-
-    var pub = startPublish(server);
-    confirmPublish(pub);
-
-    pub.stderr.expect("Pub's authorization to upload packages has expired and "
-        "can't be automatically refreshed.");
-    authorizePub(pub, server, "new access token");
-
-    server.handle('GET', '/api/packages/versions/new', (request) {
-      expect(request.headers,
-          containsPair('authorization', 'Bearer new access token'));
-
-      return new shelf.Response(200);
-    });
-
-    // After we give pub an invalid response, it should crash. We wait for it to
-    // do so rather than killing it so it'll write out the credentials file.
-    pub.shouldExit(1);
-
-    d.credentialsFile(server, 'new access token').validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/oauth2/with_no_credentials_authenticates_and_saves_credentials_test.dart b/sdk/lib/_internal/pub/test/oauth2/with_no_credentials_authenticates_and_saves_credentials_test.dart
deleted file mode 100644
index aac2261..0000000
--- a/sdk/lib/_internal/pub/test/oauth2/with_no_credentials_authenticates_and_saves_credentials_test.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration('with no credentials.json, authenticates and saves '
-      'credentials.json', () {
-    d.validPackage.create();
-
-    var server = new ScheduledServer();
-    var pub = startPublish(server);
-    confirmPublish(pub);
-    authorizePub(pub, server);
-
-    server.handle('GET', '/api/packages/versions/new', (request) {
-      expect(request.headers,
-          containsPair('authorization', 'Bearer access token'));
-
-      return new shelf.Response(200);
-    });
-
-    // After we give pub an invalid response, it should crash. We wait for it to
-    // do so rather than killing it so it'll write out the credentials file.
-    pub.shouldExit(1);
-
-    d.credentialsFile(server, 'access token').validate();
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/oauth2/with_server_rejected_credentials_authenticates_again_test.dart b/sdk/lib/_internal/pub/test/oauth2/with_server_rejected_credentials_authenticates_again_test.dart
deleted file mode 100644
index 94479f7..0000000
--- a/sdk/lib/_internal/pub/test/oauth2/with_server_rejected_credentials_authenticates_again_test.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:convert';
-
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('with server-rejected credentials, authenticates again and saves '
-      'credentials.json', () {
-    d.validPackage.create();
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPublish(server);
-
-    confirmPublish(pub);
-
-    server.handle('GET', '/api/packages/versions/new', (request) {
-      return new shelf.Response(401,
-          body: JSON.encode({'error': {'message': 'your token sucks'}}),
-          headers: {
-        'www-authenticate': 'Bearer error="invalid_token",'
-            ' error_description="your token sucks"'
-      });
-    });
-
-    pub.stderr.expect('OAuth2 authorization failed (your token sucks).');
-    pub.stdout.expect(startsWith('Uploading...'));
-    pub.kill();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/package_list_files_test.dart b/sdk/lib/_internal/pub/test/package_list_files_test.dart
deleted file mode 100644
index 079a6b9..0000000
--- a/sdk/lib/_internal/pub/test/package_list_files_test.dart
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library packages_list_files_test;
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../lib/src/entrypoint.dart';
-import '../lib/src/io.dart';
-import '../lib/src/system_cache.dart';
-import 'descriptor.dart' as d;
-import 'test_pub.dart';
-
-String root;
-Entrypoint entrypoint;
-
-main() {
-  initConfig();
-
-  group('not in a git repo', () {
-    setUp(() {
-      d.appDir().create();
-      scheduleEntrypoint();
-    });
-
-
-    integration('lists files recursively', () {
-      d.dir(appPath, [
-        d.file('file1.txt', 'contents'),
-        d.file('file2.txt', 'contents'),
-        d.dir('subdir', [
-          d.file('subfile1.txt', 'subcontents'),
-          d.file('subfile2.txt', 'subcontents')
-        ])
-      ]).create();
-
-      schedule(() {
-        expect(entrypoint.root.listFiles(), unorderedEquals([
-          path.join(root, 'pubspec.yaml'),
-          path.join(root, 'file1.txt'),
-          path.join(root, 'file2.txt'),
-          path.join(root, 'subdir', 'subfile1.txt'),
-          path.join(root, 'subdir', 'subfile2.txt')
-        ]));
-      });
-    });
-
-    commonTests();
-  });
-
-  group('with git', () {
-    setUp(() {
-      ensureGit();
-      d.git(appPath, [d.appPubspec()]).create();
-      scheduleEntrypoint();
-    });
-
-    integration("includes files that are or aren't checked in", () {
-      d.dir(appPath, [
-        d.file('file1.txt', 'contents'),
-        d.file('file2.txt', 'contents'),
-        d.dir('subdir', [
-          d.file('subfile1.txt', 'subcontents'),
-          d.file('subfile2.txt', 'subcontents')
-        ])
-      ]).create();
-
-      schedule(() {
-        expect(entrypoint.root.listFiles(), unorderedEquals([
-          path.join(root, 'pubspec.yaml'),
-          path.join(root, 'file1.txt'),
-          path.join(root, 'file2.txt'),
-          path.join(root, 'subdir', 'subfile1.txt'),
-          path.join(root, 'subdir', 'subfile2.txt')
-        ]));
-      });
-    });
-
-    integration("ignores files that are gitignored if desired", () {
-      d.dir(appPath, [
-        d.file('.gitignore', '*.txt'),
-        d.file('file1.txt', 'contents'),
-        d.file('file2.text', 'contents'),
-        d.dir('subdir', [
-          d.file('subfile1.txt', 'subcontents'),
-          d.file('subfile2.text', 'subcontents')
-        ])
-      ]).create();
-
-      schedule(() {
-        expect(entrypoint.root.listFiles(useGitIgnore: true), unorderedEquals([
-          path.join(root, 'pubspec.yaml'),
-          path.join(root, '.gitignore'),
-          path.join(root, 'file2.text'),
-          path.join(root, 'subdir', 'subfile2.text')
-        ]));
-      });
-
-      schedule(() {
-        expect(entrypoint.root.listFiles(), unorderedEquals([
-          path.join(root, 'pubspec.yaml'),
-          path.join(root, 'file1.txt'),
-          path.join(root, 'file2.text'),
-          path.join(root, 'subdir', 'subfile1.txt'),
-          path.join(root, 'subdir', 'subfile2.text')
-        ]));
-      });
-    });
-
-    commonTests();
-  });
-}
-
-void scheduleEntrypoint() {
-  schedule(() {
-    root = path.join(sandboxDir, appPath);
-    entrypoint = new Entrypoint(root,
-        new SystemCache.withSources(rootDir: root));
-  }, 'initializing entrypoint');
-
-  currentSchedule.onComplete.schedule(() {
-    entrypoint = null;
-  }, 'nulling entrypoint');
-}
-
-void commonTests() {
-  integration('ignores broken symlinks', () {
-    // Windows requires us to symlink to a directory that actually exists.
-    d.dir(appPath, [d.dir('target')]).create();
-    scheduleSymlink(path.join(appPath, 'target'), path.join(appPath, 'link'));
-    schedule(() => deleteEntry(path.join(sandboxDir, appPath, 'target')));
-
-    schedule(() {
-      expect(entrypoint.root.listFiles(),
-          equals([path.join(root, 'pubspec.yaml')]));
-    });
-  });
-
-  integration('ignores pubspec.lock files', () {
-    d.dir(appPath, [
-      d.file('pubspec.lock'),
-      d.dir('subdir', [d.file('pubspec.lock')])
-    ]).create();
-
-    schedule(() {
-      expect(entrypoint.root.listFiles(),
-          equals([path.join(root, 'pubspec.yaml')]));
-    });
-  });
-
-  integration('ignores packages directories', () {
-    d.dir(appPath, [
-      d.dir('packages', [d.file('file.txt', 'contents')]),
-      d.dir('subdir', [
-        d.dir('packages', [d.file('subfile.txt', 'subcontents')]),
-      ])
-    ]).create();
-
-    schedule(() {
-      expect(entrypoint.root.listFiles(),
-          equals([path.join(root, 'pubspec.yaml')]));
-    });
-  });
-
-  integration('allows pubspec.lock directories', () {
-    d.dir(appPath, [
-      d.dir('pubspec.lock', [
-        d.file('file.txt', 'contents'),
-      ])
-    ]).create();
-
-    schedule(() {
-      expect(entrypoint.root.listFiles(), unorderedEquals([
-        path.join(root, 'pubspec.yaml'),
-        path.join(root, 'pubspec.lock', 'file.txt')
-      ]));
-    });
-  });
-
-  group('and "beneath"', () {
-    integration('only lists files beneath the given root', () {
-      d.dir(appPath, [
-        d.file('file1.txt', 'contents'),
-        d.file('file2.txt', 'contents'),
-        d.dir('subdir', [
-          d.file('subfile1.txt', 'subcontents'),
-          d.file('subfile2.txt', 'subcontents'),
-          d.dir('subsubdir', [
-            d.file('subsubfile1.txt', 'subsubcontents'),
-            d.file('subsubfile2.txt', 'subsubcontents'),
-          ])
-        ])
-      ]).create();
-
-      schedule(() {
-        expect(entrypoint.root.listFiles(beneath: path.join(root, 'subdir')),
-            unorderedEquals([
-          path.join(root, 'subdir', 'subfile1.txt'),
-          path.join(root, 'subdir', 'subfile2.txt'),
-          path.join(root, 'subdir', 'subsubdir', 'subsubfile1.txt'),
-          path.join(root, 'subdir', 'subsubdir', 'subsubfile2.txt')
-        ]));
-      });
-    });
-
-    integration("doesn't care if the root is blacklisted", () {
-      d.dir(appPath, [
-        d.file('file1.txt', 'contents'),
-        d.file('file2.txt', 'contents'),
-        d.dir('packages', [
-          d.file('subfile1.txt', 'subcontents'),
-          d.file('subfile2.txt', 'subcontents'),
-          d.dir('subsubdir', [
-            d.file('subsubfile1.txt', 'subsubcontents'),
-            d.file('subsubfile2.txt', 'subsubcontents')
-          ])
-        ])
-      ]).create();
-
-      schedule(() {
-        expect(entrypoint.root.listFiles(beneath: path.join(root, 'packages')),
-            unorderedEquals([
-          path.join(root, 'packages', 'subfile1.txt'),
-          path.join(root, 'packages', 'subfile2.txt'),
-          path.join(root, 'packages', 'subsubdir', 'subsubfile1.txt'),
-          path.join(root, 'packages', 'subsubdir', 'subsubfile2.txt')
-        ]));
-      });
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/preprocess_test.dart b/sdk/lib/_internal/pub/test/preprocess_test.dart
deleted file mode 100644
index 4f43dd8..0000000
--- a/sdk/lib/_internal/pub/test/preprocess_test.dart
+++ /dev/null
@@ -1,303 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub.test.preprocess_test;
-
-import 'package:pub_semver/pub_semver.dart';
-import 'package:unittest/unittest.dart';
-
-import '../lib/src/preprocess.dart';
-import 'test_pub.dart';
-
-main() {
-  initConfig();
-
-  test("does nothing on a file without preprocessor directives", () {
-    var text = '''
-some text
-// normal comment
-// #
- //# not beginning of line
-''';
-
-    expect(_preprocess(text), equals(text));
-  });
-
-  test("allows bare insert directive", () {
-    expect(_preprocess('//> foo'), equals('foo'));
-  });
-
-  test("allows empty insert directive", () {
-    expect(_preprocess('''
-//> foo
-//>
-//> bar
-'''), equals('foo\n\nbar\n'));
-  });
-
-  group("if", () {
-    group("with a version range", () {
-      test("removes sections with non-matching versions", () {
-        expect(_preprocess('''
-before
-//# if barback <1.0.0
-inside
-//# end
-after
-'''), equals('''
-before
-after
-'''));
-      });
-
-      test("doesn't insert section with non-matching versions", () {
-        expect(_preprocess('''
-before
-//# if barback <1.0.0
-//> inside
-//# end
-after
-'''), equals('''
-before
-after
-'''));
-      });
-
-      test("doesn't remove sections with matching versions", () {
-        expect(_preprocess('''
-before
-//# if barback >1.0.0
-inside
-//# end
-after
-'''), equals('''
-before
-inside
-after
-'''));
-      });
-
-      test("inserts sections with matching versions", () {
-        expect(_preprocess('''
-before
-//# if barback >1.0.0
-//> inside
-//# end
-after
-'''), equals('''
-before
-inside
-after
-'''));
-      });
-
-      test("allows multi-element version ranges", () {
-        expect(_preprocess('''
-before
-//# if barback >=1.0.0 <2.0.0
-inside 1
-//# end
-//# if barback >=0.9.0 <1.0.0
-inside 2
-//# end
-after
-'''), equals('''
-before
-inside 1
-after
-'''));
-      });
-    });
-
-    group("with a package name", () {
-      test("removes sections for a nonexistent package", () {
-        expect(_preprocess('''
-before
-//# if fblthp
-inside
-//# end
-after
-'''), equals('''
-before
-after
-'''));
-      });
-
-      test("doesn't insert sections for a nonexistent package", () {
-        expect(_preprocess('''
-before
-//# if fblthp
-//> inside
-//# end
-after
-'''), equals('''
-before
-after
-'''));
-      });
-
-      test("doesn't remove sections with an existent package", () {
-        expect(_preprocess('''
-before
-//# if barback
-inside
-//# end
-after
-'''), equals('''
-before
-inside
-after
-'''));
-      });
-
-      test("inserts sections with an existent package", () {
-        expect(_preprocess('''
-before
-//# if barback
-//> inside
-//# end
-after
-'''), equals('''
-before
-inside
-after
-'''));
-      });
-    });
-  });
-
-  group("else", () {
-    test("removes non-matching sections", () {
-      expect(_preprocess('''
-before
-//# if barback >1.0.0
-inside 1
-//# else
-inside 2
-//# end
-after
-'''), equals('''
-before
-inside 1
-after
-'''));
-    });
-
-    test("doesn't insert non-matching sections", () {
-      expect(_preprocess('''
-before
-//# if barback >1.0.0
-inside 1
-//# else
-//> inside 2
-//# end
-after
-'''), equals('''
-before
-inside 1
-after
-'''));
-    });
-
-    test("doesn't remove matching sections", () {
-      expect(_preprocess('''
-before
-//# if barback <1.0.0
-inside 1
-//# else
-inside 2
-//# end
-after
-'''), equals('''
-before
-inside 2
-after
-'''));
-    });
-
-    test("inserts matching sections", () {
-      expect(_preprocess('''
-before
-//# if barback <1.0.0
-inside 1
-//# else
-//> inside 2
-//# end
-after
-'''), equals('''
-before
-inside 2
-after
-'''));
-    });
-  });
-
-  group("errors", () {
-    test("disallows unknown statements", () {
-      expect(() => _preprocess('//# foo bar\n//# end'), throwsFormatException);
-    });
-
-    test("disallows insert directive without space", () {
-      expect(() => _preprocess('//>foo'), throwsFormatException);
-    });
-
-    group("if", () {
-      test("disallows if with no arguments", () {
-        expect(() => _preprocess('//# if\n//# end'), throwsFormatException);
-      });
-
-      test("disallows if with no package", () {
-        expect(() => _preprocess('//# if <=1.0.0\n//# end'),
-            throwsFormatException);
-      });
-
-      test("disallows invalid version constraint", () {
-        expect(() => _preprocess('//# if barback >=1.0\n//# end'),
-            throwsFormatException);
-      });
-
-      test("disallows dangling end", () {
-        expect(() => _preprocess('//# end'),
-            throwsFormatException);
-      });
-
-      test("disallows if without end", () {
-        expect(() => _preprocess('//# if barback >=1.0.0'),
-            throwsFormatException);
-      });
-
-      test("disallows nested if", () {
-        expect(() => _preprocess('''
-//# if barback >=1.0.0
-//# if barback >= 1.5.0
-//# end
-//# end
-'''),
-            throwsFormatException);
-      });
-    });
-
-    group("else", () {
-      test("disallows else without if", () {
-        expect(() => _preprocess('//# else\n//# end'), throwsFormatException);
-      });
-
-      test("disallows else without end", () {
-        expect(() => _preprocess('//# if barback >=1.0.0\n//# else'),
-            throwsFormatException);
-      });
-
-      test("disallows else with an argument", () {
-        expect(() => _preprocess('''
-//# if barback >=1.0.0
-//# else barback <0.5.0
-//# end
-'''), throwsFormatException);
-      });
-    });
-  });
-}
-
-String _preprocess(String input) =>
-    preprocess(input, {'barback': new Version.parse("1.2.3")}, 'source/url');
diff --git a/sdk/lib/_internal/pub/test/pub_get_and_upgrade_test.dart b/sdk/lib/_internal/pub/test/pub_get_and_upgrade_test.dart
deleted file mode 100644
index c5d78a3..0000000
--- a/sdk/lib/_internal/pub/test/pub_get_and_upgrade_test.dart
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../lib/src/exit_codes.dart' as exit_codes;
-import 'descriptor.dart' as d;
-import 'test_pub.dart';
-
-main() {
-  initConfig();
-
-  forBothPubGetAndUpgrade((command) {
-    group('requires', () {
-      integration('a pubspec', () {
-        d.dir(appPath, []).create();
-
-        pubCommand(command,
-            error: new RegExp(r'Could not find a file named "pubspec.yaml" '
-                r'in "[^\n]*"\.'));
-      });
-
-      integration('a pubspec with a "name" key', () {
-        d.dir(appPath, [
-          d.pubspec({"dependencies": {"foo": null}})
-        ]).create();
-
-        pubCommand(command,
-            error: contains('Missing the required "name" field.'),
-            exitCode: exit_codes.DATA);
-      });
-    });
-
-    integration('adds itself to the packages', () {
-      // The symlink should use the name in the pubspec, not the name of the
-      // directory.
-      d.dir(appPath, [
-        d.pubspec({"name": "myapp_name"}),
-        d.libDir('myapp_name')
-      ]).create();
-
-      pubCommand(command);
-
-      d.dir(packagesPath, [
-        d.dir("myapp_name", [
-          d.file('myapp_name.dart', 'main() => "myapp_name";')
-        ])
-      ]).validate();
-    });
-
-    integration('does not adds itself to the packages if it has no "lib" '
-        'directory', () {
-      // The symlink should use the name in the pubspec, not the name of the
-      // directory.
-      d.dir(appPath, [
-        d.pubspec({"name": "myapp_name"}),
-      ]).create();
-
-      pubCommand(command);
-
-      d.dir(packagesPath, [
-        d.nothing("myapp_name")
-      ]).validate();
-    });
-
-    integration('does not add a package if it does not have a "lib" '
-        'directory', () {
-      // Using a path source, but this should be true of all sources.
-      d.dir('foo', [
-        d.libPubspec('foo', '0.0.0-not.used')
-      ]).create();
-
-      d.dir(appPath, [
-        d.appPubspec({"foo": {"path": "../foo"}})
-      ]).create();
-
-      pubCommand(command);
-
-      d.packagesDir({"foo": null}).validate();
-    });
-
-    integration('reports a solver failure', () {
-      // myapp depends on foo and bar which both depend on baz with mismatched
-      // descriptions.
-      d.dir('deps', [
-        d.dir('foo', [
-          d.pubspec({"name": "foo", "dependencies": {
-            "baz": {"path": "../baz1"}
-          }})
-        ]),
-        d.dir('bar', [
-          d.pubspec({"name": "bar", "dependencies": {
-            "baz": {"path": "../baz2"}
-          }})
-        ]),
-        d.dir('baz1', [
-          d.libPubspec('baz', '0.0.0')
-        ]),
-        d.dir('baz2', [
-          d.libPubspec('baz', '0.0.0')
-        ])
-      ]).create();
-
-      d.dir(appPath, [
-        d.appPubspec({
-          "foo": {"path": "../deps/foo"},
-          "bar": {"path": "../deps/bar"}
-        })
-      ]).create();
-
-      pubCommand(command,
-          error: new RegExp("^Incompatible dependencies on baz:\n"));
-    });
-
-    integration('does not allow a dependency on itself', () {
-      d.dir(appPath, [
-        d.appPubspec({
-          "myapp": {"path": "."}
-        })
-      ]).create();
-
-      pubCommand(command,
-          error: contains('A package may not list itself as a dependency.'),
-          exitCode: exit_codes.DATA);
-    });
-
-    integration('does not allow a dev dependency on itself', () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "dev_dependencies": {
-            "myapp": {"path": "."}
-          }
-        })
-      ]).create();
-
-      pubCommand(command,
-          error: contains('A package may not list itself as a dependency.'),
-          exitCode: exit_codes.DATA);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/pub_test.dart b/sdk/lib/_internal/pub/test/pub_test.dart
deleted file mode 100644
index d664fa7..0000000
--- a/sdk/lib/_internal/pub/test/pub_test.dart
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../lib/src/exit_codes.dart' as exit_codes;
-import 'test_pub.dart';
-
-main() {
-  initConfig();
-
-  integration('running pub with no command displays usage', () {
-    schedulePub(args: [], output: """
-        Pub is a package manager for Dart.
-
-        Usage: pub <command> [arguments]
-
-        Global options:
-        -h, --help            Print this usage information.
-            --version         Print pub version.
-            --[no-]trace      Print debugging information when an error occurs.
-            --verbosity       Control output verbosity.
-
-                  [all]       Show all output including internal tracing messages.
-                  [io]        Also show IO operations.
-                  [normal]    Show errors, warnings, and user messages.
-                  [solver]    Show steps during version resolution.
-
-        -v, --verbose         Shortcut for "--verbosity=all".
-
-        Available commands:
-          build       Apply transformers to build a package.
-          cache       Work with the system cache.
-          deps        Print package dependencies.
-          downgrade   Downgrade the current package's dependencies to oldest versions.
-          get         Get the current package's dependencies.
-          global      Work with global packages.
-          help        Display help information for pub.
-          publish     Publish the current package to pub.dartlang.org.
-          run         Run an executable from a package.
-          serve       Run a local web development server.
-          upgrade     Upgrade the current package's dependencies to latest versions.
-          uploader    Manage uploaders for a package on pub.dartlang.org.
-          version     Print pub version.
-
-        Run "pub help <command>" for more information about a command.
-        See http://dartlang.org/tools/pub for detailed documentation.
-        """);
-  });
-
-  integration('running pub with just --version displays version', () {
-    schedulePub(args: ['--version'], output: 'Pub 0.1.2+3');
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/pub_uploader_test.dart b/sdk/lib/_internal/pub/test/pub_uploader_test.dart
deleted file mode 100644
index 89054eb..0000000
--- a/sdk/lib/_internal/pub/test/pub_uploader_test.dart
+++ /dev/null
@@ -1,169 +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 pub_uploader_test;
-
-import 'dart:convert';
-
-import 'package:scheduled_test/scheduled_process.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:shelf/shelf.dart' as shelf;
-
-import '../lib/src/exit_codes.dart' as exit_codes;
-import '../lib/src/utils.dart';
-import 'descriptor.dart' as d;
-import 'test_pub.dart';
-
-final USAGE_STRING = '''
-Manage uploaders for a package on pub.dartlang.org.
-
-Usage: pub uploader [options] {add/remove} <email>
--h, --help       Print this usage information.
-    --server     The package server on which the package is hosted.
-                 (defaults to "https://pub.dartlang.org")
-
-    --package    The package whose uploaders will be modified.
-                 (defaults to the current package)
-
-Run "pub help" to see global options.
-See http://dartlang.org/tools/pub/cmd/pub-uploader.html for detailed documentation.
-''';
-
-ScheduledProcess startPubUploader(ScheduledServer server, List<String> args) {
-  var tokenEndpoint = server.url.then((url) =>
-      url.resolve('/token').toString());
-  args = flatten(['uploader', '--server', tokenEndpoint, args]);
-  return startPub(args: args, tokenEndpoint: tokenEndpoint);
-}
-
-main() {
-  initConfig();
-  group('displays usage', () {
-    integration('when run with no arguments', () {
-      schedulePub(args: ['uploader'],
-          output: USAGE_STRING, exitCode: exit_codes.USAGE);
-    });
-
-    integration('when run with only a command', () {
-      schedulePub(args: ['uploader', 'add'],
-          output: USAGE_STRING, exitCode: exit_codes.USAGE);
-    });
-
-    integration('when run with an invalid command', () {
-      schedulePub(args: ['uploader', 'foo', 'email'],
-          output: USAGE_STRING, exitCode: exit_codes.USAGE);
-    });
-  });
-
-  integration('adds an uploader', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPubUploader(server, ['--package', 'pkg', 'add', 'email']);
-
-    server.handle('POST', '/api/packages/pkg/uploaders', (request) {
-      return request.readAsString().then((body) {
-        expect(body, equals('email=email'));
-
-        return new shelf.Response.ok(JSON.encode({
-          'success': {'message': 'Good job!'}
-        }), headers: {'content-type': 'application/json'});
-      });
-    });
-
-    pub.stdout.expect('Good job!');
-    pub.shouldExit(exit_codes.SUCCESS);
-  });
-
-  integration('removes an uploader', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPubUploader(server, ['--package', 'pkg', 'remove', 'email']);
-
-    server.handle('DELETE', '/api/packages/pkg/uploaders/email', (request) {
-      return new shelf.Response.ok(JSON.encode({
-        'success': {'message': 'Good job!'}
-      }), headers: {'content-type': 'application/json'});
-    });
-
-    pub.stdout.expect('Good job!');
-    pub.shouldExit(exit_codes.SUCCESS);
-  });
-
-  integration('defaults to the current package', () {
-    d.validPackage.create();
-
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPubUploader(server, ['add', 'email']);
-
-    server.handle('POST', '/api/packages/test_pkg/uploaders', (request) {
-      return new shelf.Response.ok(JSON.encode({
-        'success': {'message': 'Good job!'}
-      }), headers: {'content-type': 'application/json'});
-    });
-
-    pub.stdout.expect('Good job!');
-    pub.shouldExit(exit_codes.SUCCESS);
-  });
-
-  integration('add provides an error', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPubUploader(server, ['--package', 'pkg', 'add', 'email']);
-
-    server.handle('POST', '/api/packages/pkg/uploaders', (request) {
-      return new shelf.Response(400,
-          body: JSON.encode({'error': {'message': 'Bad job!'}}),
-          headers: {'content-type': 'application/json'});
-    });
-
-    pub.stderr.expect('Bad job!');
-    pub.shouldExit(1);
-  });
-
-  integration('remove provides an error', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPubUploader(server,
-        ['--package', 'pkg', 'remove', 'e/mail']);
-
-    server.handle('DELETE', '/api/packages/pkg/uploaders/e%2Fmail', (request) {
-      return new shelf.Response(400,
-          body: JSON.encode({'error': {'message': 'Bad job!'}}),
-          headers: {'content-type': 'application/json'});
-    });
-
-    pub.stderr.expect('Bad job!');
-    pub.shouldExit(1);
-  });
-
-  integration('add provides invalid JSON', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPubUploader(server, ['--package', 'pkg', 'add', 'email']);
-
-    server.handle('POST', '/api/packages/pkg/uploaders',
-        (request) => new shelf.Response.ok("{not json"));
-
-    pub.stderr.expect(emitsLines(
-        'Invalid server response:\n'
-        '{not json'));
-    pub.shouldExit(1);
-  });
-
-  integration('remove provides invalid JSON', () {
-    var server = new ScheduledServer();
-    d.credentialsFile(server, 'access token').create();
-    var pub = startPubUploader(server, ['--package', 'pkg', 'remove', 'email']);
-
-    server.handle('DELETE', '/api/packages/pkg/uploaders/email',
-        (request) => new shelf.Response.ok("{not json"));
-
-    pub.stderr.expect(emitsLines(
-        'Invalid server response:\n'
-        '{not json'));
-    pub.shouldExit(1);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/pubspec_test.dart b/sdk/lib/_internal/pub/test/pubspec_test.dart
deleted file mode 100644
index 4fddbd4..0000000
--- a/sdk/lib/_internal/pub/test/pubspec_test.dart
+++ /dev/null
@@ -1,532 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pubspec_test;
-
-import 'dart:async';
-
-import 'package:pub_semver/pub_semver.dart';
-import 'package:unittest/unittest.dart';
-
-import '../lib/src/package.dart';
-import '../lib/src/pubspec.dart';
-import '../lib/src/source.dart';
-import '../lib/src/source/path.dart';
-import '../lib/src/source_registry.dart';
-import 'test_pub.dart';
-
-class MockSource extends Source {
-  final String name = "mock";
-
-  Future<Pubspec> doDescribe(PackageId id) => throw new UnsupportedError(
-      "Cannot describe mock packages.");
-
-  Future get(PackageId id, String symlink) => throw new UnsupportedError(
-      "Cannot get a mock package.");
-
-  Future<String> getDirectory(PackageId id) => throw new UnsupportedError(
-      "Cannot get the directory for mock packages.");
-
-  dynamic parseDescription(String filePath, description,
-                           {bool fromLockFile: false}) {
-    if (description != 'ok') throw new FormatException('Bad');
-    return description;
-  }
-
-  bool descriptionsEqual(description1, description2) =>
-      description1 == description2;
-
-  String packageName(description) => 'foo';
-}
-
-main() {
-  initConfig();
-  group('parse()', () {
-    var sources = new SourceRegistry();
-    sources.register(new MockSource());
-    sources.register(new PathSource());
-
-    var throwsPubspecException =
-      throwsA(new isInstanceOf<PubspecException>('PubspecException'));
-
-    expectPubspecException(String contents, fn(Pubspec pubspec),
-        [String expectedContains]) {
-      var expectation = throwsPubspecException;
-      if (expectedContains != null) {
-        expectation = throwsA(allOf(
-            new isInstanceOf<PubspecException>('PubspecException'),
-            predicate((error) => error.message.contains(expectedContains))));
-      }
-
-      var pubspec = new Pubspec.parse(contents, sources);
-      expect(() => fn(pubspec), expectation);
-    }
-
-    test("doesn't eagerly throw an error for an invalid field", () {
-      // Shouldn't throw an error.
-      new Pubspec.parse('version: not a semver', sources);
-    });
-
-    test("eagerly throws an error if the pubspec name doesn't match the "
-        "expected name", () {
-      expect(() => new Pubspec.parse("name: foo", sources, expectedName: 'bar'),
-          throwsPubspecException);
-    });
-
-    test("eagerly throws an error if the pubspec doesn't have a name and an "
-        "expected name is passed", () {
-      expect(() => new Pubspec.parse("{}", sources, expectedName: 'bar'),
-          throwsPubspecException);
-    });
-
-    test("allows a version constraint for dependencies", () {
-      var pubspec = new Pubspec.parse('''
-dependencies:
-  foo:
-    mock: ok
-    version: ">=1.2.3 <3.4.5"
-''', sources);
-
-      var foo = pubspec.dependencies[0];
-      expect(foo.name, equals('foo'));
-      expect(foo.constraint.allows(new Version(1, 2, 3)), isTrue);
-      expect(foo.constraint.allows(new Version(1, 2, 5)), isTrue);
-      expect(foo.constraint.allows(new Version(3, 4, 5)), isFalse);
-    });
-
-    test("allows an empty dependencies map", () {
-      var pubspec = new Pubspec.parse('''
-dependencies:
-''', sources);
-
-      expect(pubspec.dependencies, isEmpty);
-    });
-
-    test("allows a version constraint for dev dependencies", () {
-      var pubspec = new Pubspec.parse('''
-dev_dependencies:
-  foo:
-    mock: ok
-    version: ">=1.2.3 <3.4.5"
-''', sources);
-
-      var foo = pubspec.devDependencies[0];
-      expect(foo.name, equals('foo'));
-      expect(foo.constraint.allows(new Version(1, 2, 3)), isTrue);
-      expect(foo.constraint.allows(new Version(1, 2, 5)), isTrue);
-      expect(foo.constraint.allows(new Version(3, 4, 5)), isFalse);
-    });
-
-    test("allows an empty dev dependencies map", () {
-      var pubspec = new Pubspec.parse('''
-dev_dependencies:
-''', sources);
-
-      expect(pubspec.devDependencies, isEmpty);
-    });
-
-    test("allows a version constraint for dependency overrides", () {
-      var pubspec = new Pubspec.parse('''
-dependency_overrides:
-  foo:
-    mock: ok
-    version: ">=1.2.3 <3.4.5"
-''', sources);
-
-      var foo = pubspec.dependencyOverrides[0];
-      expect(foo.name, equals('foo'));
-      expect(foo.constraint.allows(new Version(1, 2, 3)), isTrue);
-      expect(foo.constraint.allows(new Version(1, 2, 5)), isTrue);
-      expect(foo.constraint.allows(new Version(3, 4, 5)), isFalse);
-    });
-
-    test("allows an empty dependency overrides map", () {
-      var pubspec = new Pubspec.parse('''
-dependency_overrides:
-''', sources);
-
-      expect(pubspec.dependencyOverrides, isEmpty);
-    });
-
-    test("allows an unknown source", () {
-      var pubspec = new Pubspec.parse('''
-dependencies:
-  foo:
-    unknown: blah
-''', sources);
-
-      var foo = pubspec.dependencies[0];
-      expect(foo.name, equals('foo'));
-      expect(foo.source, equals('unknown'));
-    });
-
-    test("throws if a package is in dependencies and dev_dependencies", () {
-      expectPubspecException('''
-dependencies:
-  foo:
-    mock: ok
-dev_dependencies:
-  foo:
-    mock: ok
-''', (pubspec) {
-        // This check only triggers if both [dependencies] and [devDependencies]
-        // are accessed.
-        pubspec.dependencies;
-        pubspec.devDependencies;
-      });
-    });
-
-    test("throws if it dependes on itself", () {
-      expectPubspecException('''
-name: myapp
-dependencies:
-  myapp:
-    mock: ok
-''', (pubspec) => pubspec.dependencies);
-    });
-
-    test("throws if it has a dev dependency on itself", () {
-      expectPubspecException('''
-name: myapp
-dev_dependencies:
-  myapp:
-    mock: ok
-''', (pubspec) => pubspec.devDependencies);
-    });
-
-    test("throws if it has an override on itself", () {
-      expectPubspecException('''
-name: myapp
-dependency_overrides:
-  myapp:
-    mock: ok
-''', (pubspec) => pubspec.dependencyOverrides);
-    });
-
-    test("throws if the description isn't valid", () {
-      expectPubspecException('''
-dependencies:
-  foo:
-    mock: bad
-''', (pubspec) => pubspec.dependencies);
-    });
-
-    test("throws if dependency version is not a string", () {
-      expectPubspecException('''
-dependencies:
-  foo:
-    mock: ok
-    version: 1.2
-''', (pubspec) => pubspec.dependencies);
-    });
-
-    test("throws if version is not a version constraint", () {
-      expectPubspecException('''
-dependencies:
-  foo:
-    mock: ok
-    version: not constraint
-''', (pubspec) => pubspec.dependencies);
-    });
-
-    test("throws if 'name' is not a string", () {
-      expectPubspecException('name: [not, a, string]',
-          (pubspec) => pubspec.name);
-    });
-
-    test("throws if version is not a string", () {
-      expectPubspecException('version: [2, 0, 0]',
-          (pubspec) => pubspec.version,
-          '"version" field must be a string');
-    });
-
-    test("throws if version is malformed (looking like a double)", () {
-      expectPubspecException('version: 2.1',
-          (pubspec) => pubspec.version,
-          '"version" field must have three numeric components: major, minor, '
-          'and patch. Instead of "2.1", consider "2.1.0"');
-    });
-
-    test("throws if version is malformed (looking like an int)", () {
-      expectPubspecException('version: 2',
-          (pubspec) => pubspec.version,
-          '"version" field must have three numeric components: major, minor, '
-          'and patch. Instead of "2", consider "2.0.0"');
-    });
-
-    test("throws if version is not a version", () {
-      expectPubspecException('version: not version',
-          (pubspec) => pubspec.version);
-    });
-
-    test("throws if transformers isn't a list", () {
-      expectPubspecException('transformers: "not list"',
-          (pubspec) => pubspec.transformers,
-          '"transformers" field must be a list');
-    });
-
-    test("throws if a transformer isn't a string or map", () {
-      expectPubspecException('transformers: [12]',
-          (pubspec) => pubspec.transformers,
-          'A transformer must be a string or map.');
-    });
-
-    test("throws if a transformer's configuration isn't a map", () {
-      expectPubspecException('transformers: [{pkg: 12}]',
-          (pubspec) => pubspec.transformers,
-          "A transformer's configuration must be a map.");
-    });
-
-    test("throws if a transformer's configuration contains an unknown "
-        "reserved key at the top level", () {
-      expectPubspecException('''
-name: pkg
-transformers: [{pkg: {\$key: "value"}}]''',
-          (pubspec) => pubspec.transformers,
-          'Invalid transformer config: Unknown reserved field.');
-    });
-
-    test("doesn't throw if a transformer's configuration contains a "
-        "non-top-level key beginning with a dollar sign", () {
-      var pubspec = new Pubspec.parse('''
-name: pkg
-transformers:
-- pkg: {outer: {\$inner: value}}
-''', sources);
-
-      var pkg = pubspec.transformers[0].single;
-      expect(pkg.configuration["outer"]["\$inner"], equals("value"));
-    });
-
-    test("throws if the \$include value is not a string or list", () {
-      expectPubspecException('''
-name: pkg
-transformers:
-- pkg: {\$include: 123}''',
-          (pubspec) => pubspec.transformers,
-          'Invalid transformer config: "\$include" field must be a string or '
-            'list.');
-    });
-
-    test("throws if the \$include list contains a non-string", () {
-      expectPubspecException('''
-name: pkg
-transformers:
-- pkg: {\$include: ["ok", 123, "alright", null]}''',
-        (pubspec) => pubspec.transformers,
-        'Invalid transformer config: "\$include" field may contain only '
-          'strings.');
-    });
-
-    test("throws if the \$exclude value is not a string or list", () {
-      expectPubspecException('''
-name: pkg
-transformers:
-- pkg: {\$exclude: 123}''',
-        (pubspec) => pubspec.transformers,
-        'Invalid transformer config: "\$exclude" field must be a string or '
-          'list.');
-    });
-
-    test("throws if the \$exclude list contains a non-string", () {
-      expectPubspecException('''
-name: pkg
-transformers:
-- pkg: {\$exclude: ["ok", 123, "alright", null]}''',
-        (pubspec) => pubspec.transformers,
-        'Invalid transformer config: "\$exclude" field may contain only '
-          'strings.');
-    });
-
-    test("throws if a transformer is not from a dependency", () {
-      expectPubspecException('''
-name: pkg
-transformers: [foo]
-''',
-        (pubspec) => pubspec.transformers,
-        '"foo" is not a dependency.');
-    });
-
-    test("allows a transformer from a normal dependency", () {
-      var pubspec = new Pubspec.parse('''
-name: pkg
-dependencies:
-  foo:
-    mock: ok
-transformers:
-- foo''', sources);
-
-      expect(pubspec.transformers[0].single.id.package, equals("foo"));
-    });
-
-    test("allows a transformer from a dev dependency", () {
-      var pubspec = new Pubspec.parse('''
-name: pkg
-dev_dependencies:
-  foo:
-    mock: ok
-transformers:
-- foo''', sources);
-
-      expect(pubspec.transformers[0].single.id.package, equals("foo"));
-    });
-
-    test("allows a transformer from a dependency override", () {
-      var pubspec = new Pubspec.parse('''
-name: pkg
-dependency_overrides:
-  foo:
-    mock: ok
-transformers:
-- foo''', sources);
-
-      expect(pubspec.transformers[0].single.id.package, equals("foo"));
-    });
-
-    test("allows comment-only files", () {
-      var pubspec = new Pubspec.parse('''
-# No external dependencies yet
-# Including for completeness
-# ...and hoping the spec expands to include details about author, version, etc
-# See http://www.dartlang.org/docs/pub-package-manager/ for details
-''', sources);
-      expect(pubspec.version, equals(Version.none));
-      expect(pubspec.dependencies, isEmpty);
-    });
-
-    test("throws a useful error for unresolvable path dependencies", () {
-      expectPubspecException('''
-name: pkg
-dependencies:
-  from_path: {path: non_local_path}
-''', (pubspec) => pubspec.dependencies,
-          '"non_local_path" is a relative path, but this isn\'t a local '
-          'pubspec.');
-    });
-
-    group("environment", () {
-      test("defaults to any SDK constraint if environment is omitted", () {
-        var pubspec = new Pubspec.parse('', sources);
-        expect(pubspec.environment.sdkVersion, equals(VersionConstraint.any));
-      });
-
-      test("allows an empty environment map", () {
-        var pubspec = new Pubspec.parse('''
-environment:
-''', sources);
-        expect(pubspec.environment.sdkVersion, equals(VersionConstraint.any));
-      });
-
-      test("throws if the environment value isn't a map", () {
-        expectPubspecException('environment: []',
-            (pubspec) => pubspec.environment);
-      });
-
-      test("allows a version constraint for the sdk", () {
-        var pubspec = new Pubspec.parse('''
-environment:
-  sdk: ">=1.2.3 <2.3.4"
-''', sources);
-        expect(pubspec.environment.sdkVersion,
-            equals(new VersionConstraint.parse(">=1.2.3 <2.3.4")));
-      });
-
-      test("throws if the sdk isn't a string", () {
-        expectPubspecException('environment: {sdk: []}',
-            (pubspec) => pubspec.environment);
-        expectPubspecException('environment: {sdk: 1.0}',
-            (pubspec) => pubspec.environment);
-      });
-
-      test("throws if the sdk isn't a valid version constraint", () {
-        expectPubspecException('environment: {sdk: "oopies"}',
-            (pubspec) => pubspec.environment);
-      });
-    });
-
-    group("publishTo", () {
-      test("defaults to null if omitted", () {
-        var pubspec = new Pubspec.parse('', sources);
-        expect(pubspec.publishTo, isNull);
-      });
-
-      test("throws if not a string", () {
-        expectPubspecException('publish_to: 123',
-            (pubspec) => pubspec.publishTo);
-      });
-
-      test("allows a URL", () {
-        var pubspec = new Pubspec.parse('''
-publish_to: http://example.com
-''', sources);
-        expect(pubspec.publishTo, equals("http://example.com"));
-      });
-
-      test("allows none", () {
-        var pubspec = new Pubspec.parse('''
-publish_to: none
-''', sources);
-        expect(pubspec.publishTo, equals("none"));
-      });
-
-      test("throws on other strings", () {
-        expectPubspecException('publish_to: http://bad.url:not-port',
-            (pubspec) => pubspec.publishTo);
-      });
-    });
-
-    group("executables", () {
-      test("defaults to an empty map if omitted", () {
-        var pubspec = new Pubspec.parse('', sources);
-        expect(pubspec.executables, isEmpty);
-      });
-
-      test("allows simple names for keys and most characters in values", () {
-        var pubspec = new Pubspec.parse('''
-executables:
-  abcDEF-123_: "abc DEF-123._"
-''', sources);
-        expect(pubspec.executables['abcDEF-123_'], equals('abc DEF-123._'));
-      });
-
-      test("throws if not a map", () {
-        expectPubspecException('executables: not map',
-            (pubspec) => pubspec.executables);
-      });
-
-      test("throws if key is not a string", () {
-        expectPubspecException('executables: {123: value}',
-            (pubspec) => pubspec.executables);
-      });
-
-      test("throws if a key isn't a simple name", () {
-        expectPubspecException('executables: {funny/name: ok}',
-            (pubspec) => pubspec.executables);
-      });
-
-      test("throws if a value is not a string", () {
-        expectPubspecException('executables: {command: 123}',
-            (pubspec) => pubspec.executables);
-      });
-
-      test("throws if a value contains a path separator", () {
-        expectPubspecException('executables: {command: funny_name/part}',
-            (pubspec) => pubspec.executables);
-      });
-
-      test("throws if a value contains a windows path separator", () {
-        expectPubspecException(r'executables: {command: funny_name\part}',
-            (pubspec) => pubspec.executables);
-      });
-
-      test("uses the key if the value is null", () {
-        var pubspec = new Pubspec.parse('''
-executables:
-  command:
-''', sources);
-        expect(pubspec.executables['command'], equals('command'));
-      });
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/real_version_test.dart b/sdk/lib/_internal/pub/test/real_version_test.dart
deleted file mode 100644
index a84f746..0000000
--- a/sdk/lib/_internal/pub/test/real_version_test.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'dart:io';
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_process.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../lib/src/exit_codes.dart' as exit_codes;
-import 'test_pub.dart';
-
-main() {
-  initConfig();
-
-  // This test is a bit funny.
-  //
-  // Pub parses the "version" file that gets generated and shipped with the SDK.
-  // We want to make sure that the actual version file that gets created is
-  // also one pub can parse. If this test fails, it means the version file's
-  // format has changed in a way pub didn't expect.
-  //
-  // Note that this test expects to be invoked from a Dart executable that is
-  // in the built SDK's "bin" directory. Note also that this invokes pub from
-  // the built SDK directory, and not the live pub code directly in the repo.
-  integration('parse the real SDK "version" file', () {
-    // Get the path to the pub binary in the SDK. Note that we can't use
-    // sdk.rootDirectory here because that assumes the entrypoint Dart script
-    // being run is pub itself. Here, the entrypoint is this test file.
-    var pubPath = path.join(path.dirname(Platform.executable),
-        Platform.operatingSystem == "windows" ? "pub.bat" : "pub");
-
-    var pub = new ScheduledProcess.start(pubPath, ['version']);
-    pub.stdout.expect(startsWith("Pub"));
-    pub.shouldExit(exit_codes.SUCCESS);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/allows_dart_extension_test.dart b/sdk/lib/_internal/pub/test/run/allows_dart_extension_test.dart
deleted file mode 100644
index 38bdb77..0000000
--- a/sdk/lib/_internal/pub/test/run/allows_dart_extension_test.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const SCRIPT = """
-import 'dart:io';
-
-main() {
-  stdout.writeln("stdout output");
-  stderr.writeln("stderr output");
-  exitCode = 123;
-}
-""";
-
-main() {
-  initConfig();
-  integration('allows a ".dart" extension on the argument', () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("bin", [
-        d.file("script.dart", SCRIPT)
-      ])
-    ]).create();
-
-    var pub = pubRun(args: ["script.dart"]);
-    pub.stdout.expect("stdout output");
-    pub.stderr.expect("stderr output");
-    pub.shouldExit(123);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/app_can_read_from_stdin_test.dart b/sdk/lib/_internal/pub/test/run/app_can_read_from_stdin_test.dart
deleted file mode 100644
index 933de2c..0000000
--- a/sdk/lib/_internal/pub/test/run/app_can_read_from_stdin_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const SCRIPT = """
-import 'dart:io';
-
-main() {
-  print("started");
-  var line1 = stdin.readLineSync();
-  print("between");
-  var line2 = stdin.readLineSync();
-  print(line1);
-  print(line2);
-}
-""";
-
-main() {
-  initConfig();
-  integration('the spawned application can read from stdin', () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("bin", [
-        d.file("script.dart", SCRIPT)
-      ])
-    ]).create();
-
-    var pub = pubRun(args: ["bin/script"]);
-
-    pub.stdout.expect("started");
-    pub.writeLine("first");
-    pub.stdout.expect("between");
-    pub.writeLine("second");
-    pub.stdout.expect("first");
-    pub.stdout.expect("second");
-    pub.shouldExit(0);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/displays_transformer_logs_test.dart b/sdk/lib/_internal/pub/test/run/displays_transformer_logs_test.dart
deleted file mode 100644
index 1dff2d2..0000000
--- a/sdk/lib/_internal/pub/test/run/displays_transformer_logs_test.dart
+++ /dev/null
@@ -1,90 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const SCRIPT = """
-import "package:myapp/lib.dart";
-main() {
-  callLib();
-}
-""";
-
-const LIB = """
-callLib() {
-  print("lib");
-}
-""";
-
-// Make it lazy so that "lib.dart" isn't transformed until after the process
-// is started. Otherwise, since this tranformer modifies .dart files, it will
-// be run while the transformers themselves are loading during pub run's
-// startup.
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class LoggingTransformer extends Transformer implements LazyTransformer {
-  LoggingTransformer.asPlugin();
-
-  String get allowedExtensions => '.dart';
-
-  void apply(Transform transform) {
-    transform.logger.info('\${transform.primaryInput.id}.');
-    transform.logger.warning('\${transform.primaryInput.id}.');
-  }
-
-  void declareOutputs(DeclaringTransform transform) {
-    // TODO(rnystrom): Remove this when #19408 is fixed.
-    transform.declareOutput(transform.primaryId);
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration('displays transformer log messages', () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [
-          d.file("lib.dart", LIB),
-          d.dir("src", [
-            d.file("transformer.dart", TRANSFORMER)
-          ])
-        ]),
-        d.dir("bin", [
-          d.file("script.dart", SCRIPT)
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var pub = pubRun(args: ["bin/script"]);
-
-      // Note that the info log is only displayed here because the test
-      // harness runs pub in verbose mode. By default, only the warning would
-      // be shown.
-      pub.stdout.expect("[Info from Logging]:");
-      pub.stdout.expect("myapp|bin/script.dart.");
-
-      pub.stderr.expect("[Warning from Logging]:");
-      pub.stderr.expect("myapp|bin/script.dart.");
-
-      pub.stdout.expect("[Info from Logging]:");
-      pub.stdout.expect("myapp|lib/lib.dart.");
-
-      pub.stderr.expect("[Warning from Logging]:");
-      pub.stderr.expect("myapp|lib/lib.dart.");
-
-      pub.stdout.expect("lib");
-      pub.shouldExit();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/does_not_run_on_transformer_error_test.dart b/sdk/lib/_internal/pub/test/run/does_not_run_on_transformer_error_test.dart
deleted file mode 100644
index 51985a3..0000000
--- a/sdk/lib/_internal/pub/test/run/does_not_run_on_transformer_error_test.dart
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const SCRIPT = """
-main() {
-  print("should not get here!");
-}
-""";
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class FailingTransformer extends Transformer {
-  FailingTransformer.asPlugin();
-
-  String get allowedExtensions => '.dart';
-
-  void apply(Transform transform) {
-    // Don't run on the transformer itself.
-    if (transform.primaryInput.id.path.startsWith("lib")) return;
-    transform.logger.error('\${transform.primaryInput.id}.');
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration('does not run if a transformer has an error', () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [
-          d.dir("src", [
-            d.file("transformer.dart", TRANSFORMER)
-          ])
-        ]),
-        d.dir("bin", [
-          d.file("script.dart", SCRIPT)
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var pub = pubRun(args: ["bin/script"]);
-
-      pub.stderr.expect("[Error from Failing]:");
-      pub.stderr.expect("myapp|bin/script.dart.");
-
-      // Note: no output from the script.
-      pub.shouldExit();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/doesnt_load_an_unnecessary_transformer_test.dart b/sdk/lib/_internal/pub/test/run/doesnt_load_an_unnecessary_transformer_test.dart
deleted file mode 100644
index 1be2487..0000000
--- a/sdk/lib/_internal/pub/test/run/doesnt_load_an_unnecessary_transformer_test.dart
+++ /dev/null
@@ -1,55 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class BrokenTransformer extends Transformer {
-  RewriteTransformer.asPlugin() {
-    throw 'This transformer is broken!';
-  }
-
-  String get allowedExtensions => '.txt';
-
-  void apply(Transform transform) {}
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("doesn't load an unnecessary transformer", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {"myapp/src/transformer": {r"$include": "lib/myapp.dart"}}
-          ]
-        }),
-        d.dir("lib", [
-          d.file("myapp.dart", ""),
-          d.dir("src", [d.file("transformer.dart", TRANSFORMER)])
-        ]),
-        d.dir("bin", [
-          d.file("hi.dart", "void main() => print('Hello!');")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      // This shouldn't load the transformer, since it doesn't transform
-      // anything that the entrypoint imports. If it did load the transformer,
-      // we'd know since it would throw an exception.
-      var pub = pubRun(args: ["bin/hi"]);
-      pub.stdout.expect("Hello!");
-      pub.shouldExit();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/errors_if_no_executable_is_given_test.dart b/sdk/lib/_internal/pub/test/run/errors_if_no_executable_is_given_test.dart
deleted file mode 100644
index 388d497..0000000
--- a/sdk/lib/_internal/pub/test/run/errors_if_no_executable_is_given_test.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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 '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('Errors if the executable does not exist.', () {
-    d.dir(appPath, [
-      d.appPubspec()
-    ]).create();
-
-    schedulePub(args: ["run"],
-        error: """
-Must specify an executable to run.
-
-Usage: pub run <executable> [args...]
--h, --help    Print this usage information.
-    --mode    Mode to run transformers in.
-              (defaults to "release" for dependencies, "debug" for entrypoint)
-
-Run "pub help" to see global options.
-""",
-        exitCode: exit_codes.USAGE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/errors_if_only_transitive_dependency_test.dart b/sdk/lib/_internal/pub/test/run/errors_if_only_transitive_dependency_test.dart
deleted file mode 100644
index c644b53..0000000
--- a/sdk/lib/_internal/pub/test/run/errors_if_only_transitive_dependency_test.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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 '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('Errors if the script is in a non-immediate dependency.', () {
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("bar.dart", "main() => print('foobar');")
-      ])
-    ]).create();
-
-    d.dir("bar", [
-      d.libPubspec("bar", "1.0.0", deps: {
-        "foo": {"path": "../foo"}
-      })
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "bar": {"path": "../bar"}
-      })
-    ]).create();
-
-    pubGet();
-
-    var pub = pubRun(args: ["foo:script"]);
-    pub.stderr.expect('Package "foo" is not an immediate dependency.');
-    pub.stderr.expect('Cannot run executables in transitive dependencies.');
-    pub.shouldExit(exit_codes.DATA);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/errors_if_path_in_dependency_test.dart b/sdk/lib/_internal/pub/test/run/errors_if_path_in_dependency_test.dart
deleted file mode 100644
index 3874f35..0000000
--- a/sdk/lib/_internal/pub/test/run/errors_if_path_in_dependency_test.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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 '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('Errors if the executable is in a subdirectory in a '
-      'dependency.', () {
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0")
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      })
-    ]).create();
-
-    schedulePub(args: ["run", "foo:sub/dir"],
-        error: """
-Cannot run an executable in a subdirectory of a dependency.
-
-Usage: pub run <executable> [args...]
--h, --help    Print this usage information.
-    --mode    Mode to run transformers in.
-              (defaults to "release" for dependencies, "debug" for entrypoint)
-
-Run "pub help" to see global options.
-""",
-        exitCode: exit_codes.USAGE);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/forwards_signal_posix_test.dart b/sdk/lib/_internal/pub/test/run/forwards_signal_posix_test.dart
deleted file mode 100644
index 6b9e222..0000000
--- a/sdk/lib/_internal/pub/test/run/forwards_signal_posix_test.dart
+++ /dev/null
@@ -1,52 +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:io';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const _catchableSignals = const [
-  ProcessSignal.SIGHUP,
-  ProcessSignal.SIGTERM,
-  ProcessSignal.SIGUSR1,
-  ProcessSignal.SIGUSR2,
-  ProcessSignal.SIGWINCH,
-];
-
-const SCRIPT = """
-import 'dart:io';
-
-main() {
-  ProcessSignal.SIGHUP.watch().first.then(print);
-  ProcessSignal.SIGTERM.watch().first.then(print);
-  ProcessSignal.SIGUSR1.watch().first.then(print);
-  ProcessSignal.SIGUSR2.watch().first.then(print);
-  ProcessSignal.SIGWINCH.watch().first.then(print);
-
-  print("ready");
-}
-""";
-
-main() {
-  initConfig();
-  integration('forwards signals to the inner script', () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("bin", [
-        d.file("script.dart", SCRIPT)
-      ])
-    ]).create();
-
-    var pub = pubRun(args: ["bin/script"]);
-
-    pub.stdout.expect("ready");
-    for (var signal in _catchableSignals) {
-      pub.signal(signal);
-      pub.stdout.expect(signal.toString());
-    }
-
-    pub.kill();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/ignores_explicit_dart2js_transformer_test.dart b/sdk/lib/_internal/pub/test/run/ignores_explicit_dart2js_transformer_test.dart
deleted file mode 100644
index a5bcdb3..0000000
--- a/sdk/lib/_internal/pub/test/run/ignores_explicit_dart2js_transformer_test.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("doesn't choke on an explicit dart2js transformer", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "transformers": [r"$dart2js"]
-      }),
-      d.dir("bin", [
-        d.file("script.dart", "main() => print('Hello!');")
-      ])
-    ]).create();
-
-    var pub = pubRun(args: ["bin/script"]);
-    pub.stdout.expect("Hello!");
-    pub.shouldExit(0);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/includes_parent_directories_of_entrypoint_test.dart b/sdk/lib/_internal/pub/test/run/includes_parent_directories_of_entrypoint_test.dart
deleted file mode 100644
index 8169689..0000000
--- a/sdk/lib/_internal/pub/test/run/includes_parent_directories_of_entrypoint_test.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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:path/path.dart' as path;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const SCRIPT = r"""
-import '../../a.dart';
-import '../b.dart';
-main() {
-  print("$a $b");
-}
-""";
-
-main() {
-  initConfig();
-  integration('allows assets in parent directories of the entrypoint to be'
-      'accessed', () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("tool", [
-        d.file("a.dart", "var a = 'a';"),
-        d.dir("a", [
-          d.file("b.dart", "var b = 'b';"),
-          d.dir("b", [
-            d.file("app.dart", SCRIPT)
-          ])
-        ])
-      ])
-    ]).create();
-
-    var pub = pubRun(args: [path.join("tool", "a", "b", "app")]);
-    pub.stdout.expect("a b");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/mode_test.dart b/sdk/lib/_internal/pub/test/run/mode_test.dart
deleted file mode 100644
index ff8fd4b..0000000
--- a/sdk/lib/_internal/pub/test/run/mode_test.dart
+++ /dev/null
@@ -1,84 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class DartTransformer extends Transformer {
-  final BarbackSettings _settings;
-
-  DartTransformer.asPlugin(this._settings);
-
-  String get allowedExtensions => '.in';
-
-  void apply(Transform transform) {
-    transform.addOutput(new Asset.fromString(
-        new AssetId(transform.primaryInput.id.package, "bin/script.dart"),
-        "void main() => print('\${_settings.mode.name}');"));
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration('runs a local script with customizable modes', () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", TRANSFORMER),
-          d.file("primary.in", "")
-        ])])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      // By default it should run in debug mode.
-      var pub = pubRun(args: ["bin/script"]);
-      pub.stdout.expect("debug");
-      pub.shouldExit();
-
-      // A custom mode should be specifiable.
-      pub = pubRun(args: ["--mode", "custom-mode", "bin/script"]);
-      pub.stdout.expect("custom-mode");
-      pub.shouldExit();
-    });
-
-    integration('runs a dependency script with customizable modes', () {
-      d.dir("foo", [
-        d.pubspec({
-          "name": "foo",
-          "version": "1.2.3",
-          "transformers": ["foo/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", TRANSFORMER),
-          d.file("primary.in", "")
-        ])])
-      ]).create();
-
-      d.appDir({"foo": {"path": "../foo"}}).create();
-
-      createLockFile('myapp', sandbox: ['foo'], pkg: ['barback']);
-
-      // By default it should run in release mode.
-      var pub = pubRun(args: ["foo:script"]);
-      pub.stdout.expect("release");
-      pub.shouldExit();
-
-      // A custom mode should be specifiable.
-      pub = pubRun(args: ["--mode", "custom-mode", "foo:script"]);
-      pub.stdout.expect("custom-mode");
-      pub.shouldExit();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/nonexistent_dependency_test.dart b/sdk/lib/_internal/pub/test/run/nonexistent_dependency_test.dart
deleted file mode 100644
index 4ecb666..0000000
--- a/sdk/lib/_internal/pub/test/run/nonexistent_dependency_test.dart
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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 '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('Errors if the script is in an unknown package.', () {
-    d.dir(appPath, [
-      d.appPubspec()
-    ]).create();
-
-    var pub = pubRun(args: ["foo:script"]);
-    pub.stderr.expect('Could not find package "foo". Did you forget to add a '
-        'dependency?');
-    pub.shouldExit(exit_codes.DATA);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/nonexistent_script_in_dependency_test.dart b/sdk/lib/_internal/pub/test/run/nonexistent_script_in_dependency_test.dart
deleted file mode 100644
index 88fdfc0..0000000
--- a/sdk/lib/_internal/pub/test/run/nonexistent_script_in_dependency_test.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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:path/path.dart' as p;
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('Errors if the script in a dependency does not exist.', () {
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0")
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      })
-    ]).create();
-
-    pubGet();
-
-    var pub = pubRun(args: ["foo:script"]);
-    pub.stderr.expect(
-        "Could not find ${p.join("bin", "script.dart")} in package foo.");
-    pub.shouldExit(exit_codes.NO_INPUT);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/nonexistent_script_test.dart b/sdk/lib/_internal/pub/test/run/nonexistent_script_test.dart
deleted file mode 100644
index 7704fdf..0000000
--- a/sdk/lib/_internal/pub/test/run/nonexistent_script_test.dart
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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:path/path.dart' as p;
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('Errors if the script does not exist.', () {
-    d.dir(appPath, [
-      d.appPubspec()
-    ]).create();
-
-    var pub = pubRun(args: [p.join("bin", "script")]);
-    pub.stderr.expect("Could not find ${p.join("bin", "script.dart")}.");
-    pub.shouldExit(exit_codes.NO_INPUT);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/passes_along_arguments_test.dart b/sdk/lib/_internal/pub/test/run/passes_along_arguments_test.dart
deleted file mode 100644
index 4f16a0c..0000000
--- a/sdk/lib/_internal/pub/test/run/passes_along_arguments_test.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const SCRIPT = """
-main(List<String> args) {
-  print(args.join(" "));
-}
-""";
-
-main() {
-  initConfig();
-  integration('passes arguments to the spawned script', () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("bin", [
-        d.file("args.dart", SCRIPT)
-      ])
-    ]).create();
-
-    // Use some args that would trip up pub's arg parser to ensure that it
-    // isn't trying to look at them.
-    var pub = pubRun(args: ["bin/args", "--verbose", "-m", "--", "help"]);
-
-    pub.stdout.expect("--verbose -m -- help");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/runs_a_generated_script_test.dart b/sdk/lib/_internal/pub/test/run/runs_a_generated_script_test.dart
deleted file mode 100644
index ab136b9..0000000
--- a/sdk/lib/_internal/pub/test/run/runs_a_generated_script_test.dart
+++ /dev/null
@@ -1,49 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class DartTransformer extends Transformer {
-  DartTransformer.asPlugin();
-
-  String get allowedExtensions => '.in';
-
-  void apply(Transform transform) {
-    transform.addOutput(new Asset.fromString(
-        new AssetId("myapp", "bin/script.dart"),
-        "void main() => print('generated');"));
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration('runs a script generated from scratch by a transformer', () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", TRANSFORMER),
-          d.file("primary.in", "")
-        ])])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var pub = pubRun(args: ["bin/script"]);
-
-      pub.stdout.expect("generated");
-      pub.shouldExit();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/runs_app_in_directory_in_entrypoint_test.dart b/sdk/lib/_internal/pub/test/run/runs_app_in_directory_in_entrypoint_test.dart
deleted file mode 100644
index b742c6a..0000000
--- a/sdk/lib/_internal/pub/test/run/runs_app_in_directory_in_entrypoint_test.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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:path/path.dart' as path;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('runs a Dart application in the entrypoint package', () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("tool", [
-        d.file("app.dart", "main() => print('tool');"),
-        d.dir("sub", [
-          d.file("app.dart", "main() => print('sub');")
-        ])
-      ])
-    ]).create();
-
-    var pub = pubRun(args: [path.join("tool", "app")]);
-    pub.stdout.expect("tool");
-    pub.shouldExit();
-
-    pub = pubRun(args: [path.join("tool", "sub", "app")]);
-    pub.stdout.expect("sub");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/runs_app_in_entrypoint_test.dart b/sdk/lib/_internal/pub/test/run/runs_app_in_entrypoint_test.dart
deleted file mode 100644
index 2aaaa29..0000000
--- a/sdk/lib/_internal/pub/test/run/runs_app_in_entrypoint_test.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const SCRIPT = """
-import 'dart:io';
-
-main() {
-  stdout.writeln("stdout output");
-  stderr.writeln("stderr output");
-  exitCode = 123;
-}
-""";
-
-main() {
-  initConfig();
-  integration('runs a Dart application in the entrypoint package', () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("bin", [
-        d.file("script.dart", SCRIPT)
-      ])
-    ]).create();
-
-    var pub = pubRun(args: ["bin/script"]);
-    pub.stdout.expect("stdout output");
-    pub.stderr.expect("stderr output");
-    pub.shouldExit(123);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/runs_app_in_entrypoint_with_warning_test.dart b/sdk/lib/_internal/pub/test/run/runs_app_in_entrypoint_with_warning_test.dart
deleted file mode 100644
index 922525b..0000000
--- a/sdk/lib/_internal/pub/test/run/runs_app_in_entrypoint_with_warning_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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:path/path.dart' as p;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const SCRIPT = """
-import 'dart:io';
-
-main() {
-  stdout.writeln("stdout output");
-  stderr.writeln("stderr output");
-  exitCode = 123;
-}
-""";
-
-main() {
-  initConfig();
-  integration('runs a Dart application in the entrypoint package', () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("bin", [
-        d.file("script.dart", SCRIPT)
-      ])
-    ]).create();
-
-    var pub = pubRun(args: ["script"]);
-    pub.stdout.expect("stdout output");
-    pub.stderr.expect(
-        'In future releases, "pub run script" will mean the same thing as "pub '
-            'run script:script".');
-    pub.stderr.expect(
-        'Run "pub run ${p.join('bin', 'script')}" explicitly to run the local '
-            'executable.');
-    pub.stderr.expect("stderr output");
-    pub.shouldExit(123);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/runs_from_a_dependency_override_after_dependency_test.dart b/sdk/lib/_internal/pub/test/run/runs_from_a_dependency_override_after_dependency_test.dart
deleted file mode 100644
index d30e6f4..0000000
--- a/sdk/lib/_internal/pub/test/run/runs_from_a_dependency_override_after_dependency_test.dart
+++ /dev/null
@@ -1,54 +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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  // Regression test for issue 23113
-  integration('runs a named Dart application in a dependency', () {
-    servePackages((builder) {
-      builder.serve('foo', '1.0.0', pubspec: {
-        'name': 'foo',
-        'version': '1.0.0'
-      }, contents: [
-        d.dir("bin", [
-          d.file("bar.dart", "main() => print('foobar');")
-        ])
-      ]);
-    });
-
-    d.dir(appPath, [
-      d.appPubspec({"foo": null})
-    ]).create();
-
-    pubGet();
-
-    var pub = pubRun(args: ["foo:bar"]);
-    pub.stdout.expect("foobar");
-    pub.shouldExit();
-
-    d.dir("foo", [
-      d.libPubspec("foo", "2.0.0"),
-      d.dir("bin", [
-        d.file("bar.dart", "main() => print('different');")
-      ])
-    ]).create();
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": {"path": "../foo"}}
-      })
-    ]).create();
-
-    pubGet();
-
-    pub = pubRun(args: ["foo:bar"]);
-    pub.stdout.expect("different");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/runs_named_app_in_dependency_test.dart b/sdk/lib/_internal/pub/test/run/runs_named_app_in_dependency_test.dart
deleted file mode 100644
index 3ccfa90..0000000
--- a/sdk/lib/_internal/pub/test/run/runs_named_app_in_dependency_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('runs a named Dart application in a dependency', () {
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("bar.dart", "main() => print('foobar');")
-      ])
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      })
-    ]).create();
-
-    pubGet();
-
-    var pub = pubRun(args: ["foo:bar"]);
-    pub.stdout.expect("foobar");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/runs_named_app_in_dev_dependency_test.dart b/sdk/lib/_internal/pub/test/run/runs_named_app_in_dev_dependency_test.dart
deleted file mode 100644
index 6c3c1e7..0000000
--- a/sdk/lib/_internal/pub/test/run/runs_named_app_in_dev_dependency_test.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('runs a named Dart application in a dev dependency', () {
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("bar.dart", "main() => print('foobar');")
-      ])
-    ]).create();
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dev_dependencies": {
-          "foo": {"path": "../foo"}
-        }
-      })
-    ]).create();
-
-    pubGet();
-
-    var pub = pubRun(args: ["foo:bar"]);
-    pub.stdout.expect("foobar");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/runs_shorthand_app_in_dependency_test.dart b/sdk/lib/_internal/pub/test/run/runs_shorthand_app_in_dependency_test.dart
deleted file mode 100644
index 6c9f64b..0000000
--- a/sdk/lib/_internal/pub/test/run/runs_shorthand_app_in_dependency_test.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration('runs a shorthand Dart application in a dependency', () {
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("bin", [
-        d.file("foo.dart", "main() => print('foo');")
-      ])
-    ]).create();
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {
-          "foo": {"path": "../foo"}
-        }
-      })
-    ]).create();
-
-    pubGet();
-
-    var pub = pubRun(args: ["foo"]);
-    pub.stdout.expect("foo");
-    pub.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/runs_the_script_in_checked_mode_test.dart b/sdk/lib/_internal/pub/test/run/runs_the_script_in_checked_mode_test.dart
deleted file mode 100644
index fd6b27a..0000000
--- a/sdk/lib/_internal/pub/test/run/runs_the_script_in_checked_mode_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const SCRIPT = """
-main() {
-  int a = true;
-}
-""";
-
-main() {
-  initConfig();
-  integration('runs the script in checked mode by default', () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("bin", [
-        d.file("script.dart", SCRIPT)
-      ])
-    ]).create();
-
-    schedulePub(args: ["run", "script"],
-        error: contains("'bool' is not a subtype of type 'int' of 'a'"),
-        exitCode: 255);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/run/runs_transformer_in_entrypoint_test.dart b/sdk/lib/_internal/pub/test/run/runs_transformer_in_entrypoint_test.dart
deleted file mode 100644
index f367433..0000000
--- a/sdk/lib/_internal/pub/test/run/runs_transformer_in_entrypoint_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const SCRIPT = """
-const TOKEN = "hi";
-main() {
-  print(TOKEN);
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration('runs transformers in the entrypoint package', () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", dartTransformer("transformed"))
-        ])]),
-        d.dir("bin", [
-          d.file("hi.dart", SCRIPT)
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var pub = pubRun(args: ["bin/hi"]);
-
-      pub.stdout.expect("(hi, transformed)");
-      pub.shouldExit();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/404_page_test.dart b/sdk/lib/_internal/pub/test/serve/404_page_test.dart
deleted file mode 100644
index f1f2ce3..0000000
--- a/sdk/lib/_internal/pub/test/serve/404_page_test.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  setUp(() {
-    d.dir(appPath, [
-      d.appPubspec()
-    ]).create();
-  });
-
-  integration("the 404 page describes the missing asset", () {
-    pubServe();
-
-    scheduleRequest("packages/foo/missing.txt").then((response) {
-      expect(response.statusCode, equals(404));
-
-      // Should mention the asset that can't be found.
-      expect(response.body, contains("foo"));
-      expect(response.body, contains("missing.txt"));
-    });
-
-    endPubServe();
-  });
-
-  integration("the 404 page describes the error", () {
-    pubServe();
-
-    scheduleRequest("packages").then((response) {
-      expect(response.statusCode, equals(404));
-
-      // Should mention the asset that can't be found.
-      expect(response.body, contains('&quot;&#47;packages&quot;'));
-    });
-
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/allows_arbitrary_modes_test.dart b/sdk/lib/_internal/pub/test/serve/allows_arbitrary_modes_test.dart
deleted file mode 100644
index 9eb7ccf..0000000
--- a/sdk/lib/_internal/pub/test/serve/allows_arbitrary_modes_test.dart
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class ModeTransformer extends Transformer {
-  final BarbackSettings settings;
-  ModeTransformer.asPlugin(this.settings);
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    return new Future.value().then((_) {
-      var id = transform.primaryInput.id.changeExtension(".out");
-      transform.addOutput(new Asset.fromString(id, settings.mode.toString()));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("allows user-defined mode names", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe(args: ["--mode", "depeche"]);
-      requestShouldSucceed("foo.out", "depeche");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/defaults_to_debug_mode_test.dart b/sdk/lib/_internal/pub/test/serve/defaults_to_debug_mode_test.dart
deleted file mode 100644
index 5037824..0000000
--- a/sdk/lib/_internal/pub/test/serve/defaults_to_debug_mode_test.dart
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class ModeTransformer extends Transformer {
-  final BarbackSettings settings;
-  ModeTransformer.asPlugin(this.settings);
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    return new Future.value().then((_) {
-      var id = transform.primaryInput.id.changeExtension(".out");
-      transform.addOutput(new Asset.fromString(id, settings.mode.toString()));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("defaults to debug mode", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.out", "debug");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/does_not_crash_if_an_unused_dart_file_has_a_syntax_error_test.dart b/sdk/lib/_internal/pub/test/serve/does_not_crash_if_an_unused_dart_file_has_a_syntax_error_test.dart
deleted file mode 100644
index 09d41bd..0000000
--- a/sdk/lib/_internal/pub/test/serve/does_not_crash_if_an_unused_dart_file_has_a_syntax_error_test.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("doesn't crash if an unused .dart file has a syntax error", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER),
-          d.file("unused.dart", "(*&^#@")
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var server = pubServe();
-      requestShouldSucceed("foo.out", "foo.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/does_not_get_first_if_a_dependency_is_removed_test.dart b/sdk/lib/_internal/pub/test/serve/does_not_get_first_if_a_dependency_is_removed_test.dart
deleted file mode 100644
index 48ab3c1..0000000
--- a/sdk/lib/_internal/pub/test/serve/does_not_get_first_if_a_dependency_is_removed_test.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("does not get if a dependency is removed", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1"),
-      d.libDir("foo")
-    ]).create();
-
-    // Get "foo" into the lock file.
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      })
-    ]).create();
-    pubGet();
-
-    // Remove it from the pubspec.
-    d.dir(appPath, [
-      d.appPubspec()
-    ]).create();
-
-    pubServe(shouldGetFirst: false);
-    requestShouldSucceed("packages/foo/foo.dart", 'main() => "foo";');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/does_not_get_first_if_git_url_did_not_change_test.dart b/sdk/lib/_internal/pub/test/serve/does_not_get_first_if_git_url_did_not_change_test.dart
deleted file mode 100644
index d0c8fa1..0000000
--- a/sdk/lib/_internal/pub/test/serve/does_not_get_first_if_git_url_did_not_change_test.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("does not get first if a git dependency's url is unchanged", () {
-    d.git('foo.git', [
-      d.libPubspec('foo', '1.0.0'),
-      d.libDir("foo")
-    ]).create();
-
-    d.appDir({
-      "foo": {"git": "../foo.git"}
-    }).create();
-
-    pubGet();
-    pubServe(shouldGetFirst: false);
-    requestShouldSucceed("packages/foo/foo.dart", 'main() => "foo";');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/does_not_get_first_if_locked_matches_override_test.dart b/sdk/lib/_internal/pub/test/serve/does_not_get_first_if_locked_matches_override_test.dart
deleted file mode 100644
index 5c4ed3a..0000000
--- a/sdk/lib/_internal/pub/test/serve/does_not_get_first_if_locked_matches_override_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  // This is a regression test for https://dartbug.com/15180.
-  initConfig();
-  integration("does not get if the locked version matches the override", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1"),
-      d.libDir("foo")
-    ]).create();
-
-    // Get "foo" into the lock file.
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {
-          "foo": "any"
-        },
-        "dependency_overrides": {
-          "foo": {
-            "path": "../foo",
-            "version": ">=0.0.1"
-          }
-        }
-      })
-    ]).create();
-    pubGet();
-
-    pubServe(shouldGetFirst: false);
-    requestShouldSucceed("packages/foo/foo.dart", 'main() => "foo";');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/does_not_get_first_if_locked_version_matches_test.dart b/sdk/lib/_internal/pub/test/serve/does_not_get_first_if_locked_version_matches_test.dart
deleted file mode 100644
index 6b46bce..0000000
--- a/sdk/lib/_internal/pub/test/serve/does_not_get_first_if_locked_version_matches_test.dart
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("does not get if the locked version of a dependency is allowed "
-      "by the pubspec's constraint", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1"),
-      d.libDir("foo")
-    ]).create();
-
-    // Get "foo" into the lock file.
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {
-          "path": "../foo",
-          "version": ">=0.0.1"
-        },
-      })
-    ]).create();
-    pubGet();
-
-    // Change the version.
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {
-          "path": "../foo",
-          "version": "<2.0.0"
-        },
-      })
-    ]).create();
-
-    pubServe(shouldGetFirst: false);
-    requestShouldSucceed("packages/foo/foo.dart", 'main() => "foo";');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/does_not_serve_dart_in_release_test.dart b/sdk/lib/_internal/pub/test/serve/does_not_serve_dart_in_release_test.dart
deleted file mode 100644
index 1c61497..0000000
--- a/sdk/lib/_internal/pub/test/serve/does_not_serve_dart_in_release_test.dart
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("does not serve .dart files in release mode", () {
-
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1"),
-      d.dir("lib", [
-        d.file("foo.dart",
-            """
-            library foo;
-            foo() => 'foo';
-            """)
-      ])
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      }),
-      d.dir("lib", [
-        d.file("lib.dart", "lib() => print('hello');"),
-      ]),
-      d.dir("web", [
-        d.file("file.dart",
-            """
-            import 'package:foo/foo.dart';
-            main() => print('hello');
-            """),
-        d.dir("sub", [
-          d.file("sub.dart", "main() => 'foo';"),
-        ])
-      ])
-    ]).create();
-
-    pubServe(shouldGetFirst: true, args: ["--mode", "release"]);
-    requestShould404("file.dart");
-    requestShould404("packages/myapp/lib.dart");
-    requestShould404("packages/foo/foo.dart");
-    requestShould404("sub/sub.dart");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/does_not_serve_hidden_assets_test.dart b/sdk/lib/_internal/pub/test/serve/does_not_serve_hidden_assets_test.dart
deleted file mode 100644
index 0429e7e..0000000
--- a/sdk/lib/_internal/pub/test/serve/does_not_serve_hidden_assets_test.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("doesn't serve hidden assets", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file(".outer.txt", "outer contents"),
-        d.dir(".dir", [
-          d.file("inner.txt", "inner contents"),
-        ])
-      ])
-    ]).create();
-
-    pubServe();
-    requestShould404(".outer.txt");
-    requestShould404(".dir/inner.txt");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/does_not_watch_compiled_js_files_test.dart b/sdk/lib/_internal/pub/test/serve/does_not_watch_compiled_js_files_test.dart
deleted file mode 100644
index 4d620f6..0000000
--- a/sdk/lib/_internal/pub/test/serve/does_not_watch_compiled_js_files_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("does not watch changes to compiled JS files in the package", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "body")
-      ])
-    ]).create();
-
-    pubServe();
-    waitForBuildSuccess();
-    requestShouldSucceed("index.html", "body");
-
-    d.dir(appPath, [
-      d.dir("web", [
-        d.file('file.dart', 'void main() => print("hello");'),
-        d.file("other.dart.js", "should be ignored"),
-        d.file("other.dart.js.map", "should be ignored"),
-        d.file("other.dart.precompiled.js", "should be ignored")
-      ])
-    ]).create();
-
-    waitForBuildSuccess();
-    requestShouldSucceed("file.dart", 'void main() => print("hello");');
-    requestShould404("other.dart.js");
-    requestShould404("other.dart.js.map");
-    requestShould404("other.dart.precompiled.js");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/gets_first_if_dependency_added_test.dart b/sdk/lib/_internal/pub/test/serve/gets_first_if_dependency_added_test.dart
deleted file mode 100644
index f1d7bb8..0000000
--- a/sdk/lib/_internal/pub/test/serve/gets_first_if_dependency_added_test.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("gets first if a dependency is not in the lock file", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1"),
-      d.libDir("foo")
-    ]).create();
-
-    // Create a lock file without "foo".
-    d.dir(appPath, [
-      d.appPubspec()
-    ]).create();
-    pubGet();
-
-    // Add it to the pubspec.
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      })
-    ]).create();
-
-    pubServe(shouldGetFirst: true);
-    requestShouldSucceed("packages/foo/foo.dart", 'main() => "foo";');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/gets_first_if_dependency_is_not_installed_test.dart b/sdk/lib/_internal/pub/test/serve/gets_first_if_dependency_is_not_installed_test.dart
deleted file mode 100644
index d76d836..0000000
--- a/sdk/lib/_internal/pub/test/serve/gets_first_if_dependency_is_not_installed_test.dart
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("gets first if a dependency is not installed", () {
-    servePackages((builder) => builder.serve("foo", "1.2.3"));
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    // Run pub to get a lock file.
-    pubGet();
-
-    // Delete the system cache so it isn't installed any more.
-    schedule(() => deleteEntry(path.join(sandboxDir, cachePath)));
-
-    pubServe(shouldGetFirst: true);
-    requestShouldSucceed("packages/foo/foo.dart", 'main() => "foo 1.2.3";');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/gets_first_if_dependency_version_changed_test.dart b/sdk/lib/_internal/pub/test/serve/gets_first_if_dependency_version_changed_test.dart
deleted file mode 100644
index 4bcd4e4..0000000
--- a/sdk/lib/_internal/pub/test/serve/gets_first_if_dependency_version_changed_test.dart
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("gets first if a dependency's version doesn't match the one in "
-      "the lock file", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1"),
-      d.libDir("foo")
-    ]).create();
-
-    d.appDir({
-      "foo": {
-        "path": "../foo",
-        "version": "0.0.1"
-      }
-    }).create();
-
-    pubGet();
-
-    // Change the version in the pubspec and package.
-    d.appDir({
-      "foo": {
-        "path": "../foo",
-        "version": "0.0.2"
-      }
-    }).create();
-
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.2"),
-      d.libDir("foo")
-    ]).create();
-
-    pubServe(shouldGetFirst: true);
-    requestShouldSucceed("packages/foo/foo.dart", 'main() => "foo";');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/gets_first_if_dev_dependency_changed_test.dart b/sdk/lib/_internal/pub/test/serve/gets_first_if_dev_dependency_changed_test.dart
deleted file mode 100644
index 6b41d01..0000000
--- a/sdk/lib/_internal/pub/test/serve/gets_first_if_dev_dependency_changed_test.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'dart:convert';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("gets first if a dev dependency has changed", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1"),
-      d.libDir("foo")
-    ]).create();
-
-    // Create a pubspec with "foo" and a lock file without it.
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dev_dependencies": {
-          "foo": {"path": "../foo"}
-        }
-      }),
-      d.file("pubspec.lock", JSON.encode({
-        'packages': {}
-      }))
-    ]).create();
-
-    pubServe(shouldGetFirst: true);
-    requestShouldSucceed("packages/foo/foo.dart", 'main() => "foo";');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/gets_first_if_git_ref_changed_test.dart b/sdk/lib/_internal/pub/test/serve/gets_first_if_git_ref_changed_test.dart
deleted file mode 100644
index 91f2d3f..0000000
--- a/sdk/lib/_internal/pub/test/serve/gets_first_if_git_ref_changed_test.dart
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("gets first if a git dependency's ref doesn't match the one in "
-      "the lock file", () {
-    var repo = d.git('foo.git', [
-      d.libDir('foo', 'before'),
-      d.libPubspec('foo', '1.0.0')
-    ]);
-    repo.create();
-    var commit1 = repo.revParse('HEAD');
-
-    d.git('foo.git', [
-      d.libDir('foo', 'after'),
-      d.libPubspec('foo', '1.0.0')
-    ]).commit();
-
-    var commit2 = repo.revParse('HEAD');
-
-    // Lock it to the ref of the first commit.
-    d.appDir({
-      "foo": {"git": {"url": "../foo.git", "ref": commit1}}
-    }).create();
-
-    pubGet();
-
-    // Change the commit in the pubspec.
-    d.appDir({
-      "foo": {"git": {"url": "../foo.git", "ref": commit2}}
-    }).create();
-
-    pubServe(shouldGetFirst: true);
-    requestShouldSucceed("packages/foo/foo.dart", 'main() => "after";');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/gets_first_if_git_url_changed_test.dart b/sdk/lib/_internal/pub/test/serve/gets_first_if_git_url_changed_test.dart
deleted file mode 100644
index 71e98ad..0000000
--- a/sdk/lib/_internal/pub/test/serve/gets_first_if_git_url_changed_test.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("gets first if a git dependency's url doesn't match the one in "
-      "the lock file", () {
-    d.git("foo-before.git", [
-      d.libPubspec("foo", "1.0.0"),
-      d.libDir("foo", "before")
-    ]).create();
-
-    d.git("foo-after.git", [
-      d.libPubspec("foo", "1.0.0"),
-      d.libDir("foo", "after")
-    ]).create();
-
-    d.appDir({
-      "foo": {"git": "../foo-before.git"}
-    }).create();
-
-    pubGet();
-
-    // Change the path in the pubspec.
-    d.appDir({
-      "foo": {"git": "../foo-after.git"}
-    }).create();
-
-    pubServe(shouldGetFirst: true);
-    requestShouldSucceed("packages/foo/foo.dart", 'main() => "after";');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/gets_first_if_no_lockfile_test.dart b/sdk/lib/_internal/pub/test/serve/gets_first_if_no_lockfile_test.dart
deleted file mode 100644
index 6abbfd9..0000000
--- a/sdk/lib/_internal/pub/test/serve/gets_first_if_no_lockfile_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("gets first if there is no lockfile", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1"),
-      d.libDir("foo")
-    ]).create();
-
-    d.appDir({
-      "foo": {"path": "../foo"}
-    }).create();
-
-    pubServe(shouldGetFirst: true);
-    requestShouldSucceed("packages/foo/foo.dart", 'main() => "foo";');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/gets_first_if_path_dependency_changed_test.dart b/sdk/lib/_internal/pub/test/serve/gets_first_if_path_dependency_changed_test.dart
deleted file mode 100644
index abb460e..0000000
--- a/sdk/lib/_internal/pub/test/serve/gets_first_if_path_dependency_changed_test.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("gets first if a path dependency's path doesn't match the one in "
-      "the lock file", () {
-    d.dir("foo-before", [
-      d.libPubspec("foo", "0.0.1"),
-      d.libDir("foo", "before")
-    ]).create();
-
-    d.dir("foo-after", [
-      d.libPubspec("foo", "0.0.1"),
-      d.libDir("foo", "after")
-    ]).create();
-
-    d.appDir({
-      "foo": {"path": "../foo-before"}
-    }).create();
-
-    pubGet();
-
-    // Change the path in the pubspec.
-    d.appDir({
-      "foo": {"path": "../foo-after"}
-    }).create();
-
-    pubServe(shouldGetFirst: true);
-    requestShouldSucceed("packages/foo/foo.dart", 'main() => "after";');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/gets_first_if_source_changed_test.dart b/sdk/lib/_internal/pub/test/serve/gets_first_if_source_changed_test.dart
deleted file mode 100644
index dfefed2..0000000
--- a/sdk/lib/_internal/pub/test/serve/gets_first_if_source_changed_test.dart
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'dart:convert';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("gets first if a dependency's source doesn't match the one in "
-      "the lock file", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1"),
-      d.libDir("foo")
-    ]).create();
-
-    d.dir(appPath, [
-      // A pubspec with a path source.
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      }),
-      // A lock file with the hosted source.
-      d.file("pubspec.lock", JSON.encode({
-        'packages': {
-          'foo': {
-            'version': '0.0.0',
-            'source': 'hosted',
-            'description': 'foo'
-          }
-        }
-      }))
-    ]).create();
-
-    pubServe(shouldGetFirst: true);
-    requestShouldSucceed("packages/foo/foo.dart", 'main() => "foo";');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/gets_first_if_transitive_dependency_is_not_installed_test.dart b/sdk/lib/_internal/pub/test/serve/gets_first_if_transitive_dependency_is_not_installed_test.dart
deleted file mode 100644
index 3d36745..0000000
--- a/sdk/lib/_internal/pub/test/serve/gets_first_if_transitive_dependency_is_not_installed_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("gets first if a transitive dependency is not installed", () {
-    servePackages((builder) => builder.serve("bar", "1.2.3"));
-
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0", deps: {
-        "bar": "any"
-      }),
-      d.libDir("foo")
-    ]).create();
-
-    d.appDir({
-      "foo": {"path": "../foo"}
-    }).create();
-
-    // Run pub to install everything.
-    pubGet();
-
-    // Delete the system cache so bar isn't installed any more.
-    schedule(() => deleteEntry(path.join(sandboxDir, cachePath)));
-
-    pubServe(shouldGetFirst: true);
-    requestShouldSucceed("packages/bar/bar.dart", 'main() => "bar 1.2.3";');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/invalid_method_test.dart b/sdk/lib/_internal/pub/test/serve/invalid_method_test.dart
deleted file mode 100644
index a49f77b..0000000
--- a/sdk/lib/_internal/pub/test/serve/invalid_method_test.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("responds with a 405 for an invalid method", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "<body>"),
-      ])
-    ]).create();
-
-    pubServe();
-
-    postShould405("index.html");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/invalid_urls_test.dart b/sdk/lib/_internal/pub/test/serve/invalid_urls_test.dart
deleted file mode 100644
index 29c73a1..0000000
--- a/sdk/lib/_internal/pub/test/serve/invalid_urls_test.dart
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("responds with a 404 on incomplete special URLs", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1")
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      }),
-      d.dir("lib", [
-        // Make a file that maps to the special "packages" directory to ensure
-        // it is *not* found.
-        d.file("packages")
-      ]),
-      d.dir("web", [
-        d.file("packages")
-      ])
-    ]).create();
-
-    pubGet();
-    pubServe();
-    requestShould404("packages");
-    requestShould404("packages/");
-    requestShould404("packages/myapp");
-    requestShould404("packages/myapp/");
-    requestShould404("packages/foo");
-    requestShould404("packages/foo/");
-    requestShould404("packages/unknown");
-    requestShould404("packages/unknown/");
-    endPubServe();
-  });
-
-}
diff --git a/sdk/lib/_internal/pub/test/serve/missing_asset_test.dart b/sdk/lib/_internal/pub/test/serve/missing_asset_test.dart
deleted file mode 100644
index 3f39054..0000000
--- a/sdk/lib/_internal/pub/test/serve/missing_asset_test.dart
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("responds with a 404 for missing assets", () {
-    d.dir(appPath, [
-      d.appPubspec()
-    ]).create();
-
-    pubServe();
-    requestShould404("index.html");
-    requestShould404("packages/myapp/nope.dart");
-    requestShould404("dir/packages/myapp/nope.dart");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/missing_dependency_file_test.dart b/sdk/lib/_internal/pub/test/serve/missing_dependency_file_test.dart
deleted file mode 100644
index 46821ba..0000000
--- a/sdk/lib/_internal/pub/test/serve/missing_dependency_file_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("responds with a 404 for a missing files in dependencies", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1")
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      })
-    ]).create();
-
-    pubGet();
-    pubServe();
-    requestShould404("packages/foo/nope.dart");
-    requestShould404("dir/packages/foo/nope.dart");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/missing_file_test.dart b/sdk/lib/_internal/pub/test/serve/missing_file_test.dart
deleted file mode 100644
index be56743..0000000
--- a/sdk/lib/_internal/pub/test/serve/missing_file_test.dart
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("responds with a 404 for missing source files", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("lib", [
-        d.file("nope.dart", "nope")
-      ]),
-      d.dir("web", [
-        d.file("index.html", "<body>"),
-      ])
-    ]).create();
-
-    // Start the server with the files present so that it creates barback
-    // assets for them.
-    pubServe();
-
-    // Now delete them.
-    schedule(() {
-      deleteEntry(path.join(sandboxDir, appPath, "lib", "nope.dart"));
-      deleteEntry(path.join(sandboxDir, appPath, "web", "index.html"));
-    }, "delete files");
-
-    // Now request them.
-    // TODO(rnystrom): It's possible for these requests to happen quickly
-    // enough that the file system hasn't notified for the deletions yet. If
-    // that happens, we can probably just add a short delay here.
-
-    requestShould404("index.html");
-    requestShould404("packages/myapp/nope.dart");
-    requestShould404("dir/packages/myapp/nope.dart");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/native_watch_added_file_test.dart b/sdk/lib/_internal/pub/test/serve/native_watch_added_file_test.dart
deleted file mode 100644
index 4da32bd..0000000
--- a/sdk/lib/_internal/pub/test/serve/native_watch_added_file_test.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-// TODO(nweiz): Default to testing the native watcher and add an explicit test
-// for the polling watcher when issue 14941 is fixed.
-
-main() {
-  initConfig();
-  integration("picks up files added after serving started when using the "
-      "native watcher", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "body")
-      ])
-    ]).create();
-
-    pubServe(args: ["--no-force-poll"]);
-    waitForBuildSuccess();
-    requestShouldSucceed("index.html", "body");
-
-    d.dir(appPath, [
-      d.dir("web", [
-        d.file("other.html", "added")
-      ])
-    ]).create();
-
-    waitForBuildSuccess();
-    requestShouldSucceed("other.html", "added");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/native_watch_modified_file_test.dart b/sdk/lib/_internal/pub/test/serve/native_watch_modified_file_test.dart
deleted file mode 100644
index 883af6d..0000000
--- a/sdk/lib/_internal/pub/test/serve/native_watch_modified_file_test.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-// TODO(nweiz): Default to testing the native watcher and add an explicit test
-// for the polling watcher when issue 14941 is fixed.
-
-main() {
-  initConfig();
-  integration("watches modifications to files when using the native watcher",
-      () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "before")
-      ])
-    ]).create();
-
-    pubServe(args: ["--no-force-poll"]);
-    requestShouldSucceed("index.html", "before");
-
-    d.dir(appPath, [
-      d.dir("web", [
-        d.file("index.html", "after")
-      ])
-    ]).create();
-
-    waitForBuildSuccess();
-    requestShouldSucceed("index.html", "after");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/native_watch_removed_file_test.dart b/sdk/lib/_internal/pub/test/serve/native_watch_removed_file_test.dart
deleted file mode 100644
index 271842e..0000000
--- a/sdk/lib/_internal/pub/test/serve/native_watch_removed_file_test.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-// TODO(nweiz): Default to testing the native watcher and add an explicit test
-// for the polling watcher when issue 14941 is fixed.
-
-main() {
-  initConfig();
-  integration("stop serving a file that is removed when using the native "
-      "watcher", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "body")
-      ])
-    ]).create();
-
-    pubServe(args: ["--no-force-poll"]);
-    requestShouldSucceed("index.html", "body");
-
-    schedule(() => deleteEntry(
-        path.join(sandboxDir, appPath, "web", "index.html")));
-
-    waitForBuildSuccess();
-    requestShould404("index.html");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/native_watch_replaced_file_test.dart b/sdk/lib/_internal/pub/test/serve/native_watch_replaced_file_test.dart
deleted file mode 100644
index 8a01ae1..0000000
--- a/sdk/lib/_internal/pub/test/serve/native_watch_replaced_file_test.dart
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  // This is a regression test for http://dartbug.com/21402.
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("picks up files replaced after serving started when using the "
-        "native watcher", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("file.txt", "before"),
-        ]),
-        d.file("other", "after")
-      ]).create();
-
-      createLockFile("myapp", pkg: ["barback"]);
-
-      pubServe(args: ["--no-force-poll"]);
-      waitForBuildSuccess();
-      requestShouldSucceed("file.out", "before.out");
-
-      schedule(() {
-        // Replace file.txt by renaming other on top of it.
-        return new File(p.join(sandboxDir, appPath, "other"))
-            .rename(p.join(sandboxDir, appPath, "web", "file.txt"));
-      });
-
-      // Read the transformed file to ensure the change is actually noticed by
-      // pub and not that we just get the new file contents piped through
-      // without pub realizing they've changed.
-      waitForBuildSuccess();
-      requestShouldSucceed("file.out", "after.out");
-
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/serve_from_app_lib_test.dart b/sdk/lib/_internal/pub/test/serve/serve_from_app_lib_test.dart
deleted file mode 100644
index ad4e91a..0000000
--- a/sdk/lib/_internal/pub/test/serve/serve_from_app_lib_test.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("'packages' URLs look in the app's lib directory", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("lib", [
-        d.file("lib.dart", "foo() => 'foo';"),
-        d.dir("sub", [
-          d.file("lib.dart", "bar() => 'bar';"),
-        ])
-      ])
-    ]).create();
-
-    pubServe();
-    requestShouldSucceed("packages/myapp/lib.dart", "foo() => 'foo';");
-    requestShouldSucceed("packages/myapp/sub/lib.dart", "bar() => 'bar';");
-
-    // "packages" can be in a subpath of the URL:
-    requestShouldSucceed("foo/packages/myapp/lib.dart", "foo() => 'foo';");
-    requestShouldSucceed("a/b/packages/myapp/sub/lib.dart", "bar() => 'bar';");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/serve_from_app_web_test.dart b/sdk/lib/_internal/pub/test/serve/serve_from_app_web_test.dart
deleted file mode 100644
index 4859b81..0000000
--- a/sdk/lib/_internal/pub/test/serve/serve_from_app_web_test.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("finds files in the app's web directory", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "<body>"),
-        d.file("file.dart", "main() => print('hello');"),
-        d.dir("sub", [
-          d.file("file.html", "<body>in subdir</body>"),
-          d.file("lib.dart", "main() => 'foo';"),
-        ])
-      ])
-    ]).create();
-
-    pubServe();
-    requestShouldSucceed("index.html", "<body>");
-    requestShouldSucceed("file.dart", "main() => print('hello');");
-    requestShouldSucceed("sub/file.html", "<body>in subdir</body>");
-    requestShouldSucceed("sub/lib.dart", "main() => 'foo';");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/serve_from_dependency_lib_test.dart b/sdk/lib/_internal/pub/test/serve/serve_from_dependency_lib_test.dart
deleted file mode 100644
index b55a06f..0000000
--- a/sdk/lib/_internal/pub/test/serve/serve_from_dependency_lib_test.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("'packages' URLs look in the dependency's lib directory", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1"),
-      d.dir("lib", [
-        d.file("lib.dart", "foo() => 'foo';"),
-        d.dir("sub", [
-          d.file("lib.dart", "bar() => 'bar';"),
-        ])
-      ])
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      })
-    ]).create();
-
-    pubServe(shouldGetFirst: true);
-    requestShouldSucceed("packages/foo/lib.dart", "foo() => 'foo';");
-    requestShouldSucceed("packages/foo/sub/lib.dart", "bar() => 'bar';");
-
-    // "packages" can be in a subpath of the URL:
-    requestShouldSucceed("foo/packages/foo/lib.dart", "foo() => 'foo';");
-    requestShouldSucceed("a/b/packages/foo/sub/lib.dart", "bar() => 'bar';");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/serves_file_with_space_test.dart b/sdk/lib/_internal/pub/test/serve/serves_file_with_space_test.dart
deleted file mode 100644
index eead808..0000000
--- a/sdk/lib/_internal/pub/test/serve/serves_file_with_space_test.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("serves a filename with a space", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("foo bar.txt", "outer contents"),
-        d.dir("sub dir", [
-          d.file("inner.txt", "inner contents"),
-        ])
-      ])
-    ]).create();
-
-    pubServe();
-    requestShouldSucceed("foo%20bar.txt", "outer contents");
-    requestShouldSucceed("sub%20dir/inner.txt", "inner contents");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/serves_index_html_for_directories_test.dart b/sdk/lib/_internal/pub/test/serve/serves_index_html_for_directories_test.dart
deleted file mode 100644
index 0974381..0000000
--- a/sdk/lib/_internal/pub/test/serve/serves_index_html_for_directories_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("serves index.html for directories", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "<body>super"),
-        d.dir("sub", [
-          d.file("index.html", "<body>sub")
-        ])
-      ])
-    ]).create();
-
-    pubServe();
-    requestShouldSucceed("", "<body>super");
-    requestShouldSucceed("sub/", "<body>sub");
-    requestShouldRedirect("sub", "/sub/");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/serves_web_and_test_dirs_by_default_test.dart b/sdk/lib/_internal/pub/test/serve/serves_web_and_test_dirs_by_default_test.dart
deleted file mode 100644
index eabca23..0000000
--- a/sdk/lib/_internal/pub/test/serve/serves_web_and_test_dirs_by_default_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("serves web/ and test/ dirs by default", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [d.file("foo", "contents")]),
-      d.dir("test", [d.file("bar", "contents")]),
-      d.dir("example", [d.file("baz", "contents")])
-    ]).create();
-
-    pubServe();
-    requestShouldSucceed("foo", "contents", root: "web");
-    requestShouldSucceed("bar", "contents", root: "test");
-    requestShould404("baz", root: "web");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/supports_cross_origin_header_test.dart b/sdk/lib/_internal/pub/test/serve/supports_cross_origin_header_test.dart
deleted file mode 100644
index 66b7dda..0000000
--- a/sdk/lib/_internal/pub/test/serve/supports_cross_origin_header_test.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("sends responses that allow cross-origin requests", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [d.file("index.html", "<body>")])
-    ]).create();
-
-    pubServe();
-    requestShouldSucceed("index.html", "<body>",
-        headers: containsPair("access-control-allow-origin", "*"));
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/supports_user_defined_declaring_transformers_test.dart b/sdk/lib/_internal/pub/test/serve/supports_user_defined_declaring_transformers_test.dart
deleted file mode 100644
index ccf5fa5..0000000
--- a/sdk/lib/_internal/pub/test/serve/supports_user_defined_declaring_transformers_test.dart
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-const DECLARING_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class DeclaringRewriteTransformer extends Transformer
-    implements DeclaringTransformer {
-  DeclaringRewriteTransformer.asPlugin();
-
-  String get allowedExtensions => '.out';
-
-  Future apply(Transform transform) {
-    transform.logger.info('Rewriting \${transform.primaryInput.id}.');
-    return transform.primaryInput.readAsString().then((contents) {
-      var id = transform.primaryInput.id.changeExtension(".final");
-      transform.addOutput(new Asset.fromString(id, "\$contents.final"));
-    });
-  }
-
-  Future declareOutputs(DeclaringTransform transform) {
-    transform.declareOutput(transform.primaryId.changeExtension(".final"));
-    return new Future.value();
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("supports a user-defined declaring transformer", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/lazy", "myapp/src/declaring"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          // Include a lazy transformer before the declaring transformer,
-          // because otherwise its behavior is indistinguishable from a normal
-          // transformer.
-          d.file("lazy.dart", LAZY_TRANSFORMER),
-          d.file("declaring.dart", DECLARING_TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var server = pubServe();
-      // The build should complete without either transformer logging anything.
-      server.stdout.expect('Build completed successfully');
-
-      requestShouldSucceed("foo.final", "foo.out.final");
-      server.stdout.expect(emitsLines(
-          '[Info from LazyRewrite]:\n'
-          'Rewriting myapp|web/foo.txt.\n'
-          '[Info from DeclaringRewrite]:\n'
-          'Rewriting myapp|web/foo.out.'));
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/supports_user_defined_lazy_transformers_test.dart b/sdk/lib/_internal/pub/test/serve/supports_user_defined_lazy_transformers_test.dart
deleted file mode 100644
index 69859f4..0000000
--- a/sdk/lib/_internal/pub/test/serve/supports_user_defined_lazy_transformers_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("supports a user-defined lazy transformer", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", LAZY_TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var server = pubServe();
-      // The build should complete without the transformer logging anything.
-      server.stdout.expect('Build completed successfully');
-
-      requestShouldSucceed("foo.out", "foo.out");
-      server.stdout.expect(emitsLines(
-          '[Info from LazyRewrite]:\n'
-          'Rewriting myapp|web/foo.txt.'));
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/unknown_dependency_test.dart b/sdk/lib/_internal/pub/test/serve/unknown_dependency_test.dart
deleted file mode 100644
index 9f52958..0000000
--- a/sdk/lib/_internal/pub/test/serve/unknown_dependency_test.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("responds with a 404 unknown dependencies", () {
-    d.dir(appPath, [
-      d.appPubspec()
-    ]).create();
-
-    pubServe();
-    requestShould404("packages/foo/nope.dart");
-    requestShould404("assets/foo/nope.png");
-    requestShould404("dir/packages/foo/nope.dart");
-    requestShould404("dir/assets/foo/nope.png");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/uses_appropriate_mime_types_test.dart b/sdk/lib/_internal/pub/test/serve/uses_appropriate_mime_types_test.dart
deleted file mode 100644
index c5ebfdb..0000000
--- a/sdk/lib/_internal/pub/test/serve/uses_appropriate_mime_types_test.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("uses appropriate mime types", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "<body>"),
-        d.file("file.dart", "main() => print('hello');"),
-        d.file("file.js", "console.log('hello');"),
-        d.file("file.css", "body {color: blue}")
-      ])
-    ]).create();
-
-    pubServe();
-    requestShouldSucceed("index.html", anything,
-        headers: containsPair('content-type', 'text/html'));
-    requestShouldSucceed("file.dart", anything,
-        headers: containsPair('content-type', 'application/dart'));
-    requestShouldSucceed("file.js", anything,
-        headers: containsPair('content-type', 'application/javascript'));
-    requestShouldSucceed("file.css", anything,
-        headers: containsPair('content-type', 'text/css'));
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/utils.dart b/sdk/lib/_internal/pub/test/serve/utils.dart
deleted file mode 100644
index be87afc..0000000
--- a/sdk/lib/_internal/pub/test/serve/utils.dart
+++ /dev/null
@@ -1,502 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'dart:async';
-import 'dart:convert';
-import 'dart:io';
-
-import 'package:http/http.dart' as http;
-import 'package:scheduled_test/scheduled_process.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:stack_trace/stack_trace.dart';
-
-import '../../lib/src/utils.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-/// The pub process running "pub serve".
-ScheduledProcess _pubServer;
-
-/// The ephemeral port assign to the running admin server.
-int _adminPort;
-
-/// The ephemeral ports assigned to the running servers, associated with the
-/// directories they're serving.
-final _ports = new Map<String, int>();
-
-/// A completer that completes when the server has been started and the served
-/// ports are known.
-Completer _portsCompleter;
-
-/// The web socket connection to the running pub process, or `null` if no
-/// connection has been made.
-WebSocket _webSocket;
-Stream _webSocketBroadcastStream;
-
-/// The code for a transformer that renames ".txt" files to ".out" and adds a
-/// ".out" suffix.
-const REWRITE_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class RewriteTransformer extends Transformer {
-  RewriteTransformer.asPlugin();
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    return transform.primaryInput.readAsString().then((contents) {
-      var id = transform.primaryInput.id.changeExtension(".out");
-      transform.addOutput(new Asset.fromString(id, "\$contents.out"));
-    });
-  }
-}
-""";
-
-/// The code for a lazy version of [REWRITE_TRANSFORMER].
-const LAZY_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class LazyRewriteTransformer extends Transformer implements LazyTransformer {
-  LazyRewriteTransformer.asPlugin();
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    transform.logger.info('Rewriting \${transform.primaryInput.id}.');
-    return transform.primaryInput.readAsString().then((contents) {
-      var id = transform.primaryInput.id.changeExtension(".out");
-      transform.addOutput(new Asset.fromString(id, "\$contents.out"));
-    });
-  }
-
-  Future declareOutputs(DeclaringTransform transform) {
-    transform.declareOutput(transform.primaryId.changeExtension(".out"));
-    return new Future.value();
-  }
-}
-""";
-
-/// The web socket error code for a directory not being served.
-const NOT_SERVED = 1;
-
-/// Returns the source code for a Dart library defining a Transformer that
-/// rewrites Dart files.
-///
-/// The transformer defines a constant named TOKEN whose value is [id]. When the
-/// transformer transforms another Dart file, it will look for a "TOKEN"
-/// constant definition there and modify it to include *this* transformer's
-/// TOKEN value as well.
-///
-/// If [import] is passed, it should be the name of a package that defines its
-/// own TOKEN constant. The primary library of that package will be imported
-/// here and its TOKEN value will be added to this library's.
-///
-/// This transformer takes one configuration field: "addition". This is
-/// concatenated to its TOKEN value before adding it to the output library.
-String dartTransformer(String id, {String import}) {
-  if (import != null) {
-    id = '$id imports \${$import.TOKEN}';
-    import = 'import "package:$import/$import.dart" as $import;';
-  } else {
-    import = '';
-  }
-
-  return """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-$import
-
-import 'dart:io';
-
-const TOKEN = "$id";
-
-final _tokenRegExp = new RegExp(r'^const TOKEN = "(.*?)";\$', multiLine: true);
-
-class DartTransformer extends Transformer {
-  final BarbackSettings _settings;
-
-  DartTransformer.asPlugin(this._settings);
-
-  String get allowedExtensions => '.dart';
-
-  Future apply(Transform transform) {
-    return transform.primaryInput.readAsString().then((contents) {
-      transform.addOutput(new Asset.fromString(transform.primaryInput.id,
-          contents.replaceAllMapped(_tokenRegExp, (match) {
-        var token = TOKEN;
-        var addition = _settings.configuration["addition"];
-        if (addition != null) token += addition;
-        return 'const TOKEN = "(\${match[1]}, \$token)";';
-      })));
-    });
-  }
-}
-""";
-}
-
-/// Schedules starting the `pub serve` process.
-///
-/// Unlike [pubServe], this doesn't determine the port number of the server, and
-/// so may be used to test for errors in the initialization process.
-///
-/// Returns the `pub serve` process.
-ScheduledProcess startPubServe({Iterable<String> args,
-    bool createWebDir: true}) {
-  var pubArgs = [
-    "serve",
-    "--port=0", // Use port 0 to get an ephemeral port.
-    "--force-poll",
-    "--admin-port=0", // Use port 0 to get an ephemeral port.
-    "--log-admin-url"
-  ];
-
-  if (args != null) pubArgs.addAll(args);
-
-  // Dart2js can take a long time to compile dart code, so we increase the
-  // timeout to cope with that.
-  currentSchedule.timeout *= 1.5;
-
-  if (createWebDir) d.dir(appPath, [d.dir("web")]).create();
-  return startPub(args: pubArgs);
-}
-
-/// Schedules starting the "pub serve" process and records its port number for
-/// future requests.
-///
-/// If [shouldGetFirst] is `true`, validates that pub get is run first.
-///
-/// If [createWebDir] is `true`, creates a `web/` directory if one doesn't exist
-/// so pub doesn't complain about having nothing to serve.
-///
-/// Returns the `pub serve` process.
-ScheduledProcess pubServe({bool shouldGetFirst: false, bool createWebDir: true,
-    Iterable<String> args}) {
-  _pubServer = startPubServe(args: args, createWebDir: createWebDir);
-  _portsCompleter = new Completer();
-
-  currentSchedule.onComplete.schedule(() {
-    _portsCompleter = null;
-    _ports.clear();
-
-    if (_webSocket != null) {
-      _webSocket.close();
-      _webSocket = null;
-      _webSocketBroadcastStream = null;
-    }
-  });
-
-  if (shouldGetFirst) {
-    _pubServer.stdout.expect(consumeThrough(anyOf([
-      "Got dependencies!",
-      matches(new RegExp(r"^Changed \d+ dependenc"))
-    ])));
-  }
-
-  _pubServer.stdout.expect(startsWith("Loading source assets..."));
-  _pubServer.stdout.expect(consumeWhile(matches("Loading .* transformers...")));
-
-  _pubServer.stdout.expect(predicate(_parseAdminPort));
-
-  // The server should emit one or more ports.
-  _pubServer.stdout.expect(
-      consumeWhile(predicate(_parsePort, 'emits server url')));
-  schedule(() {
-    expect(_ports, isNot(isEmpty));
-    _portsCompleter.complete();
-  });
-
-  return _pubServer;
-}
-
-/// The regular expression for parsing pub's output line describing the URL for
-/// the server.
-final _parsePortRegExp = new RegExp(r"([^ ]+) +on http://localhost:(\d+)");
-
-/// Parses the port number from the "Running admin server on localhost:1234"
-/// line printed by pub serve.
-bool _parseAdminPort(String line) {
-  expect(line, startsWith('Running admin server on'));
-  var match = _parsePortRegExp.firstMatch(line);
-  if (match == null) return false;
-  _adminPort = int.parse(match[2]);
-  return true;
-}
-
-/// Parses the port number from the "Serving blah on localhost:1234" line
-/// printed by pub serve.
-bool _parsePort(String line) {
-  var match = _parsePortRegExp.firstMatch(line);
-  if (match == null) return false;
-  _ports[match[1]] = int.parse(match[2]);
-  return true;
-}
-
-void endPubServe() {
-  _pubServer.kill();
-}
-
-/// Schedules an HTTP request to the running pub server with [urlPath] and
-/// invokes [callback] with the response.
-///
-/// [root] indicates which server should be accessed, and defaults to "web".
-Future<http.Response> scheduleRequest(String urlPath, {String root}) {
-  return schedule(() {
-    return http.get(_getServerUrlSync(root, urlPath));
-  }, "request $urlPath");
-}
-
-/// Schedules an HTTP request to the running pub server with [urlPath] and
-/// verifies that it responds with a body that matches [expectation].
-///
-/// [expectation] may either be a [Matcher] or a string to match an exact body.
-/// [root] indicates which server should be accessed, and defaults to "web".
-/// [headers] may be either a [Matcher] or a map to match an exact headers map.
-void requestShouldSucceed(String urlPath, expectation, {String root, headers}) {
-  scheduleRequest(urlPath, root: root).then((response) {
-    expect(response.statusCode, equals(200));
-    if (expectation != null) expect(response.body, expectation);
-    if (headers != null) expect(response.headers, headers);
-  });
-}
-
-/// Schedules an HTTP request to the running pub server with [urlPath] and
-/// verifies that it responds with a 404.
-///
-/// [root] indicates which server should be accessed, and defaults to "web".
-void requestShould404(String urlPath, {String root}) {
-  scheduleRequest(urlPath, root: root).then((response) {
-    expect(response.statusCode, equals(404));
-  });
-}
-
-/// Schedules an HTTP request to the running pub server with [urlPath] and
-/// verifies that it responds with a redirect to the given [redirectTarget].
-///
-/// [redirectTarget] may be either a [Matcher] or a string to match an exact
-/// URL. [root] indicates which server should be accessed, and defaults to
-/// "web".
-void requestShouldRedirect(String urlPath, redirectTarget, {String root}) {
-  schedule(() {
-    var request = new http.Request("GET",
-        Uri.parse(_getServerUrlSync(root, urlPath)));
-    request.followRedirects = false;
-    return request.send().then((response) {
-      expect(response.statusCode ~/ 100, equals(3));
-      expect(response.headers, containsPair('location', redirectTarget));
-    });
-  }, "request $urlPath");
-}
-
-/// Schedules an HTTP POST to the running pub server with [urlPath] and verifies
-/// that it responds with a 405.
-///
-/// [root] indicates which server should be accessed, and defaults to "web".
-void postShould405(String urlPath, {String root}) {
-  schedule(() {
-    return http.post(_getServerUrlSync(root, urlPath)).then((response) {
-      expect(response.statusCode, equals(405));
-    });
-  }, "request $urlPath");
-}
-
-/// Schedules an HTTP request to the (theoretically) running pub server with
-/// [urlPath] and verifies that it cannot be connected to.
-///
-/// [root] indicates which server should be accessed, and defaults to "web".
-void requestShouldNotConnect(String urlPath, {String root}) {
-  schedule(() {
-    return expect(http.get(_getServerUrlSync(root, urlPath)),
-        throwsA(new isInstanceOf<SocketException>()));
-  }, "request $urlPath");
-}
-
-/// Reads lines from pub serve's stdout until it prints the build success
-/// message.
-///
-/// The schedule will not proceed until the output is found. If not found, it
-/// will eventually time out.
-void waitForBuildSuccess() =>
-  _pubServer.stdout.expect(consumeThrough(contains("successfully")));
-
-/// Schedules opening a web socket connection to the currently running pub
-/// serve.
-Future _ensureWebSocket() {
-  // Use the existing one if already connected.
-  if (_webSocket != null) return new Future.value();
-
-  // Server should already be running.
-  expect(_pubServer, isNotNull);
-  expect(_adminPort, isNotNull);
-
-  return WebSocket.connect("ws://localhost:$_adminPort").then((socket) {
-    _webSocket = socket;
-    // TODO(rnystrom): Works around #13913.
-    _webSocketBroadcastStream = _webSocket.map(JSON.decode).asBroadcastStream();
-  });
-}
-
-/// Schedules closing the web socket connection to the currently-running pub
-/// serve.
-void closeWebSocket() {
-  schedule(() {
-    return _ensureWebSocket().then((_) => _webSocket.close())
-        .then((_) => _webSocket = null);
-  }, "closing web socket");
-}
-
-/// Sends a JSON RPC 2.0 request to the running pub serve's web socket
-/// connection.
-///
-/// This calls a method named [method] with the given [params] (or no
-/// parameters, if it's not passed). [params] may contain Futures, in which case
-/// this will wait until they've completed before sending the request.
-///
-/// This schedules the request, but doesn't block the schedule on the response.
-/// It returns the response as a [Future].
-Future<Map> webSocketRequest(String method, [Map params]) {
-  var completer = new Completer();
-  schedule(() {
-    return Future.wait([
-      _ensureWebSocket(),
-      awaitObject(params),
-    ]).then((results) {
-      var resolvedParams = results[1];
-      chainToCompleter(
-          currentSchedule.wrapFuture(_jsonRpcRequest(method, resolvedParams)),
-          completer);
-    });
-  }, "send $method with $params to web socket");
-  return completer.future;
-}
-
-/// Sends a JSON RPC 2.0 request to the running pub serve's web socket
-/// connection, waits for a reply, then verifies the result.
-///
-/// This calls a method named [method] with the given [params]. [params] may
-/// contain Futures, in which case this will wait until they've completed before
-/// sending the request.
-///
-/// The result is validated using [result], which may be a [Matcher] or a [Map]
-/// containing [Matcher]s and [Future]s. This will wait until any futures are
-/// completed before sending the request.
-///
-/// Returns a [Future] that completes to the call's result.
-Future<Map> expectWebSocketResult(String method, Map params, result) {
-  return schedule(() {
-    return Future.wait([
-      webSocketRequest(method, params),
-      awaitObject(result)
-    ]).then((results) {
-      var response = results[0];
-      var resolvedResult = results[1];
-      expect(response["result"], resolvedResult);
-      return response["result"];
-    });
-  }, "send $method with $params to web socket and expect $result");
-}
-
-/// Sends a JSON RPC 2.0 request to the running pub serve's web socket
-/// connection, waits for a reply, then verifies the error response.
-///
-/// This calls a method named [method] with the given [params]. [params] may
-/// contain Futures, in which case this will wait until they've completed before
-/// sending the request.
-///
-/// The error response is validated using [errorCode] and [errorMessage]. Both
-/// of these must be provided. The error code is checked against [errorCode] and
-/// the error message is checked against [errorMessage]. Either of these may be
-/// matchers.
-///
-/// If [data] is provided, it is a JSON value or matcher used to validate the
-/// "data" value of the error response.
-///
-/// Returns a [Future] that completes to the error's [data] field.
-Future expectWebSocketError(String method, Map params, errorCode,
-    errorMessage, {data}) {
-  return schedule(() {
-    return webSocketRequest(method, params).then((response) {
-      expect(response["error"]["code"], errorCode);
-      expect(response["error"]["message"], errorMessage);
-
-      if (data != null) {
-        expect(response["error"]["data"], data);
-      }
-
-      return response["error"]["data"];
-    });
-  }, "send $method with $params to web socket and expect error $errorCode");
-}
-
-/// Validates that [root] was not bound to a port when pub serve started.
-Future expectNotServed(String root) {
-  return schedule(() {
-    expect(_ports.containsKey(root), isFalse);
-  });
-}
-
-/// The next id to use for a JSON-RPC 2.0 request.
-var _rpcId = 0;
-
-/// Sends a JSON-RPC 2.0 request calling [method] with [params].
-///
-/// Returns the response object.
-Future<Map> _jsonRpcRequest(String method, [Map params]) {
-  var id = _rpcId++;
-  var message = {
-    "jsonrpc": "2.0",
-    "method": method,
-    "id": id
-  };
-  if (params != null) message["params"] = params;
-  _webSocket.add(JSON.encode(message));
-
-  return _webSocketBroadcastStream
-      .firstWhere((response) => response["id"] == id).then((value) {
-    currentSchedule.addDebugInfo(
-        "Web Socket request $method with params $params\n"
-        "Result: $value");
-
-    expect(value["id"], equals(id));
-    return value;
-  });
-}
-
-/// Returns a [Future] that completes to a URL string for the server serving
-/// [path] from [root].
-///
-/// If [root] is omitted, defaults to "web". If [path] is omitted, no path is
-/// included. The Future will complete once the server is up and running and
-/// the bound ports are known.
-Future<String> getServerUrl([String root, String path]) =>
-    _portsCompleter.future.then((_) => _getServerUrlSync(root, path));
-
-/// Records that [root] has been bound to [port].
-///
-/// Used for testing the Web Socket API for binding new root directories to
-/// ports after pub serve has been started.
-registerServerPort(String root, int port) {
-  _ports[root] = port;
-}
-
-/// Returns a URL string for the server serving [path] from [root].
-///
-/// If [root] is omitted, defaults to "web". If [path] is omitted, no path is
-/// included. Unlike [getServerUrl], this should only be called after the ports
-/// are known.
-String _getServerUrlSync([String root, String path]) {
-  if (root == null) root = 'web';
-  expect(_ports, contains(root));
-  var url = "http://localhost:${_ports[root]}";
-  if (path != null) url = "$url/$path";
-  return url;
-}
-
diff --git a/sdk/lib/_internal/pub/test/serve/watch_added_file_test.dart b/sdk/lib/_internal/pub/test/serve/watch_added_file_test.dart
deleted file mode 100644
index 7a42aa1..0000000
--- a/sdk/lib/_internal/pub/test/serve/watch_added_file_test.dart
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("picks up files added after serving started", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "body")
-      ])
-    ]).create();
-
-    pubServe();
-    waitForBuildSuccess();
-    requestShouldSucceed("index.html", "body");
-
-    d.dir(appPath, [
-      d.dir("web", [
-        d.file("other.html", "added")
-      ])
-    ]).create();
-
-    waitForBuildSuccess();
-    requestShouldSucceed("other.html", "added");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/watch_modified_file_test.dart b/sdk/lib/_internal/pub/test/serve/watch_modified_file_test.dart
deleted file mode 100644
index 4ab929e..0000000
--- a/sdk/lib/_internal/pub/test/serve/watch_modified_file_test.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("watches modifications to files", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "before")
-      ])
-    ]).create();
-
-    pubServe();
-    requestShouldSucceed("index.html", "before");
-
-    d.dir(appPath, [
-      d.dir("web", [
-        d.file("index.html", "after")
-      ])
-    ]).create();
-
-    waitForBuildSuccess();
-    requestShouldSucceed("index.html", "after");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/watch_removed_file_test.dart b/sdk/lib/_internal/pub/test/serve/watch_removed_file_test.dart
deleted file mode 100644
index 55ff576..0000000
--- a/sdk/lib/_internal/pub/test/serve/watch_removed_file_test.dart
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-main() {
-  initConfig();
-  integration("stop serving a file that is removed", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "body")
-      ])
-    ]).create();
-
-    pubServe();
-    requestShouldSucceed("index.html", "body");
-
-    schedule(() => deleteEntry(
-        path.join(sandboxDir, appPath, "web", "index.html")));
-
-    waitForBuildSuccess();
-    requestShould404("index.html");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/exit_on_close_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/exit_on_close_test.dart
deleted file mode 100644
index 3335ddf..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/exit_on_close_test.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  initConfig();
-  integration("exits when the connection closes", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "<body>")
-      ])
-    ]).create();
-
-    var server = pubServe();
-
-    // Make sure the web socket is active.
-    expectWebSocketResult("urlToAssetId", {
-      "url": getServerUrl("web", "index.html")
-    }, {"package": "myapp", "path": "web/index.html"});
-
-    expectWebSocketResult("exitOnClose", null, null);
-
-    // Close the web socket.
-    closeWebSocket();
-
-    server.stdout.expect("Build completed successfully");
-    server.stdout.expect("WebSocket connection closed, terminating.");
-    server.shouldExit(0);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_errors_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_errors_test.dart
deleted file mode 100644
index 61b1928..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_errors_test.dart
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:json_rpc_2/error_code.dart' as rpc_error_code;
-import 'package:path/path.dart' as p;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  // TODO(rnystrom): Split into independent tests.
-  initConfig();
-  integration("pathToUrls errors on bad inputs", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("web", [
-        d.file("foo.txt", "foo")
-      ])
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({"foo": {"path": "../foo"}}),
-      d.file("top-level.txt", "top-level"),
-      d.dir("bin", [
-        d.file("foo.txt", "foo"),
-      ]),
-      d.dir("lib", [
-        d.file("myapp.dart", "myapp"),
-      ])
-    ]).create();
-
-    pubServe(shouldGetFirst: true);
-
-    // Bad arguments.
-    expectWebSocketError("pathToUrls", {"path": 123},
-        rpc_error_code.INVALID_PARAMS,
-        'Parameter "path" for method "pathToUrls" must be a string, but was '
-            '123.');
-
-    expectWebSocketError("pathToUrls", {"path": "main.dart", "line": 12.34},
-        rpc_error_code.INVALID_PARAMS,
-        'Parameter "line" for method "pathToUrls" must be an integer, but was '
-            '12.34.');
-
-    // Unserved directories.
-    expectNotServed(p.join('bin', 'foo.txt'));
-    expectNotServed(p.join('nope', 'foo.txt'));
-    expectNotServed(p.join("..", "bar", "lib", "bar.txt"));
-    expectNotServed(p.join("..", "foo", "web", "foo.txt"));
-
-    endPubServe();
-  });
-}
-
-void expectNotServed(String path) {
-  expectWebSocketError("pathToUrls", {"path": path}, NOT_SERVED,
-      'Asset path "$path" is not currently being served.');
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_test.dart
deleted file mode 100644
index 5db405c..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_test.dart
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:path/path.dart' as p;
-
-import '../../../lib/src/io.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  // TODO(rnystrom): Split into independent tests.
-  initConfig();
-  integration("pathToUrls converts asset ids to matching URL paths", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "1.0.0"),
-      d.dir("lib", [
-        d.file("foo.dart", "foo() => null;")
-      ])
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({"foo": {"path": "../foo"}}),
-      d.dir("test", [
-        d.file("index.html", "<body>"),
-        d.dir("sub", [
-          d.file("bar.html", "bar"),
-        ])
-      ]),
-      d.dir("lib", [
-        d.file("app.dart", "app() => null;")
-      ]),
-      d.dir("web", [
-        d.file("index.html", "<body>"),
-        d.dir("sub", [
-          d.file("bar.html", "bar"),
-        ])
-      ]),
-      d.dir("randomdir", [
-        d.file("index.html", "<body>")
-      ])
-    ]).create();
-
-    pubServe(args: ["test", "web", "randomdir"], shouldGetFirst: true);
-
-    // Paths in web/.
-    expectWebSocketResult("pathToUrls", {
-      "path": p.join("web", "index.html")
-    }, {
-      "urls": [getServerUrl("web", "index.html")]
-    });
-
-    expectWebSocketResult("pathToUrls", {
-      "path": p.join("web", "sub", "bar.html")
-    }, {
-      "urls": [getServerUrl("web", "sub/bar.html")]
-    });
-
-    // Paths in test/.
-    expectWebSocketResult("pathToUrls", {
-      "path": p.join("test", "index.html")
-    }, {
-      "urls": [getServerUrl("test", "index.html")]
-    });
-
-    expectWebSocketResult("pathToUrls", {
-      "path": p.join("test", "sub", "bar.html")
-    }, {
-      "urls": [getServerUrl("test", "sub/bar.html")]
-    });
-
-    // A non-default directory.
-    expectWebSocketResult("pathToUrls", {
-      "path": p.join("randomdir", "index.html")
-    }, {
-      "urls": [getServerUrl("randomdir", "index.html")]
-    });
-
-    // A path in lib/.
-    expectWebSocketResult("pathToUrls", {
-      "path": p.join("lib", "app.dart")
-    }, {"urls": [
-      getServerUrl("test", "packages/myapp/app.dart"),
-      getServerUrl("web", "packages/myapp/app.dart"),
-      getServerUrl("randomdir", "packages/myapp/app.dart")
-    ]});
-
-    // A path to this package in packages/.
-    expectWebSocketResult("pathToUrls", {
-      "path": p.join("packages", "myapp", "app.dart")
-    }, {"urls": [
-      getServerUrl("test", "packages/myapp/app.dart"),
-      getServerUrl("web", "packages/myapp/app.dart"),
-      getServerUrl("randomdir", "packages/myapp/app.dart")
-    ]});
-
-    // A path to another package in packages/.
-    expectWebSocketResult("pathToUrls", {
-      "path": p.join("packages", "foo", "foo.dart")
-    }, {"urls": [
-      getServerUrl("test", "packages/foo/foo.dart"),
-      getServerUrl("web", "packages/foo/foo.dart"),
-      getServerUrl("randomdir", "packages/foo/foo.dart")
-    ]});
-
-    // A relative path to another package's lib/ directory.
-    expectWebSocketResult("pathToUrls", {
-      "path": p.join("..", "foo", "lib", "foo.dart")
-    }, {"urls": [
-      getServerUrl("test", "packages/foo/foo.dart"),
-      getServerUrl("web", "packages/foo/foo.dart"),
-      getServerUrl("randomdir", "packages/foo/foo.dart")
-    ]});
-
-    // Note: Using canonicalize here because pub gets the path to the
-    // entrypoint package from the working directory, which has had symlinks
-    // resolve. On Mac, "/tmp" is actually a symlink to "/private/tmp", so we
-    // need to accomodate that.
-
-    // An absolute path to another package's lib/ directory.
-    expectWebSocketResult("pathToUrls", {
-      "path": canonicalize(p.join(sandboxDir, "foo", "lib", "foo.dart"))
-    }, {"urls": [
-      getServerUrl("test", "packages/foo/foo.dart"),
-      getServerUrl("web", "packages/foo/foo.dart"),
-      getServerUrl("randomdir", "packages/foo/foo.dart")
-    ]});
-
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_with_line_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_with_line_test.dart
deleted file mode 100644
index 340e932b..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_with_line_test.dart
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:path/path.dart' as p;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  initConfig();
-  integration("pathToUrls provides output line if given source", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("main.dart", "main"),
-      ])
-    ]).create();
-
-    pubServe();
-
-    expectWebSocketResult("pathToUrls", {
-      "path": p.join("web", "main.dart"),
-      "line": 12345
-    }, {
-      "urls": [getServerUrl("web", "main.dart")],
-      "line": 12345
-    });
-
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_already_served_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_already_served_test.dart
deleted file mode 100644
index e0df88c..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_already_served_test.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  initConfig();
-  integration("returns the old URL if the directory is already served", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "<body>")
-      ])
-    ]).create();
-
-    pubServe();
-
-    expectWebSocketResult("serveDirectory", {"path": "web"}, {
-      "url": getServerUrl("web")
-    });
-
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_and_immediately_request_asset_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_and_immediately_request_asset_test.dart
deleted file mode 100644
index cc6ecd4..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_and_immediately_request_asset_test.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  initConfig();
-  integration("binds a directory to a new port and immediately requests an "
-      "asset URL from that server", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("test", [
-        d.file("index.html", "<test body>")
-      ]),
-      d.dir("web", [
-        d.file("index.html", "<body>")
-      ])
-    ]).create();
-
-    pubServe(args: ["web"]);
-
-    // Bind the new directory.
-    expect(webSocketRequest("serveDirectory", {"path": "test"}), completes);
-
-    expectWebSocketResult("pathToUrls", {"path": "test/index.html"}, {
-      "urls": [endsWith("/index.html")]
-    });
-
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_and_immediately_serve_again_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_and_immediately_serve_again_test.dart
deleted file mode 100644
index dc7f3e3..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_and_immediately_serve_again_test.dart
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'dart:async';
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  initConfig();
-  integration("binds a directory to a new port and immediately binds that "
-      "directory again", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("test", [
-        d.file("index.html", "<test body>")
-      ]),
-      d.dir("web", [
-        d.file("index.html", "<body>")
-      ])
-    ]).create();
-
-    pubServe(args: ["web"]);
-
-    schedule(() {
-      return Future.wait([
-        webSocketRequest("serveDirectory", {"path": "test"}),
-        webSocketRequest("serveDirectory", {"path": "test"})
-      ]).then((results) {
-        expect(results[0], contains("result"));
-        expect(results[1], contains("result"));
-        expect(results[0]["result"], equals(results[1]["result"]));
-      });
-    });
-
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_and_immediately_unserve_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_and_immediately_unserve_test.dart
deleted file mode 100644
index 984a658..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_and_immediately_unserve_test.dart
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'dart:async';
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  initConfig();
-  integration("binds a directory to a new port and immediately unbinds that "
-      "directory", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("test", [
-        d.file("index.html", "<test body>")
-      ]),
-      d.dir("web", [
-        d.file("index.html", "<body>")
-      ])
-    ]).create();
-
-    pubServe(args: ["web"]);
-
-    // We call [webSocketRequest] outside of the [schedule] call below because
-    // we need it to schedule the sending of the request to guarantee that the
-    // serve is sent before the unserve.
-    var serveRequest = webSocketRequest("serveDirectory", {"path": "test"});
-    var unserveRequest = webSocketRequest("unserveDirectory", {"path": "test"});
-
-    schedule(() {
-      return Future.wait([serveRequest, unserveRequest]).then((results) {
-        expect(results[0], contains("result"));
-        expect(results[1], contains("result"));
-        // These results should be equal since "serveDirectory" returns the URL
-        // of the new server and "unserveDirectory" returns the URL of the
-        // server that was turned off. We're asserting that the same server was
-        // both started and stopped.
-        expect(results[0]["result"]["url"], matches(r"http://localhost:\d+"));
-        expect(results[0]["result"], equals(results[1]["result"]));
-      });
-    });
-
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_arg_errors_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_arg_errors_test.dart
deleted file mode 100644
index 5bf9f44..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_arg_errors_test.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:json_rpc_2/error_code.dart' as rpc_error_code;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  initConfig();
-
-  setUp(() {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "<body>")
-      ])
-    ]).create();
-  });
-
-  integration("responds with an error if 'path' is not a string", () {
-    pubServe();
-    expectWebSocketError("serveDirectory", {"path": 123},
-        rpc_error_code.INVALID_PARAMS,
-        'Parameter "path" for method "serveDirectory" must be a string, but '
-            'was 123.');
-    endPubServe();
-  });
-
-  integration("responds with an error if 'path' is absolute", () {
-    pubServe();
-    expectWebSocketError("serveDirectory", {"path": "/absolute.txt"},
-        rpc_error_code.INVALID_PARAMS,
-        '"path" must be a relative path. Got "/absolute.txt".');
-    endPubServe();
-  });
-
-  integration("responds with an error if 'path' reaches out", () {
-    pubServe();
-    expectWebSocketError("serveDirectory", {"path": "a/../../bad.txt"},
-        rpc_error_code.INVALID_PARAMS,
-        '"path" cannot reach out of its containing directory. Got '
-            '"a/../../bad.txt".');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_overlapping_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_overlapping_test.dart
deleted file mode 100644
index 143e531..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_overlapping_test.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  initConfig();
-  integration("fails if the directory overlaps one already being served", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "<body>"),
-        d.dir("sub", [
-          d.file("index.html", "<sub>"),
-        ])
-      ])
-    ]).create();
-
-    pubServe();
-
-    var webSub = path.join("web", "sub");
-    expectWebSocketError("serveDirectory", {"path": webSub}, 2,
-        'Path "$webSub" overlaps already served directory "web".',
-        data: containsPair("directories", ["web"]));
-
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_test.dart
deleted file mode 100644
index 148f74d..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/serve_directory_test.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  initConfig();
-  integration("binds a directory to a new port", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("test", [
-        d.file("index.html", "<test body>")
-      ]),
-      d.dir("web", [
-        d.file("index.html", "<body>")
-      ])
-    ]).create();
-
-    pubServe(args: ["web"]);
-
-    // Bind the new directory.
-    expectWebSocketResult("serveDirectory", {"path": "test"}, {
-      "url": matches(r"http://localhost:\d+")
-    }).then((response) {
-      var url = Uri.parse(response["url"]);
-      registerServerPort("test", url.port);
-    });
-
-    // It should be served now.
-    requestShouldSucceed("index.html", "<test body>", root: "test");
-
-    // And watched.
-    d.dir(appPath, [
-      d.dir("test", [
-        d.file("index.html", "after")
-      ])
-    ]).create();
-
-    waitForBuildSuccess();
-    requestShouldSucceed("index.html", "after", root: "test");
-
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/unserve_directory_arg_errors_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/unserve_directory_arg_errors_test.dart
deleted file mode 100644
index 3345536..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/unserve_directory_arg_errors_test.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:json_rpc_2/error_code.dart' as rpc_error_code;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  initConfig();
-
-  setUp(() {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "<body>")
-      ])
-    ]).create();
-  });
-
-  integration("responds with an error if 'path' is not a string", () {
-    pubServe();
-    expectWebSocketError("unserveDirectory", {"path": 123},
-        rpc_error_code.INVALID_PARAMS,
-        'Parameter "path" for method "unserveDirectory" must be a string, but '
-            'was 123.');
-    endPubServe();
-  });
-
-  integration("responds with an error if 'path' is absolute", () {
-    pubServe();
-    expectWebSocketError("unserveDirectory", {"path": "/absolute.txt"},
-        rpc_error_code.INVALID_PARAMS,
-        '"path" must be a relative path. Got "/absolute.txt".');
-    endPubServe();
-  });
-
-  integration("responds with an error if 'path' reaches out", () {
-    pubServe();
-    expectWebSocketError("unserveDirectory", {"path": "a/../../bad.txt"},
-        rpc_error_code.INVALID_PARAMS,
-        '"path" cannot reach out of its containing directory. Got '
-            '"a/../../bad.txt".');
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/unserve_directory_not_served_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/unserve_directory_not_served_test.dart
deleted file mode 100644
index 1f2273e..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/unserve_directory_not_served_test.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  initConfig();
-  integration("errors if the directory is not served", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("index.html", "<body>")
-      ])
-    ]).create();
-
-    pubServe();
-
-    // Unbind the directory.
-    expectWebSocketError("unserveDirectory", {"path": "test"}, NOT_SERVED,
-        'Directory "test" is not bound to a server.');
-
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/unserve_directory_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/unserve_directory_test.dart
deleted file mode 100644
index f9446d9..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/unserve_directory_test.dart
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  initConfig();
-  integration("unbinds a directory from a port", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("test", [
-        d.file("index.html", "<test body>")
-      ]),
-      d.dir("web", [
-        d.file("index.html", "<body>")
-      ])
-    ]).create();
-
-    pubServe();
-
-    requestShouldSucceed("index.html", "<body>");
-    requestShouldSucceed("index.html", "<test body>", root: "test");
-
-    // Unbind the directory.
-    expectWebSocketResult("unserveDirectory", {"path": "test"}, {
-      "url": getServerUrl("test")
-    });
-
-    // "test" should not be served now.
-    requestShouldNotConnect("index.html", root: "test");
-
-    // "web" is still fine.
-    requestShouldSucceed("index.html", "<body>");
-
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/url_to_asset_id_errors_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/url_to_asset_id_errors_test.dart
deleted file mode 100644
index 4fef6a2..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/url_to_asset_id_errors_test.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  initConfig();
-  setUp(() {
-    d.dir(appPath, [
-      d.appPubspec()
-    ]).create();
-  });
-
-  integration("responds with NOT_SERVED for an unknown domain", () {
-    pubServe();
-    expectWebSocketError("urlToAssetId", {
-      "url": "http://example.com:80/index.html"
-    }, NOT_SERVED, '"example.com:80" is not being served by pub.');
-    endPubServe();
-  });
-
-  integration("responds with NOT_SERVED for an unknown port", () {
-    pubServe();
-    expectWebSocketError("urlToAssetId", {
-      "url": "http://localhost:80/index.html"
-    }, NOT_SERVED, '"localhost:80" is not being served by pub.');
-    endPubServe();
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/url_to_asset_id_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/url_to_asset_id_test.dart
deleted file mode 100644
index 9bc2392..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/url_to_asset_id_test.dart
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  // TODO(rnystrom): Split into independent tests.
-  initConfig();
-  setUp(() {
-    d.dir("foo", [
-      d.libPubspec("foo", "0.0.1"),
-      d.dir("lib", [
-        d.file("foo.dart", "foo")
-      ])
-    ]).create();
-
-    d.dir(appPath, [
-      d.appPubspec({
-        "foo": {"path": "../foo"}
-      }),
-      d.dir("lib", [
-        d.file("myapp.dart", "myapp"),
-      ]),
-      d.dir("test", [
-        d.file("index.html", "<body>"),
-        d.dir("sub", [
-          d.file("bar.html", "bar"),
-        ])
-      ]),
-      d.dir("web", [
-        d.file("index.html", "<body>"),
-        d.dir("sub", [
-          d.file("bar.html", "bar"),
-        ])
-      ])
-    ]).create();
-  });
-
-  integration("converts URLs to matching asset ids in web/", () {
-    pubServe(shouldGetFirst: true);
-    expectWebSocketResult("urlToAssetId", {
-      "url": getServerUrl("web", "index.html")
-    }, {"package": "myapp", "path": "web/index.html"});
-    endPubServe();
-  });
-
-  integration("converts URLs to matching asset ids in subdirectories of web/",
-      () {
-    pubServe(shouldGetFirst: true);
-    expectWebSocketResult("urlToAssetId", {
-      "url": getServerUrl("web", "sub/bar.html")
-    }, {"package": "myapp", "path": "web/sub/bar.html"});
-    endPubServe();
-  });
-
-  integration("converts URLs to matching asset ids in test/", () {
-    pubServe(shouldGetFirst: true);
-    expectWebSocketResult("urlToAssetId", {
-      "url": getServerUrl("test", "index.html")
-    }, {"package": "myapp", "path": "test/index.html"});
-    endPubServe();
-  });
-
-  integration("converts URLs to matching asset ids in subdirectories of test/",
-      () {
-    pubServe(shouldGetFirst: true);
-    expectWebSocketResult("urlToAssetId", {
-      "url": getServerUrl("test", "sub/bar.html")
-    }, {"package": "myapp", "path": "test/sub/bar.html"});
-    endPubServe();
-  });
-
-  integration("converts URLs to matching asset ids in the entrypoint's lib/",
-      () {
-    // Path in root package's lib/.
-    pubServe(shouldGetFirst: true);
-    expectWebSocketResult("urlToAssetId", {
-      "url": getServerUrl("web", "packages/myapp/myapp.dart")
-    }, {"package": "myapp", "path": "lib/myapp.dart"});
-    endPubServe();
-  });
-
-  integration("converts URLs to matching asset ids in a dependency's lib/", () {
-    // Path in lib/.
-    pubServe(shouldGetFirst: true);
-    expectWebSocketResult("urlToAssetId", {
-      "url": getServerUrl("web", "packages/foo/foo.dart")
-    }, {"package": "foo", "path": "lib/foo.dart"});
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/url_to_asset_id_with_line_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/url_to_asset_id_with_line_test.dart
deleted file mode 100644
index f73a7ec..0000000
--- a/sdk/lib/_internal/pub/test/serve/web_socket/url_to_asset_id_with_line_test.dart
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../utils.dart';
-
-main() {
-  initConfig();
-  integration("provides output line number if given source one", () {
-    d.dir(appPath, [
-      d.appPubspec(),
-      d.dir("web", [
-        d.file("main.dart", "main")
-      ])
-    ]).create();
-
-    pubServe();
-
-    // Paths in web/.
-    expectWebSocketResult("urlToAssetId", {
-      "url": getServerUrl("web", "main.dart"),
-      "line": 12345
-    }, {
-      "package": "myapp",
-      "path": "web/main.dart",
-      "line": 12345
-    });
-
-    endPubServe();
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/serve_packages.dart b/sdk/lib/_internal/pub/test/serve_packages.dart
deleted file mode 100644
index 35c970f..0000000
--- a/sdk/lib/_internal/pub/test/serve_packages.dart
+++ /dev/null
@@ -1,195 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library serve_packages;
-
-import 'dart:async';
-import 'dart:convert';
-
-import 'package:path/path.dart' as p;
-import 'package:pub_semver/pub_semver.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:yaml/yaml.dart';
-
-import '../lib/src/io.dart';
-import '../lib/src/utils.dart';
-import 'descriptor.dart' as d;
-import 'test_pub.dart';
-
-/// The [d.DirectoryDescriptor] describing the server layout of `/api/packages`
-/// on the test server.
-///
-/// This contains metadata for packages that are being served via
-/// [servePackages]. It's `null` if [servePackages] has not yet been called for
-/// this test.
-d.DirectoryDescriptor _servedApiPackageDir;
-
-/// The [d.DirectoryDescriptor] describing the server layout of `/packages` on
-/// the test server.
-///
-/// This contains the tarballs for packages that are being served via
-/// [servePackages]. It's `null` if [servePackages] has not yet been called for
-/// this test.
-d.DirectoryDescriptor _servedPackageDir;
-
-/// The current [PackageServerBuilder] that a user uses to specify which package
-/// to serve.
-///
-/// This is preserved over multiple calls to [servePackages] within the same
-/// test so that additional packages can be added.
-PackageServerBuilder _builder;
-
-/// Creates an HTTP server that replicates the structure of pub.dartlang.org.
-///
-/// Calls [callback] with a [PackageServerBuilder] that's used to specify
-/// which packages to serve.
-///
-/// If [replace] is false, subsequent calls to [servePackages] will add to the
-/// set of packages that are being served. Previous packages will continue to be
-/// served. Otherwise, the previous packages will no longer be served.
-void servePackages(void callback(PackageServerBuilder builder),
-    {bool replace: false}) {
-  if (_servedPackageDir == null) {
-    _builder = new PackageServerBuilder();
-    _servedApiPackageDir = d.dir('packages', []);
-    _servedPackageDir = d.dir('packages', []);
-    serve([
-      d.dir('api', [_servedApiPackageDir]),
-      _servedPackageDir
-    ]);
-
-    currentSchedule.onComplete.schedule(() {
-      _builder = null;
-      _servedApiPackageDir = null;
-      _servedPackageDir = null;
-    }, 'cleaning up served packages');
-  }
-
-  schedule(() {
-    if (replace) _builder = new PackageServerBuilder();
-    callback(_builder);
-    return _builder._await().then((resolvedPubspecs) {
-      _servedApiPackageDir.contents.clear();
-      _servedPackageDir.contents.clear();
-      _builder._packages.forEach((name, versions) {
-        _servedApiPackageDir.contents.addAll([
-          d.file('$name', JSON.encode({
-            'name': name,
-            'uploaders': ['nweiz@google.com'],
-            'versions': versions.map((version) =>
-                packageVersionApiMap(version.pubspec)).toList()
-          })),
-          d.dir(name, [
-            d.dir('versions', versions.map((version) {
-              return d.file(version.version.toString(), JSON.encode(
-                  packageVersionApiMap(version.pubspec, full: true)));
-            }))
-          ])
-        ]);
-
-        _servedPackageDir.contents.add(d.dir(name, [
-          d.dir('versions', versions.map((version) =>
-              d.tar('${version.version}.tar.gz', version.contents)))
-        ]));
-      });
-    });
-  }, 'initializing the package server');
-}
-
-/// Like [servePackages], but instead creates an empty server with no packages
-/// registered.
-///
-/// This will always replace a previous server.
-void serveNoPackages() => servePackages((_) {}, replace: true);
-
-/// A builder for specifying which packages should be served by [servePackages].
-class PackageServerBuilder {
-  /// A map from package names to a list of concrete packages to serve.
-  final _packages = new Map<String, List<_ServedPackage>>();
-
-  /// A group of futures from [serve] calls.
-  ///
-  /// This should be accessed by calling [_awair].
-  var _futures = new FutureGroup();
-
-  /// Specifies that a package named [name] with [version] should be served.
-  ///
-  /// If [deps] is passed, it's used as the "dependencies" field of the pubspec.
-  /// If [pubspec] is passed, it's used as the rest of the pubspec. Either of
-  /// these may recursively contain Futures.
-  ///
-  /// If [contents] is passed, it's used as the contents of the package. By
-  /// default, a package just contains a dummy lib directory.
-  void serve(String name, String version, {Map deps, Map pubspec,
-      Iterable<d.Descriptor> contents}) {
-    _futures.add(Future.wait([
-      awaitObject(deps),
-      awaitObject(pubspec)
-    ]).then((pair) {
-      var resolvedDeps = pair.first;
-      var resolvedPubspec = pair.last;
-
-      var pubspecFields = {
-        "name": name,
-        "version": version
-      };
-      if (resolvedPubspec != null) pubspecFields.addAll(resolvedPubspec);
-      if (resolvedDeps != null) pubspecFields["dependencies"] = resolvedDeps;
-
-      if (contents == null) contents = [d.libDir(name, "$name $version")];
-      contents = [d.file("pubspec.yaml", yaml(pubspecFields))]
-          ..addAll(contents);
-
-      var packages = _packages.putIfAbsent(name, () => []);
-      packages.add(new _ServedPackage(pubspecFields, contents));
-    }));
-  }
-
-  /// Serves the versions of [package] and all its dependencies that are
-  /// currently checked into the Dart repository.
-  void serveRepoPackage(String package) {
-    _addPackage(name) {
-      if (_packages.containsKey(name)) return;
-      _packages[name] = [];
-
-      var root = packagePath(name);
-      var pubspec = new Map.from(loadYaml(
-          readTextFile(p.join(root, 'pubspec.yaml'))));
-
-      // Remove any SDK constraints since we don't have a valid SDK version
-      // while testing.
-      pubspec.remove('environment');
-
-      _packages[name].add(new _ServedPackage(pubspec, [
-        d.file('pubspec.yaml', yaml(pubspec)),
-        new d.DirectoryDescriptor.fromFilesystem('lib', p.join(root, 'lib'))
-      ]));
-
-      if (pubspec.containsKey('dependencies')) {
-        pubspec['dependencies'].keys.forEach(_addPackage);
-      }
-    }
-
-    _addPackage(package);
-  }
-
-  /// Returns a Future that completes once all the [serve] calls have been fully
-  /// processed.
-  Future _await() {
-    if (_futures.futures.isEmpty) return new Future.value();
-    return _futures.future.then((_) {
-      _futures = new FutureGroup();
-    });
-  }
-}
-
-/// A package that's intended to be served.
-class _ServedPackage {
-  final Map pubspec;
-  final List<d.Descriptor> contents;
-
-  Version get version => new Version.parse(pubspec['version']);
-
-  _ServedPackage(this.pubspec, this.contents);
-}
diff --git a/sdk/lib/_internal/pub/test/snapshot/creates_a_snapshot_for_immediate_and_transitive_dep_test.dart b/sdk/lib/_internal/pub/test/snapshot/creates_a_snapshot_for_immediate_and_transitive_dep_test.dart
deleted file mode 100644
index f411043..0000000
--- a/sdk/lib/_internal/pub/test/snapshot/creates_a_snapshot_for_immediate_and_transitive_dep_test.dart
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("creates a snapshot for an immediate dependency that's also a "
-      "transitive dependency", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.3", contents: [
-        d.dir("bin", [
-          d.file("hello.dart", "void main() => print('hello!');"),
-          d.file("goodbye.dart", "void main() => print('goodbye!');"),
-          d.file("shell.sh", "echo shell"),
-          d.dir("subdir", [
-            d.file("sub.dart", "void main() => print('sub!');")
-          ])
-        ])
-      ]);
-      builder.serve("bar", "1.2.3", deps: {"foo": "1.2.3"});
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    pubGet(output: allOf([
-      contains("Precompiled foo:hello."),
-      contains("Precompiled foo:goodbye.")
-    ]));
-
-    d.dir(p.join(appPath, '.pub', 'bin'), [
-      d.file('sdk-version', '0.1.2+3\n'),
-      d.dir('foo', [
-        d.matcherFile('hello.dart.snapshot', contains('hello!')),
-        d.matcherFile('goodbye.dart.snapshot', contains('goodbye!')),
-        d.nothing('shell.sh.snapshot'),
-        d.nothing('subdir')
-      ])
-    ]).validate();
-
-    var process = pubRun(args: ['foo:hello']);
-    process.stdout.expect("hello!");
-    process.shouldExit();
-
-    process = pubRun(args: ['foo:goodbye']);
-    process.stdout.expect("goodbye!");
-    process.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/snapshot/creates_a_snapshot_test.dart b/sdk/lib/_internal/pub/test/snapshot/creates_a_snapshot_test.dart
deleted file mode 100644
index 6683d06..0000000
--- a/sdk/lib/_internal/pub/test/snapshot/creates_a_snapshot_test.dart
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("creates a snapshot for an immediate dependency's executables",
-      () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.3", contents: [
-        d.dir("bin", [
-          d.file("hello.dart", "void main() => print('hello!');"),
-          d.file("goodbye.dart", "void main() => print('goodbye!');"),
-          d.file("shell.sh", "echo shell"),
-          d.dir("subdir", [
-            d.file("sub.dart", "void main() => print('sub!');")
-          ])
-        ])
-      ]);
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    pubGet(output: allOf([
-      contains("Precompiled foo:hello."),
-      contains("Precompiled foo:goodbye.")
-    ]));
-
-    d.dir(p.join(appPath, '.pub', 'bin'), [
-      d.file('sdk-version', '0.1.2+3\n'),
-      d.dir('foo', [
-        d.matcherFile('hello.dart.snapshot', contains('hello!')),
-        d.matcherFile('goodbye.dart.snapshot', contains('goodbye!')),
-        d.nothing('shell.sh.snapshot'),
-        d.nothing('subdir')
-      ])
-    ]).validate();
-
-    var process = pubRun(args: ['foo:hello']);
-    process.stdout.expect("hello!");
-    process.shouldExit();
-
-    process = pubRun(args: ['foo:goodbye']);
-    process.stdout.expect("goodbye!");
-    process.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/snapshot/doesnt_load_irrelevant_transformers_test.dart b/sdk/lib/_internal/pub/test/snapshot/doesnt_load_irrelevant_transformers_test.dart
deleted file mode 100644
index b0b412d..0000000
--- a/sdk/lib/_internal/pub/test/snapshot/doesnt_load_irrelevant_transformers_test.dart
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const BROKEN_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class BrokenTransformer extends Transformer {
-  BrokenTransformer.asPlugin();
-
-  // This file intentionally has a syntax error so that any attempt to load it
-  // will crash.
-""";
-
-main() {
-  initConfig();
-
-  // Regression test for issue 20917.
-  integration("snapshots the transformed version of an executable", () {
-    servePackages((builder) {
-      builder.serveRepoPackage('barback');
-
-      builder.serve("foo", "1.2.3",
-          contents: [
-        d.dir("bin", [
-          d.file("hello.dart", "void main() => print('hello!');")
-        ])
-      ]);
-    });
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {
-          "foo": "1.2.3",
-          "barback": "any"
-        },
-        "transformers": ["myapp"]
-      }),
-      d.dir("lib", [
-        d.file("transformer.dart", BROKEN_TRANSFORMER)
-      ])
-    ]).create();
-
-    pubGet(output: contains("Precompiled foo:hello."));
-
-    d.dir(p.join(appPath, '.pub', 'bin'), [
-      d.dir('foo', [d.matcherFile('hello.dart.snapshot', contains('hello!'))])
-    ]).validate();
-
-    var process = pubRun(args: ['foo:hello']);
-    process.stdout.expect("hello!");
-    process.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/snapshot/doesnt_resnapshot_when_a_dependency_is_unchanged_test.dart b/sdk/lib/_internal/pub/test/snapshot/doesnt_resnapshot_when_a_dependency_is_unchanged_test.dart
deleted file mode 100644
index 8750e79..0000000
--- a/sdk/lib/_internal/pub/test/snapshot/doesnt_resnapshot_when_a_dependency_is_unchanged_test.dart
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("doesn't recreate a snapshot when no dependencies of a package "
-      "have changed", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.3", deps: {"bar": "any"}, contents: [
-        d.dir("bin", [d.file("hello.dart", "void main() => print('hello!');")])
-      ]);
-      builder.serve("bar", "1.2.3");
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    pubGet(output: contains("Precompiled foo:hello."));
-
-    pubUpgrade(output: isNot(contains("Precompiled foo:hello.")));
-
-    d.dir(p.join(appPath, '.pub', 'bin'), [
-      d.file('sdk-version', '0.1.2+3\n'),
-      d.dir('foo', [d.matcherFile('hello.dart.snapshot', contains('hello!'))])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/snapshot/doesnt_snapshot_an_entrypoint_dependency_test.dart b/sdk/lib/_internal/pub/test/snapshot/doesnt_snapshot_an_entrypoint_dependency_test.dart
deleted file mode 100644
index 5fd71a6..0000000
--- a/sdk/lib/_internal/pub/test/snapshot/doesnt_snapshot_an_entrypoint_dependency_test.dart
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("doesn't create a snapshot for a package that depends on the "
-      "entrypoint", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.3", deps: {'bar': '1.2.3'}, contents: [
-        d.dir("bin", [d.file("hello.dart", "void main() => print('hello!');")])
-      ]);
-      builder.serve("bar", "1.2.3", deps: {'myapp': 'any'});
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    pubGet();
-
-    // No local cache should be created, since all dependencies transitively
-    // depend on the entrypoint.
-    d.nothing(p.join(appPath, '.pub', 'bin')).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/snapshot/doesnt_snapshot_path_dependency_test.dart b/sdk/lib/_internal/pub/test/snapshot/doesnt_snapshot_path_dependency_test.dart
deleted file mode 100644
index 5c1b1c4..0000000
--- a/sdk/lib/_internal/pub/test/snapshot/doesnt_snapshot_path_dependency_test.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("doesn't create a snapshot for a path dependency", () {
-    d.dir("foo", [
-      d.libPubspec("foo", "1.2.3"),
-      d.dir("bin", [
-        d.dir("bin", [d.file("hello.dart", "void main() => print('hello!');")])
-      ])
-    ]).create();
-
-    d.appDir({"foo": {"path": "../foo"}}).create();
-
-    pubGet();
-
-    d.nothing(p.join(appPath, '.pub', 'bin')).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/snapshot/doesnt_snapshot_transitive_dependencies_test.dart b/sdk/lib/_internal/pub/test/snapshot/doesnt_snapshot_transitive_dependencies_test.dart
deleted file mode 100644
index 039c7fb..0000000
--- a/sdk/lib/_internal/pub/test/snapshot/doesnt_snapshot_transitive_dependencies_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("doesn't create a snapshot for transitive dependencies' "
-      "executables", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.3", deps: {'bar': '1.2.3'});
-      builder.serve("bar", "1.2.3", contents: [
-        d.dir("bin", [d.file("hello.dart", "void main() => print('hello!');")])
-      ]);
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    pubGet();
-
-    d.nothing(p.join(appPath, '.pub', 'bin', 'bar')).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/snapshot/prints_errors_for_broken_snapshots_test.dart b/sdk/lib/_internal/pub/test/snapshot/prints_errors_for_broken_snapshots_test.dart
deleted file mode 100644
index b398df7..0000000
--- a/sdk/lib/_internal/pub/test/snapshot/prints_errors_for_broken_snapshots_test.dart
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("prints errors for broken snapshot compilation", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.3", contents: [
-        d.dir("bin", [
-          d.file("hello.dart", "void main() { no closing brace"),
-          d.file("goodbye.dart", "void main() { no closing brace"),
-        ])
-      ]);
-      builder.serve("bar", "1.2.3", contents: [
-        d.dir("bin", [
-          d.file("hello.dart", "void main() { no closing brace"),
-          d.file("goodbye.dart", "void main() { no closing brace"),
-        ])
-      ]);
-    });
-
-    d.appDir({"foo": "1.2.3", "bar": "1.2.3"}).create();
-
-    // This should still have a 0 exit code, since installation succeeded even
-    // if precompilation didn't.
-    pubGet(error: allOf([
-      contains("Failed to precompile foo:hello"),
-      contains("Failed to precompile foo:goodbye"),
-      contains("Failed to precompile bar:hello"),
-      contains("Failed to precompile bar:goodbye")
-    ]), exitCode: 0);
-
-    d.dir(p.join(appPath, '.pub', 'bin'), [
-      d.file('sdk-version', '0.1.2+3\n'),
-      d.dir('foo', [
-        d.nothing('hello.dart.snapshot'),
-        d.nothing('goodbye.dart.snapshot')
-      ]),
-      d.dir('bar', [
-        d.nothing('hello.dart.snapshot'),
-        d.nothing('goodbye.dart.snapshot')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/snapshot/recompiles_if_the_sdk_is_out_of_date_test.dart b/sdk/lib/_internal/pub/test/snapshot/recompiles_if_the_sdk_is_out_of_date_test.dart
deleted file mode 100644
index 1d8d213..0000000
--- a/sdk/lib/_internal/pub/test/snapshot/recompiles_if_the_sdk_is_out_of_date_test.dart
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("creates a snapshot for an immediate dependency's executables",
-      () {
-    servePackages((builder) {
-      builder.serve("foo", "5.6.7", contents: [
-        d.dir("bin", [d.file("hello.dart", "void main() => print('hello!');")])
-      ]);
-    });
-
-    d.appDir({"foo": "5.6.7"}).create();
-
-    pubGet(output: contains("Precompiled foo:hello."));
-
-    d.dir(p.join(appPath, '.pub', 'bin'), [
-      d.dir('foo', [d.outOfDateSnapshot('hello.dart.snapshot')])
-    ]).create();
-
-    var process = pubRun(args: ['foo:hello']);
-
-    // In the real world this would just print "hello!", but since we collect
-    // all output we see the precompilation messages as well.
-    process.stdout.expect("Precompiling executables...");
-    process.stdout.expect(consumeThrough("hello!"));
-    process.shouldExit();
-
-    d.dir(p.join(appPath, '.pub', 'bin'), [
-      d.file('sdk-version', '0.1.2+3'),
-      d.dir('foo', [d.matcherFile('hello.dart.snapshot', contains('hello!'))])
-    ]).create();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/snapshot/snapshots_transformed_code_test.dart b/sdk/lib/_internal/pub/test/snapshot/snapshots_transformed_code_test.dart
deleted file mode 100644
index 7c35cdc..0000000
--- a/sdk/lib/_internal/pub/test/snapshot/snapshots_transformed_code_test.dart
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const REPLACE_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class ReplaceTransformer extends Transformer {
-  ReplaceTransformer.asPlugin();
-
-  String get allowedExtensions => '.dart';
-
-  Future apply(Transform transform) {
-    return transform.primaryInput.readAsString().then((contents) {
-      transform.addOutput(new Asset.fromString(transform.primaryInput.id,
-          contents.replaceAll("REPLACE ME", "hello!")));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  integration("snapshots the transformed version of an executable", () {
-    servePackages((builder) {
-      builder.serveRepoPackage('barback');
-
-      builder.serve("foo", "1.2.3",
-          deps: {"barback": "any"},
-          pubspec: {'transformers': ['foo']},
-          contents: [
-        d.dir("lib", [d.file("foo.dart", REPLACE_TRANSFORMER)]),
-        d.dir("bin", [
-          d.file("hello.dart", """
-final message = 'REPLACE ME';
-
-void main() => print(message);
-"""),
-        ])
-      ]);
-    });
-
-    d.appDir({"foo": "1.2.3"}).create();
-
-    pubGet(output: contains("Precompiled foo:hello."));
-
-    d.dir(p.join(appPath, '.pub', 'bin'), [
-      d.dir('foo', [d.matcherFile('hello.dart.snapshot', contains('hello!'))])
-    ]).validate();
-
-    var process = pubRun(args: ['foo:hello']);
-    process.stdout.expect("hello!");
-    process.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/snapshot/updates_snapshot_for_git_dependency_test.dart b/sdk/lib/_internal/pub/test/snapshot/updates_snapshot_for_git_dependency_test.dart
deleted file mode 100644
index c1c1f68..0000000
--- a/sdk/lib/_internal/pub/test/snapshot/updates_snapshot_for_git_dependency_test.dart
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("upgrades a snapshot when a git dependency is upgraded", () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.pubspec({
-        "name": "foo",
-        "version": "0.0.1"
-      }),
-      d.dir("bin", [
-        d.file("hello.dart", "void main() => print('Hello!');")
-      ])
-    ]).create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-    pubGet(output: contains("Precompiled foo:hello."));
-
-    d.dir(p.join(appPath, '.pub', 'bin', 'foo'), [
-      d.matcherFile('hello.dart.snapshot', contains('Hello!'))
-    ]).validate();
-
-    d.git('foo.git', [
-      d.dir("bin", [
-        d.file("hello.dart", "void main() => print('Goodbye!');")
-      ])
-    ]).commit();
-
-    pubUpgrade(output: contains("Precompiled foo:hello."));
-
-    d.dir(p.join(appPath, '.pub', 'bin', 'foo'), [
-      d.matcherFile('hello.dart.snapshot', contains('Goodbye!'))
-    ]).validate();
-
-    var process = pubRun(args: ['foo:hello']);
-    process.stdout.expect("Goodbye!");
-    process.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/snapshot/upgrades_snapshot_for_dependency_test.dart b/sdk/lib/_internal/pub/test/snapshot/upgrades_snapshot_for_dependency_test.dart
deleted file mode 100644
index 36e4471..0000000
--- a/sdk/lib/_internal/pub/test/snapshot/upgrades_snapshot_for_dependency_test.dart
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("upgrades a snapshot when a dependency is upgraded", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.3", pubspec: {
-        "dependencies": {"bar": "any"}
-      }, contents: [
-        d.dir("bin", [
-          d.file("hello.dart", """
-import 'package:bar/bar.dart';
-
-void main() => print(message);
-""")
-        ])
-      ]);
-      builder.serve("bar", "1.2.3", contents: [
-        d.dir("lib", [d.file("bar.dart", "final message = 'hello!';")])
-      ]);
-    });
-
-    d.appDir({"foo": "any"}).create();
-
-    pubGet(output: contains("Precompiled foo:hello."));
-
-    d.dir(p.join(appPath, '.pub', 'bin', 'foo'), [
-      d.matcherFile('hello.dart.snapshot', contains('hello!'))
-    ]).validate();
-
-    servePackages((builder) {
-      builder.serve("bar", "1.2.4", contents: [
-        d.dir("lib", [d.file("bar.dart", "final message = 'hello 2!';")]),
-      ]);
-    });
-
-    pubUpgrade(output: contains("Precompiled foo:hello."));
-
-    d.dir(p.join(appPath, '.pub', 'bin', 'foo'), [
-      d.matcherFile('hello.dart.snapshot', contains('hello 2!'))
-    ]).validate();
-
-    var process = pubRun(args: ['foo:hello']);
-    process.stdout.expect("hello 2!");
-    process.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/snapshot/upgrades_snapshot_test.dart b/sdk/lib/_internal/pub/test/snapshot/upgrades_snapshot_test.dart
deleted file mode 100644
index 10aefb6..0000000
--- a/sdk/lib/_internal/pub/test/snapshot/upgrades_snapshot_test.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:path/path.dart' as p;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("upgrades a snapshot when its package is upgraded", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.2.3", contents: [
-        d.dir("bin", [
-          d.file("hello.dart", "void main() => print('hello!');")
-        ])
-      ]);
-    });
-
-    d.appDir({"foo": "any"}).create();
-
-    pubGet(output: contains("Precompiled foo:hello."));
-
-    d.dir(p.join(appPath, '.pub', 'bin', 'foo'), [
-      d.matcherFile('hello.dart.snapshot', contains('hello!'))
-    ]).validate();
-
-    servePackages((builder) {
-      builder.serve("foo", "1.2.4", contents: [
-        d.dir("bin", [
-          d.file("hello.dart", "void main() => print('hello 2!');")
-        ])
-      ]);
-    });
-
-    pubUpgrade(output: contains("Precompiled foo:hello."));
-
-    d.dir(p.join(appPath, '.pub', 'bin', 'foo'), [
-      d.matcherFile('hello.dart.snapshot', contains('hello 2!'))
-    ]).validate();
-
-    var process = pubRun(args: ['foo:hello']);
-    process.stdout.expect("hello 2!");
-    process.shouldExit();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/test_pub.dart b/sdk/lib/_internal/pub/test/test_pub.dart
deleted file mode 100644
index b0ec23f..0000000
--- a/sdk/lib/_internal/pub/test/test_pub.dart
+++ /dev/null
@@ -1,976 +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.
-
-/// Test infrastructure for testing pub.
-///
-/// Unlike typical unit tests, most pub tests are integration tests that stage
-/// some stuff on the file system, run pub, and then validate the results. This
-/// library provides an API to build tests like that.
-library test_pub;
-
-import 'dart:async';
-import 'dart:convert';
-import 'dart:io';
-import 'dart:math';
-
-import 'package:http/testing.dart';
-import 'package:path/path.dart' as p;
-import 'package:pub_semver/pub_semver.dart';
-import 'package:scheduled_test/scheduled_process.dart';
-import 'package:scheduled_test/scheduled_server.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart' hide fail;
-import 'package:shelf/shelf.dart' as shelf;
-import 'package:shelf/shelf_io.dart' as shelf_io;
-import 'package:unittest/compact_vm_config.dart';
-import 'package:yaml/yaml.dart';
-
-import '../lib/src/entrypoint.dart';
-import '../lib/src/exit_codes.dart' as exit_codes;
-// TODO(rnystrom): Using "gitlib" as the prefix here is ugly, but "git" collides
-// with the git descriptor method. Maybe we should try to clean up the top level
-// scope a bit?
-import '../lib/src/git.dart' as gitlib;
-import '../lib/src/http.dart';
-import '../lib/src/io.dart';
-import '../lib/src/lock_file.dart';
-import '../lib/src/log.dart' as log;
-import '../lib/src/package.dart';
-import '../lib/src/pubspec.dart';
-import '../lib/src/source/hosted.dart';
-import '../lib/src/source/path.dart';
-import '../lib/src/source_registry.dart';
-import '../lib/src/system_cache.dart';
-import '../lib/src/utils.dart';
-import '../lib/src/validator.dart';
-import 'descriptor.dart' as d;
-import 'serve_packages.dart';
-
-export 'serve_packages.dart';
-
-/// This should be called at the top of a test file to set up an appropriate
-/// test configuration for the machine running the tests.
-initConfig() {
-  useCompactVMConfiguration();
-  filterStacks = true;
-  unittestConfiguration.timeout = null;
-}
-
-/// The current [HttpServer] created using [serve].
-var _server;
-
-/// The list of paths that have been requested from the server since the last
-/// call to [getRequestedPaths].
-final _requestedPaths = <String>[];
-
-/// The cached value for [_portCompleter].
-Completer<int> _portCompleterCache;
-
-/// A [Matcher] that matches JavaScript generated by dart2js with minification
-/// enabled.
-Matcher isMinifiedDart2JSOutput =
-    isNot(contains("// The code supports the following hooks"));
-
-/// A [Matcher] that matches JavaScript generated by dart2js with minification
-/// disabled.
-Matcher isUnminifiedDart2JSOutput =
-    contains("// The code supports the following hooks");
-
-/// A map from package names to paths from which those packages should be loaded
-/// for [createLockFile].
-///
-/// This allows older versions of dependencies than those that exist in the repo
-/// to be used when testing pub.
-Map<String, String> _packageOverrides;
-
-/// A map from barback versions to the paths of directories in the repo
-/// containing them.
-///
-/// This includes the latest version of barback from pkg as well as all old
-/// versions of barback in third_party.
-final _barbackVersions = _findBarbackVersions();
-
-/// Some older barback versions require older versions of barback's dependencies
-/// than those that are in the repo.
-///
-/// This is a map from barback version ranges to the dependencies for those
-/// barback versions. Each dependency version listed here should be included in
-/// third_party/pkg.
-final _barbackDeps = {
-  new VersionConstraint.parse("<0.15.0"): {
-    "source_maps": "0.9.4"
-  }
-};
-
-/// Populates [_barbackVersions].
-Map<Version, String> _findBarbackVersions() {
-  var versions = {};
-  var currentBarback = p.join(repoRoot, 'third_party', 'pkg', 'barback');
-  versions[new Pubspec.load(currentBarback, new SourceRegistry()).version] =
-      currentBarback;
-
-  for (var dir in listDir(p.join(repoRoot, 'third_party', 'pkg'))) {
-    var basename = p.basename(dir);
-    if (!basename.startsWith('barback-')) continue;
-    versions[new Version.parse(split1(basename, '-').last)] = dir;
-  }
-
-  return versions;
-}
-
-/// Runs the tests in [callback] against all versions of barback in the repo
-/// that match [versionConstraint].
-///
-/// This is used to test that pub doesn't accidentally break older versions of
-/// barback that it's committed to supporting. Only versions `0.13.0` and later
-/// will be tested.
-void withBarbackVersions(String versionConstraint, void callback()) {
-  var constraint = new VersionConstraint.parse(versionConstraint);
-
-  var validVersions = _barbackVersions.keys.where(constraint.allows);
-  if (validVersions.isEmpty) {
-    throw new ArgumentError(
-        'No available barback version matches "$versionConstraint".');
-  }
-
-  for (var version in validVersions) {
-    group("with barback $version", () {
-      setUp(() {
-        _packageOverrides = {};
-        _packageOverrides['barback'] = _barbackVersions[version];
-        _barbackDeps.forEach((constraint, deps) {
-          if (!constraint.allows(version)) return;
-          deps.forEach((packageName, version) {
-            _packageOverrides[packageName] = p.join(
-                repoRoot, 'third_party', 'pkg', '$packageName-$version');
-          });
-        });
-
-        currentSchedule.onComplete.schedule(() {
-          _packageOverrides = null;
-        });
-      });
-
-      callback();
-    });
-  }
-}
-
-/// The completer for [port].
-Completer<int> get _portCompleter {
-  if (_portCompleterCache != null) return _portCompleterCache;
-  _portCompleterCache = new Completer<int>();
-  currentSchedule.onComplete.schedule(() {
-    _portCompleterCache = null;
-  }, 'clearing the port completer');
-  return _portCompleterCache;
-}
-
-/// A future that will complete to the port used for the current server.
-Future<int> get port => _portCompleter.future;
-
-/// Gets the list of paths that have been requested from the server since the
-/// last time this was called (or since the server was first spun up).
-Future<List<String>> getRequestedPaths() {
-  return schedule(() {
-    var paths = _requestedPaths.toList();
-    _requestedPaths.clear();
-    return paths;
-  }, "get previous network requests");
-}
-
-/// Creates an HTTP server to serve [contents] as static files.
-///
-/// This server will exist only for the duration of the pub run. Subsequent
-/// calls to [serve] replace the previous server.
-void serve([List<d.Descriptor> contents]) {
-  var baseDir = d.dir("serve-dir", contents);
-
-  _hasServer = true;
-
-  schedule(() {
-    return _closeServer().then((_) {
-      return shelf_io.serve((request) {
-        currentSchedule.heartbeat();
-        var path = p.posix.fromUri(request.url.path.replaceFirst("/", ""));
-        _requestedPaths.add(path);
-
-        return validateStream(baseDir.load(path))
-            .then((stream) => new shelf.Response.ok(stream))
-            .catchError((error) {
-          return new shelf.Response.notFound('File "$path" not found.');
-        });
-      }, 'localhost', 0).then((server) {
-        _server = server;
-        _portCompleter.complete(_server.port);
-        currentSchedule.onComplete.schedule(_closeServer);
-      });
-    });
-  }, 'starting a server serving:\n${baseDir.describe()}');
-}
-
-/// Closes [_server].
-///
-/// Returns a [Future] that completes after the [_server] is closed.
-Future _closeServer() {
-  if (_server == null) return new Future.value();
-  var future = _server.close();
-  _server = null;
-  _hasServer = false;
-  _portCompleterCache = null;
-  return future;
-}
-
-/// `true` if the current test spins up an HTTP server.
-bool _hasServer = false;
-
-/// Converts [value] into a YAML string.
-String yaml(value) => JSON.encode(value);
-
-/// The full path to the created sandbox directory for an integration test.
-String get sandboxDir => _sandboxDir;
-String _sandboxDir;
-
-/// The path of the package cache directory used for tests, relative to the
-/// sandbox directory.
-final String cachePath = "cache";
-
-/// The path of the mock app directory used for tests, relative to the sandbox
-/// directory.
-final String appPath = "myapp";
-
-/// The path of the packages directory in the mock app used for tests, relative
-/// to the sandbox directory.
-final String packagesPath = "$appPath/packages";
-
-/// Set to true when the current batch of scheduled events should be aborted.
-bool _abortScheduled = false;
-
-/// Enum identifying a pub command that can be run with a well-defined success
-/// output.
-class RunCommand {
-  static final get = new RunCommand('get', new RegExp(
-      r'Got dependencies!|Changed \d+ dependenc(y|ies)!'));
-  static final upgrade = new RunCommand('upgrade', new RegExp(
-      r'(No dependencies changed\.|Changed \d+ dependenc(y|ies)!)$'));
-  static final downgrade = new RunCommand('downgrade', new RegExp(
-      r'(No dependencies changed\.|Changed \d+ dependenc(y|ies)!)$'));
-
-  final String name;
-  final RegExp success;
-  RunCommand(this.name, this.success);
-}
-
-/// Runs the tests defined within [callback] using both pub get and pub upgrade.
-///
-/// Many tests validate behavior that is the same between pub get and
-/// upgrade have the same behavior. Instead of duplicating those tests, this
-/// takes a callback that defines get/upgrade agnostic tests and runs them
-/// with both commands.
-void forBothPubGetAndUpgrade(void callback(RunCommand command)) {
-  group(RunCommand.get.name, () => callback(RunCommand.get));
-  group(RunCommand.upgrade.name, () => callback(RunCommand.upgrade));
-}
-
-/// Schedules an invocation of pub [command] and validates that it completes
-/// in an expected way.
-///
-/// By default, this validates that the command completes successfully and
-/// understands the normal output of a successful pub command. If [warning] is
-/// given, it expects the command to complete successfully *and* print
-/// [warning] to stderr. If [error] is given, it expects the command to *only*
-/// print [error] to stderr. [output], [error], and [warning] may be strings,
-/// [RegExp]s, or [Matcher]s.
-///
-/// If [exitCode] is given, expects the command to exit with that code.
-// TODO(rnystrom): Clean up other tests to call this when possible.
-void pubCommand(RunCommand command,
-    {Iterable<String> args, output, error, warning, int exitCode}) {
-  if (error != null && warning != null) {
-    throw new ArgumentError("Cannot pass both 'error' and 'warning'.");
-  }
-
-  var allArgs = [command.name];
-  if (args != null) allArgs.addAll(args);
-
-  if (output == null) output = command.success;
-
-  if (error != null && exitCode == null) exitCode = 1;
-
-  // No success output on an error.
-  if (error != null) output = null;
-  if (warning != null) error = warning;
-
-  schedulePub(args: allArgs, output: output, error: error, exitCode: exitCode);
-}
-
-void pubGet({Iterable<String> args, output, error, warning, int exitCode}) {
-  pubCommand(RunCommand.get, args: args, output: output, error: error,
-      warning: warning, exitCode: exitCode);
-}
-
-void pubUpgrade({Iterable<String> args, output, error, warning, int exitCode}) {
-  pubCommand(RunCommand.upgrade, args: args, output: output, error: error,
-      warning: warning, exitCode: exitCode);
-}
-
-void pubDowngrade({Iterable<String> args, output, error, warning,
-    int exitCode}) {
-  pubCommand(RunCommand.downgrade, args: args, output: output, error: error,
-      warning: warning, exitCode: exitCode);
-}
-
-/// Schedules starting the "pub [global] run" process and validates the
-/// expected startup output.
-///
-/// If [global] is `true`, this invokes "pub global run", otherwise it does
-/// "pub run".
-///
-/// Returns the `pub run` process.
-ScheduledProcess pubRun({bool global: false, Iterable<String> args}) {
-  var pubArgs = global ? ["global", "run"] : ["run"];
-  pubArgs.addAll(args);
-  var pub = startPub(args: pubArgs);
-
-  // Loading sources and transformers isn't normally printed, but the pub test
-  // infrastructure runs pub in verbose mode, which enables this.
-  pub.stdout.expect(consumeWhile(startsWith("Loading")));
-
-  return pub;
-}
-
-/// Defines an integration test.
-///
-/// The [body] should schedule a series of operations which will be run
-/// asynchronously.
-void integration(String description, void body()) =>
-  _integration(description, body, test);
-
-/// Like [integration], but causes only this test to run.
-void solo_integration(String description, void body()) =>
-  _integration(description, body, solo_test);
-
-void _integration(String description, void body(), [Function testFn]) {
-  testFn(description, () {
-    // TODO(nweiz): remove this when issue 15362 is fixed.
-    currentSchedule.timeout *= 2;
-
-    // The windows bots are very slow, so we increase the default timeout.
-    if (Platform.operatingSystem == "windows") {
-      currentSchedule.timeout *= 2;
-    }
-
-    _sandboxDir = createSystemTempDir();
-    d.defaultRoot = sandboxDir;
-    currentSchedule.onComplete.schedule(() => deleteEntry(_sandboxDir),
-        'deleting the sandbox directory');
-
-    // Schedule the test.
-    body();
-  });
-}
-
-/// Get the path to the root "pub/test" directory containing the pub
-/// tests.
-String get testDirectory =>
-  p.absolute(p.dirname(libraryPath('test_pub')));
-
-/// Schedules renaming (moving) the directory at [from] to [to], both of which
-/// are assumed to be relative to [sandboxDir].
-void scheduleRename(String from, String to) {
-  schedule(
-      () => renameDir(
-          p.join(sandboxDir, from),
-          p.join(sandboxDir, to)),
-      'renaming $from to $to');
-}
-
-/// Schedules creating a symlink at path [symlink] that points to [target],
-/// both of which are assumed to be relative to [sandboxDir].
-void scheduleSymlink(String target, String symlink) {
-  schedule(
-      () => createSymlink(
-          p.join(sandboxDir, target),
-          p.join(sandboxDir, symlink)),
-      'symlinking $target to $symlink');
-}
-
-/// Schedules a call to the Pub command-line utility.
-///
-/// Runs Pub with [args] and validates that its results match [output] (or
-/// [outputJson]), [error], and [exitCode].
-///
-/// [output] and [error] can be [String]s, [RegExp]s, or [Matcher]s.
-///
-/// If [outputJson] is given, validates that pub outputs stringified JSON
-/// matching that object, which can be a literal JSON object or any other
-/// [Matcher].
-///
-/// If [environment] is given, any keys in it will override the environment
-/// variables passed to the spawned process.
-void schedulePub({List args, output, error, outputJson,
-    int exitCode: exit_codes.SUCCESS, Map<String, String> environment}) {
-  // Cannot pass both output and outputJson.
-  assert(output == null || outputJson == null);
-
-  var pub = startPub(args: args, environment: environment);
-  pub.shouldExit(exitCode);
-
-  var failures = [];
-  var stderr;
-
-  expect(Future.wait([
-    pub.stdoutStream().toList(),
-    pub.stderrStream().toList()
-  ]).then((results) {
-    var stdout = results[0].join("\n");
-    stderr = results[1].join("\n");
-
-    if (outputJson == null) {
-      _validateOutput(failures, 'stdout', output, stdout);
-      return null;
-    }
-
-    // Allow the expected JSON to contain futures.
-    return awaitObject(outputJson).then((resolved) {
-      _validateOutputJson(failures, 'stdout', resolved, stdout);
-    });
-  }).then((_) {
-    _validateOutput(failures, 'stderr', error, stderr);
-
-    if (!failures.isEmpty) throw new TestFailure(failures.join('\n'));
-  }), completes);
-}
-
-/// Like [startPub], but runs `pub lish` in particular with [server] used both
-/// as the OAuth2 server (with "/token" as the token endpoint) and as the
-/// package server.
-///
-/// Any futures in [args] will be resolved before the process is started.
-ScheduledProcess startPublish(ScheduledServer server, {List args}) {
-  var tokenEndpoint = server.url.then((url) =>
-      url.resolve('/token').toString());
-  if (args == null) args = [];
-  args = flatten(['lish', '--server', tokenEndpoint, args]);
-  return startPub(args: args, tokenEndpoint: tokenEndpoint);
-}
-
-/// Handles the beginning confirmation process for uploading a packages.
-///
-/// Ensures that the right output is shown and then enters "y" to confirm the
-/// upload.
-void confirmPublish(ScheduledProcess pub) {
-  // TODO(rnystrom): This is overly specific and inflexible regarding different
-  // test packages. Should validate this a little more loosely.
-  pub.stdout.expect(startsWith('Publishing test_pkg 1.0.0 to '));
-  pub.stdout.expect(consumeThrough(
-      "Looks great! Are you ready to upload your package (y/n)?"));
-  pub.writeLine("y");
-}
-
-/// Gets the absolute path to [relPath], which is a relative path in the test
-/// sandbox.
-String _pathInSandbox(String relPath) {
-  return p.join(p.absolute(sandboxDir), relPath);
-}
-
-/// Gets the environment variables used to run pub in a test context.
-Future<Map> getPubTestEnvironment([String tokenEndpoint]) async {
-  var environment = {};
-  environment['_PUB_TESTING'] = 'true';
-  environment['PUB_CACHE'] = _pathInSandbox(cachePath);
-
-  // Ensure a known SDK version is set for the tests that rely on that.
-  environment['_PUB_TEST_SDK_VERSION'] = "0.1.2+3";
-
-  if (tokenEndpoint != null) {
-    environment['_PUB_TEST_TOKEN_ENDPOINT'] = tokenEndpoint.toString();
-  }
-
-  if (_hasServer) {
-    return port.then((p) {
-      environment['PUB_HOSTED_URL'] = "http://localhost:$p";
-      return environment;
-    });
-  }
-
-  return environment;
-}
-
-/// Starts a Pub process and returns a [ScheduledProcess] that supports
-/// interaction with that process.
-///
-/// Any futures in [args] will be resolved before the process is started.
-///
-/// If [environment] is given, any keys in it will override the environment
-/// variables passed to the spawned process.
-ScheduledProcess startPub({List args, Future<String> tokenEndpoint,
-    Map<String, String> environment}) {
-  ensureDir(_pathInSandbox(appPath));
-
-  // Find a Dart executable we can use to spawn. Use the same one that was
-  // used to run this script itself.
-  var dartBin = Platform.executable;
-
-  // If the executable looks like a path, get its full path. That way we
-  // can still find it when we spawn it with a different working directory.
-  if (dartBin.contains(Platform.pathSeparator)) {
-    dartBin = p.absolute(dartBin);
-  }
-
-  // Always run pub from a snapshot. Since we require the SDK to be built, the
-  // snapshot should be there. Note that this *does* mean that the snapshot has
-  // to be manually updated when changing code before running the tests.
-  // Otherwise, you will test against stale data.
-  //
-  // Using the snapshot makes running the tests much faster, which is why we
-  // make this trade-off.
-  var pubPath = p.join(p.dirname(dartBin), 'snapshots/pub.dart.snapshot');
-  var dartArgs = [pubPath, '--verbose'];
-  dartArgs.addAll(args);
-
-  if (tokenEndpoint == null) tokenEndpoint = new Future.value();
-  var environmentFuture = tokenEndpoint
-      .then((tokenEndpoint) => getPubTestEnvironment(tokenEndpoint))
-      .then((pubEnvironment) {
-    if (environment != null) pubEnvironment.addAll(environment);
-    return pubEnvironment;
-  });
-
-  return new PubProcess.start(dartBin, dartArgs, environment: environmentFuture,
-      workingDirectory: _pathInSandbox(appPath),
-      description: args.isEmpty ? 'pub' : 'pub ${args.first}');
-}
-
-/// A subclass of [ScheduledProcess] that parses pub's verbose logging output
-/// and makes [stdout] and [stderr] work as though pub weren't running in
-/// verbose mode.
-class PubProcess extends ScheduledProcess {
-  Stream<Pair<log.Level, String>> _log;
-  Stream<String> _stdout;
-  Stream<String> _stderr;
-
-  PubProcess.start(executable, arguments,
-      {workingDirectory, environment, String description,
-       Encoding encoding: UTF8})
-    : super.start(executable, arguments,
-        workingDirectory: workingDirectory,
-        environment: environment,
-        description: description,
-        encoding: encoding);
-
-  Stream<Pair<log.Level, String>> _logStream() {
-    if (_log == null) {
-      _log = mergeStreams(
-        _outputToLog(super.stdoutStream(), log.Level.MESSAGE),
-        _outputToLog(super.stderrStream(), log.Level.ERROR));
-    }
-
-    var pair = tee(_log);
-    _log = pair.first;
-    return pair.last;
-  }
-
-  final _logLineRegExp = new RegExp(r"^([A-Z ]{4})[:|] (.*)$");
-  final _logLevels = [
-    log.Level.ERROR, log.Level.WARNING, log.Level.MESSAGE, log.Level.IO,
-    log.Level.SOLVER, log.Level.FINE
-  ].fold(<String, log.Level>{}, (levels, level) {
-    levels[level.name] = level;
-    return levels;
-  });
-
-  Stream<Pair<log.Level, String>> _outputToLog(Stream<String> stream,
-      log.Level defaultLevel) {
-    var lastLevel;
-    return stream.map((line) {
-      var match = _logLineRegExp.firstMatch(line);
-      if (match == null) return new Pair<log.Level, String>(defaultLevel, line);
-
-      var level = _logLevels[match[1]];
-      if (level == null) level = lastLevel;
-      lastLevel = level;
-      return new Pair<log.Level, String>(level, match[2]);
-    });
-  }
-
-  Stream<String> stdoutStream() {
-    if (_stdout == null) {
-      _stdout = _logStream().expand((entry) {
-        if (entry.first != log.Level.MESSAGE) return [];
-        return [entry.last];
-      });
-    }
-
-    var pair = tee(_stdout);
-    _stdout = pair.first;
-    return pair.last;
-  }
-
-  Stream<String> stderrStream() {
-    if (_stderr == null) {
-      _stderr = _logStream().expand((entry) {
-        if (entry.first != log.Level.ERROR &&
-            entry.first != log.Level.WARNING) {
-          return [];
-        }
-        return [entry.last];
-      });
-    }
-
-    var pair = tee(_stderr);
-    _stderr = pair.first;
-    return pair.last;
-  }
-}
-
-/// The path to the `packages` directory from which pub loads its dependencies.
-String get _packageRoot => p.absolute(Platform.packageRoot);
-
-/// Fails the current test if Git is not installed.
-///
-/// We require machines running these tests to have git installed. This
-/// validation gives an easier-to-understand error when that requirement isn't
-/// met than just failing in the middle of a test when pub invokes git.
-///
-/// This also increases the [Schedule] timeout to 30 seconds on Windows,
-/// where Git runs really slowly.
-void ensureGit() {
-  if (Platform.operatingSystem == "windows") {
-    currentSchedule.timeout = new Duration(seconds: 30);
-  }
-
-  if (!gitlib.isInstalled) {
-    throw new Exception("Git must be installed to run this test.");
-  }
-}
-
-/// Schedules activating a global package [package] without running
-/// "pub global activate".
-///
-/// This is useful because global packages must be hosted, but the test hosted
-/// server doesn't serve barback. The other parameters here follow
-/// [createLockFile].
-void makeGlobalPackage(String package, String version,
-    Iterable<d.Descriptor> contents, {Iterable<String> pkg,
-    Map<String, String> hosted}) {
-  // Start the server so we know what port to use in the cache directory name.
-  serveNoPackages();
-
-  // Create the package in the hosted cache.
-  d.hostedCache([
-    d.dir("$package-$version", contents)
-  ]).create();
-
-  var lockFile = _createLockFile(pkg: pkg, hosted: hosted);
-
-  // Add the root package to the lockfile.
-  var id = new PackageId(package, "hosted", new Version.parse(version),
-      package);
-  lockFile.packages[package] = id;
-
-  // Write the lockfile to the global cache.
-  var sources = new SourceRegistry();
-  sources.register(new HostedSource());
-  sources.register(new PathSource());
-
-  d.dir(cachePath, [
-    d.dir("global_packages", [
-      d.file("$package.lock", lockFile.serialize(null, sources))
-    ])
-  ]).create();
-}
-
-/// Creates a lock file for [package] without running `pub get`.
-///
-/// [sandbox] is a list of path dependencies to be found in the sandbox
-/// directory. [pkg] is a list of packages in the Dart repo's "pkg" directory;
-/// each package listed here and all its dependencies will be linked to the
-/// version in the Dart repo.
-///
-/// [hosted] is a list of package names to version strings for dependencies on
-/// hosted packages.
-void createLockFile(String package, {Iterable<String> sandbox,
-    Iterable<String> pkg, Map<String, String> hosted}) {
-  var lockFile = _createLockFile(sandbox: sandbox, pkg: pkg, hosted: hosted);
-
-  var sources = new SourceRegistry();
-  sources.register(new HostedSource());
-  sources.register(new PathSource());
-
-  d.file(p.join(package, 'pubspec.lock'),
-      lockFile.serialize(null, sources)).create();
-}
-
-/// Creates a lock file for [package] without running `pub get`.
-///
-/// [sandbox] is a list of path dependencies to be found in the sandbox
-/// directory. [pkg] is a list of packages in the Dart repo's "pkg" directory;
-/// each package listed here and all its dependencies will be linked to the
-/// version in the Dart repo.
-///
-/// [hosted] is a list of package names to version strings for dependencies on
-/// hosted packages.
-LockFile _createLockFile({Iterable<String> sandbox,
-Iterable<String> pkg, Map<String, String> hosted}) {
-  var dependencies = {};
-
-  if (sandbox != null) {
-    for (var package in sandbox) {
-      dependencies[package] = '../$package';
-    }
-  }
-
-  if (pkg != null) {
-    _addPackage(String package) {
-      if (dependencies.containsKey(package)) return;
-
-      var path;
-      if (package == 'barback' && _packageOverrides == null) {
-        throw new StateError("createLockFile() can only create a lock file "
-            "with a barback dependency within a withBarbackVersions() "
-            "block.");
-      }
-
-      if (_packageOverrides.containsKey(package)) {
-        path = _packageOverrides[package];
-      } else {
-        path = packagePath(package);
-      }
-
-      dependencies[package] = path;
-      var pubspec = loadYaml(
-          readTextFile(p.join(path, 'pubspec.yaml')));
-      var packageDeps = pubspec['dependencies'];
-      if (packageDeps == null) return;
-      packageDeps.keys.forEach(_addPackage);
-    }
-
-    pkg.forEach(_addPackage);
-  }
-
-  var lockFile = new LockFile.empty();
-  dependencies.forEach((name, dependencyPath) {
-    var id = new PackageId(name, 'path', new Version(0, 0, 0), {
-      'path': dependencyPath,
-      'relative': p.isRelative(dependencyPath)
-    });
-    lockFile.packages[name] = id;
-  });
-
-  if (hosted != null) {
-    hosted.forEach((name, version) {
-      var id = new PackageId(name, 'hosted', new Version.parse(version), name);
-      lockFile.packages[name] = id;
-    });
-  }
-
-  return lockFile;
-}
-
-/// Returns the path to [package] within the repo.
-String packagePath(String package) =>
-    dirExists(p.join(repoRoot, 'pkg', package)) ?
-        p.join(repoRoot, 'pkg', package) :
-        p.join(repoRoot, 'third_party', 'pkg', package);
-
-/// Uses [client] as the mock HTTP client for this test.
-///
-/// Note that this will only affect HTTP requests made via http.dart in the
-/// parent process.
-void useMockClient(MockClient client) {
-  var oldInnerClient = innerHttpClient;
-  innerHttpClient = client;
-  currentSchedule.onComplete.schedule(() {
-    innerHttpClient = oldInnerClient;
-  }, 'de-activating the mock client');
-}
-
-/// Describes a map representing a library package with the given [name],
-/// [version], and [dependencies].
-Map packageMap(String name, String version, [Map dependencies]) {
-  var package = {
-    "name": name,
-    "version": version,
-    "author": "Natalie Weizenbaum <nweiz@google.com>",
-    "homepage": "http://pub.dartlang.org",
-    "description": "A package, I guess."
-  };
-
-  if (dependencies != null) package["dependencies"] = dependencies;
-
-  return package;
-}
-
-/// Resolves [target] relative to the path to pub's `test/asset` directory.
-String testAssetPath(String target) =>
-    p.join(p.dirname(libraryPath('test_pub')), 'asset', target);
-
-/// Returns a Map in the format used by the pub.dartlang.org API to represent a
-/// package version.
-///
-/// [pubspec] is the parsed pubspec of the package version. If [full] is true,
-/// this returns the complete map, including metadata that's only included when
-/// requesting the package version directly.
-Map packageVersionApiMap(Map pubspec, {bool full: false}) {
-  var name = pubspec['name'];
-  var version = pubspec['version'];
-  var map = {
-    'pubspec': pubspec,
-    'version': version,
-    'url': '/api/packages/$name/versions/$version',
-    'archive_url': '/packages/$name/versions/$version.tar.gz',
-    'new_dartdoc_url': '/api/packages/$name/versions/$version'
-        '/new_dartdoc',
-    'package_url': '/api/packages/$name'
-  };
-
-  if (full) {
-    map.addAll({
-      'downloads': 0,
-      'created': '2012-09-25T18:38:28.685260',
-      'libraries': ['$name.dart'],
-      'uploader': ['nweiz@google.com']
-    });
-  }
-
-  return map;
-}
-
-/// Returns the name of the shell script for a binstub named [name].
-///
-/// Adds a ".bat" extension on Windows.
-String binStubName(String name) => Platform.isWindows ? '$name.bat' : name;
-
-/// Compares the [actual] output from running pub with [expected].
-///
-/// If [expected] is a [String], ignores leading and trailing whitespace
-/// differences and tries to report the offending difference in a nice way.
-///
-/// If it's a [RegExp] or [Matcher], just reports whether the output matches.
-void _validateOutput(List<String> failures, String pipe, expected,
-                     String actual) {
-  if (expected == null) return;
-
-  if (expected is String) {
-    _validateOutputString(failures, pipe, expected, actual);
-  } else {
-    if (expected is RegExp) expected = matches(expected);
-    expect(actual, expected);
-  }
-}
-
-void _validateOutputString(List<String> failures, String pipe,
-                           String expected, String actual) {
-  var actualLines = actual.split("\n");
-  var expectedLines = expected.split("\n");
-
-  // Strip off the last line. This lets us have expected multiline strings
-  // where the closing ''' is on its own line. It also fixes '' expected output
-  // to expect zero lines of output, not a single empty line.
-  if (expectedLines.last.trim() == '') {
-    expectedLines.removeLast();
-  }
-
-  var results = [];
-  var failed = false;
-
-  // Compare them line by line to see which ones match.
-  var length = max(expectedLines.length, actualLines.length);
-  for (var i = 0; i < length; i++) {
-    if (i >= actualLines.length) {
-      // Missing output.
-      failed = true;
-      results.add('? ${expectedLines[i]}');
-    } else if (i >= expectedLines.length) {
-      // Unexpected extra output.
-      failed = true;
-      results.add('X ${actualLines[i]}');
-    } else {
-      var expectedLine = expectedLines[i].trim();
-      var actualLine = actualLines[i].trim();
-
-      if (expectedLine != actualLine) {
-        // Mismatched lines.
-        failed = true;
-        results.add('X ${actualLines[i]}');
-      } else {
-        // Output is OK, but include it in case other lines are wrong.
-        results.add('| ${actualLines[i]}');
-      }
-    }
-  }
-
-  // If any lines mismatched, show the expected and actual.
-  if (failed) {
-    failures.add('Expected $pipe:');
-    failures.addAll(expectedLines.map((line) => '| $line'));
-    failures.add('Got:');
-    failures.addAll(results);
-  }
-}
-
-/// Validates that [actualText] is a string of JSON that matches [expected],
-/// which may be a literal JSON object, or any other [Matcher].
-void _validateOutputJson(List<String> failures, String pipe,
-                         expected, String actualText) {
-  var actual;
-  try {
-    actual = JSON.decode(actualText);
-  } on FormatException catch(error) {
-    failures.add('Expected $pipe JSON:');
-    failures.add(expected);
-    failures.add('Got invalid JSON:');
-    failures.add(actualText);
-  }
-
-  // Match against the expectation.
-  expect(actual, expected);
-}
-
-/// A function that creates a [Validator] subclass.
-typedef Validator ValidatorCreator(Entrypoint entrypoint);
-
-/// Schedules a single [Validator] to run on the [appPath].
-///
-/// Returns a scheduled Future that contains the errors and warnings produced
-/// by that validator.
-Future<Pair<List<String>, List<String>>> schedulePackageValidation(
-    ValidatorCreator fn) {
-  return schedule(() {
-    var cache = new SystemCache.withSources(
-        rootDir: p.join(sandboxDir, cachePath));
-
-    return new Future.sync(() {
-      var validator = fn(new Entrypoint(p.join(sandboxDir, appPath), cache));
-      return validator.validate().then((_) {
-        return new Pair(validator.errors, validator.warnings);
-      });
-    });
-  }, "validating package");
-}
-
-/// A matcher that matches a Pair.
-Matcher pairOf(Matcher firstMatcher, Matcher lastMatcher) =>
-   new _PairMatcher(firstMatcher, lastMatcher);
-
-class _PairMatcher extends Matcher {
-  final Matcher _firstMatcher;
-  final Matcher _lastMatcher;
-
-  _PairMatcher(this._firstMatcher, this._lastMatcher);
-
-  bool matches(item, Map matchState) {
-    if (item is! Pair) return false;
-    return _firstMatcher.matches(item.first, matchState) &&
-        _lastMatcher.matches(item.last, matchState);
-  }
-
-  Description describe(Description description) {
-    return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]);
-  }
-}
-
-/// A [StreamMatcher] that matches multiple lines of output.
-StreamMatcher emitsLines(String output) => inOrder(output.split("\n"));
diff --git a/sdk/lib/_internal/pub/test/transcript_test.dart b/sdk/lib/_internal/pub/test/transcript_test.dart
deleted file mode 100644
index 34ea130..0000000
--- a/sdk/lib/_internal/pub/test/transcript_test.dart
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library version_test;
-
-import 'package:unittest/unittest.dart';
-import 'test_pub.dart';
-import '../lib/src/transcript.dart';
-
-main() {
-  initConfig();
-
-  test("discards from the middle once it reaches the maximum", () {
-    var transcript = new Transcript<String>(4);
-    forEachToString() {
-      var result = "";
-      transcript.forEach((entry) => result += entry, (n) => result += "[$n]");
-      return result;
-    }
-
-    expect(forEachToString(), equals(""));
-    transcript.add("a");
-    expect(forEachToString(), equals("a"));
-    transcript.add("b");
-    expect(forEachToString(), equals("ab"));
-    transcript.add("c");
-    expect(forEachToString(), equals("abc"));
-    transcript.add("d");
-    expect(forEachToString(), equals("abcd"));
-    transcript.add("e");
-    expect(forEachToString(), equals("ab[1]de"));
-    transcript.add("f");
-    expect(forEachToString(), equals("ab[2]ef"));
-  });
-
-  test("does not discard if it doesn't reach the maximum", () {
-    var transcript = new Transcript<String>(40);
-    forEachToString() {
-      var result = "";
-      transcript.forEach((entry) => result += entry, (n) => result += "[$n]");
-      return result;
-    }
-
-    expect(forEachToString(), equals(""));
-    transcript.add("a");
-    expect(forEachToString(), equals("a"));
-    transcript.add("b");
-    expect(forEachToString(), equals("ab"));
-    transcript.add("c");
-    expect(forEachToString(), equals("abc"));
-    transcript.add("d");
-    expect(forEachToString(), equals("abcd"));
-    transcript.add("e");
-    expect(forEachToString(), equals("abcde"));
-    transcript.add("f");
-    expect(forEachToString(), equals("abcdef"));
-  });
-
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/a_transformer_rejects_its_config_test.dart b/sdk/lib/_internal/pub/test/transformer/a_transformer_rejects_its_config_test.dart
deleted file mode 100644
index caa0c95..0000000
--- a/sdk/lib/_internal/pub/test/transformer/a_transformer_rejects_its_config_test.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const REJECT_CONFIG_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class RejectConfigTransformer extends Transformer {
-  RejectConfigTransformer.asPlugin(BarbackSettings settings) {
-    throw "I hate these settings!";
-  }
-
-  Future<bool> isPrimary(_) => new Future.value(true);
-  Future apply(Transform transform) {}
-}
-""";
-
-main() {
-  initConfig();
-
-  withBarbackVersions("any", () {
-     integration("a transformer can reject is configuration", () {
-       d.dir(appPath, [
-         d.pubspec({
-           "name": "myapp",
-           "transformers": [{"myapp/src/transformer": {'foo': 'bar'}}]
-         }),
-         d.dir("lib", [d.dir("src", [
-           d.file("transformer.dart", REJECT_CONFIG_TRANSFORMER)
-         ])])
-       ]).create();
-
-       createLockFile('myapp', pkg: ['barback']);
-
-       var pub = startPubServe();
-       pub.stderr.expect(endsWith('Error loading transformer: I hate these '
-           'settings!'));
-       pub.shouldExit(1);
-     });
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/transformer/asset_not_found_exceptions_are_detectable_test.dart b/sdk/lib/_internal/pub/test/transformer/asset_not_found_exceptions_are_detectable_test.dart
deleted file mode 100644
index e862b756..0000000
--- a/sdk/lib/_internal/pub/test/transformer/asset_not_found_exceptions_are_detectable_test.dart
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'dart:convert';
-
-import 'package:scheduled_test/scheduled_stream.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-final transformer = """
-import 'dart:async';
-import 'dart:convert';
-
-import 'package:barback/barback.dart';
-
-class GetInputTransformer extends Transformer {
-  GetInputTransformer.asPlugin();
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    return transform.readInputAsString(new AssetId('myapp', 'nonexistent'))
-        .catchError((error) {
-      if (error is! AssetNotFoundException) throw error;
-      transform.addOutput(new Asset.fromString(transform.primaryInput.id,
-          JSON.encode({
-        'package': error.id.package,
-        'path': error.id.path
-      })));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("AssetNotFoundExceptions are detectable", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", transformer)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var server = pubServe();
-      requestShouldSucceed("foo.txt", JSON.encode({
-        "package": "myapp",
-        "path": "nonexistent"
-      }));
-      endPubServe();
-
-      // Since the AssetNotFoundException was caught and handled, the server
-      // shouldn't print any error information for it.
-      server.stderr.expect(isDone);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/cache_test.dart b/sdk/lib/_internal/pub/test/transformer/cache_test.dart
deleted file mode 100644
index d4a51a0..0000000
--- a/sdk/lib/_internal/pub/test/transformer/cache_test.dart
+++ /dev/null
@@ -1,348 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const REPLACE_FROM_LIBRARY_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-import 'package:bar/bar.dart';
-
-class ReplaceTransformer extends Transformer {
-  ReplaceTransformer.asPlugin();
-
-  String get allowedExtensions => '.dart';
-
-  Future apply(Transform transform) {
-    return transform.primaryInput.readAsString().then((contents) {
-      transform.addOutput(new Asset.fromString(
-          transform.primaryInput.id,
-          contents.replaceAll("Hello", replacement)));
-    });
-  }
-}
-""";
-
-// TODO(nweiz): Currently scheduled_test.setUp doesn't play well with test_pub,
-// since it only assigns the sandbox directory once the main test body has
-// run. Fix this and move this to a real setUp call.
-void setUp() {
-  servePackages((builder) {
-    builder.serveRepoPackage('barback');
-
-    builder.serve("foo", "1.2.3",
-        deps: {'barback': 'any'},
-        contents: [
-      d.dir("lib", [
-        d.file("transformer.dart", replaceTransformer("Hello", "Goodbye"))
-      ])
-    ]);
-
-    builder.serve("bar", "1.2.3",
-        deps: {'barback': 'any'},
-        contents: [
-      d.dir("lib", [
-        d.file("transformer.dart", replaceTransformer("Goodbye", "See ya"))
-      ])
-    ]);
-
-    builder.serve("baz", "1.2.3");
-  });
-
-  d.dir(appPath, [
-    d.pubspec({
-      "name": "myapp",
-      "dependencies": {
-        "foo": "1.2.3",
-        "bar": "1.2.3"
-      },
-      "transformers": ["foo"]
-    }),
-    d.dir("bin", [
-      d.file("myapp.dart", "main() => print('Hello!');")
-    ])
-  ]).create();
-
-  pubGet();
-}
-
-main() {
-  initConfig();
-
-  integration("caches a transformer snapshot", () {
-    setUp();
-
-    var process = pubRun(args: ['myapp']);
-    process.stdout.expect("Goodbye!");
-    process.shouldExit();
-
-    d.dir(appPath, [
-      d.dir(".pub/transformers", [
-        d.file("manifest.txt", "0.1.2+3\nfoo"),
-        d.matcherFile("transformers.snapshot", isNot(isEmpty))
-      ])
-    ]).validate();
-
-    // Run the executable again to make sure loading the transformer from the
-    // cache works.
-    process = pubRun(args: ['myapp']);
-    process.stdout.expect("Goodbye!");
-    process.shouldExit();
-  });
-
-  integration("recaches if the SDK version is out-of-date", () {
-    setUp();
-
-    d.dir(appPath, [
-      d.dir(".pub/transformers", [
-        // The version 0.0.1 is different than the test version 0.1.2+3.
-        d.file("manifest.txt", "0.0.1\nfoo"),
-        d.file("transformers.snapshot", "junk")
-      ])
-    ]).create();
-
-    var process = pubRun(args: ['myapp']);
-    process.stdout.expect("Goodbye!");
-    process.shouldExit();
-
-    d.dir(appPath, [
-      d.dir(".pub/transformers", [
-        d.file("manifest.txt", "0.1.2+3\nfoo"),
-        d.matcherFile("transformers.snapshot", isNot(isEmpty))
-      ])
-    ]).validate();
-  });
-
-  integration("recaches if the transformers change", () {
-    setUp();
-
-    var process = pubRun(args: ['myapp']);
-    process.stdout.expect("Goodbye!");
-    process.shouldExit();
-
-    d.dir(appPath, [
-      d.dir(".pub/transformers", [
-        d.file("manifest.txt", "0.1.2+3\nfoo"),
-        d.matcherFile("transformers.snapshot", isNot(isEmpty))
-      ])
-    ]).validate();
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {
-          "foo": "1.2.3",
-          "bar": "1.2.3"
-        },
-        "transformers": ["foo", "bar"]
-      }),
-      d.dir("bin", [
-        d.file("myapp.dart", "main() => print('Hello!');")
-      ])
-    ]).create();
-
-    process = pubRun(args: ['myapp']);
-    process.stdout.expect("See ya!");
-    process.shouldExit();
-
-    d.dir(appPath, [
-      d.dir(".pub/transformers", [
-        d.file("manifest.txt", "0.1.2+3\nbar,foo"),
-        d.matcherFile("transformers.snapshot", isNot(isEmpty))
-      ])
-    ]).validate();
-  });
-
-  integration("recaches if the transformer version changes", () {
-    setUp();
-
-    var process = pubRun(args: ['myapp']);
-    process.stdout.expect("Goodbye!");
-    process.shouldExit();
-
-    d.dir(appPath, [
-      d.dir(".pub/transformers", [
-        d.file("manifest.txt", "0.1.2+3\nfoo"),
-        d.matcherFile("transformers.snapshot", isNot(isEmpty))
-      ])
-    ]).validate();
-
-    servePackages((builder) {
-      builder.serve("foo", "2.0.0",
-          deps: {'barback': 'any'},
-          contents: [
-        d.dir("lib", [
-          d.file("transformer.dart", replaceTransformer("Hello", "New"))
-        ])
-      ]);
-    });
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": "any"},
-        "transformers": ["foo"]
-      })
-    ]).create();
-
-    pubUpgrade();
-
-    process = pubRun(args: ['myapp']);
-    process.stdout.expect("New!");
-    process.shouldExit();
-
-    d.dir(appPath, [
-      d.dir(".pub/transformers", [
-        d.file("manifest.txt", "0.1.2+3\nfoo"),
-        d.matcherFile("transformers.snapshot", isNot(isEmpty))
-      ])
-    ]).validate();
-  });
-
-  integration("recaches if a transitive dependency version changes", () {
-    servePackages((builder) {
-      builder.serveRepoPackage('barback');
-
-      builder.serve("foo", "1.2.3",
-          deps: {
-            'barback': 'any',
-            'bar': 'any'
-          },
-          contents: [
-        d.dir("lib", [
-          d.file("transformer.dart", REPLACE_FROM_LIBRARY_TRANSFORMER)
-        ])
-      ]);
-
-      builder.serve("bar", "1.2.3", contents: [
-        d.dir("lib", [
-          d.file("bar.dart", "final replacement = 'Goodbye';")
-        ])
-      ]);
-    });
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": "1.2.3"},
-        "transformers": ["foo"]
-      }),
-      d.dir("bin", [
-        d.file("myapp.dart", "main() => print('Hello!');")
-      ])
-    ]).create();
-
-    pubGet();
-
-    var process = pubRun(args: ['myapp']);
-    process.stdout.expect("Goodbye!");
-    process.shouldExit();
-
-    servePackages((builder) {
-      builder.serve("bar", "2.0.0", contents: [
-        d.dir("lib", [
-          d.file("bar.dart", "final replacement = 'See ya';")
-        ])
-      ]);
-    });
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": "any"},
-        "transformers": ["foo"]
-      })
-    ]).create();
-
-    pubUpgrade();
-
-    process = pubRun(args: ['myapp']);
-    process.stdout.expect("See ya!");
-    process.shouldExit();
-  });
-
-  // Issue 21298.
-  integration("doesn't recache when a transformer is removed", () {
-    setUp();
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {
-          "foo": "1.2.3",
-          "bar": "1.2.3"
-        },
-        "transformers": ["foo", "bar"]
-      }),
-      d.dir("bin", [
-        d.file("myapp.dart", "main() => print('Hello!');")
-      ])
-    ]).create();
-
-    var process = pubRun(args: ['myapp']);
-    process.stdout.expect("See ya!");
-    process.shouldExit();
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {
-          "foo": "1.2.3",
-          // Add a new dependency to trigger another "pub get". This works
-          // around issue 20498.
-          "baz": "1.2.3"
-        },
-        "transformers": ["foo"]
-      }),
-      d.dir("bin", [
-        d.file("myapp.dart", "main() => print('Hello!');")
-      ])
-    ]).create();
-
-    process = pubRun(args: ['myapp']);
-    process.stdout.expect(
-        "Your pubspec has changed, so we need to update your lockfile:");
-    process.stdout.expect(consumeThrough("Goodbye!"));
-    process.shouldExit();
-
-    // "bar" should still be in the manifest, since there's no reason to
-    // recompile the cache.
-    d.dir(appPath, [
-      d.dir(".pub/transformers", [
-        d.file("manifest.txt", "0.1.2+3\nbar,foo"),
-        d.matcherFile("transformers.snapshot", isNot(isEmpty))
-      ])
-    ]).validate();
-  });
-}
-
-String replaceTransformer(String input, String output) {
-  return """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class ReplaceTransformer extends Transformer {
-  ReplaceTransformer.asPlugin();
-
-  String get allowedExtensions => '.dart';
-
-  Future apply(Transform transform) {
-    return transform.primaryInput.readAsString().then((contents) {
-      transform.addOutput(new Asset.fromString(
-          transform.primaryInput.id,
-          contents.replaceAll("$input", "$output")));
-    });
-  }
-}
-""";
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/can_log_messages_test.dart b/sdk/lib/_internal/pub/test/transformer/can_log_messages_test.dart
deleted file mode 100644
index da82d5d..0000000
--- a/sdk/lib/_internal/pub/test/transformer/can_log_messages_test.dart
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/scheduled_stream.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-const SOURCE_MAPS_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-import 'package:source_maps/source_maps.dart';
-
-class RewriteTransformer extends Transformer {
-  RewriteTransformer.asPlugin();
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    transform.logger.info('info!');
-    transform.logger.warning('Warning!',
-        asset: transform.primaryInput.id.changeExtension('.foo'));
-    var sourceFile = new SourceFile.text(
-        'http://fake.com/not_real.dart',
-        'not a real\\ndart file');
-    transform.logger.error('ERROR!', span: new FileSpan(sourceFile, 11));
-    return transform.primaryInput.readAsString().then((contents) {
-      var id = transform.primaryInput.id.changeExtension(".out");
-      transform.addOutput(new Asset.fromString(id, "\$contents.out"));
-    });
-  }
-}
-""";
-
-const SOURCE_SPAN_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-import 'package:source_span/source_span.dart';
-
-class RewriteTransformer extends Transformer {
-  RewriteTransformer.asPlugin();
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    transform.logger.info('info!');
-    transform.logger.warning('Warning!',
-        asset: transform.primaryInput.id.changeExtension('.foo'));
-    var sourceFile = new SourceFile('not a real\\ndart file',
-        url: 'http://fake.com/not_real.dart');
-    transform.logger.error('ERROR!', span: sourceFile.span(11, 12));
-    return transform.primaryInput.readAsString().then((contents) {
-      var id = transform.primaryInput.id.changeExtension(".out");
-      transform.addOutput(new Asset.fromString(id, "\$contents.out"));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  // This intentionally tests barback 0.14.2 with both transformers, since it
-  // supports both types of span.
-  withBarbackVersions("<0.15.0", () => runTest(SOURCE_MAPS_TRANSFORMER));
-  withBarbackVersions(">=0.14.2", () => runTest(SOURCE_SPAN_TRANSFORMER));
-}
-
-void runTest(String transformerText) {
-  integration("can log messages", () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "transformers": ["myapp/src/transformer"]
-      }),
-      d.dir("lib", [d.dir("src", [
-        d.file("transformer.dart", transformerText)
-      ])]),
-      d.dir("web", [
-        d.file("foo.txt", "foo")
-      ])
-    ]).create();
-
-    createLockFile('myapp', pkg: ['barback']);
-
-    var pub = startPub(args: ["build"]);
-    pub.stdout.expect(startsWith("Loading source assets..."));
-    pub.stdout.expect(consumeWhile(matches("Loading .* transformers...")));
-    pub.stdout.expect(startsWith("Building myapp..."));
-
-    pub.stdout.expect(emitsLines("""
-[Rewrite on myapp|web/foo.txt]:
-info!"""));
-
-    pub.stderr.expect(emitsLines("""
-[Rewrite on myapp|web/foo.txt with input myapp|web/foo.foo]:
-Warning!
-[Rewrite on myapp|web/foo.txt]:"""));
-
-    // The details of the analyzer's error message change pretty frequently,
-    // so instead of validating the entire line, just look for a couple of
-    // salient bits of information.
-    pub.stderr.expect(allOf([
-      contains("2"),                              // The line number.
-      contains("1"),                              // The column number.
-      contains("http://fake.com/not_real.dart"),  // The library.
-      contains("ERROR"),                          // That it's an error.
-    ]));
-
-    // In barback >=0.15.0, the span will point to the location where the error
-    // occurred.
-    pub.stderr.expect(allow(inOrder(["d", "^"])));
-
-    pub.stderr.expect("Build failed.");
-
-    pub.shouldExit(exit_codes.DATA);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/can_use_consume_primary_test.dart b/sdk/lib/_internal/pub/test/transformer/can_use_consume_primary_test.dart
deleted file mode 100644
index d397b1b..0000000
--- a/sdk/lib/_internal/pub/test/transformer/can_use_consume_primary_test.dart
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class RewriteTransformer extends Transformer {
-  RewriteTransformer.asPlugin();
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    transform.consumePrimary();
-    return transform.primaryInput.readAsString().then((contents) {
-      var id = transform.primaryInput.id.changeExtension(".out");
-      var asset = new Asset.fromString(id, "\$contents.out");
-      transform.addOutput(asset);
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("a transform can use consumePrimary", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.out", "foo.out");
-      requestShould404("foo.txt");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/can_use_has_input_test.dart b/sdk/lib/_internal/pub/test/transformer/can_use_has_input_test.dart
deleted file mode 100644
index 1e8a858..0000000
--- a/sdk/lib/_internal/pub/test/transformer/can_use_has_input_test.dart
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class RewriteTransformer extends Transformer {
-  RewriteTransformer.asPlugin();
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    return Future.wait([
-      transform.hasInput(transform.primaryInput.id),
-      transform.hasInput(new AssetId('hooble', 'whatsit'))
-    ]).then((results) {
-      var id = transform.primaryInput.id.changeExtension(".out");
-      var asset = new Asset.fromString(id,
-          "primary: \${results[0]}, secondary: \${results[1]}");
-      transform.addOutput(asset);
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("a transform can use hasInput", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.out", "primary: true, secondary: false");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/can_use_read_input_as_string_test.dart b/sdk/lib/_internal/pub/test/transformer/can_use_read_input_as_string_test.dart
deleted file mode 100644
index 612eee5..0000000
--- a/sdk/lib/_internal/pub/test/transformer/can_use_read_input_as_string_test.dart
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class RewriteTransformer extends Transformer {
-  RewriteTransformer.asPlugin();
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    return transform.readInputAsString(transform.primaryInput.id)
-        .then((contents) {
-      var id = transform.primaryInput.id.changeExtension(".out");
-      transform.addOutput(new Asset.fromString(id, "\$contents.out"));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("a transform can use readInputAsString", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.out", "foo.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/can_use_read_input_test.dart b/sdk/lib/_internal/pub/test/transformer/can_use_read_input_test.dart
deleted file mode 100644
index 2adbb45..0000000
--- a/sdk/lib/_internal/pub/test/transformer/can_use_read_input_test.dart
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class RewriteTransformer extends Transformer {
-  RewriteTransformer.asPlugin();
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    return transform.readInput(transform.primaryInput.id).toList()
-        .then((contents) {
-      var id = transform.primaryInput.id.changeExtension(".out");
-      var asset = new Asset.fromString(id, "\$contents.out");
-      transform.addOutput(asset);
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("a transform can use readInputAsString", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.out", "[[102, 111, 111]].out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/configuration/configuration_defaults_to_empty_map_test.dart b/sdk/lib/_internal/pub/test/transformer/configuration/configuration_defaults_to_empty_map_test.dart
deleted file mode 100644
index 3f7f48e..0000000
--- a/sdk/lib/_internal/pub/test/transformer/configuration/configuration_defaults_to_empty_map_test.dart
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'dart:convert';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-final transformer = """
-import 'dart:async';
-import 'dart:convert';
-
-import 'package:barback/barback.dart';
-
-class ConfigTransformer extends Transformer {
-  final BarbackSettings settings;
-
-  ConfigTransformer.asPlugin(this.settings);
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    return transform.primaryInput.readAsString().then((contents) {
-      var id = transform.primaryInput.id.changeExtension(".json");
-      transform.addOutput(
-          new Asset.fromString(id, JSON.encode(settings.configuration)));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("configuration defaults to an empty map", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", transformer)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var server = pubServe();
-      requestShouldSucceed("foo.json", JSON.encode({}));
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/configuration/passes_configuration_to_a_transformer_test.dart b/sdk/lib/_internal/pub/test/transformer/configuration/passes_configuration_to_a_transformer_test.dart
deleted file mode 100644
index 180baa2..0000000
--- a/sdk/lib/_internal/pub/test/transformer/configuration/passes_configuration_to_a_transformer_test.dart
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'dart:convert';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-final transformer = """
-import 'dart:async';
-import 'dart:convert';
-
-import 'package:barback/barback.dart';
-
-class ConfigTransformer extends Transformer {
-  final BarbackSettings settings;
-
-  ConfigTransformer.asPlugin(this.settings);
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    return transform.primaryInput.readAsString().then((contents) {
-      var id = transform.primaryInput.id.changeExtension(".json");
-      transform.addOutput(
-        new Asset.fromString(id, JSON.encode(settings.configuration)));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("passes configuration to a transformer", () {
-      var configuration = {"param": ["list", "of", "values"]};
-
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [{"myapp/src/transformer": configuration}]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", transformer)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var server = pubServe();
-      requestShouldSucceed("foo.json", JSON.encode(configuration));
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/configuration/with_configuration_only_instantiates_configurable_transformers_test.dart b/sdk/lib/_internal/pub/test/transformer/configuration/with_configuration_only_instantiates_configurable_transformers_test.dart
deleted file mode 100644
index 3bce3bb..0000000
--- a/sdk/lib/_internal/pub/test/transformer/configuration/with_configuration_only_instantiates_configurable_transformers_test.dart
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'dart:convert';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-final transformer = """
-import 'dart:async';
-import 'dart:convert';
-
-import 'package:barback/barback.dart';
-
-class ConfigTransformer extends Transformer {
-  final BarbackSettings settings;
-
-  ConfigTransformer.asPlugin(this.settings);
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    return transform.primaryInput.readAsString().then((contents) {
-      var id = transform.primaryInput.id.changeExtension(".json");
-      transform.addOutput(
-          new Asset.fromString(id, JSON.encode(settings.configuration)));
-    });
-  }
-}
-
-class RewriteTransformer extends Transformer {
-  RewriteTransformer.asPlugin();
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    return transform.primaryInput.readAsString().then((contents) {
-      var id = transform.primaryInput.id.changeExtension(".out");
-      transform.addOutput(new Asset.fromString(id, "\$contents.out"));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-     integration("with configuration, only instantiates configurable "
-         "transformers", () {
-       var configuration = {"param": ["list", "of", "values"]};
-
-       d.dir(appPath, [
-         d.pubspec({
-           "name": "myapp",
-           "transformers": [{"myapp/src/transformer": configuration}]
-         }),
-         d.dir("lib", [d.dir("src", [
-           d.file("transformer.dart", transformer)
-         ])]),
-         d.dir("web", [
-           d.file("foo.txt", "foo")
-         ])
-       ]).create();
-
-       createLockFile('myapp', pkg: ['barback']);
-
-       var server = pubServe();
-       requestShouldSucceed("foo.json", JSON.encode(configuration));
-       requestShould404("foo.out");
-       endPubServe();
-     });
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/transformer/dart2js_transformer_before_another_transformer_test.dart b/sdk/lib/_internal/pub/test/transformer/dart2js_transformer_before_another_transformer_test.dart
deleted file mode 100644
index 30bb374..0000000
--- a/sdk/lib/_internal/pub/test/transformer/dart2js_transformer_before_another_transformer_test.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-// Regression test for issue 21726.
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("runs a dart2js transformer before a local transformer", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            r"$dart2js",
-            "myapp/src/transformer"
-          ]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.out", "foo.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/does_not_run_a_transform_on_an_input_in_another_package_test.dart b/sdk/lib/_internal/pub/test/transformer/does_not_run_a_transform_on_an_input_in_another_package_test.dart
deleted file mode 100644
index a464101..0000000
--- a/sdk/lib/_internal/pub/test/transformer/does_not_run_a_transform_on_an_input_in_another_package_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("does not run a transform on an input in another package", () {
-      d.dir("foo", [
-        d.pubspec({
-          "name": "foo",
-          "version": "0.0.1",
-          "transformers": ["foo/transformer"]
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER),
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      d.dir(appPath, [
-        d.appPubspec({"foo": {"path": "../foo"}}),
-        d.dir("lib", [
-          d.file("bar.txt", "bar")
-        ])
-      ]).create();
-
-      createLockFile('myapp', sandbox: ['foo'], pkg: ['barback']);
-
-      pubServe();
-      requestShould404("packages/myapp/bar.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/exclusion/exclude_asset_glob_test.dart b/sdk/lib/_internal/pub/test/transformer/exclusion/exclude_asset_glob_test.dart
deleted file mode 100644
index 812e7b4..0000000
--- a/sdk/lib/_internal/pub/test/transformer/exclusion/exclude_asset_glob_test.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("allows a glob to exclude", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {
-              "myapp/src/transformer": {
-                "\$exclude": "**/foo.txt"
-              }
-            }
-          ]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo"),
-          d.file("bar.txt", "bar"),
-          d.dir("sub", [
-            d.file("foo.txt", "foo"),
-          ])
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShould404("foo.out");
-      requestShouldSucceed("bar.out", "bar.out");
-      requestShould404("sub/foo.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/exclusion/exclude_asset_list_test.dart b/sdk/lib/_internal/pub/test/transformer/exclusion/exclude_asset_list_test.dart
deleted file mode 100644
index 5293039..0000000
--- a/sdk/lib/_internal/pub/test/transformer/exclusion/exclude_asset_list_test.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("excludes a list of assets", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {
-              "myapp/src/transformer": {
-                "\$exclude": [
-                  "web/foo.txt",
-                  "web/sub/foo.txt"
-                ]
-              }
-            }
-          ]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo"),
-          d.file("bar.txt", "bar"),
-          d.dir("sub", [
-            d.file("foo.txt", "foo"),
-          ])
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShould404("foo.out");
-      requestShould404("sub/foo.out");
-      requestShouldSucceed("bar.out", "bar.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/exclusion/exclude_asset_prefix_test.dart b/sdk/lib/_internal/pub/test/transformer/exclusion/exclude_asset_prefix_test.dart
deleted file mode 100644
index 6e2cfac..0000000
--- a/sdk/lib/_internal/pub/test/transformer/exclusion/exclude_asset_prefix_test.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("allows a directory prefix to exclude", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {
-              "myapp/src/transformer": {
-                "\$exclude": "web/sub"
-              }
-            }
-          ]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo"),
-          d.file("bar.txt", "bar"),
-          d.dir("sub", [
-            d.file("foo.txt", "foo"),
-          ]),
-          d.dir("subbub", [
-            d.file("foo.txt", "foo"),
-          ])
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.out", "foo.out");
-      requestShouldSucceed("bar.out", "bar.out");
-      requestShouldSucceed("subbub/foo.out", "foo.out");
-      requestShould404("sub/foo.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/exclusion/exclude_asset_string_test.dart b/sdk/lib/_internal/pub/test/transformer/exclusion/exclude_asset_string_test.dart
deleted file mode 100644
index 81e4163..0000000
--- a/sdk/lib/_internal/pub/test/transformer/exclusion/exclude_asset_string_test.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("allows a single string as the asset to exclude", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {
-              "myapp/src/transformer": {
-                "\$exclude": "web/foo.txt"
-              }
-            }
-          ]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo"),
-          d.file("bar.txt", "bar"),
-          d.dir("sub", [
-            d.file("foo.txt", "foo"),
-          ])
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShould404("foo.out");
-      requestShouldSucceed("sub/foo.out", "foo.out");
-      requestShouldSucceed("bar.out", "bar.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/exclusion/include_asset_glob_test.dart b/sdk/lib/_internal/pub/test/transformer/exclusion/include_asset_glob_test.dart
deleted file mode 100644
index f153420..0000000
--- a/sdk/lib/_internal/pub/test/transformer/exclusion/include_asset_glob_test.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("allows a glob to include", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {
-              "myapp/src/transformer": {
-                "\$include": "**/foo.txt"
-              }
-            }
-          ]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo"),
-          d.file("bar.txt", "bar"),
-          d.dir("sub", [
-            d.file("foo.txt", "foo"),
-          ])
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.out", "foo.out");
-      requestShould404("bar.out");
-      requestShouldSucceed("sub/foo.out", "foo.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/exclusion/include_asset_list_test.dart b/sdk/lib/_internal/pub/test/transformer/exclusion/include_asset_list_test.dart
deleted file mode 100644
index 4d54d3a..0000000
--- a/sdk/lib/_internal/pub/test/transformer/exclusion/include_asset_list_test.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("includes assets", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {
-              "myapp/src/transformer": {
-                "\$include": [
-                  "web/foo.txt",
-                  "web/sub/foo.txt"
-                ]
-              }
-            }
-          ]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo"),
-          d.file("bar.txt", "bar"),
-          d.dir("sub", [
-            d.file("foo.txt", "foo"),
-          ])
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.out", "foo.out");
-      requestShouldSucceed("sub/foo.out", "foo.out");
-      requestShould404("bar.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/exclusion/include_asset_prefix_test.dart b/sdk/lib/_internal/pub/test/transformer/exclusion/include_asset_prefix_test.dart
deleted file mode 100644
index 6434b64..0000000
--- a/sdk/lib/_internal/pub/test/transformer/exclusion/include_asset_prefix_test.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("allows a directory prefix to include", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {
-              "myapp/src/transformer": {
-                "\$include": "web/sub"
-              }
-            }
-          ]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo"),
-          d.file("bar.txt", "bar"),
-          d.dir("sub", [
-            d.file("foo.txt", "foo"),
-          ]),
-          d.dir("subbub", [
-            d.file("foo.txt", "foo"),
-          ])
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShould404("foo.out");
-      requestShould404("bar.out");
-      requestShouldSucceed("sub/foo.out", "foo.out");
-      requestShould404("subbub/foo.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/exclusion/include_asset_string_test.dart b/sdk/lib/_internal/pub/test/transformer/exclusion/include_asset_string_test.dart
deleted file mode 100644
index 0d90b36..0000000
--- a/sdk/lib/_internal/pub/test/transformer/exclusion/include_asset_string_test.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("allows a single string as the asset to include", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {
-              "myapp/src/transformer": {
-                "\$include": "web/foo.txt"
-              }
-            }
-          ]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo"),
-          d.file("bar.txt", "bar"),
-          d.dir("sub", [
-            d.file("foo.txt", "foo"),
-          ])
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.out", "foo.out");
-      requestShould404("sub/foo.out");
-      requestShould404("bar.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/exclusion/includes_before_excludes_test.dart b/sdk/lib/_internal/pub/test/transformer/exclusion/includes_before_excludes_test.dart
deleted file mode 100644
index b620019..0000000
--- a/sdk/lib/_internal/pub/test/transformer/exclusion/includes_before_excludes_test.dart
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("applies includes before excludes if both are present", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {
-              "myapp/src/transformer": {
-                "\$include": ["web/a.txt", "web/b.txt"],
-                "\$exclude": "web/a.txt"
-              }
-            }
-          ]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("a.txt", "a.txt"),
-          d.file("b.txt", "b.txt"),
-          d.file("c.txt", "c.txt")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShould404("a.out");
-      requestShouldSucceed("b.out", "b.txt.out");
-      requestShould404("c.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/exclusion/works_on_aggregate_transformer_test.dart b/sdk/lib/_internal/pub/test/transformer/exclusion/works_on_aggregate_transformer_test.dart
deleted file mode 100644
index 819d30fff..0000000
--- a/sdk/lib/_internal/pub/test/transformer/exclusion/works_on_aggregate_transformer_test.dart
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-const AGGREGATE_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as p;
-
-class ManyToOneTransformer extends AggregateTransformer {
-  ManyToOneTransformer.asPlugin();
-
-  String classifyPrimary(AssetId id) {
-    if (id.extension != '.txt') return null;
-    return p.url.dirname(id.path);
-  }
-
-  Future apply(AggregateTransform transform) {
-    return transform.primaryInputs.toList().then((assets) {
-      assets.sort((asset1, asset2) => asset1.id.path.compareTo(asset2.id.path));
-      return Future.wait(assets.map((asset) => asset.readAsString()));
-    }).then((contents) {
-      var id = new AssetId(transform.package,
-          p.url.join(transform.key, 'out.txt'));
-      transform.addOutput(new Asset.fromString(id, contents.join('\\n')));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions(">=0.14.1", () {
-    integration("works on an aggregate transformer", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {
-              "myapp": {
-                "\$include": ["web/a.txt", "web/b.txt", "web/c.txt"],
-                "\$exclude": "web/a.txt"
-              }
-            }
-          ]
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", AGGREGATE_TRANSFORMER),
-        ]),
-        d.dir("web", [
-          d.file("a.txt", "a"),
-          d.file("b.txt", "b"),
-          d.file("c.txt", "c"),
-          d.file("d.txt", "d")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("out.txt", "b\nc");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/exclusion/works_on_dart2js_test.dart b/sdk/lib/_internal/pub/test/transformer/exclusion/works_on_dart2js_test.dart
deleted file mode 100644
index a590293..0000000
--- a/sdk/lib/_internal/pub/test/transformer/exclusion/works_on_dart2js_test.dart
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("works on the dart2js transformer", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {
-              "\$dart2js": {
-                "\$include": ["web/a.dart", "web/b.dart"],
-                "\$exclude": "web/a.dart"
-              }
-            }
-          ]
-        }),
-        d.dir("web", [
-          d.file("a.dart", "void main() => print('hello');"),
-          d.file("b.dart", "void main() => print('hello');"),
-          d.file("c.dart", "void main() => print('hello');")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var server = pubServe();
-      // Dart2js should remain lazy.
-      server.stdout.expect("Build completed successfully");
-
-      requestShould404("a.dart.js");
-      requestShouldSucceed("b.dart.js", isNot(isEmpty));
-      server.stdout.expect(consumeThrough(emitsLines(
-          "[Info from Dart2JS]:\n"
-          "Compiling myapp|web/b.dart...")));
-      server.stdout.expect(consumeThrough("Build completed successfully"));
-
-      requestShould404("c.dart.js");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/exclusion/works_on_lazy_transformer_test.dart b/sdk/lib/_internal/pub/test/transformer/exclusion/works_on_lazy_transformer_test.dart
deleted file mode 100644
index 8fa5b4f..0000000
--- a/sdk/lib/_internal/pub/test/transformer/exclusion/works_on_lazy_transformer_test.dart
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("works on a lazy transformer", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {
-              "myapp": {
-                "\$include": ["web/a.txt", "web/b.txt"],
-                "\$exclude": "web/a.txt"
-              }
-            }
-          ]
-        }),
-        d.dir("lib", [d.file("transformer.dart", LAZY_TRANSFORMER)]),
-        d.dir("web", [
-          d.file("a.txt", "a"),
-          d.file("b.txt", "b"),
-          d.file("c.txt", "c")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var server = pubServe();
-      // The transformer should remain lazy.
-      server.stdout.expect("Build completed successfully");
-
-      requestShould404("a.out");
-      requestShouldSucceed("b.out", isNot(isEmpty));
-      server.stdout.expect(consumeThrough(emitsLines(
-          "[Info from LazyRewrite]:\n"
-          "Rewriting myapp|web/b.txt.")));
-      server.stdout.expect(consumeThrough("Build completed successfully"));
-
-      requestShould404("c.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/exclusion/works_on_transformer_group_test.dart b/sdk/lib/_internal/pub/test/transformer/exclusion/works_on_transformer_group_test.dart
deleted file mode 100644
index 27fd71c..0000000
--- a/sdk/lib/_internal/pub/test/transformer/exclusion/works_on_transformer_group_test.dart
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-import '../../serve/utils.dart';
-
-const GROUP = """
-import 'package:barback/barback.dart';
-
-import 'transformer.dart';
-
-class RewriteGroup implements TransformerGroup {
-  RewriteGroup.asPlugin();
-
-  Iterable<Iterable> get phases => [[new RewriteTransformer.asPlugin()]];
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("works on a transformer group", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {
-              "myapp/src/group": {
-                "\$include": ["web/a.txt", "web/b.txt"],
-                "\$exclude": "web/a.txt"
-              }
-            }
-          ]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER),
-          d.file("group.dart", GROUP)
-        ])]),
-        d.dir("web", [
-          d.file("a.txt", "a.txt"),
-          d.file("b.txt", "b.txt"),
-          d.file("c.txt", "c.txt")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShould404("a.out");
-      requestShouldSucceed("b.out", "b.txt.out");
-      requestShould404("c.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_file_that_defines_no_transforms_test.dart b/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_file_that_defines_no_transforms_test.dart
deleted file mode 100644
index ebfa434..0000000
--- a/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_file_that_defines_no_transforms_test.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-
-  withBarbackVersions("any", () {
-    integration("fails to load a file that defines no transforms", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/transformer"]
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", "library does_nothing;")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var pub = startPubServe();
-      pub.stderr.expect(startsWith('No transformers were defined in '));
-      pub.stderr.expect(startsWith('required by myapp.'));
-      pub.shouldExit(1);
-      pub.stderr.expect(never(contains('This is an unexpected error')));
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_non_existent_transform_test.dart b/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_non_existent_transform_test.dart
deleted file mode 100644
index 57456c6..0000000
--- a/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_non_existent_transform_test.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("fails to load a non-existent transform", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/transform"]
-        })
-      ]).create();
-
-      var pub = startPubServe();
-      pub.stderr.expect(
-          'Transformer library "package:myapp/transform.dart" not found.');
-      pub.shouldExit(1);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_pubspec_with_reserved_transformer_test.dart b/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_pubspec_with_reserved_transformer_test.dart
deleted file mode 100644
index 79f0fcb..0000000
--- a/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_pubspec_with_reserved_transformer_test.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-
-  withBarbackVersions("any", () {
-    integration("fails to load a pubspec with reserved transformer", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["\$nonexistent"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER)
-        ])])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var pub = startPubServe();
-      pub.stderr.expect(contains('Invalid transformer config: Unsupported '
-          'built-in transformer \$nonexistent.'));
-      pub.shouldExit(exit_codes.DATA);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_transform_from_a_deps_dev_dependency_test.dart b/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_transform_from_a_deps_dev_dependency_test.dart
deleted file mode 100644
index 3008835..0000000
--- a/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_transform_from_a_deps_dev_dependency_test.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("fails to load a transform from a non-dependency", () {
-      d.dir("bar", [
-        d.pubspec({
-          "name": "bar",
-          "version": "1.0.0",
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", dartTransformer('bar')),
-        ])
-      ]).create();
-
-      d.dir("foo", [
-        d.pubspec({
-          "name": "foo",
-          "version": "1.0.0",
-          "dev_dependencies": {"bar": {"path": "../bar"}},
-          "transformers": ["bar"]
-        })
-      ]).create();
-
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "dependencies": {"foo": {"path": "../foo"}}
-        })
-      ]).create();
-
-      var pub = startPubServe();
-      pub.stderr.expect(contains('Error loading transformer "bar": package '
-          '"bar" is not a dependency.'));
-      pub.shouldExit(exit_codes.DATA);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_transform_from_a_non_dependency_test.dart b/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_transform_from_a_non_dependency_test.dart
deleted file mode 100644
index 1e649c1..0000000
--- a/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_transform_from_a_non_dependency_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/exit_codes.dart' as exit_codes;
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("fails to load a transform from a non-dependency", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["foo"]
-        })
-      ]).create();
-
-      var pub = startPubServe();
-      pub.stderr.expect(contains('"foo" is not a dependency.'));
-      pub.shouldExit(exit_codes.DATA);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_transform_with_a_syntax_error_test.dart b/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_transform_with_a_syntax_error_test.dart
deleted file mode 100644
index ae98d66..0000000
--- a/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_transform_with_a_syntax_error_test.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-
-  // A syntax error will cause the analyzer to fail to parse the transformer
-  // when attempting to rewrite its imports.
-  withBarbackVersions("any", () {
-    integration("fails to load a transform with a syntax error", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", "syntax error")
-        ])])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var pub = startPubServe();
-      pub.stderr.expect(contains("unexpected token 'syntax'"));
-      pub.shouldExit(1);
-      pub.stderr.expect(never(contains('This is an unexpected error')));
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_transform_with_an_import_error_test.dart b/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_transform_with_an_import_error_test.dart
deleted file mode 100644
index 0d664bb..0000000
--- a/sdk/lib/_internal/pub/test/transformer/fails_to_load_a_transform_with_an_import_error_test.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-
-  // An import error will cause the isolate API to fail synchronously while
-  // loading the transformer.
-  withBarbackVersions("any", () {
-    integration("fails to load a transform with an import error", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", "import 'does/not/exist.dart';")
-        ])])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-      var pub = startPubServe();
-      pub.stderr.expect("Unhandled exception:");
-      pub.stderr.expect(
-          startsWith("Load Error for "));
-      pub.shouldExit(1);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/fails_to_load_an_unconfigurable_transformer_when_config_is_passed_test.dart b/sdk/lib/_internal/pub/test/transformer/fails_to_load_an_unconfigurable_transformer_when_config_is_passed_test.dart
deleted file mode 100644
index 9e18ce5..0000000
--- a/sdk/lib/_internal/pub/test/transformer/fails_to_load_an_unconfigurable_transformer_when_config_is_passed_test.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-
-  withBarbackVersions("any", () {
-     integration("fails to load an unconfigurable transformer when config is "
-         "passed", () {
-       d.dir(appPath, [
-         d.pubspec({
-           "name": "myapp",
-           "transformers": [{"myapp/src/transformer": {'foo': 'bar'}}]
-         }),
-         d.dir("lib", [d.dir("src", [
-           d.file("transformer.dart", REWRITE_TRANSFORMER)
-         ])])
-       ]).create();
-
-       createLockFile('myapp', pkg: ['barback']);
-
-       var pub = startPubServe();
-       pub.stderr.expect(startsWith('No transformers that accept configuration '
-           'were defined in '));
-       pub.shouldExit(1);
-     });
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/transformer/ignores_a_transformer_on_test_files_in_a_dependency_test.dart b/sdk/lib/_internal/pub/test/transformer/ignores_a_transformer_on_test_files_in_a_dependency_test.dart
deleted file mode 100644
index c62c00a..0000000
--- a/sdk/lib/_internal/pub/test/transformer/ignores_a_transformer_on_test_files_in_a_dependency_test.dart
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  // Regression test for issue 23480
-  integration("ignores a transformer on test files in a dependency", () {
-    servePackages((builder) {
-      builder.serveRepoPackage('barback');
-
-      builder.serve("bar", "1.2.3", contents: [
-        d.dir("lib", [
-          // Make this invalid so that if it does get loaded, pub will
-          // definitely throw an error.
-          d.file("bar.dart", "{invalid Dart code)")
-        ])
-      ]);
-
-      builder.serve("foo", "1.2.3",
-        pubspec: {
-        "name": "foo",
-        "version": "1.0.0",
-        "dev_dependencies": {
-          "bar": "any"
-        },
-        "transformers": [{
-          "bar": {"\$include": "test/**"}
-        }]
-      }, contents: [
-        d.dir("test", [
-          d.file("my_test.dart", "void main() {}")
-        ])
-      ]);
-    });
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {"foo": "any"}
-      }),
-      d.dir("web", [
-        d.file("foo.txt", "foo")
-      ])
-    ]).create();
-
-    pubGet();
-
-    pubServe();
-    requestShouldSucceed("foo.txt", "foo");
-    endPubServe();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/loads_a_declaring_aggregate_transformer_test.dart b/sdk/lib/_internal/pub/test/transformer/loads_a_declaring_aggregate_transformer_test.dart
deleted file mode 100644
index ff4ba7d7..0000000
--- a/sdk/lib/_internal/pub/test/transformer/loads_a_declaring_aggregate_transformer_test.dart
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const AGGREGATE_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as p;
-
-class ManyToOneTransformer extends AggregateTransformer
-    implements DeclaringAggregateTransformer {
-  ManyToOneTransformer.asPlugin();
-
-  String classifyPrimary(AssetId id) {
-    if (id.extension != '.out') return null;
-    return p.url.dirname(id.path);
-  }
-
-  Future apply(AggregateTransform transform) {
-    return transform.primaryInputs.toList().then((assets) {
-      assets.sort((asset1, asset2) => asset1.id.path.compareTo(asset2.id.path));
-      return Future.wait(assets.map((asset) => asset.readAsString()));
-    }).then((contents) {
-      var id = new AssetId(transform.package,
-          p.url.join(transform.key, 'out.final'));
-      transform.addOutput(new Asset.fromString(id, contents.join('\\n')));
-    });
-  }
-
-  void declareOutputs(DeclaringAggregateTransform transform) {
-    transform.declareOutput(new AssetId(transform.package,
-        p.url.join(transform.key, 'out.final')));
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions(">=0.14.1", () {
-    integration("loads a declaring aggregate transformer", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/lazy", "myapp/aggregate"]
-        }),
-        d.dir("lib", [
-          d.file("lazy.dart", LAZY_TRANSFORMER),
-          d.file("aggregate.dart", AGGREGATE_TRANSFORMER),
-        ]),
-        d.dir("web", [
-          d.file("foo.txt", "foo"),
-          d.file("bar.txt", "bar")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var server = pubServe();
-      // The transformer should preserve laziness.
-      server.stdout.expect("Build completed successfully");
-
-      requestShouldSucceed("out.final", "bar.out\nfoo.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/loads_a_diamond_transformer_dependency_graph_test.dart b/sdk/lib/_internal/pub/test/transformer/loads_a_diamond_transformer_dependency_graph_test.dart
deleted file mode 100644
index e7a35f2..0000000
--- a/sdk/lib/_internal/pub/test/transformer/loads_a_diamond_transformer_dependency_graph_test.dart
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("loads a diamond transformer dependency graph", () {
-      d.dir("top", [
-        d.pubspec({
-          "name": "top",
-          "version": "1.0.0"
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", dartTransformer('top')),
-        ])
-      ]).create();
-
-      d.dir("left", [
-        d.pubspec({
-          "name": "left",
-          "version": "1.0.0",
-          "transformers": ["top/transformer"],
-          "dependencies": {"top": {"path": "../top"}}
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", dartTransformer('left')),
-        ])
-      ]).create();
-
-      d.dir("right", [
-        d.pubspec({
-          "name": "right",
-          "version": "1.0.0",
-          "transformers": ["top/transformer"],
-          "dependencies": {"top": {"path": "../top"}}
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", dartTransformer('right')),
-        ])
-      ]).create();
-
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            "left/transformer",
-            "right/transformer",
-            "myapp/transformer"
-          ],
-          "dependencies": {
-            'left': {'path': '../left'},
-            'right': {'path': '../right'},
-          }
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", dartTransformer('myapp'))
-        ]),
-        d.dir("web", [
-          d.file("main.dart", 'const TOKEN = "main.dart";')
-        ])
-      ]).create();
-
-      createLockFile('myapp',
-          sandbox: ['top', 'left', 'right'],
-          pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("main.dart",
-          'const TOKEN = "(((main.dart, (left, top)), (right, top)), ((myapp, '
-          '(left, top)), (right, top)))";');
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/loads_a_lazy_aggregate_transformer_test.dart b/sdk/lib/_internal/pub/test/transformer/loads_a_lazy_aggregate_transformer_test.dart
deleted file mode 100644
index 80d1072..0000000
--- a/sdk/lib/_internal/pub/test/transformer/loads_a_lazy_aggregate_transformer_test.dart
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const AGGREGATE_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as p;
-
-class ManyToOneTransformer extends AggregateTransformer
-    implements LazyAggregateTransformer {
-  ManyToOneTransformer.asPlugin();
-
-  String classifyPrimary(AssetId id) {
-    if (id.extension != '.txt') return null;
-    return p.url.dirname(id.path);
-  }
-
-  Future apply(AggregateTransform transform) {
-    return transform.primaryInputs.toList().then((assets) {
-      assets.sort((asset1, asset2) => asset1.id.path.compareTo(asset2.id.path));
-      return Future.wait(assets.map((asset) => asset.readAsString()));
-    }).then((contents) {
-      var id = new AssetId(transform.package,
-          p.url.join(transform.key, 'out.txt'));
-      transform.addOutput(new Asset.fromString(id, contents.join('\\n')));
-    });
-  }
-
-  void declareOutputs(DeclaringAggregateTransform transform) {
-    transform.declareOutput(new AssetId(transform.package,
-        p.url.join(transform.key, 'out.txt')));
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions(">=0.14.1", () {
-    integration("loads a lazy aggregate transformer", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp"]
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", AGGREGATE_TRANSFORMER),
-        ]),
-        d.dir("web", [
-          d.file("foo.txt", "foo"),
-          d.file("bar.txt", "bar")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var server = pubServe();
-      // The transformer should preserve laziness.
-      server.stdout.expect("Build completed successfully");
-
-      requestShouldSucceed("out.txt", "bar\nfoo");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/loads_a_transformer_defined_in_an_exported_library_test.dart b/sdk/lib/_internal/pub/test/transformer/loads_a_transformer_defined_in_an_exported_library_test.dart
deleted file mode 100644
index aab1900..0000000
--- a/sdk/lib/_internal/pub/test/transformer/loads_a_transformer_defined_in_an_exported_library_test.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("loads a transformer defined in an exported library", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp"]
-        }),
-        d.dir("lib", [
-          d.file("myapp.dart", "export 'src/transformer.dart';"),
-          d.dir("src", [
-            d.file("transformer.dart", REWRITE_TRANSFORMER)
-          ])
-        ]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.out", "foo.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/loads_an_aggregate_transformer_test.dart b/sdk/lib/_internal/pub/test/transformer/loads_an_aggregate_transformer_test.dart
deleted file mode 100644
index 1b058f6..0000000
--- a/sdk/lib/_internal/pub/test/transformer/loads_an_aggregate_transformer_test.dart
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const AGGREGATE_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as p;
-
-class ManyToOneTransformer extends AggregateTransformer {
-  ManyToOneTransformer.asPlugin();
-
-  String classifyPrimary(AssetId id) {
-    if (id.extension != '.txt') return null;
-    return p.url.dirname(id.path);
-  }
-
-  Future apply(AggregateTransform transform) {
-    return transform.primaryInputs.toList().then((assets) {
-      assets.sort((asset1, asset2) => asset1.id.path.compareTo(asset2.id.path));
-      return Future.wait(assets.map((asset) => asset.readAsString()));
-    }).then((contents) {
-      var id = new AssetId(transform.package,
-          p.url.join(transform.key, 'out.txt'));
-      transform.addOutput(new Asset.fromString(id, contents.join('\\n')));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions(">=0.14.1", () {
-    integration("loads an aggregate transformer", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp"]
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", AGGREGATE_TRANSFORMER),
-        ]),
-        d.dir("web", [
-          d.file("foo.txt", "foo"),
-          d.file("bar.txt", "bar")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("out.txt", "bar\nfoo");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/loads_different_configurations_from_the_same_isolate_test.dart b/sdk/lib/_internal/pub/test/transformer/loads_different_configurations_from_the_same_isolate_test.dart
deleted file mode 100644
index 5efbb20..0000000
--- a/sdk/lib/_internal/pub/test/transformer/loads_different_configurations_from_the_same_isolate_test.dart
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("loads different configurations from the same isolate", () {
-      // If different configurations are loaded from different isolates, a
-      // transformer can end up being loaded twice. It's even possible for the
-      // second load to use code that's transformed by the first, which is
-      // really bad. This tests sets up such a scenario.
-      //
-      // The foo package has two self-transformers: foo/first and foo/second,
-      // loaded in that order. This means that *no instances of foo/first*
-      // should ever have their code transformed by foo/second.
-      //
-      // The myapp package also has a reference to foo/first. This reference has
-      // a different configuration than foo's, which means that if it's loaded
-      // in a separate isolate, it will be loaded after all of foo's
-      // transformers have run. This means that foo/first.dart will have been
-      // transformed by foo/first and foo/second, causing it to have different
-      // code than the previous instance. This tests asserts that that doesn't
-      // happen.
-
-      d.dir("foo", [
-        d.pubspec({
-          "name": "foo",
-          "version": "1.0.0",
-          "transformers": [
-            {"foo/first": {"addition": " in foo"}},
-            "foo/second"
-          ]
-        }),
-        d.dir("lib", [
-          d.file("first.dart", dartTransformer('foo/first')),
-          d.file("second.dart", dartTransformer('foo/second'))
-        ])
-      ]).create();
-
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": [
-            {
-              "foo/first": {
-                "addition": " in myapp",
-                "\$include": "web/first.dart"
-              }
-            },
-            {"foo/second": {"\$include": "web/second.dart"}}
-          ],
-          "dependencies": {'foo': {'path': '../foo'}}
-        }),
-        d.dir("web", [
-          // This is transformed by foo/first. It's used to see which
-          // transformers ran on foo/first.
-          d.file("first.dart", 'const TOKEN = "myapp/first";'),
-
-          // This is transformed by foo/second. It's used to see which
-          // transformers ran on foo/second.
-          d.file("second.dart", 'const TOKEN = "myapp/second";')
-        ])
-      ]).create();
-
-      createLockFile('myapp', sandbox: ['foo'], pkg: ['barback']);
-
-      pubServe();
-
-      // The version of foo/first used on myapp should have myapp's
-      // configuration and shouldn't be transformed by foo/second.
-      requestShouldSucceed("first.dart",
-          'const TOKEN = "(myapp/first, foo/first in myapp)";');
-
-      // foo/second should be transformed by only foo/first.
-      requestShouldSucceed("second.dart",
-          'const TOKEN = "(myapp/second, (foo/second, foo/first in foo))";');
-
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/multiple_transformers_reject_their_config_test.dart b/sdk/lib/_internal/pub/test/transformer/multiple_transformers_reject_their_config_test.dart
deleted file mode 100644
index 8461b5c..0000000
--- a/sdk/lib/_internal/pub/test/transformer/multiple_transformers_reject_their_config_test.dart
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import 'package:scheduled_test/scheduled_stream.dart';
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const REJECT_CONFIG_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class RejectConfigTransformer extends Transformer {
-  RejectConfigTransformer.asPlugin(BarbackSettings settings) {
-    throw "I hate these settings!";
-  }
-
-  Future<bool> isPrimary(_) => new Future.value(true);
-  Future apply(Transform transform) {}
-}
-""";
-
-main() {
-  initConfig();
-
-  withBarbackVersions("any", () {
-     integration("multiple transformers in the same phase reject their "
-         "configurations", () {
-       d.dir(appPath, [
-         d.pubspec({
-           "name": "myapp",
-           "transformers": [[
-             {"myapp/src/transformer": {'foo': 'bar'}},
-             {"myapp/src/transformer": {'baz': 'bang'}},
-             {"myapp/src/transformer": {'qux': 'fblthp'}}
-           ]]
-         }),
-         d.dir("lib", [d.dir("src", [
-           d.file("transformer.dart", REJECT_CONFIG_TRANSFORMER)
-         ])])
-       ]).create();
-
-       createLockFile('myapp', pkg: ['barback']);
-
-       // We should see three instances of the error message, once for each
-       // use of the transformer.
-       var pub = startPubServe();
-       for (var i = 0; i < 3; i++) {
-         pub.stderr.expect(consumeThrough(endsWith('Error loading transformer: '
-             'I hate these settings!')));
-       }
-       pub.shouldExit(1);
-     });
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/transformer/prefers_transformer_to_library_name_test.dart b/sdk/lib/_internal/pub/test/transformer/prefers_transformer_to_library_name_test.dart
deleted file mode 100644
index b28506c..0000000
--- a/sdk/lib/_internal/pub/test/transformer/prefers_transformer_to_library_name_test.dart
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const WRONG_TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class RewriteTransformer extends Transformer {
-  RewriteTransformer.asPlugin();
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) {
-    return transform.primaryInput.readAsString().then((contents) {
-      var id = transform.primaryInput.id.changeExtension(".wrong");
-      transform.addOutput(new Asset.fromString(id, "\$contents.wrong"));
-    });
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("prefers transformer.dart to <package name>.dart", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp"]
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER),
-          d.file("myapp.dart", WRONG_TRANSFORMER)
-        ]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.out", "foo.out");
-      requestShould404("foo.wrong");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/prints_a_transform_error_in_apply_test.dart b/sdk/lib/_internal/pub/test/transformer/prints_a_transform_error_in_apply_test.dart
deleted file mode 100644
index 2ec8320..0000000
--- a/sdk/lib/_internal/pub/test/transformer/prints_a_transform_error_in_apply_test.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-final transformer = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class RewriteTransformer extends Transformer {
-  RewriteTransformer.asPlugin();
-
-  String get allowedExtensions => '.txt';
-
-  Future apply(Transform transform) => throw new Exception('oh no!');
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("prints a transform error in apply", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", transformer)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var server = pubServe();
-      server.stderr.expect(emitsLines(
-          'Build error:\n'
-          'Transform Rewrite on myapp|web/foo.txt threw error: oh no!'));
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/prints_a_transform_interface_error_test.dart b/sdk/lib/_internal/pub/test/transformer/prints_a_transform_interface_error_test.dart
deleted file mode 100644
index 40bd9ee..0000000
--- a/sdk/lib/_internal/pub/test/transformer/prints_a_transform_interface_error_test.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-final transformer = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class RewriteTransformer extends Transformer {
-  RewriteTransformer.asPlugin();
-
-  String get allowedExtensions => '.txt';
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("prints a transform interface error", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", transformer)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      var server = pubServe();
-      server.stderr.expect(emitsLines(
-          "Build error:\n"
-          "Transform Rewrite on myapp|web/foo.txt threw error: Class "
-              "'RewriteTransformer' has no instance method 'apply'."));
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/runs_a_local_transform_on_the_application_package_test.dart b/sdk/lib/_internal/pub/test/transformer/runs_a_local_transform_on_the_application_package_test.dart
deleted file mode 100644
index 6412284..0000000
--- a/sdk/lib/_internal/pub/test/transformer/runs_a_local_transform_on_the_application_package_test.dart
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("runs a local transform on the application package", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.out", "foo.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/runs_a_third_party_transform_on_the_application_package_test.dart b/sdk/lib/_internal/pub/test/transformer/runs_a_third_party_transform_on_the_application_package_test.dart
deleted file mode 100644
index 99b2d06..0000000
--- a/sdk/lib/_internal/pub/test/transformer/runs_a_third_party_transform_on_the_application_package_test.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("runs a third-party transform on the application package", () {
-      d.dir("foo", [
-        d.libPubspec("foo", '1.0.0'),
-        d.dir("lib", [
-          d.file("foo.dart", REWRITE_TRANSFORMER)
-        ])
-      ]).create();
-
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "dependencies": {"foo": {"path": "../foo"}},
-          "transformers": ["foo"]
-        }),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', sandbox: ['foo'], pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.out", "foo.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/runs_a_third_party_transformer_on_a_local_transformer_test.dart b/sdk/lib/_internal/pub/test/transformer/runs_a_third_party_transformer_on_a_local_transformer_test.dart
deleted file mode 100644
index ca9dbdf..0000000
--- a/sdk/lib/_internal/pub/test/transformer/runs_a_third_party_transformer_on_a_local_transformer_test.dart
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("runs a third-party transformer on a local transformer", () {
-      d.dir("foo", [
-        d.libPubspec("foo", '1.0.0'),
-        d.dir("lib", [
-          d.file("transformer.dart", dartTransformer('foo'))
-        ])
-      ]).create();
-
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["foo/transformer", "myapp/transformer"],
-          "dependencies": {"foo": {"path": "../foo"}}
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", dartTransformer('myapp'))
-        ]),
-        d.dir("web", [
-          d.file("main.dart", 'const TOKEN = "main.dart";')
-        ])
-      ]).create();
-
-      createLockFile('myapp', sandbox: ['foo'], pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("main.dart",
-          'const TOKEN = "((main.dart, foo), (myapp, foo))";');
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/runs_a_transformer_group_test.dart b/sdk/lib/_internal/pub/test/transformer/runs_a_transformer_group_test.dart
deleted file mode 100644
index fa696bc..0000000
--- a/sdk/lib/_internal/pub/test/transformer/runs_a_transformer_group_test.dart
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const GROUP = """
-import 'package:barback/barback.dart';
-
-import 'transformer.dart';
-
-class RewriteGroup implements TransformerGroup {
-  RewriteGroup.asPlugin();
-
-  Iterable<Iterable> get phases => [[new RewriteTransformer.asPlugin()]];
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("runs a transformer group", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/group"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER),
-          d.file("group.dart", GROUP)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.out", "foo.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/runs_a_transformer_on_a_dependency_test.dart b/sdk/lib/_internal/pub/test/transformer/runs_a_transformer_on_a_dependency_test.dart
deleted file mode 100644
index b2092e5..0000000
--- a/sdk/lib/_internal/pub/test/transformer/runs_a_transformer_on_a_dependency_test.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("runs a local transformer on a dependency", () {
-      d.dir("foo", [
-        d.pubspec({
-          "name": "foo",
-          "version": "0.0.1",
-          "transformers": ["foo/transformer"]
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", REWRITE_TRANSFORMER),
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      d.dir(appPath, [
-        d.appPubspec({"foo": {"path": "../foo"}}),
-      ]).create();
-
-      createLockFile('myapp', sandbox: ['foo'], pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("packages/foo/foo.out", "foo.out");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/runs_one_third_party_transformer_on_another_test.dart b/sdk/lib/_internal/pub/test/transformer/runs_one_third_party_transformer_on_another_test.dart
deleted file mode 100644
index 079e377..0000000
--- a/sdk/lib/_internal/pub/test/transformer/runs_one_third_party_transformer_on_another_test.dart
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("runs one third-party transformer on another", () {
-      d.dir("foo", [
-        d.pubspec({
-          "name": "foo",
-          "version": "1.0.0"
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", dartTransformer('foo')),
-        ])
-      ]).create();
-
-      d.dir("bar", [
-        d.pubspec({
-          "name": "bar",
-          "version": "1.0.0",
-          "transformers": ["foo/transformer"],
-          "dependencies": {"foo": {"path": "../foo"}}
-        }),
-        d.dir("lib", [
-          d.file("transformer.dart", dartTransformer('bar')),
-        ])
-      ]).create();
-
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["bar/transformer"],
-          "dependencies": {'bar': {'path': '../bar'}}
-        }),
-        d.dir("web", [
-          d.file("main.dart", 'const TOKEN = "main.dart";')
-        ])
-      ]).create();
-
-      createLockFile('myapp', sandbox: ['foo', 'bar'], pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("main.dart",
-          'const TOKEN = "(main.dart, (bar, foo))";');
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/transformer/supports_a_transformer_that_doesnt_return_futures_test.dart b/sdk/lib/_internal/pub/test/transformer/supports_a_transformer_that_doesnt_return_futures_test.dart
deleted file mode 100644
index 0d67187..0000000
--- a/sdk/lib/_internal/pub/test/transformer/supports_a_transformer_that_doesnt_return_futures_test.dart
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS d.file
-// for 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 pub_tests;
-
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import '../serve/utils.dart';
-
-const TRANSFORMER = """
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-
-class RewriteTransformer extends Transformer implements DeclaringTransformer {
-  RewriteTransformer.asPlugin();
-
-  bool isPrimary(AssetId id) => id.extension == '.txt';
-
-  void apply(Transform transform) {
-    transform.addOutput(new Asset.fromString(
-        transform.primaryInput.id, "new contents"));
-  }
-
-  void declareOutputs(DeclaringTransform transform) {
-    transform.declareOutput(transform.primaryId);
-  }
-}
-""";
-
-main() {
-  initConfig();
-  withBarbackVersions("any", () {
-    integration("supports a transformer that doesn't return futures", () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "myapp",
-          "transformers": ["myapp/src/transformer"]
-        }),
-        d.dir("lib", [d.dir("src", [
-          d.file("transformer.dart", TRANSFORMER)
-        ])]),
-        d.dir("web", [
-          d.file("foo.txt", "foo")
-        ])
-      ]).create();
-
-      createLockFile('myapp', pkg: ['barback']);
-
-      pubServe();
-      requestShouldSucceed("foo.txt", "new contents");
-      endPubServe();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/unknown_source_test.dart b/sdk/lib/_internal/pub/test/unknown_source_test.dart
deleted file mode 100644
index 9ecc3a9..0000000
--- a/sdk/lib/_internal/pub/test/unknown_source_test.dart
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS d.file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE d.file.
-
-library pub_tests;
-
-import 'dart:convert';
-
-import 'descriptor.dart' as d;
-import 'test_pub.dart';
-
-main() {
-  initConfig();
-
-  forBothPubGetAndUpgrade((command) {
-    integration('fails gracefully on a dependency from an unknown source', () {
-      d.appDir({"foo": {"bad": "foo"}}).create();
-
-      pubCommand(command, error:
-          'Package myapp depends on foo from unknown source "bad".');
-    });
-
-    integration('fails gracefully on transitive dependency from an unknown '
-                'source', () {
-      d.dir('foo', [
-        d.libDir('foo', 'foo 0.0.1'),
-        d.libPubspec('foo', '0.0.1', deps: {"bar": {"bad": "bar"}})
-      ]).create();
-
-      d.appDir({"foo": {"path": "../foo"}}).create();
-
-      pubCommand(command, error:
-          'Package foo depends on bar from unknown source "bad".');
-    });
-
-    integration('ignores unknown source in lockfile', () {
-      d.dir('foo', [
-        d.libDir('foo'),
-        d.libPubspec('foo', '0.0.1')
-      ]).create();
-
-      // Depend on "foo" from a valid source.
-      d.dir(appPath, [
-        d.appPubspec({
-          "foo": {"path": "../foo"}
-        })
-      ]).create();
-
-      // But lock it to a bad one.
-      d.dir(appPath, [
-        d.file("pubspec.lock", JSON.encode({
-          'packages': {
-            'foo': {
-              'version': '0.0.0',
-              'source': 'bad',
-              'description': {
-                'name': 'foo'
-              }
-            }
-          }
-        }))
-      ]).create();
-
-      pubCommand(command);
-
-      // Should upgrade to the new one.
-      d.dir(packagesPath, [
-        d.dir("foo", [
-          d.file("foo.dart", 'main() => "foo";')
-        ])
-      ]).validate();
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/upgrade/dry_run_does_not_apply_changes_test.dart b/sdk/lib/_internal/pub/test/upgrade/dry_run_does_not_apply_changes_test.dart
deleted file mode 100644
index 6747a44..0000000
--- a/sdk/lib/_internal/pub/test/upgrade/dry_run_does_not_apply_changes_test.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/io.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("--dry-run shows report but does not apply changes", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0");
-      builder.serve("foo", "2.0.0");
-    });
-
-    // Create the first lockfile.
-    d.appDir({
-      "foo": "1.0.0"
-    }).create();
-
-    pubGet();
-
-    // Change the pubspec.
-    d.appDir({
-      "foo": "any"
-    }).create();
-
-    // Also delete the "packages" directory.
-    schedule(() {
-      deleteEntry(path.join(sandboxDir, appPath, "packages"));
-    });
-
-    // Do the dry run.
-    pubUpgrade(args: ["--dry-run"], output: allOf([
-      contains("> foo 2.0.0 (was 1.0.0)"),
-      contains("Would change 1 dependency.")
-    ]));
-
-    d.dir(appPath, [
-      // The lockfile should be unmodified.
-      d.matcherFile("pubspec.lock", contains("1.0.0")),
-      // The "packages" directory should not have been regenerated.
-      d.nothing("packages")
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/upgrade/git/do_not_upgrade_if_unneeded_test.dart b/sdk/lib/_internal/pub/test/upgrade/git/do_not_upgrade_if_unneeded_test.dart
deleted file mode 100644
index 4efce84..0000000
--- a/sdk/lib/_internal/pub/test/upgrade/git/do_not_upgrade_if_unneeded_test.dart
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("doesn't upgrade one locked Git package's dependencies if it's "
-      "not necessary", () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec("foo", "1.0.0", deps: {
-        "foo-dep": {"git": "../foo-dep.git"
-      }})
-    ]).create();
-
-    d.git('foo-dep.git', [
-      d.libDir('foo-dep'),
-      d.libPubspec('foo-dep', '1.0.0')
-    ]).create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ]),
-      d.dir('foo-dep', [
-        d.file('foo-dep.dart', 'main() => "foo-dep";')
-      ])
-    ]).validate();
-
-    d.git('foo.git', [
-      d.libDir('foo', 'foo 2'),
-      d.libPubspec("foo", "1.0.0", deps: {
-        "foo-dep": {"git": "../foo-dep.git"}
-      })
-    ]).create();
-
-    d.git('foo-dep.git', [
-      d.libDir('foo-dep', 'foo-dep 2'),
-      d.libPubspec('foo-dep', '1.0.0')
-    ]).commit();
-
-    pubUpgrade(args: ['foo']);
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo 2";')
-      ]),
-      d.dir('foo-dep', [
-        d.file('foo-dep.dart', 'main() => "foo-dep";')
-      ]),
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/upgrade/git/upgrade_locked_test.dart b/sdk/lib/_internal/pub/test/upgrade/git/upgrade_locked_test.dart
deleted file mode 100644
index d851fdc..0000000
--- a/sdk/lib/_internal/pub/test/upgrade/git/upgrade_locked_test.dart
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("upgrades locked Git packages", () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.0')
-    ]).create();
-
-    d.git('bar.git', [
-      d.libDir('bar'),
-      d.libPubspec('bar', '1.0.0')
-    ]).create();
-
-    d.appDir({
-      "foo": {"git": "../foo.git"},
-      "bar": {"git": "../bar.git"}
-    }).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ]),
-      d.dir('bar', [
-        d.file('bar.dart', 'main() => "bar";')
-      ])
-    ]).validate();
-
-    d.git('foo.git', [
-      d.libDir('foo', 'foo 2'),
-      d.libPubspec('foo', '1.0.0')
-    ]).commit();
-
-    d.git('bar.git', [
-      d.libDir('bar', 'bar 2'),
-      d.libPubspec('bar', '1.0.0')
-    ]).commit();
-
-    pubUpgrade();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo 2";')
-      ]),
-      d.dir('bar', [
-        d.file('bar.dart', 'main() => "bar 2";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/upgrade/git/upgrade_one_locked_test.dart b/sdk/lib/_internal/pub/test/upgrade/git/upgrade_one_locked_test.dart
deleted file mode 100644
index f44060e..0000000
--- a/sdk/lib/_internal/pub/test/upgrade/git/upgrade_one_locked_test.dart
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("upgrades one locked Git package but no others", () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.0')
-    ]).create();
-
-    d.git('bar.git', [
-      d.libDir('bar'),
-      d.libPubspec('bar', '1.0.0')
-    ]).create();
-
-    d.appDir({
-      "foo": {"git": "../foo.git"},
-      "bar": {"git": "../bar.git"}
-    }).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ]),
-      d.dir('bar', [
-        d.file('bar.dart', 'main() => "bar";')
-      ])
-    ]).validate();
-
-    d.git('foo.git', [
-      d.libDir('foo', 'foo 2'),
-      d.libPubspec('foo', '1.0.0')
-    ]).commit();
-
-    d.git('bar.git', [
-      d.libDir('bar', 'bar 2'),
-      d.libPubspec('bar', '1.0.0')
-    ]).commit();
-
-    pubUpgrade(args: ['foo']);
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo 2";')
-      ]),
-      d.dir('bar', [
-        d.file('bar.dart', 'main() => "bar";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/upgrade/git/upgrade_to_incompatible_pubspec_test.dart b/sdk/lib/_internal/pub/test/upgrade/git/upgrade_to_incompatible_pubspec_test.dart
deleted file mode 100644
index 90995ea..0000000
--- a/sdk/lib/_internal/pub/test/upgrade/git/upgrade_to_incompatible_pubspec_test.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../../lib/src/exit_codes.dart' as exit_codes;
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("upgrades Git packages to an incompatible pubspec", () {
-    ensureGit();
-
-    d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.0')
-    ]).create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-
-    d.git('foo.git', [
-      d.libDir('zoo'),
-      d.libPubspec('zoo', '1.0.0')
-    ]).commit();
-
-    pubUpgrade(error: contains('"name" field doesn\'t match expected name '
-        '"foo".'), exitCode: exit_codes.DATA);
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/upgrade/git/upgrade_to_nonexistent_pubspec_test.dart b/sdk/lib/_internal/pub/test/upgrade/git/upgrade_to_nonexistent_pubspec_test.dart
deleted file mode 100644
index b9bd476..0000000
--- a/sdk/lib/_internal/pub/test/upgrade/git/upgrade_to_nonexistent_pubspec_test.dart
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("upgrades Git packages to a nonexistent pubspec", () {
-    ensureGit();
-
-    var repo = d.git('foo.git', [
-      d.libDir('foo'),
-      d.libPubspec('foo', '1.0.0')
-    ]);
-    repo.create();
-
-    d.appDir({"foo": {"git": "../foo.git"}}).create();
-
-    pubGet();
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-
-    repo.runGit(['rm', 'pubspec.yaml']);
-    repo.runGit(['commit', '-m', 'delete']);
-
-    pubUpgrade(error: new RegExp(r'Could not find a file named "pubspec.yaml" '
-        r'in "[^\n]*"\.'));
-
-    d.dir(packagesPath, [
-      d.dir('foo', [
-        d.file('foo.dart', 'main() => "foo";')
-      ])
-    ]).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/upgrade/hosted/unlock_dependers_test.dart b/sdk/lib/_internal/pub/test/upgrade/hosted/unlock_dependers_test.dart
deleted file mode 100644
index e82146a..0000000
--- a/sdk/lib/_internal/pub/test/upgrade/hosted/unlock_dependers_test.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("upgrades a locked package's dependers in order to get it to max "
-      "version", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", deps: {"bar": "<2.0.0"});
-      builder.serve("bar", "1.0.0");
-    });
-
-    d.appDir({"foo": "any", "bar": "any"}).create();
-
-    pubGet();
-
-    d.packagesDir({
-      "foo": "1.0.0",
-      "bar": "1.0.0"
-    }).validate();
-
-    servePackages((builder) {
-      builder.serve("foo", "2.0.0", deps: {"bar": "<3.0.0"});
-      builder.serve("bar", "2.0.0");
-    });
-
-    pubUpgrade(args: ['bar']);
-
-    d.packagesDir({
-      "foo": "2.0.0",
-      "bar": "2.0.0"
-    }).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/upgrade/hosted/unlock_if_necessary_test.dart b/sdk/lib/_internal/pub/test/upgrade/hosted/unlock_if_necessary_test.dart
deleted file mode 100644
index 76edd98..0000000
--- a/sdk/lib/_internal/pub/test/upgrade/hosted/unlock_if_necessary_test.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("upgrades one locked pub server package's dependencies if it's "
-      "necessary", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", deps: {"foo_dep": "any"});
-      builder.serve("foo_dep", "1.0.0");
-    });
-
-    d.appDir({"foo": "any"}).create();
-
-    pubGet();
-
-    d.packagesDir({
-      "foo": "1.0.0",
-      "foo_dep": "1.0.0"
-    }).validate();
-
-    servePackages((builder) {
-      builder.serve("foo", "2.0.0", deps: {"foo_dep": ">1.0.0"});
-      builder.serve("foo_dep", "2.0.0");
-    });
-
-    pubUpgrade(args: ['foo']);
-
-    d.packagesDir({
-      "foo": "2.0.0",
-      "foo_dep": "2.0.0"
-    }).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/upgrade/hosted/upgrade_removed_constraints_test.dart b/sdk/lib/_internal/pub/test/upgrade/hosted/upgrade_removed_constraints_test.dart
deleted file mode 100644
index d641cd2..0000000
--- a/sdk/lib/_internal/pub/test/upgrade/hosted/upgrade_removed_constraints_test.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("upgrades dependencies whose constraints have been removed", () {
-    servePackages((builder) {
-      builder.serve("foo", "1.0.0", deps: {"shared-dep": "any"});
-      builder.serve("bar", "1.0.0", deps: {"shared-dep": "<2.0.0"});
-      builder.serve("shared-dep", "1.0.0");
-      builder.serve("shared-dep", "2.0.0");
-    });
-
-    d.appDir({"foo": "any", "bar": "any"}).create();
-
-    pubUpgrade();
-
-    d.packagesDir({
-      "foo": "1.0.0",
-      "bar": "1.0.0",
-      "shared-dep": "1.0.0"
-    }).validate();
-
-    d.appDir({"foo": "any"}).create();
-
-    pubUpgrade();
-
-    d.packagesDir({
-      "foo": "1.0.0",
-      "bar": null,
-      "shared-dep": "2.0.0"
-    }).validate();
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/upgrade/report/describes_change_test.dart b/sdk/lib/_internal/pub/test/upgrade/report/describes_change_test.dart
deleted file mode 100644
index 18110fc..0000000
--- a/sdk/lib/_internal/pub/test/upgrade/report/describes_change_test.dart
+++ /dev/null
@@ -1,62 +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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("shows how package changed from previous lockfile", () {
-    servePackages((builder) {
-      builder.serve("unchanged", "1.0.0");
-      builder.serve("version_changed", "1.0.0");
-      builder.serve("version_changed", "2.0.0");
-      builder.serve("source_changed", "1.0.0");
-    });
-
-    d.dir("source_changed", [
-      d.libDir("source_changed"),
-      d.libPubspec("source_changed", "2.0.0")
-    ]).create();
-
-    d.dir("description_changed_1", [
-      d.libDir("description_changed"),
-      d.libPubspec("description_changed", "1.0.0")
-    ]).create();
-
-    d.dir("description_changed_2", [
-      d.libDir("description_changed"),
-      d.libPubspec("description_changed", "1.0.0")
-    ]).create();
-
-    // Create the first lockfile.
-    d.appDir({
-      "unchanged": "any",
-      "version_changed": "1.0.0",
-      "source_changed": "any",
-      "description_changed": {"path": "../description_changed_1"}
-    }).create();
-
-    pubGet();
-
-    // Change the pubspec.
-    d.appDir({
-      "unchanged": "any",
-      "version_changed": "any",
-      "source_changed": {"path": "../source_changed"},
-      "description_changed": {"path": "../description_changed_2"}
-    }).create();
-
-    // Upgrade everything.
-    pubUpgrade(output: new RegExp(r"""
-Resolving dependencies\.\.\..*
-. description_changed 1\.0\.0 from path \.\.[/\\]description_changed_2 \(was 1\.0\.0 from path \.\.[/\\]description_changed_1\)
-. source_changed 2\.0\.0 from path \.\.[/\\]source_changed \(was 1\.0\.0\)
-. unchanged 1\.0\.0
-. version_changed 2\.0\.0 \(was 1\.0\.0\)
-""", multiLine: true));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/upgrade/report/does_not_show_newer_versions_for_locked_packages_test.dart b/sdk/lib/_internal/pub/test/upgrade/report/does_not_show_newer_versions_for_locked_packages_test.dart
deleted file mode 100644
index 2520678..0000000
--- a/sdk/lib/_internal/pub/test/upgrade/report/does_not_show_newer_versions_for_locked_packages_test.dart
+++ /dev/null
@@ -1,44 +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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("does not show how many newer versions are available for "
-      "packages that are locked and not being upgraded", () {
-    servePackages((builder) {
-      builder.serve("not_upgraded", "1.0.0");
-      builder.serve("not_upgraded", "2.0.0");
-      builder.serve("not_upgraded", "3.0.0-dev");
-      builder.serve("upgraded", "1.0.0");
-      builder.serve("upgraded", "2.0.0");
-      builder.serve("upgraded", "3.0.0-dev");
-    });
-
-    // Constraint everything to the first version.
-    d.appDir({
-      "not_upgraded": "1.0.0",
-      "upgraded": "1.0.0"
-    }).create();
-
-    pubGet();
-
-    // Loosen the constraints.
-    d.appDir({
-      "not_upgraded": "any",
-      "upgraded": "any"
-    }).create();
-
-    // Only upgrade "upgraded".
-    pubUpgrade(args: ["upgraded"], output: new RegExp(r"""
-Resolving dependencies\.\.\..*
-  not_upgraded 1\.0\.0
-. upgraded 2\.0\.0 \(was 1\.0\.0\) \(3\.0\.0-dev available\)
-""", multiLine: true));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/upgrade/report/highlights_overrides_test.dart b/sdk/lib/_internal/pub/test/upgrade/report/highlights_overrides_test.dart
deleted file mode 100644
index b33e1ed..0000000
--- a/sdk/lib/_internal/pub/test/upgrade/report/highlights_overrides_test.dart
+++ /dev/null
@@ -1,30 +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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("highlights overridden packages", () {
-    servePackages((builder) => builder.serve("overridden", "1.0.0"));
-
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependency_overrides": {
-          "overridden": "any"
-        }
-      })
-    ]).create();
-
-    // Upgrade everything.
-    pubUpgrade(output: new RegExp(r"""
-Resolving dependencies\.\.\..*
-! overridden 1\.0\.0 \(overridden\)
-""", multiLine: true));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/upgrade/report/leading_character_shows_change_test.dart b/sdk/lib/_internal/pub/test/upgrade/report/leading_character_shows_change_test.dart
deleted file mode 100644
index eef1946..0000000
--- a/sdk/lib/_internal/pub/test/upgrade/report/leading_character_shows_change_test.dart
+++ /dev/null
@@ -1,92 +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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("the character before each package describes the change", () {
-    servePackages((builder) {
-      builder.serve("added", "1.0.0");
-      builder.serve("downgraded", "1.0.0");
-      builder.serve("downgraded", "2.0.0");
-      builder.serve("overridden", "1.0.0");
-      builder.serve("removed", "1.0.0");
-      builder.serve("source_changed", "1.0.0");
-      builder.serve("upgraded", "1.0.0");
-      builder.serve("upgraded", "2.0.0");
-      builder.serve("unchanged", "1.0.0");
-    });
-
-    d.dir("description_changed_1", [
-      d.libDir("description_changed"),
-      d.libPubspec("description_changed", "1.0.0")
-    ]).create();
-
-    d.dir("description_changed_2", [
-      d.libDir("description_changed"),
-      d.libPubspec("description_changed", "1.0.0")
-    ]).create();
-
-    d.dir("source_changed", [
-      d.libDir("source_changed"),
-      d.libPubspec("source_changed", "1.0.0")
-    ]).create();
-
-    // Create the first lockfile.
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {
-          "description_changed": {"path": "../description_changed_1"},
-          "downgraded": "2.0.0",
-          "removed": "any",
-          "source_changed": "any",
-          "unchanged": "any",
-          "upgraded": "1.0.0"
-        },
-        "dependency_overrides": {
-          "overridden": "any"
-        }
-      })
-    ]).create();
-
-    pubGet();
-
-    // Change the pubspec.
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependencies": {
-          "added": "any",
-          "description_changed": {"path": "../description_changed_2"},
-          "downgraded": "1.0.0",
-          "source_changed": {"path": "../source_changed"},
-          "unchanged": "any",
-          "upgraded": "2.0.0"
-        },
-        "dependency_overrides": {
-          "overridden": "any"
-        }
-      })
-    ]).create();
-
-    // Upgrade everything.
-    pubUpgrade(output: new RegExp(r"""
-Resolving dependencies\.\.\..*
-\+ added .*
-\* description_changed .*
-< downgraded .*
-! overridden .*
-\* source_changed .*
-  unchanged .*
-> upgraded .*
-These packages are no longer being depended on:
-- removed .*
-""", multiLine: true));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/upgrade/report/shows_newer_available_versions_test.dart b/sdk/lib/_internal/pub/test/upgrade/report/shows_newer_available_versions_test.dart
deleted file mode 100644
index 9936447..0000000
--- a/sdk/lib/_internal/pub/test/upgrade/report/shows_newer_available_versions_test.dart
+++ /dev/null
@@ -1,52 +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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("shows how many newer versions are available", () {
-    servePackages((builder) {
-      builder.serve("multiple_newer", "1.0.0");
-      builder.serve("multiple_newer", "1.0.1-unstable.1");
-      builder.serve("multiple_newer", "1.0.1");
-      builder.serve("multiple_newer", "1.0.2-unstable.1");
-      builder.serve("multiple_newer_stable", "1.0.0");
-      builder.serve("multiple_newer_stable", "1.0.1");
-      builder.serve("multiple_newer_stable", "1.0.2");
-      builder.serve("multiple_newer_unstable", "1.0.0");
-      builder.serve("multiple_newer_unstable", "1.0.1-unstable.1");
-      builder.serve("multiple_newer_unstable", "1.0.1-unstable.2");
-      builder.serve("no_newer", "1.0.0");
-      builder.serve("one_newer_unstable", "1.0.0");
-      builder.serve("one_newer_unstable", "1.0.1-unstable.1");
-      builder.serve("one_newer_stable", "1.0.0");
-      builder.serve("one_newer_stable", "1.0.1");
-    });
-
-    // Constraint everything to the first version.
-    d.appDir({
-      "multiple_newer": "1.0.0",
-      "multiple_newer_stable": "1.0.0",
-      "multiple_newer_unstable": "1.0.0",
-      "no_newer": "1.0.0",
-      "one_newer_unstable": "1.0.0",
-      "one_newer_stable": "1.0.0"
-    }).create();
-
-    // Upgrade everything.
-    pubUpgrade(output: new RegExp(r"""
-Resolving dependencies\.\.\..*
-. multiple_newer 1\.0\.0 \(1\.0\.1 available\)
-. multiple_newer_stable 1\.0\.0 \(1\.0\.2\ available\)
-. multiple_newer_unstable 1\.0\.0 \(1\.0\.1-unstable\.2 available\)
-. no_newer 1\.0\.0
-. one_newer_stable 1\.0\.0 \(1\.0\.1 available\)
-. one_newer_unstable 1\.0\.0 \(1\.0\.1-unstable\.1 available\)
-""", multiLine: true));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/upgrade/report/shows_number_of_changed_dependencies_test.dart b/sdk/lib/_internal/pub/test/upgrade/report/shows_number_of_changed_dependencies_test.dart
deleted file mode 100644
index ebbe2ee..0000000
--- a/sdk/lib/_internal/pub/test/upgrade/report/shows_number_of_changed_dependencies_test.dart
+++ /dev/null
@@ -1,38 +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 pub_tests;
-
-import '../../descriptor.dart' as d;
-import '../../test_pub.dart';
-
-main() {
-  initConfig();
-  integration("does not show how many newer versions are available for "
-      "packages that are locked and not being upgraded", () {
-    servePackages((builder) {
-      builder.serve("a", "1.0.0");
-      builder.serve("b", "1.0.0");
-      builder.serve("c", "2.0.0");
-    });
-
-    d.appDir({
-      "a": "any"
-    }).create();
-
-    // One dependency changed.
-    pubUpgrade(output: new RegExp(r"Changed 1 dependency!$"));
-
-    // Remove one and add two.
-    d.appDir({
-      "b": "any",
-      "c": "any"
-    }).create();
-
-    pubUpgrade(output: new RegExp(r"Changed 3 dependencies!$"));
-
-    // Don't change anything.
-    pubUpgrade(output: new RegExp(r"No dependencies changed.$"));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/utils_test.dart b/sdk/lib/_internal/pub/test/utils_test.dart
deleted file mode 100644
index a137d2d..0000000
--- a/sdk/lib/_internal/pub/test/utils_test.dart
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library utils_test;
-
-import 'package:unittest/unittest.dart';
-import 'test_pub.dart';
-import '../lib/src/utils.dart';
-
-main() {
-  initConfig();
-
-  group('yamlToString()', () {
-    test('null', () {
-      expect(yamlToString(null), equals('null'));
-    });
-
-    test('numbers', () {
-      expect(yamlToString(123), equals('123'));
-      expect(yamlToString(12.34), equals('12.34'));
-    });
-
-    test('does not quote strings that do not need it', () {
-      expect(yamlToString('a'), equals('a'));
-      expect(yamlToString('some-string'), equals('some-string'));
-      expect(yamlToString('hey123CAPS'), equals('hey123CAPS'));
-      expect(yamlToString("_under_score"), equals('_under_score'));
-    });
-
-    test('quotes other strings', () {
-      expect(yamlToString(''), equals('""'));
-      expect(yamlToString('123'), equals('"123"'));
-      expect(yamlToString('white space'), equals('"white space"'));
-      expect(yamlToString('"quote"'), equals(r'"\"quote\""'));
-      expect(yamlToString("apostrophe'"), equals('"apostrophe\'"'));
-      expect(yamlToString("new\nline"), equals(r'"new\nline"'));
-      expect(yamlToString("?unctu@t!on"), equals(r'"?unctu@t!on"'));
-    });
-
-    test('lists use JSON style', () {
-      expect(yamlToString([1, 2, 3]), equals('[1,2,3]'));
-    });
-
-    test('uses indentation for maps', () {
-      expect(yamlToString({'a': {'b': 1, 'c': 2}, 'd': 3}),
-          equals("""
-a:
-  b: 1
-  c: 2
-d: 3"""));
-    });
-
-    test('sorts map keys', () {
-      expect(yamlToString({'a': 1, 'c': 2, 'b': 3, 'd': 4}),
-          equals("""
-a: 1
-b: 3
-c: 2
-d: 4"""));
-    });
-
-    test('quotes map keys as needed', () {
-      expect(yamlToString({'no': 1, 'yes!': 2, '123': 3}),
-          equals("""
-"123": 3
-no: 1
-"yes!": 2"""));
-    });
-
-    test('handles non-string map keys', () {
-      var map = new Map();
-      map[null] = "null";
-      map[123] = "num";
-      map[true] = "bool";
-
-      expect(yamlToString(map),
-          equals("""
-123: num
-null: null
-true: bool"""));
-    });
-
-    test('handles empty maps', () {
-      expect(yamlToString({}), equals("{}"));
-      expect(yamlToString({'a': {}, 'b': {}}), equals("""
-a: {}
-b: {}"""));
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/validator/compiled_dartdoc_test.dart b/sdk/lib/_internal/pub/test/validator/compiled_dartdoc_test.dart
deleted file mode 100644
index d269b06..0000000
--- a/sdk/lib/_internal/pub/test/validator/compiled_dartdoc_test.dart
+++ /dev/null
@@ -1,105 +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 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/entrypoint.dart';
-import '../../lib/src/validator.dart';
-import '../../lib/src/validator/compiled_dartdoc.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-Validator compiledDartdoc(Entrypoint entrypoint) =>
-  new CompiledDartdocValidator(entrypoint);
-
-main() {
-  initConfig();
-
-  group('should consider a package valid if it', () {
-    setUp(d.validPackage.create);
-
-    integration('looks normal', () => expectNoValidationError(compiledDartdoc));
-
-    integration('has most but not all files from compiling dartdoc', () {
-      d.dir(appPath, [
-        d.dir("doc-out", [
-          d.file("nav.json", ""),
-          d.file("index.html", ""),
-          d.file("styles.css", ""),
-          d.file("dart-logo-small.png", "")
-        ])
-      ]).create();
-      expectNoValidationError(compiledDartdoc);
-    });
-
-    integration('contains compiled dartdoc in a hidden directory', () {
-      ensureGit();
-
-      d.dir(appPath, [
-        d.dir(".doc-out", [
-          d.file('nav.json', ''),
-          d.file('index.html', ''),
-          d.file('styles.css', ''),
-          d.file('dart-logo-small.png', ''),
-          d.file('client-live-nav.js', '')
-        ])
-      ]).create();
-      expectNoValidationError(compiledDartdoc);
-    });
-
-    integration('contains compiled dartdoc in a gitignored directory', () {
-      ensureGit();
-
-      d.git(appPath, [
-        d.dir("doc-out", [
-          d.file('nav.json', ''),
-          d.file('index.html', ''),
-          d.file('styles.css', ''),
-          d.file('dart-logo-small.png', ''),
-          d.file('client-live-nav.js', '')
-        ]),
-        d.file(".gitignore", "/doc-out")
-      ]).create();
-      expectNoValidationError(compiledDartdoc);
-    });
-  });
-
-  group("should consider a package invalid if it", () {
-    integration('contains compiled dartdoc', () {
-      d.validPackage.create();
-
-      d.dir(appPath, [
-        d.dir('doc-out', [
-          d.file('nav.json', ''),
-          d.file('index.html', ''),
-          d.file('styles.css', ''),
-          d.file('dart-logo-small.png', ''),
-          d.file('client-live-nav.js', '')
-        ])
-      ]).create();
-
-      expectValidationWarning(compiledDartdoc);
-    });
-
-    integration('contains compiled dartdoc in a non-gitignored hidden '
-        'directory', () {
-      ensureGit();
-
-      d.validPackage.create();
-
-      d.git(appPath, [
-        d.dir('.doc-out', [
-          d.file('nav.json', ''),
-          d.file('index.html', ''),
-          d.file('styles.css', ''),
-          d.file('dart-logo-small.png', ''),
-          d.file('client-live-nav.js', '')
-        ])
-      ]).create();
-
-      expectValidationWarning(compiledDartdoc);
-    });
-  });
-}
\ No newline at end of file
diff --git a/sdk/lib/_internal/pub/test/validator/dependency_override_test.dart b/sdk/lib/_internal/pub/test/validator/dependency_override_test.dart
deleted file mode 100644
index 6f336a2..0000000
--- a/sdk/lib/_internal/pub/test/validator/dependency_override_test.dart
+++ /dev/null
@@ -1,30 +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 '../../lib/src/entrypoint.dart';
-import '../../lib/src/validator.dart';
-import '../../lib/src/validator/dependency_override.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-Validator dependencyOverride(Entrypoint entrypoint) =>
-    new DependencyOverrideValidator(entrypoint);
-
-main() {
-  initConfig();
-
-  integration('invalidates a package if it has dependency overrides', () {
-    d.dir(appPath, [
-      d.pubspec({
-        "name": "myapp",
-        "dependency_overrides": {
-          "foo": "<3.0.0"
-        }
-      })
-    ]).create();
-
-    expectValidationError(dependencyOverride);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/validator/dependency_test.dart b/sdk/lib/_internal/pub/test/validator/dependency_test.dart
deleted file mode 100644
index dd30129..0000000
--- a/sdk/lib/_internal/pub/test/validator/dependency_test.dart
+++ /dev/null
@@ -1,417 +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:async';
-import 'dart:convert';
-
-import 'package:http/http.dart' as http;
-import 'package:http/testing.dart';
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/entrypoint.dart';
-import '../../lib/src/validator.dart';
-import '../../lib/src/validator/dependency.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-Validator dependency(Entrypoint entrypoint) =>
-  new DependencyValidator(entrypoint);
-
-expectDependencyValidationError(String error) {
-  expect(schedulePackageValidation(dependency),
-      completion(pairOf(anyElement(contains(error)), isEmpty)));
-}
-
-expectDependencyValidationWarning(String warning) {
-  expect(schedulePackageValidation(dependency),
-      completion(pairOf(isEmpty, anyElement(contains(warning)))));
-}
-
-/// Sets up a test package with dependency [dep] and mocks a server with
-/// [hostedVersions] of the package available.
-setUpDependency(Map dep, {List<String> hostedVersions}) {
-  useMockClient(new MockClient((request) {
-    expect(request.method, equals("GET"));
-    expect(request.url.path, equals("/api/packages/foo"));
-
-    if (hostedVersions == null) {
-      return new Future.value(new http.Response("not found", 404));
-    } else {
-      return new Future.value(new http.Response(JSON.encode({
-        "name": "foo",
-        "uploaders": ["nweiz@google.com"],
-        "versions": hostedVersions.map((version) =>
-            packageVersionApiMap(packageMap('foo', version))).toList()
-      }), 200));
-    }
-  }));
-
-  d.dir(appPath, [
-    d.libPubspec("test_pkg", "1.0.0", deps: {"foo": dep})
-  ]).create();
-}
-
-main() {
-  initConfig();
-
-  group('should consider a package valid if it', () {
-    integration('looks normal', () {
-      d.validPackage.create();
-      expectNoValidationError(dependency);
-    });
-
-    integration('has a ^ constraint with an appropriate SDK constraint', () {
-      d.dir(appPath, [
-        d.libPubspec("test_pkg", "1.0.0", deps: {
-          "foo": "^1.2.3"
-        }, sdk: ">=1.8.0 <2.0.0")
-      ]).create();
-      expectNoValidationError(dependency);
-    });
-  });
-
-  group('should consider a package invalid if it', () {
-    setUp(d.validPackage.create);
-
-    group('has a git dependency', () {
-      group('where a hosted version exists', () {
-        integration("and should suggest the hosted primary version", () {
-          setUpDependency({'git': 'git://github.com/dart-lang/foo'},
-              hostedVersions: ["3.0.0-pre", "2.0.0", "1.0.0"]);
-          expectDependencyValidationWarning('  foo: ">=2.0.0 <3.0.0"');
-        });
-
-        integration("and should suggest the hosted prerelease version if "
-                    "it's the only version available", () {
-          setUpDependency({'git': 'git://github.com/dart-lang/foo'},
-              hostedVersions: ["3.0.0-pre", "2.0.0-pre"]);
-          expectDependencyValidationWarning('  foo: ">=3.0.0-pre <4.0.0"');
-        });
-
-        integration("and should suggest a tighter constraint if primary is "
-                    "pre-1.0.0", () {
-          setUpDependency({'git': 'git://github.com/dart-lang/foo'},
-              hostedVersions: ["0.0.1", "0.0.2"]);
-          expectDependencyValidationWarning('  foo: ">=0.0.2 <0.1.0"');
-        });
-      });
-
-      group('where no hosted version exists', () {
-        integration("and should use the other source's version", () {
-          setUpDependency({
-            'git': 'git://github.com/dart-lang/foo',
-            'version': '>=1.0.0 <2.0.0'
-          });
-          expectDependencyValidationWarning('  foo: ">=1.0.0 <2.0.0"');
-        });
-
-        integration("and should use the other source's unquoted version if "
-                    "concrete", () {
-          setUpDependency({
-            'git': 'git://github.com/dart-lang/foo',
-            'version': '0.2.3'
-          });
-          expectDependencyValidationWarning('  foo: 0.2.3');
-        });
-      });
-    });
-
-    group('has a path dependency', () {
-      group('where a hosted version exists', () {
-        integration("and should suggest the hosted primary version", () {
-          setUpDependency({'path': path.join(sandboxDir, 'foo')},
-              hostedVersions: ["3.0.0-pre", "2.0.0", "1.0.0"]);
-          expectDependencyValidationError('  foo: ">=2.0.0 <3.0.0"');
-        });
-
-        integration("and should suggest the hosted prerelease version if "
-                    "it's the only version available", () {
-          setUpDependency({'path': path.join(sandboxDir, 'foo')},
-              hostedVersions: ["3.0.0-pre", "2.0.0-pre"]);
-          expectDependencyValidationError('  foo: ">=3.0.0-pre <4.0.0"');
-        });
-
-        integration("and should suggest a tighter constraint if primary is "
-                    "pre-1.0.0", () {
-          setUpDependency({'path': path.join(sandboxDir, 'foo')},
-              hostedVersions: ["0.0.1", "0.0.2"]);
-          expectDependencyValidationError('  foo: ">=0.0.2 <0.1.0"');
-        });
-      });
-
-      group('where no hosted version exists', () {
-        integration("and should use the other source's version", () {
-          setUpDependency({
-            'path': path.join(sandboxDir, 'foo'),
-            'version': '>=1.0.0 <2.0.0'
-          });
-          expectDependencyValidationError('  foo: ">=1.0.0 <2.0.0"');
-        });
-
-        integration("and should use the other source's unquoted version if "
-                    "concrete", () {
-          setUpDependency({
-            'path': path.join(sandboxDir, 'foo'),
-            'version': '0.2.3'
-          });
-          expectDependencyValidationError('  foo: 0.2.3');
-        });
-      });
-    });
-
-    group('has an unconstrained dependency', () {
-      group('and it should not suggest a version', () {
-        integration("if there's no lockfile", () {
-          d.dir(appPath, [
-            d.libPubspec("test_pkg", "1.0.0", deps: {
-              "foo": "any"
-            })
-          ]).create();
-
-          expect(schedulePackageValidation(dependency), completion(
-              pairOf(isEmpty, everyElement(isNot(contains("\n  foo:"))))));
-        });
-
-        integration("if the lockfile doesn't have an entry for the "
-            "dependency", () {
-          d.dir(appPath, [
-            d.libPubspec("test_pkg", "1.0.0", deps: {
-              "foo": "any"
-            }),
-            d.file("pubspec.lock", JSON.encode({
-              'packages': {
-                'bar': {
-                  'version': '1.2.3',
-                  'source': 'hosted',
-                  'description': {
-                    'name': 'bar',
-                    'url': 'http://pub.dartlang.org'
-                  }
-                }
-              }
-            }))
-          ]).create();
-
-          expect(schedulePackageValidation(dependency), completion(
-              pairOf(isEmpty, everyElement(isNot(contains("\n  foo:"))))));
-        });
-      });
-
-      group('with a lockfile', () {
-        integration('and it should suggest a constraint based on the locked '
-            'version', () {
-          d.dir(appPath, [
-            d.libPubspec("test_pkg", "1.0.0", deps: {
-              "foo": "any"
-            }),
-            d.file("pubspec.lock", JSON.encode({
-              'packages': {
-                'foo': {
-                  'version': '1.2.3',
-                  'source': 'hosted',
-                  'description': {
-                    'name': 'foo',
-                    'url': 'http://pub.dartlang.org'
-                  }
-                }
-              }
-            }))
-          ]).create();
-
-          expectDependencyValidationWarning('  foo: ">=1.2.3 <2.0.0"');
-        });
-
-        integration('and it should suggest a concrete constraint if the locked '
-            'version is pre-1.0.0', () {
-          d.dir(appPath, [
-            d.libPubspec("test_pkg", "1.0.0", deps: {
-              "foo": "any"
-            }),
-            d.file("pubspec.lock", JSON.encode({
-              'packages': {
-                'foo': {
-                  'version': '0.1.2',
-                  'source': 'hosted',
-                  'description': {
-                    'name': 'foo',
-                    'url': 'http://pub.dartlang.org'
-                  }
-                }
-              }
-            }))
-          ]).create();
-
-          expectDependencyValidationWarning('  foo: ">=0.1.2 <0.2.0"');
-        });
-      });
-    });
-
-    integration('with a single-version dependency and it should suggest a '
-        'constraint based on the version', () {
-      d.dir(appPath, [
-        d.libPubspec("test_pkg", "1.0.0", deps: {
-          "foo": "1.2.3"
-        })
-      ]).create();
-
-      expectDependencyValidationWarning('  foo: ">=1.2.3 <2.0.0"');
-    });
-
-    group('has a dependency without a lower bound', () {
-      group('and it should not suggest a version', () {
-        integration("if there's no lockfile", () {
-          d.dir(appPath, [
-            d.libPubspec("test_pkg", "1.0.0", deps: {
-              "foo": "<3.0.0"
-            })
-          ]).create();
-
-          expect(schedulePackageValidation(dependency), completion(
-              pairOf(isEmpty, everyElement(isNot(contains("\n  foo:"))))));
-        });
-
-        integration("if the lockfile doesn't have an entry for the "
-            "dependency", () {
-          d.dir(appPath, [
-            d.libPubspec("test_pkg", "1.0.0", deps: {
-              "foo": "<3.0.0"
-            }),
-            d.file("pubspec.lock", JSON.encode({
-              'packages': {
-                'bar': {
-                  'version': '1.2.3',
-                  'source': 'hosted',
-                  'description': {
-                    'name': 'bar',
-                    'url': 'http://pub.dartlang.org'
-                  }
-                }
-              }
-            }))
-          ]).create();
-
-          expect(schedulePackageValidation(dependency), completion(
-              pairOf(isEmpty, everyElement(isNot(contains("\n  foo:"))))));
-        });
-      });
-
-      group('with a lockfile', () {
-        integration('and it should suggest a constraint based on the locked '
-            'version', () {
-          d.dir(appPath, [
-            d.libPubspec("test_pkg", "1.0.0", deps: {
-              "foo": "<3.0.0"
-            }),
-            d.file("pubspec.lock", JSON.encode({
-              'packages': {
-                'foo': {
-                  'version': '1.2.3',
-                  'source': 'hosted',
-                  'description': {
-                    'name': 'foo',
-                    'url': 'http://pub.dartlang.org'
-                  }
-                }
-              }
-            }))
-          ]).create();
-
-          expectDependencyValidationWarning('  foo: ">=1.2.3 <3.0.0"');
-        });
-
-        integration('and it should preserve the upper-bound operator', () {
-          d.dir(appPath, [
-            d.libPubspec("test_pkg", "1.0.0", deps: {
-              "foo": "<=3.0.0"
-            }),
-            d.file("pubspec.lock", JSON.encode({
-              'packages': {
-                'foo': {
-                  'version': '1.2.3',
-                  'source': 'hosted',
-                  'description': {
-                    'name': 'foo',
-                    'url': 'http://pub.dartlang.org'
-                  }
-                }
-              }
-            }))
-          ]).create();
-
-          expectDependencyValidationWarning('  foo: ">=1.2.3 <=3.0.0"');
-        });
-
-        integration('and it should expand the suggested constraint if the '
-            'locked version matches the upper bound', () {
-          d.dir(appPath, [
-            d.libPubspec("test_pkg", "1.0.0", deps: {
-              "foo": "<=1.2.3"
-            }),
-            d.file("pubspec.lock", JSON.encode({
-              'packages': {
-                'foo': {
-                  'version': '1.2.3',
-                  'source': 'hosted',
-                  'description': {
-                    'name': 'foo',
-                    'url': 'http://pub.dartlang.org'
-                  }
-                }
-              }
-            }))
-          ]).create();
-
-          expectDependencyValidationWarning('  foo: ">=1.2.3 <2.0.0"');
-        });
-      });
-    });
-
-    group('with a dependency without an upper bound', () {
-      integration('and it should suggest a constraint based on the lower bound',
-          () {
-        d.dir(appPath, [
-          d.libPubspec("test_pkg", "1.0.0", deps: {
-            "foo": ">=1.2.3"
-          })
-        ]).create();
-
-        expectDependencyValidationWarning('  foo: ">=1.2.3 <2.0.0"');
-      });
-
-      integration('and it should preserve the lower-bound operator', () {
-        d.dir(appPath, [
-          d.libPubspec("test_pkg", "1.0.0", deps: {
-            "foo": ">1.2.3"
-          })
-        ]).create();
-
-        expectDependencyValidationWarning('  foo: ">1.2.3 <2.0.0"');
-      });
-    });
-
-    group('has a ^ dependency', () {
-      integration("without an SDK constraint", () {
-        d.dir(appPath, [
-          d.libPubspec("integration_pkg", "1.0.0", deps: {
-            "foo": "^1.2.3"
-          })
-        ]).create();
-
-        expectDependencyValidationError('  foo: ">=1.2.3 <2.0.0"');
-      });
-
-      integration("with a too-broad SDK constraint", () {
-        d.dir(appPath, [
-          d.libPubspec("test_pkg", "1.0.0", deps: {
-            "foo": "^1.2.3"
-          }, sdk: ">=1.5.0 <2.0.0")
-        ]).create();
-
-        expectDependencyValidationError('  foo: ">=1.2.3 <2.0.0"');
-      });
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/validator/directory_test.dart b/sdk/lib/_internal/pub/test/validator/directory_test.dart
deleted file mode 100644
index 02571acd..0000000
--- a/sdk/lib/_internal/pub/test/validator/directory_test.dart
+++ /dev/null
@@ -1,48 +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 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/entrypoint.dart';
-import '../../lib/src/validator.dart';
-import '../../lib/src/validator/directory.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-Validator directory(Entrypoint entrypoint) =>
-  new DirectoryValidator(entrypoint);
-
-main() {
-  initConfig();
-
-  group('should consider a package valid if it', () {
-    setUp(d.validPackage.create);
-
-    integration('looks normal', () => expectNoValidationError(directory));
-
-    integration('has a nested directory named "tools"', () {
-      d.dir(appPath, [
-        d.dir("foo", [d.dir("tools")])
-      ]).create();
-      expectNoValidationError(directory);
-    });
-  });
-
-  group('should consider a package invalid if it has a top-level directory '
-      'named', () {
-    setUp(d.validPackage.create);
-
-    var names = [
-      "benchmarks", "docs", "examples", "sample", "samples", "tests", "tools"
-    ];
-
-    for (var name in names) {
-      integration('"$name"', () {
-        d.dir(appPath, [d.dir(name)]).create();
-        expectValidationWarning(directory);
-      });
-    }
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/validator/executable_test.dart b/sdk/lib/_internal/pub/test/validator/executable_test.dart
deleted file mode 100644
index 6d1fb81..0000000
--- a/sdk/lib/_internal/pub/test/validator/executable_test.dart
+++ /dev/null
@@ -1,57 +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 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/entrypoint.dart';
-import '../../lib/src/validator.dart';
-import '../../lib/src/validator/executable.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-Validator executable(Entrypoint entrypoint) =>
-  new ExecutableValidator(entrypoint);
-
-main() {
-  initConfig();
-
-  setUp(d.validPackage.create);
-
-  group('should consider a package valid if it', () {
-    integration('has executables that are present', () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "test_pkg",
-          "version": "1.0.0",
-          "executables": {
-            "one": "one_script",
-            "two": null
-          }
-        }),
-        d.dir("bin", [
-          d.file("one_script.dart", "main() => print('ok');"),
-          d.file("two.dart", "main() => print('ok');")
-        ])
-      ]).create();
-      expectNoValidationError(executable);
-    });
-  });
-
-  group("should consider a package invalid if it", () {
-    integration('is missing one or more listed executables', () {
-      d.dir(appPath, [
-        d.pubspec({
-          "name": "test_pkg",
-          "version": "1.0.0",
-          "executables": {
-            "nope": "not_there",
-            "nada": null
-          }
-        })
-      ]).create();
-      expectValidationWarning(executable);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/validator/license_test.dart b/sdk/lib/_internal/pub/test/validator/license_test.dart
deleted file mode 100644
index 5c3a06b..0000000
--- a/sdk/lib/_internal/pub/test/validator/license_test.dart
+++ /dev/null
@@ -1,51 +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 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/entrypoint.dart';
-import '../../lib/src/io.dart';
-import '../../lib/src/validator.dart';
-import '../../lib/src/validator/license.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-Validator license(Entrypoint entrypoint) => new LicenseValidator(entrypoint);
-
-main() {
-  initConfig();
-
-  group('should consider a package valid if it', () {
-    setUp(d.validPackage.create);
-
-    integration('looks normal', () => expectNoValidationError(license));
-
-    integration('has a COPYING file', () {
-      schedule(() => deleteEntry(path.join(sandboxDir, appPath, 'LICENSE')));
-      d.file(path.join(appPath, 'COPYING'), '').create();
-      expectNoValidationError(license);
-    });
-
-    integration('has a prefixed LICENSE file', () {
-      schedule(() => deleteEntry(path.join(sandboxDir, appPath, 'LICENSE')));
-      d.file(path.join(appPath, 'MIT_LICENSE'), '').create();
-      expectNoValidationError(license);
-    });
-
-    integration('has a suffixed LICENSE file', () {
-      schedule(() => deleteEntry(path.join(sandboxDir, appPath, 'LICENSE')));
-      d.file(path.join(appPath, 'LICENSE.md'), '').create();
-      expectNoValidationError(license);
-    });
-  });
-
-  integration('should consider a package invalid if it has no LICENSE file',
-      () {
-    d.validPackage.create();
-    schedule(() => deleteEntry(path.join(sandboxDir, appPath, 'LICENSE')));
-    expectValidationError(license);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/validator/name_test.dart b/sdk/lib/_internal/pub/test/validator/name_test.dart
deleted file mode 100644
index 17a460f..0000000
--- a/sdk/lib/_internal/pub/test/validator/name_test.dart
+++ /dev/null
@@ -1,117 +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 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/entrypoint.dart';
-import '../../lib/src/io.dart';
-import '../../lib/src/validator.dart';
-import '../../lib/src/validator/name.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-Validator name(Entrypoint entrypoint) => new NameValidator(entrypoint);
-
-main() {
-  initConfig();
-
-  group('should consider a package valid if it', () {
-    setUp(d.validPackage.create);
-
-    integration('looks normal', () => expectNoValidationError(name));
-
-    integration('has a badly-named library in lib/src', () {
-      d.dir(appPath, [
-        d.libPubspec("test_pkg", "1.0.0"),
-        d.dir("lib", [
-          d.file("test_pkg.dart", "int i = 1;"),
-          d.dir("src", [d.file("8ball.dart", "int j = 2;")])
-        ])
-      ]).create();
-      expectNoValidationError(name);
-    });
-
-    integration('has a name that starts with an underscore', () {
-      d.dir(appPath, [
-        d.libPubspec("_test_pkg", "1.0.0"),
-        d.dir("lib", [
-          d.file("_test_pkg.dart", "int i = 1;")
-        ])
-      ]).create();
-      expectNoValidationError(name);
-    });
-  });
-
-  group('should consider a package invalid if it', () {
-    setUp(d.validPackage.create);
-
-    integration('has an empty package name', () {
-      d.dir(appPath, [d.libPubspec("", "1.0.0")]).create();
-      expectValidationError(name);
-    });
-
-    integration('has a package name with an invalid character', () {
-      d.dir(appPath, [d.libPubspec("test-pkg", "1.0.0")]).create();
-      expectValidationError(name);
-    });
-
-    integration('has a package name that begins with a number', () {
-      d.dir(appPath, [d.libPubspec("8ball", "1.0.0")]).create();
-      expectValidationError(name);
-    });
-
-    integration('has a package name that contains upper-case letters', () {
-      d.dir(appPath, [d.libPubspec("TestPkg", "1.0.0")]).create();
-      expectValidationWarning(name);
-    });
-
-    integration('has a package name that is a Dart reserved word', () {
-      d.dir(appPath, [d.libPubspec("final", "1.0.0")]).create();
-      expectValidationError(name);
-    });
-
-    integration('has a library name with an invalid character', () {
-      d.dir(appPath, [
-        d.libPubspec("test_pkg", "1.0.0"),
-        d.dir("lib", [d.file("test-pkg.dart", "int i = 0;")])
-      ]).create();
-      expectValidationWarning(name);
-    });
-
-    integration('has a library name that begins with a number', () {
-      d.dir(appPath, [
-        d.libPubspec("test_pkg", "1.0.0"),
-        d.dir("lib", [d.file("8ball.dart", "int i = 0;")])
-      ]).create();
-      expectValidationWarning(name);
-    });
-
-    integration('has a library name that contains upper-case letters', () {
-      d.dir(appPath, [
-        d.libPubspec("test_pkg", "1.0.0"),
-        d.dir("lib", [d.file("TestPkg.dart", "int i = 0;")])
-      ]).create();
-      expectValidationWarning(name);
-    });
-
-    integration('has a library name that is a Dart reserved word', () {
-      d.dir(appPath, [
-        d.libPubspec("test_pkg", "1.0.0"),
-        d.dir("lib", [d.file("for.dart", "int i = 0;")])
-      ]).create();
-      expectValidationWarning(name);
-    });
-
-    integration('has a single library named differently than the package', () {
-      schedule(() =>
-          deleteEntry(path.join(sandboxDir, appPath, "lib", "test_pkg.dart")));
-      d.dir(appPath, [
-        d.dir("lib", [d.file("best_pkg.dart", "int i = 0;")])
-      ]).create();
-      expectValidationWarning(name);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/validator/pubspec_field_test.dart b/sdk/lib/_internal/pub/test/validator/pubspec_field_test.dart
deleted file mode 100644
index 4f0f33e..0000000
--- a/sdk/lib/_internal/pub/test/validator/pubspec_field_test.dart
+++ /dev/null
@@ -1,174 +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 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/entrypoint.dart';
-import '../../lib/src/validator.dart';
-import '../../lib/src/validator/pubspec_field.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-Validator pubspecField(Entrypoint entrypoint) =>
-  new PubspecFieldValidator(entrypoint);
-
-main() {
-  initConfig();
-
-  group('should consider a package valid if it', () {
-    setUp(d.validPackage.create);
-
-    integration('looks normal', () => expectNoValidationError(pubspecField));
-
-    integration('has "authors" instead of "author"', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg["authors"] = [pkg.remove("author")];
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-      expectNoValidationError(pubspecField);
-    });
-
-    integration('has an HTTPS homepage URL', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg["homepage"] = "https://pub.dartlang.org";
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectNoValidationError(pubspecField);
-    });
-
-    integration('has an HTTPS documentation URL', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg["documentation"] = "https://pub.dartlang.org";
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectNoValidationError(pubspecField);
-    });
-  });
-
-  group('should consider a package invalid if it', () {
-    setUp(d.validPackage.create);
-
-    integration('is missing the "homepage" field', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg.remove("homepage");
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectValidationError(pubspecField);
-    });
-
-    integration('is missing the "description" field', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg.remove("description");
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectValidationError(pubspecField);
-    });
-
-    integration('is missing the "author" field', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg.remove("author");
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectValidationError(pubspecField);
-    });
-
-    integration('has a non-string "homepage" field', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg["homepage"] = 12;
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectValidationError(pubspecField);
-    });
-
-    integration('has a non-string "description" field', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg["description"] = 12;
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectValidationError(pubspecField);
-    });
-
-    integration('has a non-string "author" field', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg["author"] = 12;
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectValidationError(pubspecField);
-    });
-
-    integration('has a non-list "authors" field', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg["authors"] = 12;
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectValidationError(pubspecField);
-    });
-
-    integration('has a non-string member of the "authors" field', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg["authors"] = [12];
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectValidationError(pubspecField);
-    });
-
-    integration('has a single author without an email', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg["author"] = "Natalie Weizenbaum";
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectValidationWarning(pubspecField);
-    });
-
-    integration('has one of several authors without an email', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg.remove("author");
-      pkg["authors"] = [
-        "Bob Nystrom <rnystrom@google.com>",
-        "Natalie Weizenbaum",
-        "John Messerly <jmesserly@google.com>"
-      ];
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectValidationWarning(pubspecField);
-    });
-
-    integration('has a single author without a name', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg["author"] = "<nweiz@google.com>";
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectValidationWarning(pubspecField);
-    });
-
-    integration('has one of several authors without a name', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg.remove("author");
-      pkg["authors"] = [
-        "Bob Nystrom <rnystrom@google.com>",
-        "<nweiz@google.com>",
-        "John Messerly <jmesserly@google.com>"
-      ];
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectValidationWarning(pubspecField);
-    });
-
-    integration('has a non-HTTP homepage URL', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg["homepage"] = "file:///foo/bar";
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectValidationError(pubspecField);
-    });
-
-    integration('has a non-HTTP documentation URL', () {
-      var pkg = packageMap("test_pkg", "1.0.0");
-      pkg["documentation"] = "file:///foo/bar";
-      d.dir(appPath, [d.pubspec(pkg)]).create();
-
-      expectValidationError(pubspecField);
-    });
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/validator/sdk_constraint_test.dart b/sdk/lib/_internal/pub/test/validator/sdk_constraint_test.dart
deleted file mode 100644
index 4efb822..0000000
--- a/sdk/lib/_internal/pub/test/validator/sdk_constraint_test.dart
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:async';
-import 'dart:convert';
-
-import 'package:http/http.dart' as http;
-import 'package:http/testing.dart';
-import 'package:path/path.dart' as path;
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/entrypoint.dart';
-import '../../lib/src/validator.dart';
-import '../../lib/src/validator/sdk_constraint.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-Validator sdkConstraint(Entrypoint entrypoint) =>
-  new SdkConstraintValidator(entrypoint);
-
-main() {
-  initConfig();
-
-  group('should consider a package valid if it', () {
-    integration('has no SDK constraint', () {
-      d.validPackage.create();
-      expectNoValidationError(sdkConstraint);
-    });
-
-    integration('has an SDK constraint without ^', () {
-      d.dir(appPath, [
-        d.libPubspec("test_pkg", "1.0.0", sdk: ">=1.8.0 <2.0.0")
-      ]).create();
-      expectNoValidationError(sdkConstraint);
-    });
-  });
-
-  test("should consider a package invalid if it has an SDK constraint with "
-      "^", () {
-    d.dir(appPath, [
-      d.libPubspec("test_pkg", "1.0.0", sdk: "^1.8.0")
-    ]).create();
-    expect(schedulePackageValidation(sdkConstraint),
-        completion(pairOf(anyElement(contains('">=1.8.0 <2.0.0"')), isEmpty)));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/validator/size_test.dart b/sdk/lib/_internal/pub/test/validator/size_test.dart
deleted file mode 100644
index 37b9eab..0000000
--- a/sdk/lib/_internal/pub/test/validator/size_test.dart
+++ /dev/null
@@ -1,33 +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:async';
-import 'dart:math' as math;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/validator/size.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-Function size(int size) {
-  return (entrypoint) =>
-      new SizeValidator(entrypoint, new Future.value(size));
-}
-
-main() {
-  initConfig();
-
-  setUp(d.validPackage.create);
-
-  integration('considers a package valid if it is <= 100 MB', () {
-    expectNoValidationError(size(100));
-    expectNoValidationError(size(100 * math.pow(2, 20)));
-  });
-
-  integration('considers a package invalid if it is more than 100 MB', () {
-    expectValidationError(size(100 * math.pow(2, 20) + 1));
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/validator/utf8_readme_test.dart b/sdk/lib/_internal/pub/test/validator/utf8_readme_test.dart
deleted file mode 100644
index 60e65fd..0000000
--- a/sdk/lib/_internal/pub/test/validator/utf8_readme_test.dart
+++ /dev/null
@@ -1,43 +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 'package:scheduled_test/scheduled_test.dart';
-
-import '../../lib/src/entrypoint.dart';
-import '../../lib/src/validator.dart';
-import '../../lib/src/validator/utf8_readme.dart';
-import '../descriptor.dart' as d;
-import '../test_pub.dart';
-import 'utils.dart';
-
-Validator utf8Readme(Entrypoint entrypoint) =>
-  new Utf8ReadmeValidator(entrypoint);
-
-main() {
-  initConfig();
-
-  group('should consider a package valid if it', () {
-    setUp(d.validPackage.create);
-
-    integration('looks normal', () => expectNoValidationError(utf8Readme));
-
-    integration('has a non-primary readme with invalid utf-8', () {
-      d.dir(appPath, [
-        d.file("README", "Valid utf-8"),
-        d.binaryFile("README.invalid", [192])
-      ]).create();
-      expectNoValidationError(utf8Readme);
-    });
-  });
-
-  integration('should consider a package invalid if it has a README with '
-      'invalid utf-8', () {
-    d.validPackage.create();
-
-    d.dir(appPath, [
-      d.binaryFile("README", [192])
-    ]).create();
-    expectValidationWarning(utf8Readme);
-  });
-}
diff --git a/sdk/lib/_internal/pub/test/validator/utils.dart b/sdk/lib/_internal/pub/test/validator/utils.dart
deleted file mode 100644
index 64a6b47..0000000
--- a/sdk/lib/_internal/pub/test/validator/utils.dart
+++ /dev/null
@@ -1,23 +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 validator.utils;
-
-import 'package:scheduled_test/scheduled_test.dart';
-
-import '../test_pub.dart';
-
-void expectNoValidationError(ValidatorCreator fn) {
-  expect(schedulePackageValidation(fn), completion(pairOf(isEmpty, isEmpty)));
-}
-
-void expectValidationError(ValidatorCreator fn) {
-  expect(schedulePackageValidation(fn),
-      completion(pairOf(isNot(isEmpty), anything)));
-}
-
-void expectValidationWarning(ValidatorCreator fn) {
-  expect(schedulePackageValidation(fn),
-      completion(pairOf(isEmpty, isNot(isEmpty))));
-}
diff --git a/sdk/lib/_internal/pub/test/version_solver_test.dart b/sdk/lib/_internal/pub/test/version_solver_test.dart
deleted file mode 100644
index d025ed7..0000000
--- a/sdk/lib/_internal/pub/test/version_solver_test.dart
+++ /dev/null
@@ -1,1542 +0,0 @@
-// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library pub_upgrade_test;
-
-import 'dart:async';
-
-import 'package:pub_semver/pub_semver.dart';
-import 'package:unittest/unittest.dart';
-
-import '../lib/src/lock_file.dart';
-import '../lib/src/log.dart' as log;
-import '../lib/src/package.dart';
-import '../lib/src/pubspec.dart';
-import '../lib/src/sdk.dart' as sdk;
-import '../lib/src/source/cached.dart';
-import '../lib/src/system_cache.dart';
-import '../lib/src/utils.dart';
-import '../lib/src/solver/version_solver.dart';
-import 'test_pub.dart';
-
-MockSource source1;
-MockSource source2;
-
-main() {
-  initConfig();
-
-  // Uncomment this to debug failing tests.
-  // log.verbosity = log.Verbosity.SOLVER;
-
-  // Since this test isn't run from the SDK, it can't find the "version" file
-  // to load. Instead, just manually inject a version.
-  sdk.version = new Version(1, 2, 3);
-
-  group('basic graph', basicGraph);
-  group('with lockfile', withLockFile);
-  group('root dependency', rootDependency);
-  group('dev dependency', devDependency);
-  group('unsolvable', unsolvable);
-  group('bad source', badSource);
-  group('backtracking', backtracking);
-  group('SDK constraint', sdkConstraint);
-  group('pre-release', prerelease);
-  group('override', override);
-  group('downgrade', downgrade);
-}
-
-void basicGraph() {
-  testResolve('no dependencies', {
-    'myapp 0.0.0': {}
-  }, result: {
-    'myapp from root': '0.0.0'
-  });
-
-  testResolve('simple dependency tree', {
-    'myapp 0.0.0': {
-      'a': '1.0.0',
-      'b': '1.0.0'
-    },
-    'a 1.0.0': {
-      'aa': '1.0.0',
-      'ab': '1.0.0'
-    },
-    'aa 1.0.0': {},
-    'ab 1.0.0': {},
-    'b 1.0.0': {
-      'ba': '1.0.0',
-      'bb': '1.0.0'
-    },
-    'ba 1.0.0': {},
-    'bb 1.0.0': {}
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '1.0.0',
-    'aa': '1.0.0',
-    'ab': '1.0.0',
-    'b': '1.0.0',
-    'ba': '1.0.0',
-    'bb': '1.0.0'
-  });
-
-  testResolve('shared dependency with overlapping constraints', {
-    'myapp 0.0.0': {
-      'a': '1.0.0',
-      'b': '1.0.0'
-    },
-    'a 1.0.0': {
-      'shared': '>=2.0.0 <4.0.0'
-    },
-    'b 1.0.0': {
-      'shared': '>=3.0.0 <5.0.0'
-    },
-    'shared 2.0.0': {},
-    'shared 3.0.0': {},
-    'shared 3.6.9': {},
-    'shared 4.0.0': {},
-    'shared 5.0.0': {},
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '1.0.0',
-    'b': '1.0.0',
-    'shared': '3.6.9'
-  });
-
-  testResolve('shared dependency where dependent version in turn affects '
-              'other dependencies', {
-    'myapp 0.0.0': {
-      'foo': '<=1.0.2',
-      'bar': '1.0.0'
-    },
-    'foo 1.0.0': {},
-    'foo 1.0.1': { 'bang': '1.0.0' },
-    'foo 1.0.2': { 'whoop': '1.0.0' },
-    'foo 1.0.3': { 'zoop': '1.0.0' },
-    'bar 1.0.0': { 'foo': '<=1.0.1' },
-    'bang 1.0.0': {},
-    'whoop 1.0.0': {},
-    'zoop 1.0.0': {}
-  }, result: {
-    'myapp from root': '0.0.0',
-    'foo': '1.0.1',
-    'bar': '1.0.0',
-    'bang': '1.0.0'
-  }, maxTries: 2);
-
-  testResolve('circular dependency', {
-    'myapp 1.0.0': {
-      'foo': '1.0.0'
-    },
-    'foo 1.0.0': {
-      'bar': '1.0.0'
-    },
-    'bar 1.0.0': {
-      'foo': '1.0.0'
-    }
-  }, result: {
-    'myapp from root': '1.0.0',
-    'foo': '1.0.0',
-    'bar': '1.0.0'
-  });
-
-  testResolve('removed dependency', {
-    'myapp 1.0.0': {
-      'foo': '1.0.0',
-      'bar': 'any'
-    },
-    'foo 1.0.0': {},
-    'foo 2.0.0': {},
-    'bar 1.0.0': {},
-    'bar 2.0.0': {
-      'baz': '1.0.0'
-    },
-    'baz 1.0.0': {
-      'foo': '2.0.0'
-    }
-  }, result: {
-    'myapp from root': '1.0.0',
-    'foo': '1.0.0',
-    'bar': '1.0.0'
-  }, maxTries: 2);
-}
-
-withLockFile() {
-  testResolve('with compatible locked dependency', {
-    'myapp 0.0.0': {
-      'foo': 'any'
-    },
-    'foo 1.0.0': { 'bar': '1.0.0' },
-    'foo 1.0.1': { 'bar': '1.0.1' },
-    'foo 1.0.2': { 'bar': '1.0.2' },
-    'bar 1.0.0': {},
-    'bar 1.0.1': {},
-    'bar 1.0.2': {}
-  }, lockfile: {
-    'foo': '1.0.1'
-  }, result: {
-    'myapp from root': '0.0.0',
-    'foo': '1.0.1',
-    'bar': '1.0.1'
-  });
-
-  testResolve('with incompatible locked dependency', {
-    'myapp 0.0.0': {
-      'foo': '>1.0.1'
-    },
-    'foo 1.0.0': { 'bar': '1.0.0' },
-    'foo 1.0.1': { 'bar': '1.0.1' },
-    'foo 1.0.2': { 'bar': '1.0.2' },
-    'bar 1.0.0': {},
-    'bar 1.0.1': {},
-    'bar 1.0.2': {}
-  }, lockfile: {
-    'foo': '1.0.1'
-  }, result: {
-    'myapp from root': '0.0.0',
-    'foo': '1.0.2',
-    'bar': '1.0.2'
-  });
-
-  testResolve('with unrelated locked dependency', {
-    'myapp 0.0.0': {
-      'foo': 'any'
-    },
-    'foo 1.0.0': { 'bar': '1.0.0' },
-    'foo 1.0.1': { 'bar': '1.0.1' },
-    'foo 1.0.2': { 'bar': '1.0.2' },
-    'bar 1.0.0': {},
-    'bar 1.0.1': {},
-    'bar 1.0.2': {},
-    'baz 1.0.0': {}
-  }, lockfile: {
-    'baz': '1.0.0'
-  }, result: {
-    'myapp from root': '0.0.0',
-    'foo': '1.0.2',
-    'bar': '1.0.2'
-  });
-
-  testResolve('unlocks dependencies if necessary to ensure that a new '
-      'dependency is satisfied', {
-    'myapp 0.0.0': {
-      'foo': 'any',
-      'newdep': 'any'
-    },
-    'foo 1.0.0': { 'bar': '<2.0.0' },
-    'bar 1.0.0': { 'baz': '<2.0.0' },
-    'baz 1.0.0': { 'qux': '<2.0.0' },
-    'qux 1.0.0': {},
-    'foo 2.0.0': { 'bar': '<3.0.0' },
-    'bar 2.0.0': { 'baz': '<3.0.0' },
-    'baz 2.0.0': { 'qux': '<3.0.0' },
-    'qux 2.0.0': {},
-    'newdep 2.0.0': { 'baz': '>=1.5.0' }
-  }, lockfile: {
-    'foo': '1.0.0',
-    'bar': '1.0.0',
-    'baz': '1.0.0',
-    'qux': '1.0.0'
-  }, result: {
-    'myapp from root': '0.0.0',
-    'foo': '2.0.0',
-    'bar': '2.0.0',
-    'baz': '2.0.0',
-    'qux': '1.0.0',
-    'newdep': '2.0.0'
-  }, maxTries: 4);
-}
-
-rootDependency() {
-  testResolve('with root source', {
-    'myapp 1.0.0': {
-      'foo': '1.0.0'
-    },
-    'foo 1.0.0': {
-      'myapp from root': '>=1.0.0'
-    }
-  }, result: {
-    'myapp from root': '1.0.0',
-    'foo': '1.0.0'
-  });
-
-  testResolve('with different source', {
-    'myapp 1.0.0': {
-      'foo': '1.0.0'
-    },
-    'foo 1.0.0': {
-      'myapp': '>=1.0.0'
-    }
-  }, result: {
-    'myapp from root': '1.0.0',
-    'foo': '1.0.0'
-  });
-
-  testResolve('with mismatched sources', {
-    'myapp 1.0.0': {
-      'foo': '1.0.0',
-      'bar': '1.0.0'
-    },
-    'foo 1.0.0': {
-      'myapp': '>=1.0.0'
-    },
-    'bar 1.0.0': {
-      'myapp from mock2': '>=1.0.0'
-    }
-  }, error: sourceMismatch('myapp', 'foo', 'bar'));
-
-  testResolve('with wrong version', {
-    'myapp 1.0.0': {
-      'foo': '1.0.0'
-    },
-    'foo 1.0.0': {
-      'myapp': '<1.0.0'
-    }
-  }, error: couldNotSolve);
-}
-
-devDependency() {
-  testResolve("includes root package's dev dependencies", {
-    'myapp 1.0.0': {
-      '(dev) foo': '1.0.0',
-      '(dev) bar': '1.0.0'
-    },
-    'foo 1.0.0': {},
-    'bar 1.0.0': {}
-  }, result: {
-    'myapp from root': '1.0.0',
-    'foo': '1.0.0',
-    'bar': '1.0.0'
-  });
-
-  testResolve("includes dev dependency's transitive dependencies", {
-    'myapp 1.0.0': {
-      '(dev) foo': '1.0.0'
-    },
-    'foo 1.0.0': {
-      'bar': '1.0.0'
-    },
-    'bar 1.0.0': {}
-  }, result: {
-    'myapp from root': '1.0.0',
-    'foo': '1.0.0',
-    'bar': '1.0.0'
-  });
-
-  testResolve("ignores transitive dependency's dev dependencies", {
-    'myapp 1.0.0': {
-      'foo': '1.0.0'
-    },
-    'foo 1.0.0': {
-      '(dev) bar': '1.0.0'
-    },
-    'bar 1.0.0': {}
-  }, result: {
-    'myapp from root': '1.0.0',
-    'foo': '1.0.0'
-  });
-}
-
-unsolvable() {
-  testResolve('no version that matches requirement', {
-    'myapp 0.0.0': {
-      'foo': '>=1.0.0 <2.0.0'
-    },
-    'foo 2.0.0': {},
-    'foo 2.1.3': {}
-  }, error: noVersion(['myapp', 'foo']));
-
-  testResolve('no version that matches combined constraint', {
-    'myapp 0.0.0': {
-      'foo': '1.0.0',
-      'bar': '1.0.0'
-    },
-    'foo 1.0.0': {
-      'shared': '>=2.0.0 <3.0.0'
-    },
-    'bar 1.0.0': {
-      'shared': '>=2.9.0 <4.0.0'
-    },
-    'shared 2.5.0': {},
-    'shared 3.5.0': {}
-  }, error: noVersion(['shared', 'foo', 'bar']));
-
-  testResolve('disjoint constraints', {
-    'myapp 0.0.0': {
-      'foo': '1.0.0',
-      'bar': '1.0.0'
-    },
-    'foo 1.0.0': {
-      'shared': '<=2.0.0'
-    },
-    'bar 1.0.0': {
-      'shared': '>3.0.0'
-    },
-    'shared 2.0.0': {},
-    'shared 4.0.0': {}
-  }, error: disjointConstraint(['shared', 'foo', 'bar']));
-
-  testResolve('mismatched descriptions', {
-    'myapp 0.0.0': {
-      'foo': '1.0.0',
-      'bar': '1.0.0'
-    },
-    'foo 1.0.0': {
-      'shared-x': '1.0.0'
-    },
-    'bar 1.0.0': {
-      'shared-y': '1.0.0'
-    },
-    'shared-x 1.0.0': {},
-    'shared-y 1.0.0': {}
-  }, error: descriptionMismatch('shared', 'foo', 'bar'));
-
-  testResolve('mismatched sources', {
-    'myapp 0.0.0': {
-      'foo': '1.0.0',
-      'bar': '1.0.0'
-    },
-    'foo 1.0.0': {
-      'shared': '1.0.0'
-    },
-    'bar 1.0.0': {
-      'shared from mock2': '1.0.0'
-    },
-    'shared 1.0.0': {},
-    'shared 1.0.0 from mock2': {}
-  }, error: sourceMismatch('shared', 'foo', 'bar'));
-
-  testResolve('no valid solution', {
-    'myapp 0.0.0': {
-      'a': 'any',
-      'b': 'any'
-    },
-    'a 1.0.0': {
-      'b': '1.0.0'
-    },
-    'a 2.0.0': {
-      'b': '2.0.0'
-    },
-    'b 1.0.0': {
-      'a': '2.0.0'
-    },
-    'b 2.0.0': {
-      'a': '1.0.0'
-    }
-  }, error: couldNotSolve, maxTries: 2);
-
-  // This is a regression test for #15550.
-  testResolve('no version that matches while backtracking', {
-    'myapp 0.0.0': {
-      'a': 'any',
-      'b': '>1.0.0'
-    },
-    'a 1.0.0': {},
-    'b 1.0.0': {}
-  }, error: noVersion(['myapp', 'b']), maxTries: 1);
-
-
-  // This is a regression test for #18300.
-  testResolve('...', {
-    "myapp 0.0.0": {
-      "angular": "any",
-      "collection": "any"
-    },
-    "analyzer 0.12.2": {},
-    "angular 0.10.0": {
-      "di": ">=0.0.32 <0.1.0",
-      "collection": ">=0.9.1 <1.0.0"
-    },
-    "angular 0.9.11": {
-      "di": ">=0.0.32 <0.1.0",
-      "collection": ">=0.9.1 <1.0.0"
-    },
-    "angular 0.9.10": {
-      "di": ">=0.0.32 <0.1.0",
-      "collection": ">=0.9.1 <1.0.0"
-    },
-    "collection 0.9.0": {},
-    "collection 0.9.1": {},
-    "di 0.0.37": {"analyzer": ">=0.13.0 <0.14.0"},
-    "di 0.0.36": {"analyzer": ">=0.13.0 <0.14.0"}
-  }, error: noVersion(['analyzer', 'di']), maxTries: 2);
-}
-
-badSource() {
-  testResolve('fail if the root package has a bad source in dep', {
-    'myapp 0.0.0': {
-      'foo from bad': 'any'
-    },
-  }, error: unknownSource('myapp', 'foo', 'bad'));
-
-  testResolve('fail if the root package has a bad source in dev dep', {
-    'myapp 0.0.0': {
-      '(dev) foo from bad': 'any'
-    },
-  }, error: unknownSource('myapp', 'foo', 'bad'));
-
-  testResolve('fail if all versions have bad source in dep', {
-    'myapp 0.0.0': {
-      'foo': 'any'
-    },
-    'foo 1.0.0': {
-      'bar from bad': 'any'
-    },
-    'foo 1.0.1': {
-      'baz from bad': 'any'
-    },
-    'foo 1.0.3': {
-      'bang from bad': 'any'
-    },
-  }, error: unknownSource('foo', 'bar', 'bad'), maxTries: 3);
-
-  testResolve('ignore versions with bad source in dep', {
-    'myapp 1.0.0': {
-      'foo': 'any'
-    },
-    'foo 1.0.0': {
-      'bar': 'any'
-    },
-    'foo 1.0.1': {
-      'bar from bad': 'any'
-    },
-    'foo 1.0.3': {
-      'bar from bad': 'any'
-    },
-    'bar 1.0.0': {}
-  }, result: {
-    'myapp from root': '1.0.0',
-    'foo': '1.0.0',
-    'bar': '1.0.0'
-  }, maxTries: 3);
-}
-
-backtracking() {
-  testResolve('circular dependency on older version', {
-    'myapp 0.0.0': {
-      'a': '>=1.0.0'
-    },
-    'a 1.0.0': {},
-    'a 2.0.0': {
-      'b': '1.0.0'
-    },
-    'b 1.0.0': {
-      'a': '1.0.0'
-    }
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '1.0.0'
-  }, maxTries: 2);
-
-  // The latest versions of a and b disagree on c. An older version of either
-  // will resolve the problem. This test validates that b, which is farther
-  // in the dependency graph from myapp is downgraded first.
-  testResolve('rolls back leaf versions first', {
-    'myapp 0.0.0': {
-      'a': 'any'
-    },
-    'a 1.0.0': {
-      'b': 'any'
-    },
-    'a 2.0.0': {
-      'b': 'any',
-      'c': '2.0.0'
-    },
-    'b 1.0.0': {},
-    'b 2.0.0': {
-      'c': '1.0.0'
-    },
-    'c 1.0.0': {},
-    'c 2.0.0': {}
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '2.0.0',
-    'b': '1.0.0',
-    'c': '2.0.0'
-  }, maxTries: 2);
-
-  // Only one version of baz, so foo and bar will have to downgrade until they
-  // reach it.
-  testResolve('simple transitive', {
-    'myapp 0.0.0': {'foo': 'any'},
-    'foo 1.0.0': {'bar': '1.0.0'},
-    'foo 2.0.0': {'bar': '2.0.0'},
-    'foo 3.0.0': {'bar': '3.0.0'},
-    'bar 1.0.0': {'baz': 'any'},
-    'bar 2.0.0': {'baz': '2.0.0'},
-    'bar 3.0.0': {'baz': '3.0.0'},
-    'baz 1.0.0': {}
-  }, result: {
-    'myapp from root': '0.0.0',
-    'foo': '1.0.0',
-    'bar': '1.0.0',
-    'baz': '1.0.0'
-  }, maxTries: 3);
-
-  // This ensures it doesn't exhaustively search all versions of b when it's
-  // a-2.0.0 whose dependency on c-2.0.0-nonexistent led to the problem. We
-  // make sure b has more versions than a so that the solver tries a first
-  // since it sorts sibling dependencies by number of versions.
-  testResolve('backjump to nearer unsatisfied package', {
-    'myapp 0.0.0': {
-      'a': 'any',
-      'b': 'any'
-    },
-    'a 1.0.0': { 'c': '1.0.0' },
-    'a 2.0.0': { 'c': '2.0.0-nonexistent' },
-    'b 1.0.0': {},
-    'b 2.0.0': {},
-    'b 3.0.0': {},
-    'c 1.0.0': {},
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '1.0.0',
-    'b': '3.0.0',
-    'c': '1.0.0'
-  }, maxTries: 2);
-
-  // Tests that the backjumper will jump past unrelated selections when a
-  // source conflict occurs. This test selects, in order:
-  // - myapp -> a
-  // - myapp -> b
-  // - myapp -> c (1 of 5)
-  // - b -> a
-  // It selects a and b first because they have fewer versions than c. It
-  // traverses b's dependency on a after selecting a version of c because
-  // dependencies are traversed breadth-first (all of myapps's immediate deps
-  // before any other their deps).
-  //
-  // This means it doesn't discover the source conflict until after selecting
-  // c. When that happens, it should backjump past c instead of trying older
-  // versions of it since they aren't related to the conflict.
-  testResolve('backjump to conflicting source', {
-    'myapp 0.0.0': {
-      'a': 'any',
-      'b': 'any',
-      'c': 'any'
-    },
-    'a 1.0.0': {},
-    'a 1.0.0 from mock2': {},
-    'b 1.0.0': {
-      'a': 'any'
-    },
-    'b 2.0.0': {
-      'a from mock2': 'any'
-    },
-    'c 1.0.0': {},
-    'c 2.0.0': {},
-    'c 3.0.0': {},
-    'c 4.0.0': {},
-    'c 5.0.0': {},
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '1.0.0',
-    'b': '1.0.0',
-    'c': '5.0.0'
-  }, maxTries: 2);
-
-  // Like the above test, but for a conflicting description.
-  testResolve('backjump to conflicting description', {
-    'myapp 0.0.0': {
-      'a-x': 'any',
-      'b': 'any',
-      'c': 'any'
-    },
-    'a-x 1.0.0': {},
-    'a-y 1.0.0': {},
-    'b 1.0.0': {
-      'a-x': 'any'
-    },
-    'b 2.0.0': {
-      'a-y': 'any'
-    },
-    'c 1.0.0': {},
-    'c 2.0.0': {},
-    'c 3.0.0': {},
-    'c 4.0.0': {},
-    'c 5.0.0': {},
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '1.0.0',
-    'b': '1.0.0',
-    'c': '5.0.0'
-  }, maxTries: 2);
-
-  // Similar to the above two tests but where there is no solution. It should
-  // fail in this case with no backtracking.
-  testResolve('backjump to conflicting source', {
-    'myapp 0.0.0': {
-      'a': 'any',
-      'b': 'any',
-      'c': 'any'
-    },
-    'a 1.0.0': {},
-    'a 1.0.0 from mock2': {},
-    'b 1.0.0': {
-      'a from mock2': 'any'
-    },
-    'c 1.0.0': {},
-    'c 2.0.0': {},
-    'c 3.0.0': {},
-    'c 4.0.0': {},
-    'c 5.0.0': {},
-  }, error: sourceMismatch('a', 'myapp', 'b'), maxTries: 1);
-
-  testResolve('backjump to conflicting description', {
-    'myapp 0.0.0': {
-      'a-x': 'any',
-      'b': 'any',
-      'c': 'any'
-    },
-    'a-x 1.0.0': {},
-    'a-y 1.0.0': {},
-    'b 1.0.0': {
-      'a-y': 'any'
-    },
-    'c 1.0.0': {},
-    'c 2.0.0': {},
-    'c 3.0.0': {},
-    'c 4.0.0': {},
-    'c 5.0.0': {},
-  }, error: descriptionMismatch('a', 'myapp', 'b'), maxTries: 1);
-
-  // Dependencies are ordered so that packages with fewer versions are tried
-  // first. Here, there are two valid solutions (either a or b must be
-  // downgraded once). The chosen one depends on which dep is traversed first.
-  // Since b has fewer versions, it will be traversed first, which means a will
-  // come later. Since later selections are revised first, a gets downgraded.
-  testResolve('traverse into package with fewer versions first', {
-    'myapp 0.0.0': {
-      'a': 'any',
-      'b': 'any'
-    },
-    'a 1.0.0': {'c': 'any'},
-    'a 2.0.0': {'c': 'any'},
-    'a 3.0.0': {'c': 'any'},
-    'a 4.0.0': {'c': 'any'},
-    'a 5.0.0': {'c': '1.0.0'},
-    'b 1.0.0': {'c': 'any'},
-    'b 2.0.0': {'c': 'any'},
-    'b 3.0.0': {'c': 'any'},
-    'b 4.0.0': {'c': '2.0.0'},
-    'c 1.0.0': {},
-    'c 2.0.0': {},
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '4.0.0',
-    'b': '4.0.0',
-    'c': '2.0.0'
-  }, maxTries: 2);
-
-  // This is similar to the above test. When getting the number of versions of
-  // a package to determine which to traverse first, versions that are
-  // disallowed by the root package's constraints should not be considered.
-  // Here, foo has more versions of bar in total (4), but fewer that meet
-  // myapp's constraints (only 2). There is no solution, but we will do less
-  // backtracking if foo is tested first.
-  testResolve('take root package constraints into counting versions', {
-    "myapp 0.0.0": {
-      "foo": ">2.0.0",
-      "bar": "any"
-    },
-    "foo 1.0.0": {"none": "2.0.0"},
-    "foo 2.0.0": {"none": "2.0.0"},
-    "foo 3.0.0": {"none": "2.0.0"},
-    "foo 4.0.0": {"none": "2.0.0"},
-    "bar 1.0.0": {},
-    "bar 2.0.0": {},
-    "bar 3.0.0": {},
-    "none 1.0.0": {}
-  }, error: noVersion(["foo", "none"]), maxTries: 2);
-
-  // This sets up a hundred versions of foo and bar, 0.0.0 through 9.9.0. Each
-  // version of foo depends on a baz with the same major version. Each version
-  // of bar depends on a baz with the same minor version. There is only one
-  // version of baz, 0.0.0, so only older versions of foo and bar will
-  // satisfy it.
-  var map = {
-    'myapp 0.0.0': {
-      'foo': 'any',
-      'bar': 'any'
-    },
-    'baz 0.0.0': {}
-  };
-
-  for (var i = 0; i < 10; i++) {
-    for (var j = 0; j < 10; j++) {
-      map['foo $i.$j.0'] = {'baz': '$i.0.0'};
-      map['bar $i.$j.0'] = {'baz': '0.$j.0'};
-    }
-  }
-
-  testResolve('complex backtrack', map, result: {
-    'myapp from root': '0.0.0',
-    'foo': '0.9.0',
-    'bar': '9.0.0',
-    'baz': '0.0.0'
-  }, maxTries: 10);
-
-  // If there's a disjoint constraint on a package, then selecting other
-  // versions of it is a waste of time: no possible versions can match. We need
-  // to jump past it to the most recent package that affected the constraint.
-  testResolve('backjump past failed package on disjoint constraint', {
-    'myapp 0.0.0': {
-      'a': 'any',
-      'foo': '>2.0.0'
-    },
-    'a 1.0.0': {
-      'foo': 'any' // ok
-    },
-    'a 2.0.0': {
-      'foo': '<1.0.0' // disjoint with myapp's constraint on foo
-    },
-    'foo 2.0.0': {},
-    'foo 2.0.1': {},
-    'foo 2.0.2': {},
-    'foo 2.0.3': {},
-    'foo 2.0.4': {}
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '1.0.0',
-    'foo': '2.0.4'
-  }, maxTries: 2);
-
-  // This is a regression test for #18666. It was possible for the solver to
-  // "forget" that a package had previously led to an error. In that case, it
-  // would backtrack over the failed package instead of trying different
-  // versions of it.
-  testResolve("finds solution with less strict constraint", {
-    "myapp 1.0.0": {
-      "a": "any",
-      "c": "any",
-      "d": "any"
-    },
-    "a 2.0.0": {},
-    "a 1.0.0": {},
-    "b 1.0.0": {"a": "1.0.0"},
-    "c 1.0.0": {"b": "any"},
-    "d 2.0.0": {"myapp": "any"},
-    "d 1.0.0": {"myapp": "<1.0.0"}
-  }, result: {
-    'myapp from root': '1.0.0',
-    'a': '1.0.0',
-    'b': '1.0.0',
-    'c': '1.0.0',
-    'd': '2.0.0'
-  }, maxTries: 3);
-}
-
-sdkConstraint() {
-  var badVersion = '0.0.0-nope';
-  var goodVersion = sdk.version.toString();
-
-  testResolve('root matches SDK', {
-    'myapp 0.0.0': {'sdk': goodVersion }
-  }, result: {
-    'myapp from root': '0.0.0'
-  });
-
-  testResolve('root does not match SDK', {
-    'myapp 0.0.0': {'sdk': badVersion }
-  }, error: couldNotSolve);
-
-  testResolve('dependency does not match SDK', {
-    'myapp 0.0.0': {'foo': 'any'},
-    'foo 0.0.0': {'sdk': badVersion }
-  }, error: couldNotSolve);
-
-  testResolve('transitive dependency does not match SDK', {
-    'myapp 0.0.0': {'foo': 'any'},
-    'foo 0.0.0': {'bar': 'any'},
-    'bar 0.0.0': {'sdk': badVersion }
-  }, error: couldNotSolve);
-
-  testResolve('selects a dependency version that allows the SDK', {
-    'myapp 0.0.0': {'foo': 'any'},
-    'foo 1.0.0': {'sdk': goodVersion },
-    'foo 2.0.0': {'sdk': goodVersion },
-    'foo 3.0.0': {'sdk': badVersion },
-    'foo 4.0.0': {'sdk': badVersion }
-  }, result: {
-    'myapp from root': '0.0.0',
-    'foo': '2.0.0'
-  }, maxTries: 3);
-
-  testResolve('selects a transitive dependency version that allows the SDK', {
-    'myapp 0.0.0': {'foo': 'any'},
-    'foo 1.0.0': {'bar': 'any'},
-    'bar 1.0.0': {'sdk': goodVersion },
-    'bar 2.0.0': {'sdk': goodVersion },
-    'bar 3.0.0': {'sdk': badVersion },
-    'bar 4.0.0': {'sdk': badVersion }
-  }, result: {
-    'myapp from root': '0.0.0',
-    'foo': '1.0.0',
-    'bar': '2.0.0'
-  }, maxTries: 3);
-
-  testResolve('selects a dependency version that allows a transitive '
-              'dependency that allows the SDK', {
-    'myapp 0.0.0': {'foo': 'any'},
-    'foo 1.0.0': {'bar': '1.0.0'},
-    'foo 2.0.0': {'bar': '2.0.0'},
-    'foo 3.0.0': {'bar': '3.0.0'},
-    'foo 4.0.0': {'bar': '4.0.0'},
-    'bar 1.0.0': {'sdk': goodVersion },
-    'bar 2.0.0': {'sdk': goodVersion },
-    'bar 3.0.0': {'sdk': badVersion },
-    'bar 4.0.0': {'sdk': badVersion }
-  }, result: {
-    'myapp from root': '0.0.0',
-    'foo': '2.0.0',
-    'bar': '2.0.0'
-  }, maxTries: 3);
-}
-
-void prerelease() {
-  testResolve('prefer stable versions over unstable', {
-    'myapp 0.0.0': {
-      'a': 'any'
-    },
-    'a 1.0.0': {},
-    'a 1.1.0-dev': {},
-    'a 2.0.0-dev': {},
-    'a 3.0.0-dev': {}
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '1.0.0'
-  });
-
-  testResolve('use latest allowed prerelease if no stable versions match', {
-    'myapp 0.0.0': {
-      'a': '<2.0.0'
-    },
-    'a 1.0.0-dev': {},
-    'a 1.1.0-dev': {},
-    'a 1.9.0-dev': {},
-    'a 3.0.0': {}
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '1.9.0-dev'
-  });
-
-  testResolve('use an earlier stable version on a < constraint', {
-    'myapp 0.0.0': {
-      'a': '<2.0.0'
-    },
-    'a 1.0.0': {},
-    'a 1.1.0': {},
-    'a 2.0.0-dev': {},
-    'a 2.0.0': {}
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '1.1.0'
-  });
-
-  testResolve('prefer a stable version even if constraint mentions unstable', {
-    'myapp 0.0.0': {
-      'a': '<=2.0.0-dev'
-    },
-    'a 1.0.0': {},
-    'a 1.1.0': {},
-    'a 2.0.0-dev': {},
-    'a 2.0.0': {}
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '1.1.0'
-  });
-}
-
-void override() {
-  testResolve('chooses best version matching override constraint', {
-    'myapp 0.0.0': {
-      'a': 'any'
-    },
-    'a 1.0.0': {},
-    'a 2.0.0': {},
-    'a 3.0.0': {}
-  }, overrides: {
-    'a': '<3.0.0'
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '2.0.0'
-  });
-
-  testResolve('uses override as dependency', {
-    'myapp 0.0.0': {},
-    'a 1.0.0': {},
-    'a 2.0.0': {},
-    'a 3.0.0': {}
-  }, overrides: {
-    'a': '<3.0.0'
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '2.0.0'
-  });
-
-  testResolve('ignores other constraints on overridden package', {
-    'myapp 0.0.0': {
-      'b': 'any',
-      'c': 'any'
-    },
-    'a 1.0.0': {},
-    'a 2.0.0': {},
-    'a 3.0.0': {},
-    'b 1.0.0': {
-      'a': '1.0.0'
-    },
-    'c 1.0.0': {
-      'a': '3.0.0'
-    }
-  }, overrides: {
-    'a': '2.0.0'
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '2.0.0',
-    'b': '1.0.0',
-    'c': '1.0.0'
-  });
-
-  testResolve('backtracks on overidden package for its constraints', {
-    'myapp 0.0.0': {
-      'shared': '2.0.0'
-    },
-    'a 1.0.0': {
-      'shared': 'any'
-    },
-    'a 2.0.0': {
-      'shared': '1.0.0'
-    },
-    'shared 1.0.0': {},
-    'shared 2.0.0': {}
-  }, overrides: {
-    'a': '<3.0.0'
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '1.0.0',
-    'shared': '2.0.0'
-  }, maxTries: 2);
-
-  testResolve('override compatible with locked dependency', {
-    'myapp 0.0.0': {
-      'foo': 'any'
-    },
-    'foo 1.0.0': { 'bar': '1.0.0' },
-    'foo 1.0.1': { 'bar': '1.0.1' },
-    'foo 1.0.2': { 'bar': '1.0.2' },
-    'bar 1.0.0': {},
-    'bar 1.0.1': {},
-    'bar 1.0.2': {}
-  }, lockfile: {
-    'foo': '1.0.1'
-  }, overrides: {
-    'foo': '<1.0.2'
-  }, result: {
-    'myapp from root': '0.0.0',
-    'foo': '1.0.1',
-    'bar': '1.0.1'
-  });
-
-  testResolve('override incompatible with locked dependency', {
-    'myapp 0.0.0': {
-      'foo': 'any'
-    },
-    'foo 1.0.0': { 'bar': '1.0.0' },
-    'foo 1.0.1': { 'bar': '1.0.1' },
-    'foo 1.0.2': { 'bar': '1.0.2' },
-    'bar 1.0.0': {},
-    'bar 1.0.1': {},
-    'bar 1.0.2': {}
-  }, lockfile: {
-    'foo': '1.0.1'
-  }, overrides: {
-    'foo': '>1.0.1'
-  }, result: {
-    'myapp from root': '0.0.0',
-    'foo': '1.0.2',
-    'bar': '1.0.2'
-  });
-
-  testResolve('no version that matches override', {
-    'myapp 0.0.0': {},
-    'foo 2.0.0': {},
-    'foo 2.1.3': {}
-  }, overrides: {
-    'foo': '>=1.0.0 <2.0.0'
-  }, error: noVersion(['myapp']));
-
-  testResolve('override a bad source without error', {
-    'myapp 0.0.0': {
-      'foo from bad': 'any'
-    },
-    'foo 0.0.0': {}
-  }, overrides: {
-    'foo': 'any'
-  }, result: {
-    'myapp from root': '0.0.0',
-    'foo': '0.0.0'
-  });
-}
-
-void downgrade() {
-  testResolve("downgrades a dependency to the lowest matching version", {
-    'myapp 0.0.0': {
-      'foo': '>=2.0.0 <3.0.0'
-    },
-    'foo 1.0.0': {},
-    'foo 2.0.0-dev': {},
-    'foo 2.0.0': {},
-    'foo 2.1.0': {}
-  }, lockfile: {
-    'foo': '2.1.0'
-  }, result: {
-    'myapp from root': '0.0.0',
-    'foo': '2.0.0'
-  }, downgrade: true);
-
-  testResolve('use earliest allowed prerelease if no stable versions match '
-      'while downgrading', {
-    'myapp 0.0.0': {
-      'a': '>=2.0.0-dev.1 <3.0.0'
-    },
-    'a 1.0.0': {},
-    'a 2.0.0-dev.1': {},
-    'a 2.0.0-dev.2': {},
-    'a 2.0.0-dev.3': {}
-  }, result: {
-    'myapp from root': '0.0.0',
-    'a': '2.0.0-dev.1'
-  }, downgrade: true);
-}
-
-testResolve(String description, Map packages, {
-    Map lockfile, Map overrides, Map result, FailMatcherBuilder error,
-    int maxTries, bool downgrade: false}) {
-  _testResolve(test, description, packages, lockfile: lockfile,
-      overrides: overrides, result: result, error: error, maxTries: maxTries,
-      downgrade: downgrade);
-}
-
-solo_testResolve(String description, Map packages, {
-    Map lockfile, Map overrides, Map result, FailMatcherBuilder error,
-    int maxTries, bool downgrade: false}) {
-  log.verbosity = log.Verbosity.SOLVER;
-  _testResolve(solo_test, description, packages, lockfile: lockfile,
-      overrides: overrides, result: result, error: error, maxTries: maxTries,
-      downgrade: downgrade);
-}
-
-_testResolve(void testFn(String description, Function body),
-    String description, Map packages, {
-    Map lockfile, Map overrides, Map result, FailMatcherBuilder error,
-    int maxTries, bool downgrade: false}) {
-  if (maxTries == null) maxTries = 1;
-
-  testFn(description, () {
-    var cache = new SystemCache('.');
-    source1 = new MockSource('mock1');
-    source2 = new MockSource('mock2');
-    cache.register(source1);
-    cache.register(source2);
-    cache.sources.setDefault(source1.name);
-
-    // Build the test package graph.
-    var root;
-    packages.forEach((description, dependencies) {
-      var id = parseSpec(description);
-      var package = mockPackage(id, dependencies,
-          id.name == 'myapp' ? overrides : null);
-      if (id.name == 'myapp') {
-        // Don't add the root package to the server, so we can verify that Pub
-        // doesn't try to look up information about the local package on the
-        // remote server.
-        root = package;
-      } else {
-        (cache.sources[id.source] as MockSource).addPackage(
-            id.description, package);
-      }
-    });
-
-    // Clean up the expectation.
-    if (result != null) {
-      var newResult = {};
-      result.forEach((description, version) {
-        var id = parseSpec(description, version);
-        newResult[id.name] = id;
-      });
-      result = newResult;
-    }
-
-    // Parse the lockfile.
-    var realLockFile = new LockFile.empty();
-    if (lockfile != null) {
-      lockfile.forEach((name, version) {
-        version = new Version.parse(version);
-        realLockFile.packages[name] =
-            new PackageId(name, source1.name, version, name);
-      });
-    }
-
-    // Resolve the versions.
-    var future = resolveVersions(
-        downgrade ? SolveType.DOWNGRADE : SolveType.GET,
-        cache.sources, root, lockFile: realLockFile);
-
-    var matcher;
-    if (result != null) {
-      matcher = new SolveSuccessMatcher(result, maxTries);
-    } else if (error != null) {
-      matcher = error(maxTries);
-    }
-
-    expect(future, completion(matcher));
-  });
-}
-
-typedef SolveFailMatcher FailMatcherBuilder(int maxTries);
-
-FailMatcherBuilder noVersion(List<String> packages) {
-  return (maxTries) => new SolveFailMatcher(packages, maxTries,
-      NoVersionException);
-}
-
-FailMatcherBuilder disjointConstraint(List<String> packages) {
-  return (maxTries) => new SolveFailMatcher(packages, maxTries,
-      DisjointConstraintException);
-}
-
-FailMatcherBuilder descriptionMismatch(
-    String package, String depender1, String depender2) {
-  return (maxTries) => new SolveFailMatcher([package, depender1, depender2],
-      maxTries, DescriptionMismatchException);
-}
-
-// If no solution can be found, the solver just reports the last failure that
-// happened during propagation. Since we don't specify the order that solutions
-// are tried, this just validates that *some* failure occurred, but not which.
-SolveFailMatcher couldNotSolve(maxTries) =>
-    new SolveFailMatcher([], maxTries, null);
-
-FailMatcherBuilder sourceMismatch(
-    String package, String depender1, String depender2) {
-  return (maxTries) => new SolveFailMatcher([package, depender1, depender2],
-      maxTries, SourceMismatchException);
-}
-
-unknownSource(String depender, String dependency, String source) {
-  return (maxTries) => new SolveFailMatcher([depender, dependency, source],
-      maxTries, UnknownSourceException);
-}
-
-class SolveSuccessMatcher implements Matcher {
-  /// The expected concrete package selections.
-  final Map<String, PackageId> _expected;
-
-  /// The maximum number of attempts that should have been tried before finding
-  /// the solution.
-  final int _maxTries;
-
-  SolveSuccessMatcher(this._expected, this._maxTries);
-
-  Description describe(Description description) {
-    return description.add(
-        'Solver to use at most $_maxTries attempts to find:\n'
-        '${_listPackages(_expected.values)}');
-  }
-
-  Description describeMismatch(SolveResult result,
-                               Description description,
-                               Map state, bool verbose) {
-    if (!result.succeeded) {
-      description.add('Solver failed with:\n${result.error}');
-      return null;
-    }
-
-    description.add('Resolved:\n${_listPackages(result.packages)}\n');
-    description.add(state['failures']);
-    return description;
-  }
-
-  bool matches(SolveResult result, Map state) {
-    if (!result.succeeded) return false;
-
-    var expected = new Map.from(_expected);
-    var failures = new StringBuffer();
-
-    for (var id in result.packages) {
-      if (!expected.containsKey(id.name)) {
-        failures.writeln('Should not have selected $id');
-      } else {
-        var expectedId = expected.remove(id.name);
-        if (id != expectedId) {
-          failures.writeln('Expected $expectedId, not $id');
-        }
-      }
-    }
-
-    if (!expected.isEmpty) {
-      failures.writeln('Missing:\n${_listPackages(expected.values)}');
-    }
-
-    // Allow 1 here because the greedy solver will only make one attempt.
-    if (result.attemptedSolutions != 1 &&
-        result.attemptedSolutions > _maxTries) {
-      failures.writeln('Took ${result.attemptedSolutions} attempts');
-    }
-
-    if (!failures.isEmpty) {
-      state['failures'] = failures.toString();
-      return false;
-    }
-
-    return true;
-  }
-
-  String _listPackages(Iterable<PackageId> packages) {
-    return '- ${packages.join('\n- ')}';
-  }
-}
-
-class SolveFailMatcher implements Matcher {
-  /// The strings that should appear in the resulting error message.
-  // TODO(rnystrom): This seems to always be package names. Make that explicit.
-  final Iterable<String> _expected;
-
-  /// The maximum number of attempts that should be tried before failing.
-  final int _maxTries;
-
-  /// The concrete error type that should be found, or `null` if any
-  /// [SolveFailure] is allowed.
-  final Type _expectedType;
-
-  SolveFailMatcher(this._expected, this._maxTries, this._expectedType);
-
-  Description describe(Description description) {
-    description.add('Solver should fail after at most $_maxTries attempts.');
-    if (!_expected.isEmpty) {
-      var textList = _expected.map((s) => '"$s"').join(", ");
-      description.add(' The error should contain $textList.');
-    }
-    return description;
-  }
-
-  Description describeMismatch(SolveResult result,
-                               Description description,
-                               Map state, bool verbose) {
-    description.add(state['failures']);
-    return description;
-  }
-
-  bool matches(SolveResult result, Map state) {
-    var failures = new StringBuffer();
-
-    if (result.succeeded) {
-      failures.writeln('Solver succeeded');
-    } else {
-      if (_expectedType != null && result.error.runtimeType != _expectedType) {
-        failures.writeln('Should have error type $_expectedType, got '
-            '${result.error.runtimeType}');
-      }
-
-      var message = result.error.toString();
-      for (var expected in _expected) {
-        if (!message.contains(expected)) {
-          failures.writeln(
-              'Expected error to contain "$expected", got:\n$message');
-        }
-      }
-
-      // Allow 1 here because the greedy solver will only make one attempt.
-      if (result.attemptedSolutions != 1 &&
-          result.attemptedSolutions > _maxTries) {
-        failures.writeln('Took ${result.attemptedSolutions} attempts');
-      }
-    }
-
-    if (!failures.isEmpty) {
-      state['failures'] = failures.toString();
-      return false;
-    }
-
-    return true;
-  }
-}
-
-/// A source used for testing. This both creates mock package objects and acts
-/// as a source for them.
-///
-/// In order to support testing packages that have the same name but different
-/// descriptions, a package's name is calculated by taking the description
-/// string and stripping off any trailing hyphen followed by non-hyphen
-/// characters.
-class MockSource extends CachedSource {
-  final _packages = <String, Map<Version, Package>>{};
-
-  /// Keeps track of which package version lists have been requested. Ensures
-  /// that a source is only hit once for a given package and that pub
-  /// internally caches the results.
-  final _requestedVersions = new Set<String>();
-
-  /// Keeps track of which package pubspecs have been requested. Ensures that a
-  /// source is only hit once for a given package and that pub internally
-  /// caches the results.
-  final _requestedPubspecs = new Map<String, Set<Version>>();
-
-  final String name;
-  final hasMultipleVersions = true;
-
-  MockSource(this.name);
-
-  dynamic parseDescription(String containingPath, description,
-                             {bool fromLockFile: false}) => description;
-
-  bool descriptionsEqual(description1, description2) =>
-      description1 == description2;
-
-  Future<String> getDirectory(PackageId id) {
-    return new Future.value('${id.name}-${id.version}');
-  }
-
-  Future<List<Pubspec>> getVersions(String name, String description) {
-    return new Future.sync(() {
-      // Make sure the solver doesn't request the same thing twice.
-      if (_requestedVersions.contains(description)) {
-        throw new Exception('Version list for $description was already '
-            'requested.');
-      }
-
-      _requestedVersions.add(description);
-
-      if (!_packages.containsKey(description)){
-        throw new Exception('MockSource does not have a package matching '
-            '"$description".');
-      }
-
-      return _packages[description].values
-          .map((package) => package.pubspec).toList();
-    });
-  }
-
-  Future<Pubspec> describeUncached(PackageId id) {
-    return new Future.sync(() {
-      // Make sure the solver doesn't request the same thing twice.
-      if (_requestedPubspecs.containsKey(id.description) &&
-          _requestedPubspecs[id.description].contains(id.version)) {
-        throw new Exception('Pubspec for $id was already requested.');
-      }
-
-      _requestedPubspecs.putIfAbsent(id.description, () => new Set<Version>());
-      _requestedPubspecs[id.description].add(id.version);
-
-      return _packages[id.description][id.version].pubspec;
-    });
-  }
-
-  Future<Package> downloadToSystemCache(PackageId id) =>
-      throw new UnsupportedError('Cannot download mock packages');
-
-  List<Package> getCachedPackages() =>
-      throw new UnsupportedError('Cannot get mock packages');
-
-  Future<Pair<int, int>> repairCachedPackages() =>
-      throw new UnsupportedError('Cannot repair mock packages');
-
-  void addPackage(String description, Package package) {
-    _packages.putIfAbsent(description, () => new Map<Version, Package>());
-    _packages[description][package.version] = package;
-  }
-}
-
-Package mockPackage(PackageId id, Map dependencyStrings, Map overrides) {
-  var sdkConstraint = null;
-
-  // Build the pubspec dependencies.
-  var dependencies = <PackageDep>[];
-  var devDependencies = <PackageDep>[];
-
-  dependencyStrings.forEach((spec, constraint) {
-    var isDev = spec.startsWith("(dev) ");
-    if (isDev) {
-      spec = spec.substring("(dev) ".length);
-    }
-
-    var dep = parseSpec(spec).withConstraint(
-        new VersionConstraint.parse(constraint));
-
-    if (dep.name == 'sdk') {
-      sdkConstraint = dep.constraint;
-      return;
-    }
-
-    if (isDev) {
-      devDependencies.add(dep);
-    } else {
-      dependencies.add(dep);
-    }
-  });
-
-  var dependencyOverrides = <PackageDep>[];
-  if (overrides != null) {
-    overrides.forEach((spec, constraint) {
-      dependencyOverrides.add(parseSpec(spec).withConstraint(
-          new VersionConstraint.parse(constraint)));
-    });
-  }
-
-  return new Package.inMemory(new Pubspec(id.name,
-      version: id.version,
-      dependencies: dependencies,
-      devDependencies: devDependencies,
-      dependencyOverrides: dependencyOverrides,
-      sdkConstraint: sdkConstraint));
-}
-
-/// Creates a new [PackageId] parsed from [text], which looks something like
-/// this:
-///
-///   foo-xyz 1.0.0 from mock
-///
-/// The package name is "foo". A hyphenated suffix like "-xyz" here is part
-/// of the package description, but not its name, so the description here is
-/// "foo-xyz".
-///
-/// This is followed by an optional [Version]. If [version] is provided, then
-/// it is parsed to a [Version], and [text] should *not* also contain a
-/// version string.
-///
-/// The "from mock" optional suffix is the name of a source for the package.
-/// If omitted, it defaults to "mock1".
-PackageId parseSpec(String text, [String version]) {
-  var pattern = new RegExp(r"(([a-z_]*)(-[a-z_]+)?)( ([^ ]+))?( from (.*))?$");
-  var match = pattern.firstMatch(text);
-  if (match == null) {
-    throw new FormatException("Could not parse spec '$text'.");
-  }
-
-  var description = match[1];
-  var name = match[2];
-
-  var parsedVersion;
-  if (version != null) {
-    // Spec string shouldn't also contain a version.
-    if (match[5] != null) {
-      throw new ArgumentError("Spec '$text' should not contain a version "
-          "since '$version' was passed in explicitly.");
-    }
-    parsedVersion = new Version.parse(version);
-  } else {
-    if (match[5] != null) {
-      parsedVersion = new Version.parse(match[5]);
-    } else {
-      parsedVersion = Version.none;
-    }
-  }
-
-  var source = "mock1";
-  if (match[7] != null) {
-    source = match[7];
-    if (source == "root") source = null;
-  }
-
-  return new PackageId(name, source, parsedVersion, description);
-}
diff --git a/sdk/lib/collection/iterable.dart b/sdk/lib/collection/iterable.dart
index 8556595..3290682 100644
--- a/sdk/lib/collection/iterable.dart
+++ b/sdk/lib/collection/iterable.dart
@@ -90,7 +90,7 @@
   Set<E> toSet() => new Set<E>.from(this);
 
   int get length {
-    assert(this is! EfficientLengthIterable);
+    assert(this is! EfficientLength);
     int count = 0;
     Iterator it = iterator;
     while (it.moveNext()) {
@@ -397,34 +397,3 @@
   parts.add(penultimateString);
   parts.add(ultimateString);
 }
-
-
-/**
- * Marker interface for [Iterable] implementations that have an efficient
- * [length] getter.
- *
- * An iterable implementing this interface should have an "efficient"
- * implementation of `length` that doesn't trigger iteration of the
- * iterable. Being efficient doesn't necessarily require being constant
- * time, but should at least attempt to have have execution time that is
- * better than linear in the elements of the iterable.
- *
- * Methods that worry about reading the length of an `Iterable` because it
- * may be inefficient or may trigger side-effects, or may even never complete,
- * can first check if the iterable `is EfficientLengthIterable`,
- * and if so, use [length] without those concerns.
- *
- * The `EfficientLengthIterable` type should never be used as a type
- * assertion - neither as argument type or return type of a function.
- * Always use [Iterable] for the type and just document the performance if it
- * is relevant. This avoids needlessly restricting the values that can be used.
- */
-abstract class EfficientLengthIterable<T> implements Iterable<T> {
-  /**
-   * Returns the number of elements in the iterable.
-   *
-   * This is an efficient operation that doesn't iterate through
-   * the elements.
-   */
-  int get length;
-}
diff --git a/sdk/lib/collection/list.dart b/sdk/lib/collection/list.dart
index 0d02f85..e7d902e 100644
--- a/sdk/lib/collection/list.dart
+++ b/sdk/lib/collection/list.dart
@@ -389,7 +389,7 @@
 
   void replaceRange(int start, int end, Iterable<E> newContents) {
     RangeError.checkValidRange(start, end, this.length);
-    if (newContents is! EfficientLengthIterable) {
+    if (newContents is! EfficientLength) {
       newContents = newContents.toList();
     }
     int removeLength = end - start;
@@ -476,7 +476,7 @@
 
   void insertAll(int index, Iterable<E> iterable) {
     RangeError.checkValueInInterval(index, 0, length, "index");
-    if (iterable is EfficientLengthIterable) {
+    if (iterable is EfficientLength) {
       iterable = iterable.toList();
     }
     int insertionLength = iterable.length;
diff --git a/sdk/lib/collection/maps.dart b/sdk/lib/collection/maps.dart
index ecc2bf7..7945e7e 100644
--- a/sdk/lib/collection/maps.dart
+++ b/sdk/lib/collection/maps.dart
@@ -112,7 +112,7 @@
  * map's `operator[]` to lookup the keys.
  */
 class _MapBaseValueIterable<V> extends Iterable<V>
-                               implements EfficientLengthIterable<V> {
+                               implements EfficientLength {
   final Map _map;
   _MapBaseValueIterable(this._map);
 
diff --git a/sdk/lib/collection/queue.dart b/sdk/lib/collection/queue.dart
index 067c17b..af8e07a 100644
--- a/sdk/lib/collection/queue.dart
+++ b/sdk/lib/collection/queue.dart
@@ -17,7 +17,7 @@
  * This goes both for using the [iterator] directly, or for iterating an
  * `Iterable` returned by a method like [map] or [where].
  */
-abstract class Queue<E> implements EfficientLengthIterable<E> {
+abstract class Queue<E> implements Iterable<E>, EfficientLength {
 
   /**
    * Creates a queue.
@@ -482,7 +482,7 @@
       return queue;
     } else {
       int capacity = _INITIAL_CAPACITY;
-      if (elements is EfficientLengthIterable) {
+      if (elements is EfficientLength) {
         capacity = elements.length;
       }
       ListQueue<E> result = new ListQueue<E>(capacity);
diff --git a/sdk/lib/collection/splay_tree.dart b/sdk/lib/collection/splay_tree.dart
index 597c23f..fea7d34 100644
--- a/sdk/lib/collection/splay_tree.dart
+++ b/sdk/lib/collection/splay_tree.dart
@@ -600,7 +600,7 @@
 }
 
 class _SplayTreeKeyIterable<K> extends Iterable<K>
-                               implements EfficientLengthIterable<K> {
+                               implements EfficientLength {
   _SplayTree<K> _tree;
   _SplayTreeKeyIterable(this._tree);
   int get length => _tree._count;
@@ -618,7 +618,7 @@
 }
 
 class _SplayTreeValueIterable<K, V> extends Iterable<V>
-                                    implements EfficientLengthIterable<V> {
+                                    implements EfficientLength {
   SplayTreeMap<K, V> _map;
   _SplayTreeValueIterable(this._map);
   int get length => _map._count;
diff --git a/sdk/lib/convert/encoding.dart b/sdk/lib/convert/encoding.dart
index cc67f6f..696b5f0 100644
--- a/sdk/lib/convert/encoding.dart
+++ b/sdk/lib/convert/encoding.dart
@@ -69,8 +69,8 @@
   * If character set is not supported [:null:] is returned.
   */
   static Encoding getByName(String name) {
-      if (name == null) return null;
-      name = name.toLowerCase();
-      return _nameToEncoding[name];
+    if (name == null) return null;
+    name = name.toLowerCase();
+    return _nameToEncoding[name];
   }
 }
diff --git a/sdk/lib/core/iterable.dart b/sdk/lib/core/iterable.dart
index c22283a..3de39bc 100644
--- a/sdk/lib/core/iterable.dart
+++ b/sdk/lib/core/iterable.dart
@@ -358,7 +358,7 @@
    * Some iterables have a more efficient way to find the number of elements.
    */
   int get length {
-    assert(this is! EfficientLengthIterable);
+    assert(this is! EfficientLength);
     int count = 0;
     Iterator it = iterator;
     while (it.moveNext()) {
@@ -605,7 +605,7 @@
 typedef E _Generator<E>(int index);
 
 class _GeneratorIterable<E> extends Iterable<E>
-                            implements EfficientLengthIterable<E> {
+                            implements EfficientLength {
   final int _start;
   final int _end;
   final _Generator<E> _generator;
diff --git a/sdk/lib/core/list.dart b/sdk/lib/core/list.dart
index 0d10e85..9d9a093 100644
--- a/sdk/lib/core/list.dart
+++ b/sdk/lib/core/list.dart
@@ -51,7 +51,7 @@
  * directly or through iterating an [Iterable] that is backed by the list, will
  * break the iteration.
  */
-abstract class List<E> implements EfficientLengthIterable<E> {
+abstract class List<E> implements Iterable<E>, EfficientLength {
   /**
    * Creates a list of the given length.
    *
diff --git a/sdk/lib/core/set.dart b/sdk/lib/core/set.dart
index a908d57..2c6b524 100644
--- a/sdk/lib/core/set.dart
+++ b/sdk/lib/core/set.dart
@@ -31,7 +31,7 @@
  * iterating either the set itself or any [Iterable] that is backed by the set,
  * such as the ones returned by methods like [where] and [map].
  */
-abstract class Set<E> implements EfficientLengthIterable<E> {
+abstract class Set<E> extends Iterable<E> implements EfficientLength {
   /**
    * Creates an empty [Set].
    *
diff --git a/sdk/lib/internal/iterable.dart b/sdk/lib/internal/iterable.dart
index ff03d1a..47c94f8 100644
--- a/sdk/lib/internal/iterable.dart
+++ b/sdk/lib/internal/iterable.dart
@@ -5,13 +5,27 @@
 part of dart._internal;
 
 /**
+ * Marker interface for [Iterable] subclasses that have an efficient
+ * [length] implementation.
+ */
+abstract class EfficientLength {
+  /**
+   * Returns the number of elements in the iterable.
+   *
+   * This is an efficient operation that doesn't require iterating through
+   * the elements.
+   */
+  int get length;
+}
+
+/**
  * An [Iterable] for classes that have efficient [length] and [elementAt].
  *
  * All other methods are implemented in terms of [length] and [elementAt],
  * including [iterator].
  */
 abstract class ListIterable<E> extends Iterable<E>
-                               implements EfficientLengthIterable<E> {
+                               implements EfficientLength {
   int get length;
   E elementAt(int i);
 
@@ -337,7 +351,7 @@
   final _Transformation<S, T> _f;
 
   factory MappedIterable(Iterable iterable, T function(S value)) {
-    if (iterable is EfficientLengthIterable) {
+    if (iterable is EfficientLength) {
       return new EfficientLengthMappedIterable<S, T>(iterable, function);
     }
     return new MappedIterable<S, T>._(iterable, function);
@@ -359,7 +373,7 @@
 }
 
 class EfficientLengthMappedIterable<S, T> extends MappedIterable<S, T>
-    implements EfficientLengthIterable<T> {
+                                          implements EfficientLength {
   EfficientLengthMappedIterable(Iterable iterable, T function(S value))
       : super._(iterable, function);
 }
@@ -388,7 +402,8 @@
  *
  * Expects efficient `length` and `elementAt` on the source iterable.
  */
-class MappedListIterable<S, T> extends ListIterable<T> {
+class MappedListIterable<S, T> extends ListIterable<T>
+                               implements EfficientLength {
   final Iterable<S> _source;
   final _Transformation<S, T> _f;
 
@@ -481,7 +496,7 @@
     if (takeCount is! int || takeCount < 0) {
       throw new ArgumentError(takeCount);
     }
-    if (iterable is EfficientLengthIterable) {
+    if (iterable is EfficientLength) {
       return new EfficientLengthTakeIterable<E>(iterable, takeCount);
     }
     return new TakeIterable<E>._(iterable, takeCount);
@@ -495,7 +510,7 @@
 }
 
 class EfficientLengthTakeIterable<E> extends TakeIterable<E>
-                                     implements EfficientLengthIterable<E> {
+                                     implements EfficientLength {
   EfficientLengthTakeIterable(Iterable<E> iterable, int takeCount)
       : super._(iterable, takeCount);
 
@@ -568,7 +583,7 @@
   final int _skipCount;
 
   factory SkipIterable(Iterable<E> iterable, int count) {
-    if (iterable is EfficientLengthIterable) {
+    if (iterable is EfficientLength) {
       return new EfficientLengthSkipIterable<E>(iterable, count);
     }
     return new SkipIterable<E>._(iterable, count);
@@ -595,7 +610,7 @@
 }
 
 class EfficientLengthSkipIterable<E> extends SkipIterable<E>
-                                     implements EfficientLengthIterable<E> {
+                                     implements EfficientLength {
   EfficientLengthSkipIterable(Iterable<E> iterable, int skipCount)
       : super._(iterable, skipCount);
 
@@ -657,8 +672,7 @@
 /**
  * The always empty [Iterable].
  */
-class EmptyIterable<E> extends Iterable<E>
-                       implements EfficientLengthIterable<E> {
+class EmptyIterable<E> extends Iterable<E> implements EfficientLength {
   const EmptyIterable();
 
   Iterator<E> get iterator => const EmptyIterator();
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 031698c..2f271ba 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -9614,10 +9614,8 @@
 WebPlatformTest/webstorage/storage_session_setitem_t01: RuntimeError # Please triage this failure
 
 [ $compiler == dart2js && $cps_ir ]
-Language/03_Overview/1_Scoping_A01_t34: Crash # Instance of 'TypeOperator': type check unimplemented for T.
 Language/03_Overview/1_Scoping_A01_t39: Crash # Instance of 'TypeOperator': type check unimplemented for f.
 Language/03_Overview/1_Scoping_A02_t19: Crash # (switch (1){case 1:var x;break;case 2:var x;break;}): Unhandled node
-Language/03_Overview/2_Privacy_A01_t06: Crash # Instance of 'TypeOperator': type check unimplemented for _inaccessibleFuncType.
 Language/07_Classes/07_Classes_A02_t17: Crash # Please triage this failure.
 Language/07_Classes/07_Classes_A02_t18: Crash # Please triage this failure.
 Language/07_Classes/07_Classes_A02_t19: Crash # Please triage this failure.
@@ -9630,14 +9628,11 @@
 Language/07_Classes/6_Constructors/1_Generative_Constructors_A04_t10: Crash # Please triage this failure.
 Language/07_Classes/6_Constructors/1_Generative_Constructors_A04_t11: Crash # Please triage this failure.
 Language/07_Classes/6_Constructors/1_Generative_Constructors_A04_t16: Crash # Please triage this failure.
-Language/07_Classes/6_Constructors/1_Generative_Constructors_A13_t01: Crash # Instance of 'TypeOperator': type check unimplemented for T.
 Language/07_Classes/6_Constructors/2_Factories_A09_t01: Crash # Please triage this failure.
 Language/07_Classes/6_Constructors/2_Factories_A09_t02: Crash # Please triage this failure.
 Language/07_Classes/6_Constructors/2_Factories_A09_t03: Crash # Please triage this failure.
 Language/07_Classes/6_Constructors/2_Factories_A09_t04: Crash # Please triage this failure.
-Language/10_Generics/09_Generics_A04_t03: Crash # Instance of 'TypeOperator': type check unimplemented for S.
-Language/10_Generics/10_Generics_A05_t01: Crash # Instance of 'TypeOperator': type check unimplemented for T.
-Language/10_Generics/10_Generics_A05_t03: Crash # Instance of 'TypeOperator': type check unimplemented for T.
+Language/10_Generics/09_Generics_A04_t03: Crash # Please triage this failure.
 Language/12_Expressions/12_Instance_Creation/1_New_A06_t07: RuntimeError # Please triage this failure.
 Language/12_Expressions/12_Instance_Creation/1_New_A06_t08: Crash # Please triage this failure.
 Language/12_Expressions/12_Instance_Creation/1_New_A06_t09: RuntimeError # Please triage this failure.
@@ -9649,19 +9644,13 @@
 Language/12_Expressions/13_Property_Extraction_A03_t03: RuntimeError # Please triage this failure.
 Language/12_Expressions/15_Method_Invocation/4_Super_Invocation_A01_t01: RuntimeError # Please triage this failure.
 Language/12_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: RuntimeError # Please triage this failure.
-Language/12_Expressions/20_Logical_Boolean_Expressions_A01_t01: RuntimeError # Please triage this failure.
 Language/12_Expressions/22_Equality_A03_t01: RuntimeError # Please triage this failure.
 Language/12_Expressions/30_Identifier_Reference_A09_t03: Crash # (i=0): For-loop variable captured in loop header
-Language/12_Expressions/32_Type_Test_A02_t03: Crash # Instance of 'TypeOperator': type check unimplemented for Undeclared.
-Language/12_Expressions/32_Type_Test_A02_t04: Crash # Instance of 'TypeOperator': type check unimplemented for G<int, bool>.
-Language/12_Expressions/32_Type_Test_A02_t07: Crash # Instance of 'TypeOperator': type check unimplemented for G<Unknown>.
 Language/12_Expressions/33_Type_Cast_A01_t01: Crash # Instance of 'TypeOperator': type casts not implemented.
 Language/12_Expressions/33_Type_Cast_A01_t04: Crash # Instance of 'TypeOperator': type casts not implemented.
 Language/12_Expressions/33_Type_Cast_A02_t01: Crash # Instance of 'TypeOperator': type casts not implemented.
 Language/12_Expressions/33_Type_Cast_A02_t02: Crash # Instance of 'TypeOperator': type casts not implemented.
 Language/12_Expressions/33_Type_Cast_A02_t03: Crash # Instance of 'TypeOperator': type casts not implemented.
-Language/12_Expressions/33_Type_Cast_A02_t04: Crash # Instance of 'TypeOperator': type casts not implemented.
-Language/12_Expressions/33_Type_Cast_A02_t05: Crash # Instance of 'TypeOperator': type casts not implemented.
 Language/12_Expressions/33_Type_Cast_A02_t06: Crash # Instance of 'TypeOperator': type casts not implemented.
 Language/12_Expressions/33_Type_Cast_A02_t07: Crash # Instance of 'TypeOperator': type casts not implemented.
 Language/12_Expressions/33_Type_Cast_A02_t08: Crash # Instance of 'TypeOperator': type casts not implemented.
@@ -9691,10 +9680,6 @@
 Language/13_Statements/11_Return_A02_t02: Crash # (try {return 1;}finally {flag=true;}): try/finally
 Language/13_Statements/11_Return_A02_t03: Crash # (try {return 1;}finally {return 2;}): try/finally
 Language/13_Statements/11_Try_A01_t01: Crash # (try {throw "";}on int catch (ok){}catch (ok){}finally {}): try/finally
-Language/13_Statements/11_Try_A03_t01: Crash # Instance of 'TypeOperator': type check unimplemented for Unavailable.
-Language/13_Statements/11_Try_A03_t02: Crash # Instance of 'TypeOperator': type check unimplemented for Unavailable.
-Language/13_Statements/11_Try_A03_t03: Crash # Instance of 'TypeOperator': type check unimplemented for Foo.
-Language/13_Statements/11_Try_A03_t04: Crash # Instance of 'TypeOperator': type check unimplemented for Unavailable.
 Language/13_Statements/11_Try_A07_t02: Crash # (try {throw ex;}on int catch (i){}on bool catch (b){}finally {isFinallyExecuted=true;}): try/finally
 Language/13_Statements/11_Try_A08_t01: Crash #  try/finally
 Language/13_Statements/11_Try_A09_t01: Crash #  try/finally
@@ -9729,20 +9714,13 @@
 Language/14_Libraries_and_Scripts/1_Imports_A02_t26: Crash # Instance of 'TypeOperator': type check unimplemented for prefix.
 Language/14_Libraries_and_Scripts/1_Imports_A02_t27: Crash # Instance of 'TypeOperator': type check unimplemented for bar.
 Language/14_Libraries_and_Scripts/1_Imports_A02_t28: Crash # Instance of 'TypeOperator': type check unimplemented for bar.
-Language/14_Libraries_and_Scripts/1_Imports_A03_t02: Crash # Instance of 'TypeOperator': type check unimplemented for foo.
 Language/14_Libraries_and_Scripts/1_Imports_A03_t04: Crash # Instance of 'TypeOperator': type casts not implemented.
-Language/14_Libraries_and_Scripts/1_Imports_A03_t05: Crash # Instance of 'TypeOperator': type casts not implemented.
-Language/14_Libraries_and_Scripts/1_Imports_A03_t22: Crash # Instance of 'TypeOperator': type check unimplemented for foo.
 Language/14_Libraries_and_Scripts/1_Imports_A03_t24: Crash # Instance of 'TypeOperator': type casts not implemented.
-Language/14_Libraries_and_Scripts/1_Imports_A03_t25: Crash # Instance of 'TypeOperator': type casts not implemented.
-Language/14_Libraries_and_Scripts/1_Imports_A03_t31: Crash # Instance of 'TypeOperator': type check unimplemented for foo.
 Language/14_Libraries_and_Scripts/1_Imports_A03_t44: Crash # Instance of 'TypeOperator': type casts not implemented.
 Language/14_Libraries_and_Scripts/1_Imports_A03_t45: Crash # Instance of 'TypeOperator': type casts not implemented.
 Language/14_Libraries_and_Scripts/1_Imports_A03_t64: Crash # Instance of 'TypeOperator': type casts not implemented.
 Language/14_Libraries_and_Scripts/1_Imports_A03_t65: Crash # Instance of 'TypeOperator': type casts not implemented.
-Language/14_Libraries_and_Scripts/2_Exports_A04_t03: Crash # Instance of 'TypeOperator': type check unimplemented for foo.
 Language/14_Libraries_and_Scripts/2_Exports_A06_t02: Crash # Instance of 'TypeOperator': type check unimplemented for foo.
-Language/15_Types/1_Static_Types_A03_t01: Crash # Instance of 'TypeOperator': type check unimplemented for UnknownType.
 Language/15_Types/3_Type_Declarations/1_Typedef_A01_t03: Crash # Instance of 'TypeOperator': type check unimplemented for f.
 Language/15_Types/3_Type_Declarations/1_Typedef_A02_t01: Crash # Instance of 'TypeOperator': type check unimplemented for f_t.
 Language/15_Types/3_Type_Declarations/1_Typedef_A02_t02: Crash # Instance of 'TypeOperator': type check unimplemented for f_t.
@@ -9753,14 +9731,12 @@
 Language/15_Types/3_Type_Declarations/1_Typedef_A07_t05: Crash # Instance of 'TypeOperator': type check unimplemented for f.
 Language/15_Types/3_Type_Declarations/1_Typedef_A07_t06: Crash # Instance of 'TypeOperator': type check unimplemented for f.
 Language/15_Types/3_Type_Declarations/1_Typedef_A07_t07: Crash # Instance of 'TypeOperator': type check unimplemented for f.
-Language/15_Types/4_Interface_Types_A05_t04: Crash # Please triage this failure.
-Language/15_Types/4_Interface_Types_A08_t01: Crash # Instance of 'TypeOperator': type check unimplemented for S.
-Language/15_Types/4_Interface_Types_A10_t04: Crash # Please triage this failure.
-Language/15_Types/4_Interface_Types_A10_t06: Crash # Please triage this failure.
-Language/15_Types/4_Interface_Types_A10_t07: Crash # Please triage this failure.
-Language/15_Types/4_Interface_Types_A10_t08: Crash # Please triage this failure.
-Language/15_Types/4_Interface_Types_A10_t09: Crash # Please triage this failure.
-Language/15_Types/4_Interface_Types_A11_t04: Crash # Instance of 'TypeOperator': type check unimplemented for S<int>.
+Language/15_Types/4_Interface_Types_A05_t04: Crash # type expression t1 (typedef)
+Language/15_Types/4_Interface_Types_A10_t04: Crash # type expression param1 (typedef)
+Language/15_Types/4_Interface_Types_A10_t06: Crash # type expression f (typedef)
+Language/15_Types/4_Interface_Types_A10_t07: Crash # type expression f_1 (typedef)
+Language/15_Types/4_Interface_Types_A10_t08: Crash # type expression t1 (typedef)
+Language/15_Types/4_Interface_Types_A10_t09: Crash # type expression param1 (typedef)
 Language/15_Types/4_Interface_Types_A12_t18: Crash # Instance of 'TypeOperator': type check unimplemented for F1.
 Language/15_Types/5_Function_Types_A01_t01: Crash # Instance of 'TypeOperator': type check unimplemented for check_t.
 Language/15_Types/5_Function_Types_A01_t02: Crash # Instance of 'TypeOperator': type check unimplemented for t1.
@@ -9797,8 +9773,6 @@
 Language/15_Types/5_Function_Types_A03_t12: Crash # Instance of 'TypeOperator': type check unimplemented for classesFunc.
 Language/15_Types/5_Function_Types_A03_t13: Crash # Instance of 'TypeOperator': type check unimplemented for t1.
 Language/15_Types/5_Function_Types_A06_t01: Crash # Instance of 'TypeOperator': type check unimplemented for f.
-Language/15_Types/6_Type_dynamic_A02_t01: Crash # Instance of 'TypeOperator': type check unimplemented for S.
-Language/15_Types/8_Parameterized_Types_A03_t06: Crash # Instance of 'TypeOperator': type check unimplemented for T1.
 LayoutTests/fast/backgrounds/multiple-backgrounds-computed-style_t01: Crash #  Unhandled node
 LayoutTests/fast/canvas/webgl/compressed-tex-image_t01: Crash # Please triage this failure.
 LayoutTests/fast/canvas/webgl/framebuffer-object-attachment_t01: Crash # Please triage this failure.
@@ -9901,15 +9875,18 @@
 LibTest/collection/ListBase/ListBase_class_A01_t02: Crash # Please triage this failure.
 LibTest/collection/ListMixin/ListMixin_class_A01_t02: Crash # Please triage this failure.
 LibTest/core/FallThroughError/toString_A01_t02: Crash #  Unhandled node
-LibTest/core/Invocation/isAccessor_A01_t01: RuntimeError # Please triage this failure.
+LibTest/core/Invocation/isAccessor_A01_t01: Crash # Please triage this failure.
+LibTest/core/Invocation/isGetter_A01_t01: RuntimeError # Please triage this failure.
 LibTest/core/Invocation/isGetter_A01_t02: RuntimeError # Please triage this failure.
-LibTest/core/Invocation/isMethod_A01_t02: RuntimeError # Please triage this failure.
+LibTest/core/Invocation/isMethod_A01_t02: Crash # Please triage this failure.
 LibTest/core/Invocation/isSetter_A01_t01: Crash # Please triage this failure.
-LibTest/core/Invocation/memberName_A01_t01: RuntimeError # Please triage this failure.
+LibTest/core/Invocation/isSetter_A01_t02: RuntimeError # Please triage this failure.
+LibTest/core/Invocation/memberName_A01_t01: Crash # Please triage this failure.
 LibTest/core/Invocation/positionalArguments_A01_t01: RuntimeError # Please triage this failure.
 LibTest/core/List/List_class_A01_t02: Crash # Please triage this failure.
-LibTest/core/Map/Map_A01_t01: Crash # Please triage this failure.
-LibTest/core/Object/operator_equality_A01_t01 : Crash # Instance of 'TypeOperator': type casts not implemented.
+LibTest/core/Map/Map_A01_t01: Crash # type expression SomeFunction (typedef)
+LibTest/core/Object/operator_equality_A01_t01: Crash # Instance of 'TypeOperator': type casts not implemented.
+LibTest/core/Object/toString_A01_t01: Crash # Instance of 'TypeOperator': type casts not implemented.
 LibTest/core/RegExp/Pattern_semantics/firstMatch_CharacterClassEscape_A03_t01: Crash #  Unhandled node
 LibTest/core/RegExp/Pattern_semantics/splitQueryString_A02_t01: Crash #  Unhandled node
 LibTest/core/Set/add_A01_t03: RuntimeError # Please triage this failure.
@@ -9917,8 +9894,6 @@
 LibTest/core/Symbol/Symbol_A01_t05: RuntimeError # Please triage this failure.
 LibTest/core/double/INFINITY_A01_t04: Pass # Please triage this failure.
 LibTest/core/double/NEGATIVE_INFINITY_A01_t04: Pass # Please triage this failure.
-LibTest/html/Document/childNodes_A01_t01: Crash # Instance of 'TypeOperator': type check unimplemented for DocumentType.
-LibTest/html/Document/securityPolicy_A01_t01: Crash # Instance of 'TypeOperator': type check unimplemented for SecurityPolicy.
 LibTest/html/HttpRequest/abort_A01_t01: Crash #  Unhandled node
 LibTest/html/HttpRequest/getAllResponseHeaders_A01_t01: Crash #  Unhandled node
 LibTest/html/HttpRequest/getResponseHeader_A01_t01: Crash #  Unhandled node
@@ -9946,5 +9921,3 @@
 WebPlatformTest/custom-elements/instantiating/isAttribute_A01_t02: Crash #  Unhandled node
 WebPlatformTest/html/semantics/forms/the-input-element/datetime_t01: Crash # Instance of 'TypeOperator': type casts not implemented.
 WebPlatformTest/html/semantics/forms/the-input-element/valueMode_t01: Crash #  Unhandled node
-Utils/tests/Expect/equals_A01_t04 : RuntimeError
-LibTest/core/Object/toString_A01_t01 : Crash # Instance of 'TypeOperator': type casts not implemented.
diff --git a/tests/compiler/dart2js/analyze_unused_dart2js_test.dart b/tests/compiler/dart2js/analyze_unused_dart2js_test.dart
index 3fc0068..9ae51b7 100644
--- a/tests/compiler/dart2js/analyze_unused_dart2js_test.dart
+++ b/tests/compiler/dart2js/analyze_unused_dart2js_test.dart
@@ -37,6 +37,21 @@
   // Method in abstract class. Currently only instantiated trough tests.
   "lib/src/constants/expressions.dart": const [
       "The method 'readFromEnvironment' is never called"],
+
+  // Nested functions are currently kept alive in the IR.
+  "lib/src/tree_ir/": const [
+    "accept", "FunctionExpression", "CreateFunction"
+  ],
+
+  "lib/src/cps_ir/": const [
+    "accept", "CreateFunction",
+  ],
+
+  "/lib/src/dart_backend/backend_ast_to_frontend_ast.dart": const [
+    " is never "
+  ],
+
+  "/lib/src/cps_ir/type_propagation.dart": const ["UnitTypeSystem"],
 };
 
 void main() {
diff --git a/tests/compiler/dart2js/backend_dart/dart_new_backend_test.dart b/tests/compiler/dart2js/backend_dart/dart_new_backend_test.dart
deleted file mode 100644
index 4fa5d28..0000000
--- a/tests/compiler/dart2js/backend_dart/dart_new_backend_test.dart
+++ /dev/null
@@ -1,63 +0,0 @@
-// 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 '../compiler_helper.dart';
-import 'dart:async';
-import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/dart2jslib.dart';
-import 'package:compiler/src/dart_backend/dart_backend.dart';
-import 'package:compiler/src/dart_backend/backend_ast_to_frontend_ast.dart'
-    show INSERT_NEW_BACKEND_COMMENT;
-
-const String TestStaticField = """
-class Foo {
-  static int x = 1;
-}
-main() {
-  print(Foo.x);
-}
-""";
-
-Future<String> compile(String code) {
-  OutputCollector outputCollector = new OutputCollector();
-  MockCompiler compiler = new MockCompiler.internal(
-      emitJavaScript: false,
-      enableMinification: false,
-      outputProvider: outputCollector);
-  return compiler.init().then((_) {
-    compiler.parseScript(code);
-    Element element = compiler.mainApp.find('main');
-    if (element == null) return null;
-    compiler.mainFunction = element;
-    compiler.phase = Compiler.PHASE_RESOLVING;
-    compiler.backend.enqueueHelpers(compiler.enqueuer.resolution,
-                                    compiler.globalDependencies);
-    compiler.processQueue(compiler.enqueuer.resolution, element);
-    compiler.world.populate();
-    compiler.backend.onResolutionComplete();
-    compiler.irBuilder.buildNodes();
-    compiler.phase = Compiler.PHASE_COMPILING;
-    DartBackend backend = compiler.backend;
-    backend.assembleProgram();
-    String generated = outputCollector.getOutput('', 'dart');
-    return generated;
-  });
-}
-
-Future test(String code, String feature) {
-  return compile(code).then((output) {
-    if (output == null || !output.contains('main() /* new backend */')) {
-      throw 'New backend appears to be deactivated for $feature.\n'
-            'Output was: $output';
-    }
-  });
-}
-
-main() {
-  INSERT_NEW_BACKEND_COMMENT = true;
-
-  asyncTest(() => Future.forEach([
-    () => test(TestStaticField, 'static fields'),
-  ], (f) => f()));
-}
diff --git a/tests/compiler/dart2js/backend_dart/sexpr2_test.dart b/tests/compiler/dart2js/backend_dart/sexpr2_test.dart
index fb55ec0..35c3185 100644
--- a/tests/compiler/dart2js/backend_dart/sexpr2_test.dart
+++ b/tests/compiler/dart2js/backend_dart/sexpr2_test.dart
@@ -25,7 +25,7 @@
     void checkOutput(String elementName,

                      Element element,

                      String expectedOutput) {

-      RootNode ir = compiler.irBuilder.getIr(element);

+      FunctionDefinition ir = compiler.irBuilder.getIr(element);

       if (expectedOutput == null) {

         Expect.isNull(ir, "\nInput:\n${result.input}\n"

                           "No CPS IR expected for $element");

diff --git a/tests/compiler/dart2js/dart2js.status b/tests/compiler/dart2js/dart2js.status
index fa4a8bb..fa809e3 100644
--- a/tests/compiler/dart2js/dart2js.status
+++ b/tests/compiler/dart2js/dart2js.status
@@ -32,6 +32,16 @@
 
 patch_test/bug: RuntimeError # Issue 21132
 
+# These tests are for the now-deleted dart2dart variant of the CPS IR.
+# We want to adapt them to test the JS variant of the CPS IR instead,
+# but for now they are disabled.
+backend_dart/end2end_test: Skip
+backend_dart/sexpr2_test: Skip
+backend_dart/sexpr_test: Skip
+backend_dart/opt_constprop_test: Skip
+backend_dart/opt_shrinking_test: Skip
+backend_dart/opt_redundant_phi_test: Skip
+
 [ $unchecked ]
 exit_code_test: Skip # This tests requires checked mode.
 
diff --git a/tests/compiler/dart2js/exit_code_test.dart b/tests/compiler/dart2js/exit_code_test.dart
index 3199c45..82473cb 100644
--- a/tests/compiler/dart2js/exit_code_test.dart
+++ b/tests/compiler/dart2js/exit_code_test.dart
@@ -59,14 +59,14 @@
     return super.onLibrariesLoaded(loadedLibraries);
   }
 
-  void analyzeElement(Element element) {
+  WorldImpact analyzeElement(Element element) {
     test('Compiler.analyzeElement');
-    super.analyzeElement(element);
+    return super.analyzeElement(element);
   }
 
-  void codegen(CodegenWorkItem work, CodegenEnqueuer world) {
+  WorldImpact codegen(CodegenWorkItem work, CodegenEnqueuer world) {
     test('Compiler.codegen');
-    super.codegen(work, world);
+    return super.codegen(work, world);
   }
 
   withCurrentElement(Element element, f()) {
diff --git a/tests/compiler/dart2js/js_backend_cps_ir_source_information_test.dart b/tests/compiler/dart2js/js_backend_cps_ir_source_information_test.dart
index 163e58d..505901f 100644
--- a/tests/compiler/dart2js/js_backend_cps_ir_source_information_test.dart
+++ b/tests/compiler/dart2js/js_backend_cps_ir_source_information_test.dart
@@ -43,7 +43,7 @@
   return compiler.enqueuer.codegen.generatedCode[element];
 }
 
-ir.RootNode getIrNodeForElement(Compiler compiler, Element element) {
+ir.FunctionDefinition getIrNodeForElement(Compiler compiler, Element element) {
   return compiler.irBuilder.getIr(element);
 }
 
diff --git a/tests/compiler/dart2js/resolver_test.dart b/tests/compiler/dart2js/resolver_test.dart
index ceca9de..dd41c57 100644
--- a/tests/compiler/dart2js/resolver_test.dart
+++ b/tests/compiler/dart2js/resolver_test.dart
@@ -696,7 +696,8 @@
                 new CollectingTreeElements(element)));
     new InitializerResolver(visitor).resolveInitializers(element, tree);
     visitor.visit(tree.body);
-    Expect.equals(expectedElementCount, map(visitor).length);
+    Expect.equals(expectedElementCount, map(visitor).length,
+        "${map(visitor).values} for '$statement' in context of `$script`");
 
     compareWarningKinds(script, expectedWarnings, compiler.warnings);
     compareWarningKinds(script, expectedErrors, compiler.errors);
diff --git a/tests/compiler/dart2js/semantic_visitor_test.dart b/tests/compiler/dart2js/semantic_visitor_test.dart
index 663b041..c9a487e 100644
--- a/tests/compiler/dart2js/semantic_visitor_test.dart
+++ b/tests/compiler/dart2js/semantic_visitor_test.dart
@@ -19,6 +19,11 @@
 import 'package:compiler/src/util/util.dart';

 import 'memory_compiler.dart';

 

+part 'semantic_visitor_test_send_data.dart';

+part 'semantic_visitor_test_send_visitor.dart';

+part 'semantic_visitor_test_decl_data.dart';

+part 'semantic_visitor_test_decl_visitor.dart';

+

 class Visit {

   final VisitKind method;

   final element;

@@ -162,4099 +167,6 @@
   }

 }

 

-const Map<String, List<Test>> SEND_TESTS = const {

-  'Parameters': const [

-    // Parameters

-    const Test('m(o) => o;',

-        const Visit(VisitKind.VISIT_PARAMETER_GET,

-                    element: 'parameter(m#o)')),

-    const Test('m(o) { o = 42; }',

-        const Visit(VisitKind.VISIT_PARAMETER_SET,

-                    element: 'parameter(m#o)',

-                    rhs:'42')),

-    const Test('m(o) { o(null, 42); }',

-        const Visit(VisitKind.VISIT_PARAMETER_INVOKE,

-                    element: 'parameter(m#o)',

-                    arguments: '(null,42)',

-                    selector: 'CallStructure(arity=2)')),

-    // TODO(johnniwinther): Expect [VISIT_FINAL_PARAMETER_SET] instead.

-    const Test('m(final o) { o = 42; }',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs:'42')),

-  ],

-  'Local variables': const [

-    // Local variables

-    const Test('m() { var o; return o; }',

-        const Visit(VisitKind.VISIT_LOCAL_VARIABLE_GET,

-                    element: 'variable(m#o)')),

-    const Test('m() { var o; o = 42; }',

-        const Visit(VisitKind.VISIT_LOCAL_VARIABLE_SET,

-                    element: 'variable(m#o)',

-                    rhs:'42')),

-    const Test('m() { var o; o(null, 42); }',

-        const Visit(VisitKind.VISIT_LOCAL_VARIABLE_INVOKE,

-                    element: 'variable(m#o)',

-                    arguments: '(null,42)',

-                    selector: 'CallStructure(arity=2)')),

-    // TODO(johnniwinther): Expect [VISIT_FINAL_LOCAL_VARIABLE_SET] instead.

-    const Test('m() { final o = 0; o = 42; }',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs:'42')),

-    // TODO(johnniwinther): Expect [VISIT_FINAL_LOCAL_VARIABLE_SET] instead.

-    const Test('m() { const o = 0; o = 42; }',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs:'42')),

-  ],

-  'Local functions': const [

-    // Local functions

-    const Test('m() { o(a, b) {}; return o; }',

-        const Visit(VisitKind.VISIT_LOCAL_FUNCTION_GET,

-                    element: 'function(m#o)')),

-    const Test('m() { o(a, b) {}; o(null, 42); }',

-        const Visit(VisitKind.VISIT_LOCAL_FUNCTION_INVOKE,

-                    element: 'function(m#o)',

-                    arguments: '(null,42)',

-                    selector: 'CallStructure(arity=2)')),

-    // TODO(johnniwinther): Expect [VISIT_LOCAL_FUNCTION_SET] instead.

-    const Test('m() { o(a, b) {}; o = 42; }',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-  ],

-  'Static fields': const [

-    // Static fields

-    const Test(

-        '''

-        class C { static var o; }

-        m() => C.o;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_GET,

-                    element: 'field(C#o)')),

-    const Test.clazz(

-        '''

-        class C {

-          static var o;

-          m() => o;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_GET,

-                    element: 'field(C#o)')),

-    const Test.clazz(

-        '''

-        class C {

-          static var o;

-          m() => C.o;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_GET,

-                    element: 'field(C#o)')),

-    const Test.prefix(

-        '''

-        class C {

-          static var o;

-        }

-        ''',

-        'm() => p.C.o;',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_GET,

-                    element: 'field(C#o)')),

-    const Test(

-        '''

-        class C { static var o; }

-        m() { C.o = 42; }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_SET,

-                    element: 'field(C#o)',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static var o;

-          m() { o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_SET,

-                    element: 'field(C#o)',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static var o;

-          m() { C.o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_SET,

-                    element: 'field(C#o)',

-                    rhs: '42')),

-    const Test.prefix(

-        '''

-        class C {

-          static var o;

-        }

-        ''',

-        'm() { p.C.o = 42; }',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_SET,

-                    element: 'field(C#o)',

-                    rhs: '42')),

-    const Test(

-        '''

-        class C { static var o; }

-        m() { C.o(null, 42); }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE,

-                    element: 'field(C#o)',

-                    arguments: '(null,42)')),

-    const Test.clazz(

-        '''

-        class C {

-          static var o;

-          m() { o(null, 42); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE,

-                    element: 'field(C#o)',

-                    arguments: '(null,42)')),

-    const Test.clazz(

-        '''

-        class C {

-          static var o;

-          m() { C.o(null, 42); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE,

-                    element: 'field(C#o)',

-                    arguments: '(null,42)')),

-    const Test.prefix(

-        '''

-        class C {

-          static var o;

-        }

-        ''',

-        'm() { p.C.o(null, 42); }',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE,

-                    element: 'field(C#o)',

-                    arguments: '(null,42)')),

-    // TODO(johnniwinther): Expect [VISIT_FINAL_STATIC_FIELD_SET] instead.

-    const Test(

-        '''

-        class C { static final o = 0; }

-        m() { C.o = 42; }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static final o = 0;

-          m() { o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static final o = 0;

-          m() { C.o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.prefix(

-        '''

-        class C {

-          static final o = 0;

-        }

-        ''',

-        'm() { p.C.o = 42; }',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test(

-        '''

-        class C { static const o = 0; }

-        m() { C.o = 42; }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static const o = 0;

-          m() { o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static const o = 0;

-          m() { C.o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.prefix(

-        '''

-        class C {

-          static const o = 0;

-        }

-        ''',

-        'm() { p.C.o = 42; }',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-  ],

-  'Static properties': const [

-    // Static properties

-    const Test(

-        '''

-        class C {

-          static get o => null;

-        }

-        m() => C.o;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_GET,

-                    element: 'getter(C#o)')),

-    const Test.clazz(

-        '''

-        class C {

-          static get o => null;

-          m() => o;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_GET,

-                    element: 'getter(C#o)')),

-    const Test.clazz(

-        '''

-        class C {

-          static get o => null;

-          m() => C.o;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_GET,

-                    element: 'getter(C#o)')),

-    const Test.prefix(

-        '''

-        class C {

-          static get o => null;

-        }

-        ''',

-        'm() => p.C.o;',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_GET,

-                    element: 'getter(C#o)')),

-    // TODO(johnniwinther): Expected [VISIT_STATIC_GETTER_SET] instead.

-    const Test(

-        '''

-        class C { static get o => 42; }

-        m() { C.o = 42; }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static static get o => 42;

-          m() { o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static static get o => 42;

-          m() { C.o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.prefix(

-        '''

-        class C {

-          static static get o => 42;

-        }

-        ''',

-        'm() { p.C.o = 42; }',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    // TODO(johnniwinther): Expected [VISIT_STATIC_SETTER_GET] instead.

-    const Test(

-        '''

-        class C {

-          static set o(_) {}

-        }

-        m() => C.o;

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_GET,

-                    name: 'o')),

-    const Test.clazz(

-        '''

-        class C {

-          static set o(_) {}

-          m() => o;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_GET,

-                    name: 'o')),

-    const Test.clazz(

-        '''

-        class C {

-          static set o(_) {}

-          m() => C.o;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_GET,

-                    name: 'o')),

-    const Test.prefix(

-        '''

-        class C {

-          static set o(_) {}

-        }

-        ''',

-        'm() => p.C.o;',

-        const Visit(VisitKind.VISIT_UNRESOLVED_GET,

-                    name: 'o')),

-    const Test(

-        '''

-        class C { static set o(_) {} }

-        m() { C.o = 42; }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_SETTER_SET,

-                    element: 'setter(C#o)',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static set o(_) {}

-          m() { o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_SETTER_SET,

-                    element: 'setter(C#o)',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static set o(_) {}

-          m() { C.o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_SETTER_SET,

-                    element: 'setter(C#o)',

-                    rhs: '42')),

-    const Test.prefix(

-        '''

-        class C {

-          static set o(_) {}

-        }

-        ''',

-        'm() { p.C.o = 42; }',

-        const Visit(VisitKind.VISIT_STATIC_SETTER_SET,

-                    element: 'setter(C#o)',

-                    rhs: '42')),

-    const Test(

-        '''

-        class C { static get o => null; }

-        m() => C.o(null, 42);

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE,

-                    element: 'getter(C#o)',

-                    arguments: '(null,42)')),

-    const Test.clazz(

-        '''

-        class C {

-          static get o => null;

-          m() { o(null, 42); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE,

-                    element: 'getter(C#o)',

-                    arguments: '(null,42)')),

-    const Test.clazz(

-        '''

-        class C {

-          static get o => null;

-          m() { C.o(null, 42); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE,

-                    element: 'getter(C#o)',

-                    arguments: '(null,42)')),

-    const Test.prefix(

-        '''

-        class C {

-          static get o => null;

-        }

-        ''',

-        'm() { p.C.o(null, 42); }',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE,

-                    element: 'getter(C#o)',

-                    arguments: '(null,42)')),

-    // TODO(johnniwinther): Expect [VISIT_STATIC_SETTER_INVOKE] instead.

-    const Test(

-        '''

-        class C { static set o(_) {} }

-        m() => C.o(null, 42);

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

-                    name: 'o',

-                    arguments: '(null,42)')),

-    const Test.clazz(

-        '''

-        class C {

-          static set o(_) {}

-          m() { o(null, 42); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

-                    name: 'o',

-                    arguments: '(null,42)')),

-    const Test.clazz(

-        '''

-        class C {

-          static set o(_) {}

-          m() { C.o(null, 42); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

-                    name: 'o',

-                    arguments: '(null,42)')),

-    const Test.prefix(

-        '''

-        class C {

-          static set o(_) {}

-        }

-        ''',

-        'm() { p.C.o(null, 42); }',

-        const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

-                    name: 'o',

-                    arguments: '(null,42)')),

-  ],

-  'Static functions': const [

-    // Static functions

-    const Test(

-        '''

-        class C { static o(a, b) {} }

-        m() => C.o;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET,

-                    element: 'function(C#o)')),

-    const Test.clazz(

-        '''

-        class C {

-          static o(a, b) {}

-          m() => o;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET,

-                    element: 'function(C#o)')),

-    const Test.clazz(

-        '''

-        class C {

-          static o(a, b) {}

-          m() => C.o;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET,

-                    element: 'function(C#o)')),

-    const Test.prefix(

-        '''

-        class C { static o(a, b) {} }

-        ''',

-        '''

-        m() => p.C.o;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET,

-                    element: 'function(C#o)')),

-    // TODO(johnniwinther): Expect [VISIT_STATIC_FUNCTION_SET] instead.

-    const Test(

-        '''

-        class C { static o(a, b) {} }

-        m() { C.o = 42; }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static o(a, b) {}

-          m() { o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static o(a, b) {}

-          m() { C.o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.prefix(

-        '''

-        class C { static o(a, b) {} }

-        ''',

-        '''

-        m() { p.C.o = 42; }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test(

-        '''

-        class C { static o(a, b) {} }

-        m() => C.o(null, 42);

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE,

-                    element: 'function(C#o)',

-                    arguments: '(null,42)')),

-    const Test.clazz(

-        '''

-        class C {

-          static o(a, b) {}

-          m() { o(null, 42); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE,

-                    element: 'function(C#o)',

-                    arguments: '(null,42)')),

-    const Test.clazz(

-        '''

-        class C {

-          static o(a, b) {}

-          m() { C.o(null, 42); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE,

-                    element: 'function(C#o)',

-                    arguments: '(null,42)')),

-    const Test.prefix(

-        '''

-        class C {

-          static o(a, b) {}

-        }

-        ''',

-        'm() { p.C.o(null, 42); }',

-        const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE,

-                    element: 'function(C#o)',

-                    arguments: '(null,42)')),

-    const Test(

-        '''

-        class C { static o(a, b) {} }

-        m() => C.o(null);

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FUNCTION_INCOMPATIBLE_INVOKE,

-                    element: 'function(C#o)',

-                    arguments: '(null)')),

-  ],

-  'Top level fields': const [

-    // Top level fields

-    const Test(

-        '''

-        var o;

-        m() => o;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_GET,

-                    element: 'field(o)')),

-    const Test.prefix(

-        '''

-        var o;

-        ''',

-        'm() => p.o;',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_GET,

-                    element: 'field(o)')),

-    const Test(

-        '''

-        var o;

-        m() { o = 42; }

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_SET,

-                    element: 'field(o)',

-                    rhs: '42')),

-    const Test.prefix(

-        '''

-        var o;

-        ''',

-        'm() { p.o = 42; }',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_SET,

-                    element: 'field(o)',

-                    rhs: '42')),

-    // TODO(johnniwinther): Expect [VISIT_FINAL_TOP_LEVEL_FIELD_SET] instead.

-    const Test(

-        '''

-        final o = 0;

-        m() { o = 42; }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.prefix(

-        '''

-        final o = 0;

-        ''',

-        'm() { p.o = 42; }',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test(

-        '''

-        const o = 0;

-        m() { o = 42; }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.prefix(

-        '''

-        const o = 0;

-        ''',

-        'm() { p.o = 42; }',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test(

-        '''

-        var o;

-        m() { o(null, 42); }

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_INVOKE,

-                    element: 'field(o)',

-                    arguments: '(null,42)')),

-    const Test.prefix(

-        '''

-        var o;

-        ''',

-        'm() { p.o(null, 42); }',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_INVOKE,

-                    element: 'field(o)',

-                    arguments: '(null,42)')),

-    const Test(

-        '''

-        m() => o;

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_GET,

-                    name: 'o')),

-  ],

-  'Top level properties': const [

-    // Top level properties

-    const Test(

-        '''

-        get o => null;

-        m() => o;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_GET,

-                    element: 'getter(o)')),

-    const Test.prefix(

-        '''

-        get o => null;

-        ''',

-        '''

-        m() => p.o;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_GET,

-                    element: 'getter(o)')),

-    // TODO(johnniwinther): Expect [VISIT_TOP_LEVEL_SETTER_GET] instead.

-    const Test(

-        '''

-        set o(_) {}

-        m() => o;

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_GET,

-                    name: 'o')),

-    const Test.prefix(

-        '''

-        set o(_) {}

-        ''',

-        '''

-        m() => p.o;

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_GET,

-                    name: 'o')),

-    // TODO(johnniwinther): Expect [VISIT_TOP_LEVEL_GETTER_SET] instead.

-    const Test(

-        '''

-        get o => null;

-        m() { o = 42; }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.prefix(

-        '''

-        get o => null;

-        ''',

-        'm() { p.o = 42; }',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test(

-        '''

-        set o(_) {}

-        m() { o = 42; }

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_SET,

-                    element: 'setter(o)',

-                    rhs: '42')),

-    const Test.prefix(

-        '''

-        set o(_) {}

-        ''',

-        'm() { p.o = 42; }',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_SET,

-                    element: 'setter(o)',

-                    rhs: '42')),

-    const Test(

-        '''

-        get o => null;

-        m() => o(null, 42);

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_INVOKE,

-                    element: 'getter(o)',

-                    arguments: '(null,42)')),

-    const Test.prefix(

-        '''

-        get o => null;

-        ''',

-        'm() { p.o(null, 42); }',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_INVOKE,

-                    element: 'getter(o)',

-                    arguments: '(null,42)')),

-    // TODO(johnniwinther): Expected [VISIT_TOP_LEVEL_SETTER_INVOKE] instead.

-    const Test(

-        '''

-        set o(_) {}

-        m() => o(null, 42);

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

-                    name: 'o',

-                    arguments: '(null,42)')),

-    const Test.prefix(

-        '''

-        set o(_) {}

-        ''',

-        'm() { p.o(null, 42); }',

-        const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

-                    name: 'o',

-                    arguments: '(null,42)')),

-  ],

-  'Top level functions': const [

-    // Top level functions

-    const Test(

-        '''

-        o(a, b) {}

-        m() => o;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_GET,

-                    element: 'function(o)')),

-    const Test(

-        '''

-        o(a, b) {}

-        m() => o(null, 42);

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INVOKE,

-                    element: 'function(o)',

-                    arguments: '(null,42)')),

-    const Test(

-        '''

-        o(a, b) {}

-        m() => o(null);

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INCOMPATIBLE_INVOKE,

-                    element: 'function(o)',

-                    arguments: '(null)')),

-    const Test.prefix(

-        '''

-        o(a, b) {}

-        ''',

-        'm() { p.o(null, 42); }',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INVOKE,

-                    element: 'function(o)',

-                    arguments: '(null,42)')),

-    const Test(

-        '''

-        m() => o(null, 42);

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

-                    name: 'o',

-                    arguments: '(null,42)')),

-    // TODO(johnniwinther): Expect [VISIT_TOP_LEVEL_FUNCTION_SET] instead.

-    const Test(

-        '''

-        o(a, b) {}

-        m() { o = 42; }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.prefix(

-        '''

-        o(a, b) {}

-        ''',

-        'm() { p.o = 42; }',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-  ],

-  'Dynamic properties': const [

-    // Dynamic properties

-    const Test('m(o) => o.foo;',

-        const [

-          const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_GET,

-                      receiver: 'o',

-                      name: 'foo'),

-          const Visit(VisitKind.VISIT_PARAMETER_GET,

-                      element: 'parameter(m#o)'),

-        ]),

-    const Test('m(o) { o.foo = 42; }',

-        const [

-          const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_SET,

-                      receiver: 'o',

-                      name: 'foo',

-                      rhs: '42'),

-          const Visit(VisitKind.VISIT_PARAMETER_GET,

-                      element: 'parameter(m#o)'),

-        ]),

-    const Test('m(o) { o.foo(null, 42); }',

-        const [

-          const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_INVOKE,

-                      receiver: 'o',

-                      name: 'foo',

-                      arguments: '(null,42)'),

-          const Visit(VisitKind.VISIT_PARAMETER_GET,

-                      element: 'parameter(m#o)'),

-        ]),

-  ],

-  'This access': const [

-    // This access

-    const Test.clazz(

-        '''

-        class C {

-          m() => this;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_GET)),

-    const Test.clazz(

-        '''

-        class C {

-          call(a, b) {}

-          m() { this(null, 42); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_INVOKE,

-                    arguments: '(null,42)')),

-  ],

-  'This properties': const [

-    // This properties

-    const Test.clazz(

-        '''

-        class C {

-          var foo;

-          m() => foo;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_GET,

-                    name: 'foo')),

-    const Test.clazz(

-        '''

-        class C {

-          var foo;

-          m() => this.foo;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_GET,

-                    name: 'foo')),

-    const Test.clazz(

-        '''

-        class C {

-          get foo => null;

-          m() => foo;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_GET,

-                    name: 'foo')),

-    const Test.clazz(

-        '''

-        class C {

-          get foo => null;

-          m() => this.foo;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_GET,

-                    name: 'foo')),

-    const Test.clazz(

-        '''

-        class C {

-          var foo;

-          m() { foo = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_SET,

-                    name: 'foo',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          var foo;

-          m() { this.foo = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_SET,

-                    name: 'foo',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          set foo(_) {}

-          m() { foo = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_SET,

-                    name: 'foo',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          set foo(_) {}

-          m() { this.foo = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_SET,

-                    name: 'foo',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          var foo;

-          m() { foo(null, 42); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_INVOKE,

-                    name: 'foo',

-                    arguments: '(null,42)')),

-    const Test.clazz(

-        '''

-        class C {

-          var foo;

-          m() { this.foo(null, 42); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_INVOKE,

-                    name: 'foo',

-                    arguments: '(null,42)')),

-  ],

-  'Super fields': const [

-    // Super fields

-    const Test.clazz(

-        '''

-        class B {

-          var o;

-        }

-        class C extends B {

-          m() => super.o;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_FIELD_GET,

-                    element: 'field(B#o)')),

-    const Test.clazz(

-        '''

-        class B {

-          var o;

-        }

-        class C extends B {

-          m() { super.o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_FIELD_SET,

-                    element: 'field(B#o)',

-                    rhs: '42')),

-    // TODO(johnniwinther): Expect [VISIT_FINAL_SUPER_FIELD_SET] instead.

-    const Test.clazz(

-        '''

-        class B {

-          final o = 0;

-        }

-        class C extends B {

-          m() { super.o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class B {

-          var o;

-        }

-        class C extends B {

-          m() { super.o(null, 42); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_FIELD_INVOKE,

-                element: 'field(B#o)',

-                arguments: '(null,42)')),

-    const Test.clazz(

-            '''

-        class B {

-        }

-        class C extends B {

-          m() => super.o;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GET)),

-  ],

-  'Super properties': const [

-    // Super properties

-    const Test.clazz(

-        '''

-        class B {

-          get o => null;

-        }

-        class C extends B {

-          m() => super.o;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_GETTER_GET,

-                    element: 'getter(B#o)')),

-    // TODO(johnniwinther): Expect [VISIT_SUPER_SETTER_GET] instead.

-    const Test.clazz(

-        '''

-        class B {

-          set o(_) {}

-        }

-        class C extends B {

-          m() => super.o;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GET)),

-    // TODO(johnniwinther): Expect [VISIT_SUPER_GETTER_SET] instead.

-    const Test.clazz(

-        '''

-        class B {

-          get o => 0;

-        }

-        class C extends B {

-          m() { super.o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                    name: 'o',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class B {

-          set o(_) {}

-        }

-        class C extends B {

-          m() { super.o = 42; }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_SETTER_SET,

-                    element: 'setter(B#o)',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class B {

-          get o => null;

-        }

-        class C extends B {

-          m() { super.o(null, 42); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_GETTER_INVOKE,

-                    element: 'getter(B#o)',

-                    arguments: '(null,42)')),

-    // TODO(johnniwinther): Expect [VISIT_SUPER_SETTER_INVOKE] instead.

-    const Test.clazz(

-        '''

-        class B {

-          set o(_) {}

-        }

-        class C extends B {

-          m() { super.o(null, 42); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INVOKE,

-                    arguments: '(null,42)')),

-  ],

-  'Super methods': const [

-    // Super methods

-    const Test.clazz(

-        '''

-        class B {

-          o(a, b) {}

-        }

-        class C extends B {

-          m() => super.o;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_METHOD_GET,

-                    element: 'function(B#o)')),

-    const Test.clazz(

-        '''

-        class B {

-          o(a, b) {}

-        }

-        class C extends B {

-          m() { super.o(null, 42); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_METHOD_INVOKE,

-                    element: 'function(B#o)',

-                    arguments: '(null,42)')),

-    const Test.clazz(

-        '''

-        class B {

-          o(a, b) {}

-        }

-        class C extends B {

-          m() { super.o(null); }

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_METHOD_INCOMPATIBLE_INVOKE,

-                    element: 'function(B#o)',

-                    arguments: '(null)')),

-    const Test.clazz(

-            '''

-            class B {

-            }

-            class C extends B {

-              m() => super.o(null, 42);

-            }

-            ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INVOKE,

-                    arguments: '(null,42)')),

-  ],

-  'Expression invoke': const [

-    // Expression invoke

-    const Test('m() => (a, b){}(null, 42);',

-        const Visit(VisitKind.VISIT_EXPRESSION_INVOKE,

-                    receiver: '(a,b){}',

-                    arguments: '(null,42)')),

-  ],

-  'Class type literals': const [

-    // Class type literals

-    const Test(

-        '''

-        class C {}

-        m() => C;

-        ''',

-        const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_GET,

-                    constant: 'C')),

-    const Test(

-        '''

-        class C {}

-        m() => C(null, 42);

-        ''',

-        const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_INVOKE,

-                    constant: 'C',

-                    arguments: '(null,42)')),

-    const Test(

-        '''

-        class C {}

-        m() => C += 42;

-        ''',

-        const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_COMPOUND,

-                    constant: 'C',

-                    operator: '+=',

-                    rhs: '42')),

-    const Test(

-        '''

-        class C {}

-        m() => ++C;

-        ''',

-        const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_PREFIX,

-                    constant: 'C',

-                    operator: '++')),

-    const Test(

-        '''

-        class C {}

-        m() => C--;

-        ''',

-        const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_POSTFIX,

-                    constant: 'C',

-                    operator: '--')),

-    const Test(

-        '''

-        class C {}

-        m() => C;

-        ''',

-        const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_GET,

-                    constant: 'C')),

-  ],

-  'Typedef type literals': const [

-    // Typedef type literals

-    const Test(

-        '''

-        typedef F();

-        m() => F;

-        ''',

-        const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_GET,

-                    constant: 'F')),

-    const Test(

-        '''

-        typedef F();

-        m() => F(null, 42);

-        ''',

-        const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_INVOKE,

-                    constant: 'F',

-                    arguments: '(null,42)')),

-    const Test(

-        '''

-        typedef F();

-        m() => F += 42;

-        ''',

-        const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_COMPOUND,

-                    constant: 'F',

-                    operator: '+=',

-                    rhs: '42')),

-    const Test(

-        '''

-        typedef F();

-        m() => ++F;

-        ''',

-        const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_PREFIX,

-                    constant: 'F',

-                    operator: '++')),

-    const Test(

-        '''

-        typedef F();

-        m() => F--;

-        ''',

-        const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_POSTFIX,

-                    constant: 'F',

-                    operator: '--')),

-  ],

-  'Type variable type literals': const [

-    // Type variable type literals

-    const Test.clazz(

-        '''

-        class C<T> {

-          m() => T;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_GET,

-                    element: 'type_variable(C#T)')),

-    const Test.clazz(

-        '''

-        class C<T> {

-          m() => T(null, 42);

-        }

-        ''',

-        const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_INVOKE,

-                    element: 'type_variable(C#T)',

-                    arguments: '(null,42)')),

-    const Test.clazz(

-        '''

-        class C<T> {

-          m() => T += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_COMPOUND,

-                    element: 'type_variable(C#T)',

-                    operator: '+=',

-                    rhs: '42')),

-    const Test.clazz(

-        '''

-        class C<T> {

-          m() => ++T;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_PREFIX,

-                    element: 'type_variable(C#T)',

-                    operator: '++')),

-    const Test.clazz(

-        '''

-        class C<T> {

-          m() => T--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_POSTFIX,

-                    element: 'type_variable(C#T)',

-                    operator: '--')),

-

-  ],

-  'Dynamic type literals': const [

-    // Dynamic type literals

-    const Test(

-        '''

-        m() => dynamic;

-        ''',

-        const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_GET,

-                    constant: 'dynamic')),

-    // TODO(johnniwinther): Update these to expect the constant to be `dynamic`

-    // instead of `Type`. Currently the compile time constant evaluator cannot

-    // detect `dynamic` as a constant subexpression.

-    const Test(

-        '''

-        m() { dynamic(null, 42); }

-        ''',

-        const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_INVOKE,

-                    constant: 'Type',

-                    arguments: '(null,42)')),

-    const Test(

-        '''

-        m() => dynamic += 42;

-        ''',

-        const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_COMPOUND,

-                    constant: 'Type',

-                    operator: '+=',

-                    rhs: '42')),

-    const Test(

-        '''

-        m() => ++dynamic;

-        ''',

-        const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_PREFIX,

-                    constant: 'Type',

-                    operator: '++')),

-    const Test(

-        '''

-        m() => dynamic--;

-        ''',

-        const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_POSTFIX,

-                    constant: 'Type',

-                    operator: '--')),

-  ],

-  'Assert': const [

-    // Assert

-    const Test(

-        '''

-        m() { assert(false); }

-        ''',

-        const Visit(VisitKind.VISIT_ASSERT, expression: 'false')),

-  ],

-  'Logical and': const [

-    // Logical and

-    const Test(

-        '''

-        m() => true && false;

-        ''',

-        const Visit(VisitKind.VISIT_LOGICAL_AND, left: 'true', right: 'false')),

-  ],

-  'Logical or': const [

-    // Logical or

-    const Test(

-        '''

-        m() => true || false;

-        ''',

-        const Visit(VisitKind.VISIT_LOGICAL_OR, left: 'true', right: 'false')),

-  ],

-  'Is test': const [

-    // Is test

-    const Test(

-        '''

-        class C {}

-        m() => 0 is C;

-        ''',

-        const Visit(VisitKind.VISIT_IS, expression: '0', type: 'C')),

-  ],

-  'Is not test': const [

-    // Is not test

-    const Test(

-        '''

-        class C {}

-        m() => 0 is! C;

-        ''',

-        const Visit(VisitKind.VISIT_IS_NOT, expression: '0', type: 'C')),

-  ],

-  'As test': const [

-    // As test

-    const Test(

-        '''

-        class C {}

-        m() => 0 as C;

-        ''',

-        const Visit(VisitKind.VISIT_AS, expression: '0', type: 'C')),

-  ],

-  'Binary operators': const [

-    // Binary operators

-    const Test(

-        '''

-        m() => 2 + 3;

-        ''',

-        const Visit(VisitKind.VISIT_BINARY,

-                    left: '2', operator: '+', right: '3')),

-    const Test(

-        '''

-        m() => 2 - 3;

-        ''',

-        const Visit(VisitKind.VISIT_BINARY,

-                    left: '2', operator: '-', right: '3')),

-    const Test(

-        '''

-        m() => 2 * 3;

-        ''',

-        const Visit(VisitKind.VISIT_BINARY,

-                    left: '2', operator: '*', right: '3')),

-    const Test(

-        '''

-        m() => 2 / 3;

-        ''',

-        const Visit(VisitKind.VISIT_BINARY,

-                    left: '2', operator: '/', right: '3')),

-    const Test(

-        '''

-        m() => 2 ~/ 3;

-        ''',

-        const Visit(VisitKind.VISIT_BINARY,

-                    left: '2', operator: '~/', right: '3')),

-    const Test(

-        '''

-        m() => 2 % 3;

-        ''',

-        const Visit(VisitKind.VISIT_BINARY,

-                    left: '2', operator: '%', right: '3')),

-    const Test(

-        '''

-        m() => 2 << 3;

-        ''',

-        const Visit(VisitKind.VISIT_BINARY,

-                    left: '2', operator: '<<', right: '3')),

-    const Test(

-        '''

-        m() => 2 >> 3;

-        ''',

-        const Visit(VisitKind.VISIT_BINARY,

-                    left: '2', operator: '>>', right: '3')),

-    const Test(

-        '''

-        m() => 2 <= 3;

-        ''',

-        const Visit(VisitKind.VISIT_BINARY,

-                    left: '2', operator: '<=', right: '3')),

-    const Test(

-        '''

-        m() => 2 < 3;

-        ''',

-        const Visit(VisitKind.VISIT_BINARY,

-                    left: '2', operator: '<', right: '3')),

-    const Test(

-        '''

-        m() => 2 >= 3;

-        ''',

-        const Visit(VisitKind.VISIT_BINARY,

-                    left: '2', operator: '>=', right: '3')),

-    const Test(

-        '''

-        m() => 2 > 3;

-        ''',

-        const Visit(VisitKind.VISIT_BINARY,

-                    left: '2', operator: '>', right: '3')),

-    const Test(

-        '''

-        m() => 2 & 3;

-        ''',

-        const Visit(VisitKind.VISIT_BINARY,

-                    left: '2', operator: '&', right: '3')),

-    const Test(

-        '''

-        m() => 2 | 3;

-        ''',

-        const Visit(VisitKind.VISIT_BINARY,

-                    left: '2', operator: '|', right: '3')),

-    const Test(

-        '''

-        m() => 2 ^ 3;

-        ''',

-        const Visit(VisitKind.VISIT_BINARY,

-                    left: '2', operator: '^', right: '3')),

-    const Test.clazz(

-        '''

-        class B {

-          operator +(_) => null;

-        }

-        class C extends B {

-          m() => super + 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_BINARY,

-                    element: 'function(B#+)',

-                    operator: '+',

-                    right: '42')),

-    const Test.clazz(

-        '''

-        class B {}

-        class C extends B {

-          m() => super + 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_BINARY,

-                    operator: '+',

-                    right: '42')),

-  ],

-  'Index': const [

-    // Index

-    const Test(

-        '''

-        m() => 2[3];

-        ''',

-        const Visit(VisitKind.VISIT_INDEX,

-                    receiver: '2', index: '3')),

-    const Test(

-        '''

-        m() => --2[3];

-        ''',

-        const Visit(VisitKind.VISIT_INDEX_PREFIX,

-                    receiver: '2', index: '3', operator: '--')),

-    const Test(

-        '''

-        m() => 2[3]++;

-        ''',

-        const Visit(VisitKind.VISIT_INDEX_POSTFIX,

-                    receiver: '2', index: '3', operator: '++')),

-    const Test.clazz(

-        '''

-        class B {

-          operator [](_) => null;

-        }

-        class C extends B {

-          m() => super[42];

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_INDEX,

-                    element: 'function(B#[])',

-                    index: '42')),

-    const Test.clazz(

-        '''

-        class B {

-        }

-        class C extends B {

-          m() => super[42];

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX,

-                    index: '42')),

-    const Test.clazz(

-        '''

-        class B {

-          operator [](_) => null;

-          operator []=(a, b) {}

-        }

-        class C extends B {

-          m() => ++super[42];

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_INDEX_PREFIX,

-                    getter: 'function(B#[])',

-                    setter: 'function(B#[]=)',

-                    index: '42',

-                    operator: '++')),

-    const Test.clazz(

-        '''

-        class B {

-          operator []=(a, b) {}

-        }

-        class C extends B {

-          m() => ++super[42];

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_INDEX_PREFIX,

-                    setter: 'function(B#[]=)',

-                    index: '42',

-                    operator: '++')),

-    const Test.clazz(

-        '''

-        class B {

-        }

-        class C extends B {

-          m() => ++super[42];

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_PREFIX,

-                    index: '42',

-                    operator: '++')),

-    const Test.clazz(

-        '''

-        class B {

-          operator [](_) => null;

-        }

-        class C extends B {

-          m() => ++super[42];

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_PREFIX,

-                    getter: 'function(B#[])',

-                    index: '42',

-                    operator: '++')),

-    const Test.clazz(

-        '''

-        class B {

-          operator [](_) => null;

-          operator []=(a, b) {}

-        }

-        class C extends B {

-          m() => super[42]--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_INDEX_POSTFIX,

-                    getter: 'function(B#[])',

-                    setter: 'function(B#[]=)',

-                    index: '42',

-                    operator: '--')),

-    const Test.clazz(

-        '''

-        class B {

-          operator []=(a, b) {}

-        }

-        class C extends B {

-          m() => super[42]--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_INDEX_POSTFIX,

-                    setter: 'function(B#[]=)',

-                    index: '42',

-                    operator: '--')),

-    const Test.clazz(

-        '''

-        class B {

-        }

-        class C extends B {

-          m() => super[42]--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_POSTFIX,

-                    index: '42',

-                    operator: '--')),

-    const Test.clazz(

-        '''

-        class B {

-          operator [](_) => null;

-        }

-        class C extends B {

-          m() => super[42]--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_POSTFIX,

-                    getter: 'function(B#[])',

-                    index: '42',

-                    operator: '--')),

-  ],

-  'Equals': const [

-    // Equals

-    const Test(

-        '''

-        m() => 2 == 3;

-        ''',

-        const Visit(VisitKind.VISIT_EQUALS,

-                    left: '2', right: '3')),

-    const Test.clazz(

-        '''

-        class B {

-          operator ==(_) => null;

-        }

-        class C extends B {

-          m() => super == 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_EQUALS,

-                    element: 'function(B#==)',

-                    right: '42')),

-  ],

-  'Not equals': const [

-    // Not equals

-    const Test(

-        '''

-        m() => 2 != 3;

-        ''',

-        const Visit(VisitKind.VISIT_NOT_EQUALS,

-                    left: '2', right: '3')),

-    const Test.clazz(

-        '''

-        class B {

-          operator ==(_) => null;

-        }

-        class C extends B {

-          m() => super != 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_NOT_EQUALS,

-                    element: 'function(B#==)',

-                    right: '42')),

-  ],

-  'Unary expression': const [

-    // Unary expression

-    const Test(

-        '''

-        m() => -false;

-        ''',

-        const Visit(VisitKind.VISIT_UNARY,

-                    expression: 'false', operator: '-')),

-    const Test(

-        '''

-        m() => ~false;

-        ''',

-        const Visit(VisitKind.VISIT_UNARY,

-                    expression: 'false', operator: '~')),

-    const Test.clazz(

-        '''

-        class B {

-          operator -() => null;

-        }

-        class C extends B {

-          m() => -super;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_UNARY,

-                    element: 'function(B#unary-)', operator: '-')),

-    const Test.clazz(

-        '''

-        class B {

-        }

-        class C extends B {

-          m() => -super;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_UNARY,

-                    operator: '-')),

-    const Test.clazz(

-        '''

-        class B {

-          operator ~() => null;

-        }

-        class C extends B {

-          m() => ~super;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_UNARY,

-                    element: 'function(B#~)', operator: '~')),

-    const Test(

-        '''

-        m() => !0;

-        ''',

-        const Visit(VisitKind.VISIT_NOT, expression: '0')),

-  ],

-  'Index set': const [

-    // Index set

-    const Test(

-        '''

-        m() => 0[1] = 2;

-        ''',

-        const Visit(VisitKind.VISIT_INDEX_SET,

-            receiver: '0', index: '1', rhs: '2')),

-    const Test.clazz(

-        '''

-        class B {

-          operator []=(a, b) {}

-        }

-        class C extends B {

-          m() => super[1] = 2;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_INDEX_SET,

-            element: 'function(B#[]=)', index: '1', rhs: '2')),

-    const Test.clazz(

-        '''

-        class B {

-        }

-        class C extends B {

-          m() => super[1] = 2;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_SET,

-            index: '1', rhs: '2')),

-  ],

-  'Compound assignment': const [

-    // Compound assignment

-    const Test(

-        '''

-        m(a) => a.b += 42;

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_COMPOUND,

-              receiver: 'a', operator: '+=', rhs: '42',

-              getter: 'Selector(getter, b, arity=0)',

-              setter: 'Selector(setter, b, arity=1)'),

-          const Visit(VisitKind.VISIT_PARAMETER_GET,

-              element: 'parameter(m#a)')

-        ]),

-    const Test(

-        '''

-        m(a) => a += 42;

-        ''',

-        const Visit(VisitKind.VISIT_PARAMETER_COMPOUND,

-            element: 'parameter(m#a)', operator: '+=', rhs: '42')),

-    const Test(

-        '''

-        m(final a) => a += 42;

-        ''',

-        const Visit(VisitKind.VISIT_FINAL_PARAMETER_COMPOUND,

-            element: 'parameter(m#a)', operator: '+=', rhs: '42')),

-    const Test(

-        '''

-        m() {

-          var a;

-          a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_LOCAL_VARIABLE_COMPOUND,

-            element: 'variable(m#a)', operator: '+=', rhs: '42')),

-    const Test(

-        '''

-        m() {

-          final a;

-          a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_COMPOUND,

-            element: 'variable(m#a)', operator: '+=', rhs: '42')),

-    const Test(

-        '''

-        m() {

-          a() {}

-          a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_LOCAL_FUNCTION_COMPOUND,

-            element: 'function(m#a)', operator: '+=', rhs: '42')),

-    const Test(

-        '''

-        var a;

-        m() => a += 42;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_COMPOUND,

-            element: 'field(a)', operator: '+=', rhs: '42')),

-    const Test(

-        '''

-        get a => 0;

-        set a(_) {}

-        m() => a += 42;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_COMPOUND,

-            getter: 'getter(a)', setter: 'setter(a)',

-            operator: '+=', rhs: '42')),

-    const Test(

-        '''

-        class C {

-          static var a;

-        }

-        m() => C.a += 42;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_COMPOUND,

-            element: 'field(C#a)', operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static var a;

-          m() => C.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_COMPOUND,

-            element: 'field(C#a)', operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static var a;

-          m() => a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_COMPOUND,

-            element: 'field(C#a)', operator: '+=', rhs: '42')),

-    const Test.prefix(

-        '''

-        class C {

-          static var a;

-        }

-        ''',

-        '''

-        m() => p.C.a += 42;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_COMPOUND,

-            element: 'field(C#a)', operator: '+=', rhs: '42')),

-    const Test(

-        '''

-        class C {

-          static get a => 0;

-          static set a(_) {}

-        }

-        m() => C.a += 42;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND,

-            getter: 'getter(C#a)', setter: 'setter(C#a)',

-            operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static get a => 0;

-          static set a(_) {}

-          m() => C.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND,

-            getter: 'getter(C#a)', setter: 'setter(C#a)',

-            operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static get a => 0;

-          static set a(_) {}

-          m() => a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND,

-            getter: 'getter(C#a)', setter: 'setter(C#a)',

-            operator: '+=', rhs: '42')),

-    const Test.prefix(

-        '''

-        class C {

-          static get a => 0;

-          static set a(_) {}

-        }

-        ''',

-        '''

-        m() => p.C.a += 42;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND,

-            getter: 'getter(C#a)', setter: 'setter(C#a)',

-            operator: '+=', rhs: '42')),

-    // TODO(johnniwinther): Enable these when dart2js supports method and setter

-    // with the same name.

-    /*const Test(

-        '''

-        class C {

-          static a() {}

-          static set a(_) {}

-        }

-        m() => C.a += 42;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_METHOD_SETTER_COMPOUND,

-            getter: 'function(C#a)', setter: 'setter(C#a)',

-            operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static a() {}

-          static set a(_) {}

-          m() => C.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_METHOD_SETTER_COMPOUND,

-            getter: 'function(C#a)', setter: 'setter(C#a)',

-            operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class C {

-          static a() {}

-          static set a(_) {}

-          m() => a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_METHOD_SETTER_COMPOUND,

-            getter: 'function(C#a)', setter: 'setter(C#a)',

-            operator: '+=', rhs: '42')),

-    const Test.prefix(

-        '''

-        class C {

-          static a() {}

-          static set a(_) {}

-        }

-        ''',

-        '''

-        m() => p.C.a += 42;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_METHOD_SETTER_COMPOUND,

-            getter: 'function(C#a)', setter: 'setter(C#a)',

-            operator: '+=', rhs: '42')),*/

-    const Test.clazz(

-        '''

-        class C {

-          var a;

-          m() => a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_COMPOUND,

-            operator: '+=', rhs: '42',

-            getter: 'Selector(getter, a, arity=0)',

-            setter: 'Selector(setter, a, arity=1)')),

-    const Test.clazz(

-        '''

-        class C {

-          var a = 0;

-          m() => this.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_COMPOUND,

-            operator: '+=', rhs: '42',

-            getter: 'Selector(getter, a, arity=0)',

-            setter: 'Selector(setter, a, arity=1)')),

-    const Test.clazz(

-        '''

-        class B {

-          var a = 0;

-        }

-        class C extends B {

-          m() => super.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_FIELD_COMPOUND,

-            element: 'field(B#a)', operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class B {

-          final a = 0;

-        }

-        class C extends B {

-          m() => super.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_COMPOUND,

-            element: 'field(B#a)', operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class B {

-          get a => 0;

-          set a (_) {}

-        }

-        class C extends B {

-          m() => super.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_COMPOUND,

-            getter: 'getter(B#a)', setter: 'setter(B#a)',

-            operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class A {

-          get a => 0;

-        }

-        class B extends A {

-          set a (_) {}

-        }

-        class C extends B {

-          m() => super.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_COMPOUND,

-            getter: 'getter(A#a)', setter: 'setter(B#a)',

-            operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class A {

-          var a;

-        }

-        class B extends A {

-          get a => 0;

-        }

-

-        class C extends B {

-          m() => super.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_COMPOUND,

-            getter: 'getter(B#a)', setter: 'field(A#a)',

-            operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class A {

-          var a;

-        }

-        class B extends A {

-          set a(_) {}

-        }

-

-        class C extends B {

-          m() => super.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_COMPOUND,

-            getter: 'field(A#a)', setter: 'setter(B#a)',

-            operator: '+=', rhs: '42')),

-    // TODO(johnniwinther): Enable this when dart2js supports shadow setters.

-    /*const Test.clazz(

-        '''

-        class A {

-          var a;

-        }

-        class B extends A {

-          final a;

-        }

-

-        class C extends B {

-          m() => super.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_FIELD_FIELD_COMPOUND,

-            getter: 'field(B#a)', setter: 'field(A#a)',

-            operator: '+=', rhs: '42')),*/

-    const Test.clazz(

-        '''

-        class B {

-          a() {}

-        }

-        class C extends B {

-          m() => super.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_METHOD_COMPOUND,

-            element: 'function(B#a)',

-            operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class B {

-        }

-        class C extends B {

-          m() => super.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_COMPOUND,

-            operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class B {

-          set a(_) {}

-        }

-        class C extends B {

-          m() => super.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_COMPOUND,

-            setter: 'setter(B#a)', operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class B {

-          get a => 42;

-        }

-        class C extends B {

-          m() => super.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_COMPOUND,

-            getter: 'getter(B#a)', operator: '+=', rhs: '42')),

-

-    const Test.clazz(

-        '''

-        class C {

-          static set a(var value) { }

-          m() => a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_STATIC_GETTER_COMPOUND,

-            setter: 'setter(C#a)', operator: '+=', rhs: '42')),

-

-    const Test.clazz(

-        '''

-        class C {

-          static get a => 42;

-          m() => C.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_STATIC_SETTER_COMPOUND,

-            getter: 'getter(C#a)', operator: '+=', rhs: '42')),

-

-    const Test.clazz(

-        '''

-        class C {

-          static final a = 42;

-          m() => C.a += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FINAL_FIELD_COMPOUND,

-            element: 'field(C#a)', operator: '+=', rhs: '42')),

-

-    const Test(

-        '''

-        class C {

-          static a(var value) { }

-        }

-        m() => C.a += 42;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_METHOD_COMPOUND,

-            element: 'function(C#a)', operator: '+=', rhs: '42')),

-

-    const Test(

-        '''

-        set a(var value) { }

-        m() => a += 42;

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_GETTER_COMPOUND,

-            setter: 'setter(a)', operator: '+=', rhs: '42')),

-

-    const Test(

-        '''

-        get a => 42;

-        m() => a += 42;

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_SETTER_COMPOUND,

-            getter: 'getter(a)', operator: '+=', rhs: '42')),

-

-    const Test(

-        '''

-        a(var value) { }

-        m() => a += 42;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_COMPOUND,

-            element: 'function(a)', operator: '+=', rhs: '42')),

-

-    const Test(

-        '''

-        final a = 42;

-        m() => a += 42;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_COMPOUND,

-            element: 'field(a)', operator: '+=', rhs: '42')),

-

-    const Test(

-        '''

-        m() => unresolved += 42;

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_COMPOUND,

-            operator: '+=', rhs: '42')),

-  ],

-  'Compound index assignment': const [

-    // Compound index assignment

-    const Test(

-        '''

-        m() => 0[1] += 42;

-        ''',

-        const Visit(VisitKind.VISIT_COMPOUND_INDEX_SET,

-            receiver: '0', index: '1', operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class B {

-          operator [](_) {}

-          operator []=(a, b) {}

-        }

-        class C extends B {

-          m() => super[1] += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_COMPOUND_INDEX_SET,

-            getter: 'function(B#[])', setter: 'function(B#[]=)',

-            index: '1', operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class B {

-          operator []=(a, b) {}

-        }

-        class C extends B {

-          m() => super[1] += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_COMPOUND_INDEX_SET,

-            setter: 'function(B#[]=)',

-            index: '1', operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class B {

-        }

-        class C extends B {

-          m() => super[1] += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_COMPOUND_INDEX_SET,

-            index: '1', operator: '+=', rhs: '42')),

-    const Test.clazz(

-        '''

-        class B {

-          operator [](_) {}

-        }

-        class C extends B {

-          m() => super[1] += 42;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_COMPOUND_INDEX_SET,

-            getter: 'function(B#[])',

-            index: '1', operator: '+=', rhs: '42')),

-  ],

-  'Prefix expression': const [

-    // Prefix expression

-    const Test(

-        '''

-        m(a) => --a.b;

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_PREFIX,

-              receiver: 'a', operator: '--',

-              getter: 'Selector(getter, b, arity=0)',

-              setter: 'Selector(setter, b, arity=1)'),

-          const Visit(VisitKind.VISIT_PARAMETER_GET,

-              element: 'parameter(m#a)')

-        ]),

-    const Test(

-        '''

-        m(a) => ++a;

-        ''',

-        const Visit(VisitKind.VISIT_PARAMETER_PREFIX,

-            element: 'parameter(m#a)', operator: '++')),

-    const Test(

-        '''

-        m(final a) => ++a;

-        ''',

-        const Visit(VisitKind.VISIT_FINAL_PARAMETER_PREFIX,

-            element: 'parameter(m#a)', operator: '++')),

-    const Test(

-        '''

-        m() {

-          var a;

-          --a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_LOCAL_VARIABLE_PREFIX,

-            element: 'variable(m#a)', operator: '--')),

-    const Test(

-        '''

-        m() {

-          final a = 42;

-          --a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_PREFIX,

-            element: 'variable(m#a)', operator: '--')),

-    const Test(

-        '''

-        m() {

-          a() {}

-          --a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_LOCAL_FUNCTION_PREFIX,

-            element: 'function(m#a)', operator: '--')),

-    const Test(

-        '''

-        var a;

-        m() => ++a;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_PREFIX,

-            element: 'field(a)', operator: '++')),

-    const Test(

-        '''

-        get a => 0;

-        set a(_) {}

-        m() => --a;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_PREFIX,

-            getter: 'getter(a)', setter: 'setter(a)',

-            operator: '--')),

-    const Test(

-        '''

-        class C {

-          static var a;

-        }

-        m() => ++C.a;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_PREFIX,

-            element: 'field(C#a)', operator: '++')),

-    const Test.clazz(

-        '''

-        class C {

-          static var a;

-          m() => ++C.a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_PREFIX,

-            element: 'field(C#a)', operator: '++')),

-    const Test.clazz(

-        '''

-        class C {

-          static var a;

-          m() => --a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_PREFIX,

-            element: 'field(C#a)', operator: '--')),

-    const Test.prefix(

-        '''

-        class C {

-          static var a;

-        }

-        ''',

-        '''

-        m() => --p.C.a;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_PREFIX,

-            element: 'field(C#a)', operator: '--')),

-    const Test(

-        '''

-        class C {

-          static get a => 0;

-          static set a(_) {}

-        }

-        m() => ++C.a;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX,

-            getter: 'getter(C#a)', setter: 'setter(C#a)',

-            operator: '++')),

-    const Test.clazz(

-        '''

-        class C {

-          static get a => 0;

-          static set a(_) {}

-          m() => --C.a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX,

-            getter: 'getter(C#a)', setter: 'setter(C#a)',

-            operator: '--')),

-    const Test.clazz(

-        '''

-        class C {

-          static get a => 0;

-          static set a(_) {}

-          m() => --a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX,

-            getter: 'getter(C#a)', setter: 'setter(C#a)',

-            operator: '--')),

-    const Test.prefix(

-        '''

-        class C {

-          static get a => 0;

-          static set a(_) {}

-        }

-        ''',

-        '''

-        m() => ++p.C.a;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX,

-            getter: 'getter(C#a)', setter: 'setter(C#a)',

-            operator: '++')),

-    const Test.clazz(

-        '''

-        class C {

-          var a;

-          m() => --a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_PREFIX,

-            operator: '--',

-            getter: 'Selector(getter, a, arity=0)',

-            setter: 'Selector(setter, a, arity=1)')),

-    const Test.clazz(

-        '''

-        class C {

-          var a = 0;

-          m() => ++this.a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_PREFIX,

-            operator: '++',

-            getter: 'Selector(getter, a, arity=0)',

-            setter: 'Selector(setter, a, arity=1)')),

-    const Test.clazz(

-        '''

-        class B {

-          var a = 0;

-        }

-        class C extends B {

-          m() => --super.a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_FIELD_PREFIX,

-            element: 'field(B#a)', operator: '--')),

-    const Test.clazz(

-        '''

-        class B {

-          final a = 0;

-        }

-        class C extends B {

-          m() => --super.a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_PREFIX,

-            element: 'field(B#a)', operator: '--')),

-    const Test.clazz(

-        '''

-        class B {

-          get a => 0;

-          set a (_) {}

-        }

-        class C extends B {

-          m() => --super.a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_PREFIX,

-            getter: 'getter(B#a)', setter: 'setter(B#a)',

-            operator: '--')),

-    const Test.clazz(

-        '''

-        class A {

-          get a => 0;

-        }

-        class B extends A {

-          set a (_) {}

-        }

-        class C extends B {

-          m() => ++super.a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_PREFIX,

-            getter: 'getter(A#a)', setter: 'setter(B#a)',

-            operator: '++')),

-    const Test.clazz(

-        '''

-        class A {

-          var a;

-        }

-        class B extends A {

-          get a => 0;

-        }

-

-        class C extends B {

-          m() => --super.a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_PREFIX,

-            getter: 'getter(B#a)', setter: 'field(A#a)',

-            operator: '--')),

-    const Test.clazz(

-        '''

-        class A {

-          var a;

-        }

-        class B extends A {

-          set a(_) {}

-        }

-

-        class C extends B {

-          m() => ++super.a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_PREFIX,

-            getter: 'field(A#a)', setter: 'setter(B#a)',

-            operator: '++')),

-    const Test.clazz(

-        '''

-        class B {

-          a() {}

-        }

-        class C extends B {

-          m() => ++super.a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_METHOD_PREFIX,

-            element: 'function(B#a)',

-            operator: '++')),

-    const Test.clazz(

-        '''

-        class B {

-        }

-        class C extends B {

-          m() => ++super.a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_PREFIX,

-            operator: '++')),

-    const Test.clazz(

-        '''

-        class B {

-          set a(_) {}

-        }

-        class C extends B {

-          m() => ++super.a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_PREFIX,

-            setter: 'setter(B#a)', operator: '++')),

-    const Test.clazz(

-        '''

-        class B {

-          get a => 42;

-        }

-        class C extends B {

-          m() => ++super.a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_PREFIX,

-            getter: 'getter(B#a)', operator: '++')),

-

-    const Test.clazz(

-        '''

-        class C {

-          static set a(var value) { }

-          m() => ++a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_STATIC_GETTER_PREFIX,

-            setter: 'setter(C#a)', operator: '++')),

-

-    const Test.clazz(

-        '''

-        class C {

-          static get a => 42;

-          m() => ++C.a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_STATIC_SETTER_PREFIX,

-            getter: 'getter(C#a)', operator: '++')),

-

-    const Test.clazz(

-        '''

-        class C {

-          static final a = 42;

-          m() => ++C.a;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FINAL_FIELD_PREFIX,

-            element: 'field(C#a)', operator: '++')),

-

-    const Test(

-        '''

-        class C {

-          static a(var value) { }

-        }

-        m() => ++C.a;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_METHOD_PREFIX,

-            element: 'function(C#a)', operator: '++')),

-

-    const Test(

-        '''

-        set a(var value) { }

-        m() => ++a;

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_GETTER_PREFIX,

-            setter: 'setter(a)', operator: '++')),

-

-    const Test(

-        '''

-        get a => 42;

-        m() => ++a;

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_SETTER_PREFIX,

-            getter: 'getter(a)', operator: '++')),

-

-    const Test(

-        '''

-        a(var value) { }

-        m() => ++a;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_PREFIX,

-            element: 'function(a)', operator: '++')),

-

-    const Test(

-        '''

-        final a = 42;

-        m() => ++a;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_PREFIX,

-            element: 'field(a)', operator: '++')),

-

-    const Test(

-        '''

-        m() => ++unresolved;

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_PREFIX,

-            operator: '++')),

-  ],

-  'Postfix expression': const [

-    // Postfix expression

-    const Test(

-        '''

-        m(a) => a.b--;

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_POSTFIX,

-              receiver: 'a', operator: '--',

-              getter: 'Selector(getter, b, arity=0)',

-              setter: 'Selector(setter, b, arity=1)'),

-          const Visit(VisitKind.VISIT_PARAMETER_GET,

-              element: 'parameter(m#a)')

-        ]),

-    const Test(

-        '''

-        m(a) => a++;

-        ''',

-        const Visit(VisitKind.VISIT_PARAMETER_POSTFIX,

-            element: 'parameter(m#a)', operator: '++')),

-    const Test(

-        '''

-        m(final a) => a++;

-        ''',

-        const Visit(VisitKind.VISIT_FINAL_PARAMETER_POSTFIX,

-            element: 'parameter(m#a)', operator: '++')),

-    const Test(

-        '''

-        m() {

-          var a;

-          a--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_LOCAL_VARIABLE_POSTFIX,

-            element: 'variable(m#a)', operator: '--')),

-    const Test(

-        '''

-        m() {

-          final a = 42;

-          a--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_POSTFIX,

-            element: 'variable(m#a)', operator: '--')),

-    const Test(

-        '''

-        m() {

-          a() {}

-          a--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_LOCAL_FUNCTION_POSTFIX,

-            element: 'function(m#a)', operator: '--')),

-    const Test(

-        '''

-        var a;

-        m() => a++;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_POSTFIX,

-            element: 'field(a)', operator: '++')),

-    const Test(

-        '''

-        get a => 0;

-        set a(_) {}

-        m() => a--;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_POSTFIX,

-            getter: 'getter(a)', setter: 'setter(a)',

-            operator: '--')),

-    const Test(

-        '''

-        class C {

-          static var a;

-        }

-        m() => C.a++;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_POSTFIX,

-            element: 'field(C#a)', operator: '++')),

-    const Test.clazz(

-        '''

-        class C {

-          static var a;

-          m() => C.a++;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_POSTFIX,

-            element: 'field(C#a)', operator: '++')),

-    const Test.clazz(

-        '''

-        class C {

-          static var a;

-          m() => a--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_POSTFIX,

-            element: 'field(C#a)', operator: '--')),

-    const Test.prefix(

-        '''

-        class C {

-          static var a;

-        }

-        ''',

-        '''

-        m() => p.C.a--;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FIELD_POSTFIX,

-            element: 'field(C#a)', operator: '--')),

-    const Test(

-        '''

-        class C {

-          static get a => 0;

-          static set a(_) {}

-        }

-        m() => C.a++;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX,

-            getter: 'getter(C#a)', setter: 'setter(C#a)',

-            operator: '++')),

-    const Test.clazz(

-        '''

-        class C {

-          static get a => 0;

-          static set a(_) {}

-          m() => C.a--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX,

-            getter: 'getter(C#a)', setter: 'setter(C#a)',

-            operator: '--')),

-    const Test.clazz(

-        '''

-        class C {

-          static get a => 0;

-          static set a(_) {}

-          m() => a--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX,

-            getter: 'getter(C#a)', setter: 'setter(C#a)',

-            operator: '--')),

-    const Test.prefix(

-        '''

-        class C {

-          static get a => 0;

-          static set a(_) {}

-        }

-        ''',

-        '''

-        m() => p.C.a++;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX,

-            getter: 'getter(C#a)', setter: 'setter(C#a)',

-            operator: '++')),

-    const Test.clazz(

-        '''

-        class C {

-          var a;

-          m() => a--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_POSTFIX,

-            operator: '--',

-            getter: 'Selector(getter, a, arity=0)',

-            setter: 'Selector(setter, a, arity=1)')),

-    const Test.clazz(

-        '''

-        class C {

-          var a = 0;

-          m() => this.a++;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_THIS_PROPERTY_POSTFIX,

-            operator: '++',

-            getter: 'Selector(getter, a, arity=0)',

-            setter: 'Selector(setter, a, arity=1)')),

-    const Test.clazz(

-        '''

-        class B {

-          var a = 0;

-        }

-        class C extends B {

-          m() => super.a--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_FIELD_POSTFIX,

-            element: 'field(B#a)', operator: '--')),

-    const Test.clazz(

-        '''

-        class B {

-          final a = 0;

-        }

-        class C extends B {

-          m() => super.a--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_POSTFIX,

-            element: 'field(B#a)', operator: '--')),

-    const Test.clazz(

-        '''

-        class B {

-          get a => 0;

-          set a (_) {}

-        }

-        class C extends B {

-          m() => super.a--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_POSTFIX,

-            getter: 'getter(B#a)', setter: 'setter(B#a)',

-            operator: '--')),

-    const Test.clazz(

-        '''

-        class A {

-          get a => 0;

-        }

-        class B extends A {

-          set a (_) {}

-        }

-        class C extends B {

-          m() => super.a++;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_POSTFIX,

-            getter: 'getter(A#a)', setter: 'setter(B#a)',

-            operator: '++')),

-    const Test.clazz(

-        '''

-        class A {

-          var a;

-        }

-        class B extends A {

-          get a => 0;

-        }

-

-        class C extends B {

-          m() => super.a--;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_POSTFIX,

-            getter: 'getter(B#a)', setter: 'field(A#a)',

-            operator: '--')),

-    const Test.clazz(

-        '''

-        class A {

-          var a;

-        }

-        class B extends A {

-          set a(_) {}

-        }

-

-        class C extends B {

-          m() => super.a++;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_POSTFIX,

-            getter: 'field(A#a)', setter: 'setter(B#a)',

-            operator: '++')),

-    const Test.clazz(

-        '''

-        class B {

-          a() {}

-        }

-        class C extends B {

-          m() => super.a++;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_SUPER_METHOD_POSTFIX,

-            element: 'function(B#a)',

-            operator: '++')),

-    const Test.clazz(

-        '''

-        class B {

-        }

-        class C extends B {

-          m() => super.a++;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_POSTFIX,

-            operator: '++')),

-    const Test.clazz(

-        '''

-        class B {

-          set a(_) {}

-        }

-        class C extends B {

-          m() => super.a++;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_POSTFIX,

-            setter: 'setter(B#a)', operator: '++')),

-    const Test.clazz(

-        '''

-        class B {

-          get a => 42;

-        }

-        class C extends B {

-          m() => super.a++;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_POSTFIX,

-            getter: 'getter(B#a)', operator: '++')),

-

-    const Test.clazz(

-        '''

-        class C {

-          static set a(var value) { }

-          m() => a++;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_STATIC_GETTER_POSTFIX,

-            setter: 'setter(C#a)', operator: '++')),

-

-    const Test.clazz(

-        '''

-        class C {

-          static get a => 42;

-          m() => C.a++;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_STATIC_SETTER_POSTFIX,

-            getter: 'getter(C#a)', operator: '++')),

-

-    const Test.clazz(

-        '''

-        class C {

-          static final a = 42;

-          m() => C.a++;

-        }

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_FINAL_FIELD_POSTFIX,

-            element: 'field(C#a)', operator: '++')),

-

-    const Test(

-        '''

-        class C {

-          static a(var value) { }

-        }

-        m() => C.a++;

-        ''',

-        const Visit(VisitKind.VISIT_STATIC_METHOD_POSTFIX,

-            element: 'function(C#a)', operator: '++')),

-

-    const Test(

-        '''

-        set a(var value) { }

-        m() => a++;

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_GETTER_POSTFIX,

-            setter: 'setter(a)', operator: '++')),

-

-    const Test(

-        '''

-        get a => 42;

-        m() => a++;

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_SETTER_POSTFIX,

-            getter: 'getter(a)', operator: '++')),

-

-    const Test(

-        '''

-        a(var value) { }

-        m() => a++;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_POSTFIX,

-            element: 'function(a)', operator: '++')),

-

-    const Test(

-        '''

-        final a = 42;

-        m() => a++;

-        ''',

-        const Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_POSTFIX,

-            element: 'field(a)', operator: '++')),

-

-    const Test(

-        '''

-        m() => unresolved++;

-        ''',

-        const Visit(VisitKind.VISIT_UNRESOLVED_POSTFIX,

-            operator: '++')),

-  ],

-  'Constructor invocations': const [

-    const Test(

-        '''

-        class Class {

-          const Class(a, b);

-        }

-        m() => const Class(true, 42);

-        ''',

-        const Visit(VisitKind.VISIT_CONST_CONSTRUCTOR_INVOKE,

-            constant: 'const Class(true, 42)')),

-    const Test(

-        '''

-        class Class {}

-        m() => new Class();

-        ''',

-        const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE,

-            element: 'generative_constructor(Class#)',

-            arguments: '()',

-            type: 'Class',

-            selector: 'CallStructure(arity=0)')),

-    const Test(

-        '''

-        class Class {

-          Class(a, b);

-        }

-        m() => new Class(true, 42);

-        ''',

-        const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE,

-            element: 'generative_constructor(Class#)',

-            arguments: '(true,42)',

-            type: 'Class',

-            selector: 'CallStructure(arity=2)')),

-    const Test(

-        '''

-        class Class {

-          Class.named(a, b);

-        }

-        m() => new Class.named(true, 42);

-        ''',

-        const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE,

-            element: 'generative_constructor(Class#named)',

-            arguments: '(true,42)',

-            type: 'Class',

-            selector: 'CallStructure(arity=2)')),

-    const Test(

-        '''

-        class Class {

-          Class(a, b) : this._(a, b);

-          Class._(a, b);

-        }

-        m() => new Class(true, 42);

-        ''',

-        const Visit(VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_INVOKE,

-            element: 'generative_constructor(Class#)',

-            arguments: '(true,42)',

-            type: 'Class',

-            selector: 'CallStructure(arity=2)')),

-    const Test(

-        '''

-        class Class {

-          factory Class(a, b) => new Class._(a, b);

-          Class._(a, b);

-        }

-        m() => new Class(true, 42);

-        ''',

-        const Visit(VisitKind.VISIT_FACTORY_CONSTRUCTOR_INVOKE,

-            element: 'function(Class#)',

-            arguments: '(true,42)',

-            type: 'Class',

-            selector: 'CallStructure(arity=2)')),

-    const Test(

-        '''

-        class Class<T> {

-          factory Class(a, b) = Class<int>.a;

-          factory Class.a(a, b) = Class<Class<T>>.b;

-          Class.b(a, b);

-        }

-        m() => new Class<double>(true, 42);

-        ''',

-        const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

-            element: 'function(Class#)',

-            arguments: '(true,42)',

-            type: 'Class<double>',

-            target: 'generative_constructor(Class#b)',

-            targetType: 'Class<Class<int>>',

-            selector: 'CallStructure(arity=2)')),

-    const Test(

-        '''

-        class Class {

-          Class(a, b);

-        }

-        m() => new Class.unresolved(true, 42);

-        ''',

-        const Visit(

-            VisitKind.VISIT_UNRESOLVED_CONSTRUCTOR_INVOKE,

-            arguments: '(true,42)')),

-    const Test(

-        '''

-        m() => new Unresolved(true, 42);

-        ''',

-        const Visit(

-            VisitKind.VISIT_UNRESOLVED_CLASS_CONSTRUCTOR_INVOKE,

-            arguments: '(true,42)')),

-    const Test(

-        '''

-        abstract class AbstractClass {}

-        m() => new AbstractClass();

-        ''',

-        const Visit(

-            VisitKind.VISIT_ABSTRACT_CLASS_CONSTRUCTOR_INVOKE,

-            element: 'generative_constructor(AbstractClass#)',

-            type: 'AbstractClass',

-            arguments: '()',

-            selector: 'CallStructure(arity=0)')),

-    const Test(

-        '''

-        class Class {

-          factory Class(a, b) = Unresolved;

-        }

-        m() => new Class(true, 42);

-        ''',

-        const Visit(

-            VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

-            element: 'function(Class#)',

-            arguments: '(true,42)',

-            type: 'Class',

-            selector: 'CallStructure(arity=2)')),

-    const Test(

-        '''

-        class Class {

-          factory Class(a, b) = Class.named;

-        }

-        m() => new Class(true, 42);

-        ''',

-        const Visit(

-            VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

-            element: 'function(Class#)',

-            arguments: '(true,42)',

-            type: 'Class',

-            selector: 'CallStructure(arity=2)')),

-    const Test(

-        '''

-        class Class {

-          factory Class(a, b) = Class.named;

-          factory Class.named(a, b) = Class.unresolved;

-        }

-        m() => new Class(true, 42);

-        ''',

-        const Visit(

-            VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

-            element: 'function(Class#)',

-            arguments: '(true,42)',

-            type: 'Class',

-            selector: 'CallStructure(arity=2)')),

-    const Test(

-        '''

-        abstract class AbstractClass {

-          AbstractClass(a, b);

-        }

-        class Class {

-          factory Class(a, b) = AbstractClass;

-        }

-        m() => new Class(true, 42);

-        ''',

-        const Visit(

-            VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

-            element: 'function(Class#)',

-            arguments: '(true,42)',

-            type: 'Class',

-            selector: 'CallStructure(arity=2)')),

-  ],

-};

-

-const Map<String, List<Test>> DECL_TESTS = const {

-  'Function declarations': const [

-    const Test(

-        '''

-        m(a, b) {}

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-              element: 'function(m)',

-              parameters: '(a,b)',

-              body: '{}'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#b)',

-              index: 1),

-        ]),

-    const Test(

-        '''

-        m(a, [b]) {}

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-              element: 'function(m)',

-              parameters: '(a,[b])',

-              body: '{}'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL,

-              element: 'parameter(m#b)',

-              index: 1,

-              constant: 'null'),

-        ]),

-    const Test(

-        '''

-        m(a, [b = null]) {}

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-              element: 'function(m)',

-              parameters: '(a,[b=null])',

-              body: '{}'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL,

-              element: 'parameter(m#b)',

-              constant: 'null',

-              index: 1),

-        ]),

-    const Test(

-        '''

-        m(a, [b = 42]) {}

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-              element: 'function(m)',

-              parameters: '(a,[b=42])',

-              body: '{}'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL,

-              element: 'parameter(m#b)',

-              constant: 42,

-              index: 1),

-        ]),

-    const Test(

-        '''

-        m(a, {b}) {}

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-              element: 'function(m)',

-              parameters: '(a,{b})',

-              body: '{}'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL,

-              element: 'parameter(m#b)',

-              constant: 'null'),

-        ]),

-    const Test(

-        '''

-        m(a, {b: null}) {}

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-              element: 'function(m)',

-              parameters: '(a,{b: null})',

-              body: '{}'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL,

-              element: 'parameter(m#b)',

-              constant: 'null'),

-        ]),

-    const Test(

-        '''

-        m(a, {b:42}) {}

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-              element: 'function(m)',

-              parameters: '(a,{b: 42})',

-              body: '{}'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL,

-              element: 'parameter(m#b)',

-              constant: 42),

-        ]),

-    const Test(

-        '''

-        get m => null;

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_DECL,

-              element: 'getter(m)',

-              body: '=>null;'),

-        ]),

-    const Test(

-        '''

-        set m(a) {}

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_DECL,

-              element: 'setter(m)',

-              parameters: '(a)',

-              body: '{}'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#a)',

-              index: 0),

-        ]),

-    const Test.clazz(

-        '''

-        class C {

-          static m(a, b) {}

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_STATIC_FUNCTION_DECL,

-              element: 'function(C#m)',

-              parameters: '(a,b)',

-              body: '{}'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#b)',

-              index: 1),

-        ]),

-    const Test.clazz(

-        '''

-        class C {

-          static get m => null;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_STATIC_GETTER_DECL,

-              element: 'getter(C#m)',

-              body: '=>null;'),

-        ]),

-    const Test.clazz(

-        '''

-        class C {

-          static set m(a) {}

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_STATIC_SETTER_DECL,

-              element: 'setter(C#m)',

-              parameters: '(a)',

-              body: '{}'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#a)',

-              index: 0),

-        ]),

-    const Test.clazz(

-        '''

-        class C {

-          m(a, b) {}

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_INSTANCE_METHOD_DECL,

-              element: 'function(C#m)',

-              parameters: '(a,b)',

-              body: '{}'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#b)',

-              index: 1),

-        ]),

-    const Test.clazz(

-        '''

-        class C {

-          get m => null;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_INSTANCE_GETTER_DECL,

-              element: 'getter(C#m)',

-              body: '=>null;'),

-        ]),

-    const Test.clazz(

-        '''

-        class C {

-          set m(a) {}

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_INSTANCE_SETTER_DECL,

-              element: 'setter(C#m)',

-              parameters: '(a)',

-              body: '{}'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#a)',

-              index: 0),

-        ]),

-    const Test.clazz(

-        '''

-        abstract class C {

-          m(a, b);

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_ABSTRACT_METHOD_DECL,

-              element: 'function(C#m)',

-              parameters: '(a,b)'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#b)',

-              index: 1),

-        ]),

-    const Test.clazz(

-        '''

-        abstract class C {

-          get m;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_ABSTRACT_GETTER_DECL,

-              element: 'getter(C#m)'),

-        ]),

-    const Test.clazz(

-        '''

-        abstract class C {

-          set m(a);

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_ABSTRACT_SETTER_DECL,

-              element: 'setter(C#m)',

-              parameters: '(a)'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#a)',

-              index: 0),

-        ]),

-    const Test(

-        '''

-        m(a, b) {}

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-              element: 'function(m)',

-              parameters: '(a,b)',

-              body: '{}'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(m#b)',

-              index: 1),

-        ]),

-    const Test(

-        '''

-        m() {

-          local(a, b) {}

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-               element: 'function(m)',

-               parameters: '()',

-               body: '{local(a,b){}}'),

-          const Visit(VisitKind.VISIT_LOCAL_FUNCTION_DECL,

-               element: 'function(m#local)',

-               parameters: '(a,b)',

-               body: '{}'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(local#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(local#b)',

-              index: 1),

-        ]),

-    const Test(

-        '''

-        m() => (a, b) {};

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-               element: 'function(m)',

-               parameters: '()',

-               body: '=>(a,b){};'),

-          const Visit(VisitKind.VISIT_CLOSURE_DECL,

-               element: 'function(m#)',

-               parameters: '(a,b)',

-               body: '{}'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#b)',

-              index: 1),

-        ]),

-  ],

-  'Constructor declarations': const [

-    const Test.clazz(

-        '''

-        class C {

-          C(a, b);

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

-              element: 'generative_constructor(C#)',

-              parameters: '(a,b)',

-              body: ';'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#b)',

-              index: 1),

-        ],

-        method: ''),

-    const Test.clazz(

-        '''

-        class C {

-          var b;

-          C(a, this.b);

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

-              element: 'generative_constructor(C#)',

-              parameters: '(a,this.b)',

-              body: ';'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_INITIALIZING_FORMAL_DECL,

-              element: 'initializing_formal(#b)',

-              index: 1),

-        ],

-        method: ''),

-    const Test.clazz(

-        '''

-        class C {

-          var b;

-          C(a, [this.b = 42]);

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

-              element: 'generative_constructor(C#)',

-              parameters: '(a,[this.b=42])',

-              body: ';'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_OPTIONAL_INITIALIZING_FORMAL_DECL,

-              element: 'initializing_formal(#b)',

-              constant: 42,

-              index: 1),

-        ],

-        method: ''),

-    const Test.clazz(

-        '''

-        class C {

-          var b;

-          C(a, {this.b: 42});

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

-              element: 'generative_constructor(C#)',

-              parameters: '(a,{this.b: 42})',

-              body: ';'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_NAMED_INITIALIZING_FORMAL_DECL,

-              element: 'initializing_formal(#b)',

-              constant: 42),

-        ],

-        method: ''),

-    const Test.clazz(

-        '''

-        class C {

-          C(a, b) : super();

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

-              element: 'generative_constructor(C#)',

-              parameters: '(a,b)',

-              body: ';'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#b)',

-              index: 1),

-          const Visit(VisitKind.VISIT_SUPER_CONSTRUCTOR_INVOKE,

-              element: 'generative_constructor(Object#)',

-              type: 'Object',

-              arguments: '()',

-              selector: 'Selector(call, super, arity=0)'),

-        ],

-        method: ''),

-    const Test.clazz(

-        '''

-        class C {

-          var field;

-          C(a, b) : this.field = a;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

-              element: 'generative_constructor(C#)',

-              parameters: '(a,b)',

-              body: ';'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#b)',

-              index: 1),

-          const Visit(VisitKind.VISIT_FIELD_INITIALIZER,

-              element: 'field(C#field)',

-              rhs: 'a'),

-        ],

-        method: ''),

-    const Test.clazz(

-        '''

-        class C {

-          var field1;

-          var field2;

-          C(a, b) : this.field1 = a, this.field2 = b;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

-              element: 'generative_constructor(C#)',

-              parameters: '(a,b)',

-              body: ';'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#b)',

-              index: 1),

-          const Visit(VisitKind.VISIT_FIELD_INITIALIZER,

-              element: 'field(C#field1)',

-              rhs: 'a'),

-          const Visit(VisitKind.VISIT_FIELD_INITIALIZER,

-              element: 'field(C#field2)',

-              rhs: 'b'),

-        ],

-        method: ''),

-    const Test.clazz(

-        '''

-        class C {

-          C(a, b) : this._(a, b);

-          C._(a, b);

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_DECL,

-              element: 'generative_constructor(C#)',

-              parameters: '(a,b)',

-              initializers: ':this._(a,b)'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#b)',

-              index: 1),

-          const Visit(VisitKind.VISIT_THIS_CONSTRUCTOR_INVOKE,

-              element: 'generative_constructor(C#_)',

-              arguments: '(a,b)',

-              selector: 'Selector(call, _, arity=2)'),

-        ],

-        method: ''),

-    const Test.clazz(

-        '''

-        class C {

-          factory C(a, b) => null;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_FACTORY_CONSTRUCTOR_DECL,

-              element: 'function(C#)',

-              parameters: '(a,b)',

-              body: '=>null;'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#b)',

-              index: 1),

-        ],

-        method: ''),

-    const Test.clazz(

-        '''

-        class C {

-          factory C(a, b) = C._;

-          C._(a, b);

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,

-              element: 'function(C#)',

-              parameters: '(a,b)',

-              target: 'generative_constructor(C#_)',

-              type: 'C'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#b)',

-              index: 1),

-        ],

-        method: ''),

-    const Test.clazz(

-        '''

-        class C {

-          factory C(a, b) = D;

-        }

-        class D<T> {

-          D(a, b);

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,

-              element: 'function(C#)',

-              parameters: '(a,b)',

-              target: 'generative_constructor(D#)',

-              type: 'D'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#b)',

-              index: 1),

-        ],

-        method: ''),

-    const Test.clazz(

-        '''

-        class C {

-          factory C(a, b) = D<int>;

-        }

-        class D<T> {

-          D(a, b);

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,

-              element: 'function(C#)',

-              parameters: '(a,b)',

-              target: 'generative_constructor(D#)',

-              type: 'D<int>'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#b)',

-              index: 1),

-        ],

-        method: ''),

-    const Test.clazz(

-        '''

-        class C {

-          factory C(a, b) = D<int>;

-        }

-        class D<T> {

-          factory D(a, b) = E<D<T>>;

-        }

-        class E<S> {

-          E(a, b);

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,

-              element: 'function(C#)',

-              parameters: '(a,b)',

-              target: 'function(D#)',

-              type: 'D<int>'),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#a)',

-              index: 0),

-          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-              element: 'parameter(#b)',

-              index: 1),

-        ],

-        method: ''),

-  ],

-  "Field declarations": const [

-    const Test.clazz(

-        '''

-        class C {

-          var m;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL,

-              element: 'field(C#m)'),

-        ]),

-    const Test.clazz(

-        '''

-        class C {

-          var m, n;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL,

-              element: 'field(C#m)'),

-        ]),

-    const Test.clazz(

-        '''

-        class C {

-          var m = 42;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL,

-              element: 'field(C#m)',

-              rhs: 42),

-        ]),

-    const Test(

-        '''

-        m() {

-          var local;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-              element: 'function(m)',

-              parameters: '()',

-              body: '{var local;}'),

-          const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,

-              element: 'variable(m#local)'),

-        ]),

-    const Test(

-        '''

-        m() {

-          var local = 42;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-              element: 'function(m)',

-              parameters: '()',

-              body: '{var local=42;}'),

-          const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,

-              element: 'variable(m#local)',

-              rhs: 42),

-        ]),

-    const Test(

-        '''

-        m() {

-          const local = 42;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-              element: 'function(m)',

-              parameters: '()',

-              body: '{const local=42;}'),

-          const Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL,

-              element: 'variable(m#local)',

-              constant: 42),

-        ]),

-    const Test(

-        '''

-        m() {

-          var local1, local2;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-              element: 'function(m)',

-              parameters: '()',

-              body: '{var local1,local2;}'),

-          const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,

-              element: 'variable(m#local1)'),

-          const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,

-              element: 'variable(m#local2)'),

-        ]),

-    const Test(

-        '''

-        m() {

-          var local1 = 42, local2 = true;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-              element: 'function(m)',

-              parameters: '()',

-              body: '{var local1=42,local2=true;}'),

-          const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,

-              element: 'variable(m#local1)',

-              rhs: 42),

-          const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,

-              element: 'variable(m#local2)',

-              rhs: true),

-        ]),

-    const Test(

-        '''

-        m() {

-          const local1 = 42, local2 = true;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-              element: 'function(m)',

-              parameters: '()',

-              body: '{const local1=42,local2=true;}'),

-          const Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL,

-              element: 'variable(m#local1)',

-              constant: 42),

-          const Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL,

-              element: 'variable(m#local2)',

-              constant: true),

-        ]),

-    const Test.clazz(

-        '''

-        class C {

-          static var m;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_STATIC_FIELD_DECL,

-                element: 'field(C#m)'),

-        ]),

-    const Test.clazz(

-        '''

-        class C {

-          static var m, n;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_STATIC_FIELD_DECL,

-                element: 'field(C#m)'),

-        ]),

-    const Test.clazz(

-        '''

-        class C {

-          static var k, l, m, n;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_STATIC_FIELD_DECL,

-                element: 'field(C#m)'),

-        ]),

-    const Test.clazz(

-        '''

-        class C {

-          static var m = 42;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_STATIC_FIELD_DECL,

-                element: 'field(C#m)',

-                rhs: 42),

-        ]),

-    const Test.clazz(

-        '''

-        class C {

-          static var m = 42, n = true;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_STATIC_FIELD_DECL,

-                element: 'field(C#m)',

-                rhs: 42),

-        ]),

-    const Test.clazz(

-        '''

-        class C {

-          static const m = 42;

-        }

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_STATIC_CONSTANT_DECL,

-                element: 'field(C#m)',

-                constant: 42),

-        ]),

-    const Test(

-        '''

-        var m;

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL,

-                element: 'field(m)'),

-        ]),

-    const Test(

-        '''

-        var m, n;

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL,

-                element: 'field(m)'),

-        ]),

-    const Test(

-        '''

-        var m = 42;

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL,

-                element: 'field(m)',

-                rhs: 42),

-        ]),

-    const Test(

-        '''

-        const m = 42;

-        ''',

-        const [

-          const Visit(VisitKind.VISIT_TOP_LEVEL_CONSTANT_DECL,

-                element: 'field(m)',

-                constant: 42),

-        ]),

-  ],

-};

-

 const List<VisitKind> UNTESTABLE_KINDS = const <VisitKind>[

   VisitKind.VISIT_STATIC_METHOD_SETTER_COMPOUND,

   VisitKind.VISIT_STATIC_METHOD_SETTER_PREFIX,

@@ -4287,8 +199,6 @@
   VisitKind.VISIT_TOP_LEVEL_FUNCTION_SET,

   VisitKind.VISIT_FINAL_SUPER_FIELD_SET,

   VisitKind.VISIT_SUPER_GETTER_SET,

-  VisitKind.VISIT_SUPER_SETTER_GET,

-  VisitKind.VISIT_SUPER_SETTER_INVOKE,

   VisitKind.VISIT_SUPER_METHOD_SET,

 ];

 

@@ -4438,3329 +348,6 @@
   }

 }

 

-class SemanticSendTestVisitor extends SemanticTestVisitor {

-

-  SemanticSendTestVisitor(TreeElements elements) : super(elements);

-

-  @override

-  visitAs(

-      Send node,

-      Node expression,

-      DartType type,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_AS,

-        expression: expression, type: type));

-    apply(expression, arg);

-  }

-

-  @override

-  visitAssert(

-      Send node,

-      Node expression,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_ASSERT, expression: expression));

-    apply(expression, arg);

-  }

-

-  @override

-  visitBinary(

-      Send node,

-      Node left,

-      BinaryOperator operator,

-      Node right,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_BINARY,

-        left: left, operator: operator, right: right));

-    apply(left, arg);

-    apply(right, arg);

-  }

-

-  @override

-  visitIndex(

-      Send node,

-      Node receiver,

-      Node index,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_INDEX,

-        receiver: receiver, index: index));

-    apply(receiver, arg);

-    apply(index, arg);

-  }

-

-  @override

-  visitClassTypeLiteralGet(

-      Send node,

-      ConstantExpression constant,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_GET,

-        constant: constant.getText()));

-  }

-

-  @override

-  visitClassTypeLiteralInvoke(

-      Send node,

-      ConstantExpression constant,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_INVOKE,

-        constant: constant.getText(), arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitClassTypeLiteralSet(

-      SendSet node,

-      ConstantExpression constant,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_INVOKE,

-        constant: constant.getText(), rhs: rhs));

-    super.visitClassTypeLiteralSet(node, constant, rhs, arg);

-  }

-

-  @override

-  visitNotEquals(

-      Send node,

-      Node left,

-      Node right,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_NOT_EQUALS,

-        left: left, right: right));

-    apply(left, arg);

-    apply(right, arg);

-  }

-

-  @override

-  visitDynamicPropertyPrefix(

-      Send node,

-      Node receiver,

-      IncDecOperator operator,

-      Selector getterSelector,

-      Selector setterSelector,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_PREFIX,

-        receiver: receiver, operator: operator,

-        getter: getterSelector, setter: setterSelector));

-    apply(receiver, arg);

-  }

-

-  @override

-  visitDynamicPropertyPostfix(

-      Send node,

-      Node receiver,

-      IncDecOperator operator,

-      Selector getterSelector,

-      Selector setterSelector,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_POSTFIX,

-        receiver: receiver, operator: operator,

-        getter: getterSelector, setter: setterSelector));

-    apply(receiver, arg);

-  }

-

-  @override

-  visitDynamicPropertyGet(

-      Send node,

-      Node receiver,

-      Selector selector,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_GET,

-        receiver: receiver, name: selector.name));

-    apply(receiver, arg);

-  }

-

-  @override

-  visitDynamicPropertyInvoke(

-      Send node,

-      Node receiver,

-      NodeList arguments,

-      Selector selector,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_INVOKE,

-        receiver: receiver, name: selector.name, arguments: arguments));

-    apply(receiver, arg);

-    apply(arguments, arg);

-  }

-

-  @override

-  visitDynamicPropertySet(

-      SendSet node,

-      Node receiver,

-      Selector selector,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_SET,

-        receiver: receiver, name: selector.name, rhs: rhs));

-    super.visitDynamicPropertySet(node, receiver, selector, rhs, arg);

-  }

-

-  @override

-  visitDynamicTypeLiteralGet(

-      Send node,

-      ConstantExpression constant,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_GET,

-        constant: constant.getText()));

-  }

-

-  @override

-  visitDynamicTypeLiteralInvoke(

-      Send node,

-      ConstantExpression constant,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_INVOKE,

-        constant: constant.getText(), arguments: arguments));

-  }

-

-  @override

-  visitDynamicTypeLiteralSet(

-      Send node,

-      ConstantExpression constant,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_SET,

-        rhs: rhs));

-    super.visitDynamicTypeLiteralSet(node, constant, rhs, arg);

-  }

-

-  @override

-  visitExpressionInvoke(

-      Send node,

-      Node expression,

-      NodeList arguments,

-      Selector selector,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_EXPRESSION_INVOKE,

-        receiver: expression, arguments: arguments));

-  }

-

-  @override

-  visitIs(

-      Send node,

-      Node expression,

-      DartType 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) {

-    visits.add(new Visit(VisitKind.VISIT_IS_NOT,

-        expression: expression, type: type));

-    apply(expression, arg);

-  }

-

-  @override

-  visitLogicalAnd(

-      Send node,

-      Node left,

-      Node right,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOGICAL_AND,

-        left: left, right: right));

-    apply(left, arg);

-    apply(right, arg);

-  }

-

-  @override

-  visitLogicalOr(

-      Send node,

-      Node left,

-      Node right,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOGICAL_OR,

-        left: left, right: right));

-    apply(left, arg);

-    apply(right, arg);

-  }

-

-  @override

-  visitLocalFunctionGet(

-      Send node,

-      LocalFunctionElement function,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOCAL_FUNCTION_GET,

-                         element: function));

-  }

-

-  @override

-  visitLocalFunctionSet(

-      SendSet node,

-      LocalFunctionElement function,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOCAL_FUNCTION_SET,

-        element: function, rhs: rhs));

-    super.visitLocalFunctionSet(node, function, rhs, arg);

-  }

-

-  @override

-  visitLocalFunctionInvoke(

-      Send node,

-      LocalFunctionElement function,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOCAL_FUNCTION_INVOKE,

-        element: function, arguments: arguments, selector: callStructure));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitLocalVariableGet(

-      Send node,

-      LocalVariableElement variable,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOCAL_VARIABLE_GET,

-                         element: variable));

-  }

-

-  @override

-  visitLocalVariableInvoke(

-      Send node,

-      LocalVariableElement variable,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOCAL_VARIABLE_INVOKE,

-        element: variable, arguments: arguments, selector: callStructure));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitLocalVariableSet(

-      SendSet node,

-      LocalVariableElement variable,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOCAL_VARIABLE_SET,

-        element: variable, rhs: rhs));

-    super.visitLocalVariableSet(node, variable, rhs, arg);

-  }

-

-  @override

-  visitFinalLocalVariableSet(

-      SendSet node,

-      LocalVariableElement variable,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_SET,

-        element: variable, rhs: rhs));

-    super.visitFinalLocalVariableSet(node, variable, rhs, arg);

-  }

-

-  @override

-  visitParameterGet(

-      Send node,

-      ParameterElement parameter,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_PARAMETER_GET, element: parameter));

-  }

-

-  @override

-  visitParameterInvoke(

-      Send node,

-      ParameterElement parameter,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_PARAMETER_INVOKE,

-        element: parameter, arguments: arguments, selector: callStructure));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitParameterSet(

-      SendSet node,

-      ParameterElement parameter,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_PARAMETER_SET,

-                         element: parameter, rhs: rhs));

-    super.visitParameterSet(node, parameter, rhs, arg);

-  }

-

-  @override

-  visitFinalParameterSet(

-      SendSet node,

-      ParameterElement parameter,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_FINAL_PARAMETER_SET,

-                         element: parameter, rhs: rhs));

-    super.visitFinalParameterSet(node, parameter, rhs, arg);

-  }

-

-  @override

-  visitStaticFieldGet(

-      Send node,

-      FieldElement field,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_GET, element: field));

-  }

-

-  @override

-  visitStaticFieldInvoke(

-      Send node,

-      FieldElement field,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE,

-        element: field, arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitStaticFieldSet(

-      SendSet node,

-      FieldElement field,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_SET,

-        element: field, rhs: rhs));

-    super.visitStaticFieldSet(node, field, rhs, arg);

-  }

-

-  @override

-  visitFinalStaticFieldSet(

-      SendSet node,

-      FieldElement field,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET,

-        element: field, rhs: rhs));

-    super.visitFinalStaticFieldSet(node, field, rhs, arg);

-  }

-

-  @override

-  visitStaticFunctionGet(

-      Send node,

-      MethodElement function,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_FUNCTION_GET,

-        element: function));

-  }

-

-  @override

-  visitStaticFunctionSet(

-      SendSet node,

-      MethodElement function,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_FUNCTION_SET,

-        element: function, rhs: rhs));

-    super.visitStaticFunctionSet(node, function, rhs, arg);

-  }

-

-  @override

-  visitStaticFunctionInvoke(

-      Send node,

-      MethodElement function,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE,

-        element: function, arguments: arguments));

-    super.visitStaticFunctionInvoke(

-        node, function, arguments, callStructure, arg);

-  }

-

-  @override

-  visitStaticFunctionIncompatibleInvoke(

-      Send node,

-      MethodElement function,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_FUNCTION_INCOMPATIBLE_INVOKE,

-        element: function, arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitStaticGetterGet(

-      Send node,

-      FunctionElement getter,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_GETTER_GET,

-        element: getter));

-    super.visitStaticGetterGet(node, getter, arg);

-  }

-

-  @override

-  visitStaticGetterSet(

-      SendSet node,

-      MethodElement getter,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_GETTER_SET,

-        element: getter, rhs: rhs));

-    super.visitStaticGetterSet(node, getter, rhs, arg);

-  }

-

-  @override

-  visitStaticGetterInvoke(

-      Send node,

-      FunctionElement getter,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE,

-        element: getter, arguments: arguments));

-    super.visitStaticGetterInvoke(node, getter, arguments, callStructure, arg);

-  }

-

-  @override

-  visitStaticSetterInvoke(

-      Send node,

-      FunctionElement setter,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_SETTER_INVOKE,

-        element: setter, arguments: arguments));

-    super.visitStaticSetterInvoke(node, setter, arguments, callStructure, arg);

-  }

-

-  @override

-  visitStaticSetterGet(

-      Send node,

-      FunctionElement getter,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_SETTER_GET,

-        element: getter));

-    super.visitStaticSetterGet(node, getter, arg);

-  }

-

-  @override

-  visitStaticSetterSet(

-      SendSet node,

-      FunctionElement setter,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_SETTER_SET,

-        element: setter, rhs: rhs));

-    super.visitStaticSetterSet(node, setter, rhs, arg);

-  }

-

-  @override

-  visitSuperBinary(

-      Send node,

-      FunctionElement function,

-      BinaryOperator operator,

-      Node argument,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_BINARY,

-        element: function, operator: operator, right: argument));

-    apply(argument, arg);

-  }

-

-  @override

-  visitUnresolvedSuperBinary(

-      Send node,

-      Element element,

-      BinaryOperator operator,

-      Node argument,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_BINARY,

-        operator: operator, right: argument));

-    apply(argument, arg);

-  }

-

-  @override

-  visitSuperIndex(

-      Send node,

-      FunctionElement function,

-      Node index,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_INDEX,

-            element: function, index: index));

-    apply(index, arg);

-  }

-

-  @override

-  visitUnresolvedSuperIndex(

-      Send node,

-      Element element,

-      Node index,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX,

-        index: index));

-    apply(index, arg);

-  }

-

-  @override

-  visitSuperNotEquals(

-      Send node,

-      FunctionElement function,

-      Node argument,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_NOT_EQUALS,

-            element: function, right: argument));

-    apply(argument, arg);

-  }

-

-  @override

-  visitThisGet(Identifier node, arg) {

-    visits.add(new Visit(VisitKind.VISIT_THIS_GET));

-  }

-

-  @override

-  visitThisInvoke(

-      Send node,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_THIS_INVOKE, arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitThisPropertyGet(

-      Send node,

-      Selector selector,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_THIS_PROPERTY_GET,

-                         name: selector.name));

-  }

-

-  @override

-  visitThisPropertyInvoke(

-      Send node,

-      NodeList arguments,

-      Selector selector,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_THIS_PROPERTY_INVOKE,

-                         name: selector.name, arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitThisPropertySet(

-      SendSet node,

-      Selector selector,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_THIS_PROPERTY_SET,

-                         name: selector.name, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitTopLevelFieldGet(

-      Send node,

-      FieldElement field,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_GET, element: field));

-  }

-

-  @override

-  visitTopLevelFieldInvoke(

-      Send node,

-      FieldElement field,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_INVOKE,

-        element: field, arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitTopLevelFieldSet(

-      SendSet node,

-      FieldElement field,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_SET,

-        element: field, rhs: rhs));

-    super.visitTopLevelFieldSet(node, field, rhs, arg);

-  }

-

-  @override

-  visitFinalTopLevelFieldSet(

-      SendSet node,

-      FieldElement field,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_FINAL_TOP_LEVEL_FIELD_SET,

-        element: field, rhs: rhs));

-    super.visitFinalTopLevelFieldSet(node, field, rhs, arg);

-  }

-

-  @override

-  visitTopLevelFunctionGet(

-      Send node,

-      MethodElement function,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_GET,

-        element: function));

-  }

-

-  @override

-  visitTopLevelFunctionSet(

-      SendSet node,

-      MethodElement function,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_SET,

-        element: function, rhs: rhs));

-    super.visitTopLevelFunctionSet(node, function, rhs, arg);

-  }

-

-  @override

-  visitTopLevelFunctionInvoke(

-      Send node,

-      MethodElement function,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INVOKE,

-        element: function, arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitTopLevelFunctionIncompatibleInvoke(

-      Send node,

-      MethodElement function,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INCOMPATIBLE_INVOKE,

-        element: function, arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitTopLevelGetterGet(

-      Send node,

-      FunctionElement getter,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_GET,

-        element: getter));

-    super.visitTopLevelGetterGet(node, getter, arg);

-  }

-

-  @override

-  visitTopLevelSetterGet(

-      Send node,

-      FunctionElement setter,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_GET,

-        element: setter));

-    super.visitTopLevelSetterGet(node, setter, arg);

-  }

-

-  @override

-  visitTopLevelGetterInvoke(

-      Send node,

-      FunctionElement getter,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_INVOKE,

-        element: getter, arguments: arguments));

-    super.visitTopLevelGetterInvoke(

-        node, getter, arguments, callStructure, arg);

-  }

-

-  @override

-  visitTopLevelSetterInvoke(

-      Send node,

-      FunctionElement setter,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_INVOKE,

-        element: setter, arguments: arguments));

-    super.visitTopLevelSetterInvoke(

-        node, setter, arguments, callStructure, arg);

-  }

-

-  @override

-  visitTopLevelGetterSet(

-      SendSet node,

-      FunctionElement getter,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SET,

-        element: getter, rhs: rhs));

-    super.visitTopLevelGetterSet(node, getter, rhs, arg);

-  }

-

-  @override

-  visitTopLevelSetterSet(

-      SendSet node,

-      FunctionElement setter,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_SET,

-        element: setter, rhs: rhs));

-    super.visitTopLevelSetterSet(node, setter, rhs, arg);

-  }

-

-  @override

-  visitTypeVariableTypeLiteralGet(

-      Send node,

-      TypeVariableElement element,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_GET,

-        element: element));

-  }

-

-  @override

-  visitTypeVariableTypeLiteralInvoke(

-      Send node,

-      TypeVariableElement element,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_INVOKE,

-        element: element, arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitTypeVariableTypeLiteralSet(

-      SendSet node,

-      TypeVariableElement element,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_SET,

-        element: element, rhs: rhs));

-    super.visitTypeVariableTypeLiteralSet(node, element, rhs, arg);

-  }

-

-  @override

-  visitTypedefTypeLiteralGet(

-      Send node,

-      ConstantExpression constant,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_GET,

-        constant: constant.getText()));

-  }

-

-  @override

-  visitTypedefTypeLiteralInvoke(

-      Send node,

-      ConstantExpression constant,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_INVOKE,

-        constant: constant.getText(), arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitTypedefTypeLiteralSet(

-      SendSet node,

-      ConstantExpression constant,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_SET,

-        constant: constant.getText(), rhs: rhs));

-    super.visitTypedefTypeLiteralSet(node, constant, rhs, arg);

-  }

-

-  @override

-  visitUnary(

-      Send node,

-      UnaryOperator operator,

-      Node expression,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNARY,

-        expression: expression, operator: operator));

-    apply(expression, arg);

-  }

-

-  @override

-  visitNot(

-      Send node,

-      Node expression,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_NOT, expression: expression));

-    apply(expression, arg);

-  }

-

-  @override

-  visitSuperFieldGet(

-      Send node,

-      FieldElement field,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_GET, element: field));

-  }

-

-  @override

-  visitUnresolvedSuperGet(

-      Send node,

-      Element element,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GET));

-  }

-

-  @override

-  visitSuperFieldInvoke(

-      Send node,

-      FieldElement field,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_INVOKE,

-        element: field, arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitUnresolvedSuperInvoke(

-      Send node,

-      Element element,

-      NodeList arguments,

-      Selector selector,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INVOKE,

-        arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitSuperFieldSet(

-      SendSet node,

-      FieldElement field,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_SET,

-        element: field, rhs: rhs));

-    super.visitSuperFieldSet(node, field, rhs, arg);

-  }

-

-  @override

-  visitFinalSuperFieldSet(

-      SendSet node,

-      FieldElement field,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_FINAL_SUPER_FIELD_SET,

-        element: field, rhs: rhs));

-    super.visitFinalSuperFieldSet(node, field, rhs, arg);

-  }

-

-  @override

-  visitSuperMethodGet(

-      Send node,

-      MethodElement method,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_GET, element: method));

-  }

-

-  @override

-  visitSuperMethodSet(

-      SendSet node,

-      MethodElement method,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_SET,

-        element: method, rhs: rhs));

-    super.visitSuperMethodSet(node, method, rhs, arg);

-  }

-

-  @override

-  visitSuperMethodInvoke(

-      Send node,

-      MethodElement method,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_INVOKE,

-        element: method, arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitSuperMethodIncompatibleInvoke(

-      Send node,

-      MethodElement method,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_INCOMPATIBLE_INVOKE,

-        element: method, arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitSuperGetterGet(

-      Send node,

-      FunctionElement getter,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_GET, element: getter));

-    super.visitSuperGetterGet(node, getter, arg);

-  }

-

-  @override

-  visitSuperSetterGet(

-      Send node,

-      FunctionElement setter,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_SETTER_GET, element: setter));

-    super.visitSuperSetterGet(node, setter, arg);

-  }

-

-  @override

-  visitSuperGetterInvoke(

-      Send node,

-      FunctionElement getter,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_INVOKE,

-        element: getter, arguments: arguments));

-    super.visitSuperGetterInvoke(node, getter, arguments, callStructure, arg);

-  }

-

-  @override

-  visitSuperSetterInvoke(

-      Send node,

-      FunctionElement setter,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_SETTER_INVOKE,

-        element: setter, arguments: arguments));

-    super.visitSuperSetterInvoke(node, setter, arguments, callStructure, arg);

-  }

-

-  @override

-  visitSuperGetterSet(

-      SendSet node,

-      FunctionElement getter,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_SET,

-        element: getter, rhs: rhs));

-    super.visitSuperGetterSet(node, getter, rhs, arg);

-  }

-

-  @override

-  visitSuperSetterSet(

-      SendSet node,

-      FunctionElement setter,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_SETTER_SET,

-        element: setter, rhs: rhs));

-    super.visitSuperSetterSet(node, setter, rhs, arg);

-  }

-

-  @override

-  visitSuperUnary(

-      Send node,

-      UnaryOperator operator,

-      FunctionElement function,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_UNARY,

-        element: function, operator: operator));

-  }

-

-  @override

-  visitUnresolvedSuperUnary(

-      Send node,

-      UnaryOperator operator,

-      Element element,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_UNARY,

-        operator: operator));

-  }

-

-  @override

-  visitEquals(

-      Send node,

-      Node left,

-      Node right,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_EQUALS, left: left, right: right));

-    apply(left, arg);

-    apply(right, arg);

-  }

-

-  @override

-  visitSuperEquals(

-      Send node,

-      FunctionElement function,

-      Node argument,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_EQUALS,

-        element: function, right: argument));

-    apply(argument, arg);

-  }

-

-  @override

-  visitIndexSet(

-      Send node,

-      Node receiver,

-      Node index,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_INDEX_SET,

-        receiver: receiver, index: index, rhs: rhs));

-    apply(receiver, arg);

-    apply(index, arg);

-    apply(rhs, arg);

-  }

-

-  @override

-  visitSuperIndexSet(

-      Send node,

-      FunctionElement function,

-      Node index,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_INDEX_SET,

-        element: function, index: index, rhs: rhs));

-    apply(index, arg);

-    apply(rhs, arg);

-  }

-

-  @override

-  visitDynamicPropertyCompound(

-      Send node,

-      Node receiver,

-      AssignmentOperator operator,

-      Node rhs,

-      Selector getterSelector,

-      Selector setterSelector,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_COMPOUND,

-        receiver: receiver, operator: operator, rhs: rhs,

-        getter: getterSelector, setter: setterSelector));

-    apply(receiver, arg);

-    apply(rhs, arg);

-  }

-

-  @override

-  visitFinalLocalVariableCompound(

-      Send node,

-      LocalVariableElement variable,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_COMPOUND,

-        element: variable, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitFinalLocalVariablePrefix(

-      Send node,

-      LocalVariableElement variable,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_PREFIX,

-        element: variable, operator: operator));

-  }

-

-  @override

-  visitFinalLocalVariablePostfix(

-      Send node,

-      LocalVariableElement variable,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_POSTFIX,

-        element: variable, operator: operator));

-  }

-

-  @override

-  visitFinalParameterCompound(

-      Send node,

-      ParameterElement parameter,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_FINAL_PARAMETER_COMPOUND,

-        element: parameter, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitFinalParameterPrefix(

-      Send node,

-      ParameterElement parameter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_FINAL_PARAMETER_PREFIX,

-        element: parameter, operator: operator));

-  }

-

-  @override

-  visitFinalParameterPostfix(

-      Send node,

-      ParameterElement parameter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_FINAL_PARAMETER_POSTFIX,

-        element: parameter, operator: operator));

-  }

-

-  @override

-  visitFinalStaticFieldCompound(

-      Send node,

-      FieldElement field,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_FINAL_FIELD_COMPOUND,

-        element: field, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitFinalStaticFieldPostfix(

-      Send node,

-      FieldElement field,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_FINAL_FIELD_POSTFIX,

-        element: field, operator: operator));

-  }

-

-  @override

-  visitFinalStaticFieldPrefix(

-      Send node,

-      FieldElement field,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_FINAL_FIELD_PREFIX,

-        element: field, operator: operator));

-  }

-

-  @override

-  visitFinalSuperFieldCompound(

-      Send node,

-      FieldElement field,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_COMPOUND,

-        element: field, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitFinalTopLevelFieldCompound(

-      Send node,

-      FieldElement field,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_COMPOUND,

-        element: field, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitFinalTopLevelFieldPostfix(

-      Send node,

-      FieldElement field,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_POSTFIX,

-        element: field, operator: operator));

-  }

-

-  @override

-  visitFinalTopLevelFieldPrefix(

-      Send node,

-      FieldElement field,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_PREFIX,

-        element: field, operator: operator));

-  }

-

-  @override

-  visitLocalFunctionCompound(

-      Send node,

-      LocalFunctionElement function,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOCAL_FUNCTION_COMPOUND,

-        element: function, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitLocalVariableCompound(

-      Send node,

-      LocalVariableElement variable,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOCAL_VARIABLE_COMPOUND,

-        element: variable, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitParameterCompound(

-      Send node,

-      ParameterElement parameter,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_PARAMETER_COMPOUND,

-        element: parameter, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitStaticFieldCompound(

-      Send node,

-      FieldElement field,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_COMPOUND,

-        element: field, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitStaticGetterSetterCompound(

-      Send node,

-      FunctionElement getter,

-      FunctionElement setter,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND,

-        operator: operator, rhs: rhs,

-        getter: getter, setter: setter));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitSuperFieldCompound(

-      Send node,

-      FieldElement field,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_COMPOUND,

-        element: field, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitSuperGetterSetterCompound(

-      Send node,

-      FunctionElement getter,

-      FunctionElement setter,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_COMPOUND,

-        operator: operator, rhs: rhs,

-        getter: getter, setter: setter));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitThisPropertyCompound(

-      Send node,

-      AssignmentOperator operator,

-      Node rhs,

-      Selector getterSelector,

-      Selector setterSelector,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_THIS_PROPERTY_COMPOUND,

-        operator: operator, rhs: rhs,

-        getter: getterSelector, setter: setterSelector));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitTopLevelFieldCompound(

-      Send node,

-      FieldElement field,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_COMPOUND,

-        element: field, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitTopLevelGetterSetterCompound(

-      Send node,

-      FunctionElement getter,

-      FunctionElement setter,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_COMPOUND,

-        operator: operator, rhs: rhs,

-        getter: getter, setter: setter));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitStaticMethodSetterCompound(

-      Send node,

-      FunctionElement method,

-      FunctionElement setter,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_METHOD_SETTER_COMPOUND,

-        operator: operator, rhs: rhs,

-        getter: method, setter: setter));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitSuperFieldSetterCompound(

-      Send node,

-      FieldElement field,

-      FunctionElement setter,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_COMPOUND,

-        operator: operator, rhs: rhs,

-        getter: field, setter: setter));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitSuperGetterFieldCompound(

-      Send node,

-      FunctionElement getter,

-      FieldElement field,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_COMPOUND,

-        operator: operator, rhs: rhs,

-        getter: getter, setter: field));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitSuperMethodSetterCompound(

-      Send node,

-      FunctionElement method,

-      FunctionElement setter,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_SETTER_COMPOUND,

-        getter: method, setter: setter, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitSuperMethodCompound(

-      Send node,

-      FunctionElement method,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_COMPOUND,

-        element: method, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitSuperMethodPrefix(

-      Send node,

-      FunctionElement method,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_PREFIX,

-        element: method, operator: operator));

-  }

-

-  @override

-  visitSuperMethodPostfix(

-      Send node,

-      FunctionElement method,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_POSTFIX,

-        element: method, operator: operator));

-  }

-

-  @override

-  visitUnresolvedSuperCompound(

-      Send node,

-      Element element,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_COMPOUND,

-        operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitUnresolvedSuperPrefix(

-      Send node,

-      Element element,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_PREFIX,

-        operator: operator));

-  }

-

-  @override

-  visitUnresolvedSuperPostfix(

-      Send node,

-      Element element,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_POSTFIX,

-        operator: operator));

-  }

-

-  @override

-  visitTopLevelMethodSetterCompound(

-      Send node,

-      FunctionElement method,

-      FunctionElement setter,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_SETTER_COMPOUND,

-        getter: method, setter: setter, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitCompoundIndexSet(

-      Send node,

-      Node receiver,

-      Node index,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_COMPOUND_INDEX_SET,

-        receiver: receiver, index: index, rhs: rhs, operator: operator));

-    apply(receiver, arg);

-    apply(index, arg);

-    apply(rhs, arg);

-  }

-

-  @override

-  visitSuperCompoundIndexSet(

-      Send node,

-      FunctionElement getter,

-      FunctionElement setter,

-      Node index,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_COMPOUND_INDEX_SET,

-        getter: getter, setter: setter,

-        index: index, rhs: rhs, operator: operator));

-    apply(index, arg);

-    apply(rhs, arg);

-  }

-

-  @override

-  visitClassTypeLiteralCompound(

-      Send node,

-      ConstantExpression constant,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_COMPOUND,

-        constant: constant.getText(), operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitDynamicTypeLiteralCompound(

-      Send node,

-      ConstantExpression constant,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_COMPOUND,

-        constant: constant.getText(), operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitTypeVariableTypeLiteralCompound(

-      Send node,

-      TypeVariableElement element,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_COMPOUND,

-        element: element, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitTypedefTypeLiteralCompound(

-      Send node,

-      ConstantExpression constant,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_COMPOUND,

-        constant: constant.getText(), operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitLocalFunctionPrefix(

-      Send node,

-      LocalFunctionElement function,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOCAL_FUNCTION_PREFIX,

-        element: function, operator: operator));

-  }

-

-  @override

-  visitClassTypeLiteralPrefix(

-      Send node,

-      ConstantExpression constant,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_PREFIX,

-        constant: constant.getText(), operator: operator));

-  }

-

-  @override

-  visitDynamicTypeLiteralPrefix(

-      Send node,

-      ConstantExpression constant,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_PREFIX,

-        constant: constant.getText(), operator: operator));

-  }

-

-  @override

-  visitLocalVariablePrefix(

-      Send node,

-      LocalVariableElement variable,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOCAL_VARIABLE_PREFIX,

-        element: variable, operator: operator));

-  }

-

-  @override

-  visitParameterPrefix(

-      Send node,

-      ParameterElement parameter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_PARAMETER_PREFIX,

-        element: parameter, operator: operator));

-  }

-

-  @override

-  visitStaticFieldPrefix(

-      Send node,

-      FieldElement field,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_PREFIX,

-        element: field, operator: operator));

-  }

-

-  @override

-  visitStaticGetterSetterPrefix(

-      Send node,

-      FunctionElement getter,

-      FunctionElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX,

-        getter: getter, setter: setter, operator: operator));

-  }

-

-  @override

-  visitStaticMethodSetterPrefix(

-      Send node,

-      FunctionElement getter,

-      FunctionElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_METHOD_SETTER_PREFIX,

-        getter: getter, setter: setter, operator: operator));

-  }

-

-  @override

-  visitSuperFieldFieldCompound(

-      Send node,

-      FieldElement readField,

-      FieldElement writtenField,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_FIELD_COMPOUND,

-        getter: readField, setter: writtenField, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitSuperFieldFieldPrefix(

-      Send node,

-      FieldElement readField,

-      FieldElement writtenField,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_FIELD_PREFIX,

-        getter: readField, setter: writtenField, operator: operator));

-  }

-

-  @override

-  visitSuperFieldPrefix(

-      Send node,

-      FieldElement field,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_PREFIX,

-        element: field, operator: operator));

-  }

-

-  @override

-  visitFinalSuperFieldPrefix(

-      Send node,

-      FieldElement field,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_PREFIX,

-        element: field, operator: operator));

-  }

-

-  @override

-  visitSuperFieldSetterPrefix(

-      Send node,

-      FieldElement field,

-      FunctionElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_PREFIX,

-        getter: field, setter: setter, operator: operator));

-  }

-

-  @override

-  visitSuperGetterFieldPrefix(

-      Send node,

-      FunctionElement getter,

-      FieldElement field,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_PREFIX,

-        getter: getter, setter: field, operator: operator));

-  }

-

-  @override

-  visitSuperGetterSetterPrefix(

-      Send node,

-      FunctionElement getter,

-      FunctionElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_PREFIX,

-        getter: getter, setter: setter, operator: operator));

-  }

-

-  @override

-  visitSuperMethodSetterPrefix(

-      Send node,

-      FunctionElement method,

-      FunctionElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_SETTER_PREFIX,

-        getter: method, setter: setter, operator: operator));

-  }

-

-  @override

-  visitThisPropertyPrefix(

-      Send node,

-      IncDecOperator operator,

-      Selector getterSelector,

-      Selector setterSelector,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_THIS_PROPERTY_PREFIX,

-        operator: operator,

-        getter: getterSelector, setter: setterSelector));

-  }

-

-  @override

-  visitTopLevelFieldPrefix(

-      Send node,

-      FieldElement field,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_PREFIX,

-        element: field, operator: operator));

-  }

-

-  @override

-  visitTopLevelGetterSetterPrefix(

-      Send node,

-      FunctionElement getter,

-      FunctionElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_PREFIX,

-        getter: getter, setter: setter, operator: operator));

-  }

-

-  @override

-  visitTopLevelMethodSetterPrefix(

-      Send node,

-      FunctionElement method,

-      FunctionElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_SETTER_PREFIX,

-        getter: method, setter: setter, operator: operator));

-  }

-

-  @override

-  visitTypeVariableTypeLiteralPrefix(

-      Send node,

-      TypeVariableElement element,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_PREFIX,

-        element: element, operator: operator));

-  }

-

-  @override

-  visitTypedefTypeLiteralPrefix(

-      Send node,

-      ConstantExpression constant,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_PREFIX,

-        constant: constant.getText(), operator: operator));

-  }

-

-  @override

-  visitLocalFunctionPostfix(

-      Send node,

-      LocalFunctionElement function,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOCAL_FUNCTION_POSTFIX,

-        element: function, operator: operator));

-  }

-

-  @override

-  visitClassTypeLiteralPostfix(

-      Send node,

-      ConstantExpression constant,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_POSTFIX,

-        constant: constant.getText(), operator: operator));

-  }

-

-  @override

-  visitDynamicTypeLiteralPostfix(

-      Send node,

-      ConstantExpression constant,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_POSTFIX,

-        constant: constant.getText(), operator: operator));

-  }

-

-  @override

-  visitLocalVariablePostfix(

-      Send node,

-      LocalVariableElement variable,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOCAL_VARIABLE_POSTFIX,

-        element: variable, operator: operator));

-  }

-

-  @override

-  visitParameterPostfix(

-      Send node,

-      ParameterElement parameter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_PARAMETER_POSTFIX,

-        element: parameter, operator: operator));

-  }

-

-  @override

-  visitStaticFieldPostfix(

-      Send node,

-      FieldElement field,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_POSTFIX,

-        element: field, operator: operator));

-  }

-

-  @override

-  visitStaticGetterSetterPostfix(

-      Send node,

-      FunctionElement getter,

-      FunctionElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX,

-        getter: getter, setter: setter, operator: operator));

-  }

-

-  @override

-  visitStaticMethodSetterPostfix(

-      Send node,

-      FunctionElement getter,

-      FunctionElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_METHOD_SETTER_POSTFIX,

-        getter: getter, setter: setter, operator: operator));

-  }

-

-  @override

-  visitSuperFieldFieldPostfix(

-      Send node,

-      FieldElement readField,

-      FieldElement writtenField,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_FIELD_POSTFIX,

-        getter: readField, setter: writtenField, operator: operator));

-  }

-

-  @override

-  visitSuperFieldPostfix(

-      Send node,

-      FieldElement field,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_POSTFIX,

-        element: field, operator: operator));

-  }

-

-  @override

-  visitFinalSuperFieldPostfix(

-      Send node,

-      FieldElement field,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_POSTFIX,

-        element: field, operator: operator));

-  }

-

-  @override

-  visitSuperFieldSetterPostfix(

-      Send node,

-      FieldElement field,

-      FunctionElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_POSTFIX,

-        getter: field, setter: setter, operator: operator));

-  }

-

-  @override

-  visitSuperGetterFieldPostfix(

-      Send node,

-      FunctionElement getter,

-      FieldElement field,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_POSTFIX,

-        getter: getter, setter: field, operator: operator));

-  }

-

-  @override

-  visitSuperGetterSetterPostfix(

-      Send node,

-      FunctionElement getter,

-      FunctionElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_POSTFIX,

-        getter: getter, setter: setter, operator: operator));

-  }

-

-  @override

-  visitSuperMethodSetterPostfix(

-      Send node,

-      FunctionElement method,

-      FunctionElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_SETTER_POSTFIX,

-        getter: method, setter: setter, operator: operator));

-  }

-

-  @override

-  visitThisPropertyPostfix(

-      Send node,

-      IncDecOperator operator,

-      Selector getterSelector,

-      Selector setterSelector,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_THIS_PROPERTY_POSTFIX,

-        operator: operator,

-        getter: getterSelector, setter: setterSelector));

-  }

-

-  @override

-  visitTopLevelFieldPostfix(

-      Send node,

-      FieldElement field,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_POSTFIX,

-        element: field, operator: operator));

-  }

-

-  @override

-  visitTopLevelGetterSetterPostfix(

-      Send node,

-      FunctionElement getter,

-      FunctionElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_POSTFIX,

-        getter: getter, setter: setter, operator: operator));

-  }

-

-  @override

-  visitTopLevelMethodSetterPostfix(

-      Send node,

-      FunctionElement method,

-      FunctionElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_SETTER_POSTFIX,

-        getter: method, setter: setter, operator: operator));

-  }

-

-  @override

-  visitTypeVariableTypeLiteralPostfix(

-      Send node,

-      TypeVariableElement element,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_POSTFIX,

-        element: element, operator: operator));

-  }

-

-  @override

-  visitTypedefTypeLiteralPostfix(

-      Send node,

-      ConstantExpression constant,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_POSTFIX,

-        constant: constant.getText(), operator: operator));

-  }

-

-  @override

-  visitUnresolvedCompound(

-      Send node,

-      ErroneousElement element,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_COMPOUND,

-        operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitUnresolvedGet(

-      Send node,

-      Element element,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_GET, name: element.name));

-  }

-

-  @override

-  visitUnresolvedSet(

-      Send node,

-      Element element,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SET,

-                         name: element.name, rhs: rhs));

-    super.visitUnresolvedSet(node, element, rhs, arg);

-  }

-

-  @override

-  visitUnresolvedInvoke(

-      Send node,

-      Element element,

-      NodeList arguments,

-      Selector selector,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

-                         name: element.name, arguments: arguments));

-    super.visitUnresolvedInvoke(node, element, arguments, selector, arg);

-  }

-

-  @override

-  visitUnresolvedPostfix(

-      Send node,

-      ErroneousElement element,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_UNRESOLVED_POSTFIX, operator: operator));

-  }

-

-  @override

-  visitUnresolvedPrefix(

-      Send node,

-      ErroneousElement element,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_UNRESOLVED_PREFIX, operator: operator));

-  }

-

-  @override

-  visitUnresolvedSuperCompoundIndexSet(

-      Send node,

-      Element element,

-      Node index,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_UNRESOLVED_SUPER_COMPOUND_INDEX_SET,

-        index: index, operator: operator, rhs: rhs));

-    apply(index, arg);

-    apply(rhs, arg);

-  }

-

-  @override

-  visitUnresolvedSuperGetterCompoundIndexSet(

-      Send node,

-      Element element,

-      MethodElement setter,

-      Node index,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_COMPOUND_INDEX_SET,

-        setter: setter, index: index, operator: operator, rhs: rhs));

-    apply(index, arg);

-    apply(rhs, arg);

-  }

-

-  @override

-  visitUnresolvedSuperSetterCompoundIndexSet(

-      Send node,

-      MethodElement getter,

-      Element element,

-      Node index,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_COMPOUND_INDEX_SET,

-        getter: getter, index: index, operator: operator, rhs: rhs));

-    apply(index, arg);

-    apply(rhs, arg);

-  }

-

-  @override

-  visitUnresolvedSuperIndexSet(

-      Send node,

-      ErroneousElement element,

-      Node index,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_SET,

-               index: index, rhs: rhs));

-    apply(index, arg);

-    apply(rhs, arg);

-  }

-

-  @override

-  visitUnresolvedSuperIndexPostfix(

-      Send node,

-      Element element,

-      Node index,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_POSTFIX,

-               index: index, operator: operator));

-    apply(index, arg);

-  }

-

-  @override

-  visitUnresolvedSuperGetterIndexPostfix(

-      Send node,

-      Element element,

-      MethodElement setter,

-      Node index,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_INDEX_POSTFIX,

-               setter: setter, index: index, operator: operator));

-    apply(index, arg);

-  }

-

-  @override

-  visitUnresolvedSuperSetterIndexPostfix(

-      Send node,

-      MethodElement getter,

-      Element element,

-      Node index,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_POSTFIX,

-               getter: getter, index: index, operator: operator));

-    apply(index, arg);

-  }

-

-  @override

-  visitUnresolvedSuperIndexPrefix(

-      Send node,

-      Element element,

-      Node index,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_PREFIX,

-               index: index, operator: operator));

-    apply(index, arg);

-  }

-

-  @override

-  visitUnresolvedSuperGetterIndexPrefix(

-      Send node,

-      Element element,

-      MethodElement setter,

-      Node index,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_INDEX_PREFIX,

-               setter: setter, index: index, operator: operator));

-    apply(index, arg);

-  }

-

-  @override

-  visitUnresolvedSuperSetterIndexPrefix(

-      Send node,

-      MethodElement getter,

-      Element element,

-      Node index,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_PREFIX,

-               getter: getter, index: index, operator: operator));

-    apply(index, arg);

-  }

-

-  @override

-  visitIndexPostfix(

-      Send node,

-      Node receiver,

-      Node index,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_INDEX_POSTFIX,

-        receiver: receiver, index: index, operator: operator));

-    apply(receiver, arg);

-    apply(index, arg);

-  }

-

-  @override

-  visitIndexPrefix(

-      Send node,

-      Node receiver,

-      Node index,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_INDEX_PREFIX,

-        receiver: receiver, index: index, operator: operator));

-    apply(receiver, arg);

-    apply(index, arg);

-  }

-

-  @override

-  visitSuperIndexPostfix(

-      Send node,

-      FunctionElement indexFunction,

-      FunctionElement indexSetFunction,

-      Node index,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_INDEX_POSTFIX,

-        getter: indexFunction, setter: indexSetFunction,

-        index: index, operator: operator));

-    apply(index, arg);

-  }

-

-  @override

-  visitSuperIndexPrefix(

-      Send node,

-      FunctionElement indexFunction,

-      FunctionElement indexSetFunction,

-      Node index,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_INDEX_PREFIX,

-        getter: indexFunction, setter: indexSetFunction,

-        index: index, operator: operator));

-    apply(index, arg);

-  }

-

-  @override

-  visitUnresolvedClassConstructorInvoke(

-      NewExpression node,

-      Element constructor,

-      DartType 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));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitUnresolvedConstructorInvoke(

-      NewExpression node,

-      Element constructor,

-      DartType 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));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitConstConstructorInvoke(

-      NewExpression node,

-      ConstructedConstantExpression constant,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_CONST_CONSTRUCTOR_INVOKE,

-                         constant: constant.getText()));

-  }

-

-  @override

-  visitFactoryConstructorInvoke(

-      NewExpression node,

-      ConstructorElement constructor,

-      InterfaceType type,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_FACTORY_CONSTRUCTOR_INVOKE,

-        element: constructor,

-        type: type,

-        arguments: arguments,

-        selector: callStructure));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitGenerativeConstructorInvoke(

-      NewExpression node,

-      ConstructorElement constructor,

-      InterfaceType type,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE,

-        element: constructor,

-        type: type,

-        arguments: arguments,

-        selector: callStructure));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitRedirectingFactoryConstructorInvoke(

-      NewExpression node,

-      ConstructorElement constructor,

-      InterfaceType type,

-      ConstructorElement effectiveTarget,

-      InterfaceType effectiveTargetType,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

-        element: constructor,

-        type: type,

-        target: effectiveTarget,

-        targetType: effectiveTargetType,

-        arguments: arguments,

-        selector: callStructure));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitRedirectingGenerativeConstructorInvoke(

-      NewExpression node,

-      ConstructorElement constructor,

-      InterfaceType type,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_INVOKE,

-        element: constructor,

-        type: type,

-        arguments: arguments,

-        selector: callStructure));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitAbstractClassConstructorInvoke(

-      NewExpression node,

-      ConstructorElement constructor,

-      InterfaceType type,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_ABSTRACT_CLASS_CONSTRUCTOR_INVOKE,

-        element: constructor,

-        type: type,

-        arguments: arguments,

-        selector: callStructure));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitUnresolvedRedirectingFactoryConstructorInvoke(

-      NewExpression node,

-      ConstructorElement constructor,

-      InterfaceType type,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

-        element: constructor,

-        type: type,

-        arguments: arguments,

-        selector: callStructure));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitUnresolvedStaticGetterCompound(

-      Send node,

-      Element element,

-      MethodElement setter,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_STATIC_GETTER_COMPOUND,

-        setter: setter, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitUnresolvedTopLevelGetterCompound(

-      Send node,

-      Element element,

-      MethodElement setter,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_GETTER_COMPOUND,

-        setter: setter, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitUnresolvedStaticSetterCompound(

-      Send node,

-      MethodElement getter,

-      Element element,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_STATIC_SETTER_COMPOUND,

-        getter: getter, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitUnresolvedTopLevelSetterCompound(

-      Send node,

-      MethodElement getter,

-      Element element,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_SETTER_COMPOUND,

-        getter: getter, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitStaticMethodCompound(

-      Send node,

-      MethodElement method,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_METHOD_COMPOUND,

-        element: method, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitTopLevelMethodCompound(

-      Send node,

-      MethodElement method,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_COMPOUND,

-        element: method, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitUnresolvedStaticGetterPrefix(

-      Send node,

-      Element element,

-      MethodElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_STATIC_GETTER_PREFIX,

-        setter: setter, operator: operator));

-  }

-

-  @override

-  visitUnresolvedTopLevelGetterPrefix(

-      Send node,

-      Element element,

-      MethodElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_GETTER_PREFIX,

-        setter: setter, operator: operator));

-  }

-

-  @override

-  visitUnresolvedStaticSetterPrefix(

-      Send node,

-      MethodElement getter,

-      Element element,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_STATIC_SETTER_PREFIX,

-        getter: getter, operator: operator));

-  }

-

-  @override

-  visitUnresolvedTopLevelSetterPrefix(

-      Send node,

-      MethodElement getter,

-      Element element,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_SETTER_PREFIX,

-        getter: getter, operator: operator));

-  }

-

-  @override

-  visitStaticMethodPrefix(

-      Send node,

-      MethodElement method,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_METHOD_PREFIX,

-        element: method, operator: operator));

-  }

-

-  @override

-  visitTopLevelMethodPrefix(

-      Send node,

-      MethodElement method,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_PREFIX,

-        element: method, operator: operator));

-  }

-

-  @override

-  visitUnresolvedStaticGetterPostfix(

-      Send node,

-      Element element,

-      MethodElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_STATIC_GETTER_POSTFIX,

-        setter: setter, operator: operator));

-  }

-

-  @override

-  visitUnresolvedTopLevelGetterPostfix(

-      Send node,

-      Element element,

-      MethodElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_GETTER_POSTFIX,

-        setter: setter, operator: operator));

-  }

-

-  @override

-  visitUnresolvedStaticSetterPostfix(

-      Send node,

-      MethodElement getter,

-      Element element,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_STATIC_SETTER_POSTFIX,

-        getter: getter, operator: operator));

-  }

-

-  @override

-  visitUnresolvedTopLevelSetterPostfix(

-      Send node,

-      MethodElement getter,

-      Element element,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_SETTER_POSTFIX,

-        getter: getter, operator: operator));

-  }

-

-  @override

-  visitStaticMethodPostfix(

-      Send node,

-      MethodElement method,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_METHOD_POSTFIX,

-        element: method, operator: operator));

-  }

-

-  @override

-  visitTopLevelMethodPostfix(

-      Send node,

-      MethodElement method,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_POSTFIX,

-        element: method, operator: operator));

-  }

-

-  @override

-  visitUnresolvedSuperGetterCompound(

-      Send node, Element element,

-      MethodElement setter,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_COMPOUND,

-        setter: setter, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitUnresolvedSuperGetterPostfix(

-      Send node,

-      Element element,

-      MethodElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_POSTFIX,

-        setter: setter, operator: operator));

-  }

-

-  @override

-  visitUnresolvedSuperGetterPrefix(

-      Send node,

-      Element element,

-      MethodElement setter,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_PREFIX,

-        setter: setter, operator: operator));

-  }

-

-  @override

-  visitUnresolvedSuperSetterCompound(

-      Send node, MethodElement getter,

-      Element element,

-      AssignmentOperator operator,

-      Node rhs,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_COMPOUND,

-        getter: getter, operator: operator, rhs: rhs));

-    apply(rhs, arg);

-  }

-

-  @override

-  visitUnresolvedSuperSetterPostfix(

-      Send node,

-      MethodElement getter,

-      Element element,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_POSTFIX,

-        getter: getter, operator: operator));

-  }

-

-  @override

-  visitUnresolvedSuperSetterPrefix(

-      Send node,

-      MethodElement getter,

-      Element element,

-      IncDecOperator operator,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_PREFIX,

-        getter: getter, operator: operator));

-  }

-}

-

-class SemanticDeclarationTestVisitor extends SemanticTestVisitor {

-

-  SemanticDeclarationTestVisitor(TreeElements elements) : super(elements);

-

-  @override

-  errorUnresolvedSuperConstructorInvoke(

-      Send node,

-      Element element,

-      NodeList arguments,

-      Selector selector,

-      arg) {

-    // TODO: implement errorUnresolvedSuperConstructorInvoke

-  }

-

-  @override

-  errorUnresolvedThisConstructorInvoke(

-      Send node,

-      Element element,

-      NodeList arguments,

-      Selector selector,

-      arg) {

-    // TODO: implement errorUnresolvedThisConstructorInvoke

-  }

-

-  @override

-  visitAbstractMethodDeclaration(

-      FunctionExpression node,

-      MethodElement method,

-      NodeList parameters,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_ABSTRACT_METHOD_DECL,

-        element: method, parameters: parameters));

-    applyParameters(parameters, arg);

-  }

-

-  @override

-  visitClosureDeclaration(

-      FunctionExpression node,

-      LocalFunctionElement function,

-      NodeList parameters,

-      Node body,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_CLOSURE_DECL,

-        element: function, parameters: parameters, body: body));

-    applyParameters(parameters, arg);

-    apply(body, arg);

-  }

-

-  @override

-  visitFactoryConstructorDeclaration(

-      FunctionExpression node,

-      ConstructorElement constructor,

-      NodeList parameters,

-      Node body,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_FACTORY_CONSTRUCTOR_DECL,

-        element: constructor, parameters: parameters, body: body));

-    applyParameters(parameters, arg);

-    apply(body, arg);

-  }

-

-  @override

-  visitFieldInitializer(

-      SendSet node,

-      FieldElement field,

-      Node initializer,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_FIELD_INITIALIZER,

-        element: field, rhs: initializer));

-    apply(initializer, arg);

-  }

-

-  @override

-  visitGenerativeConstructorDeclaration(

-      FunctionExpression node,

-      ConstructorElement constructor,

-      NodeList parameters,

-      NodeList initializers,

-      Node body,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

-        element: constructor, parameters: parameters, body: body));

-    applyParameters(parameters, arg);

-    applyInitializers(initializers, arg);

-    apply(body, arg);

-  }

-

-  @override

-  visitInstanceMethodDeclaration(

-      FunctionExpression node,

-      MethodElement method,

-      NodeList parameters,

-      Node body,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_INSTANCE_METHOD_DECL,

-        element: method, parameters: parameters, body: body));

-    applyParameters(parameters, arg);

-    apply(body, arg);

-  }

-

-  @override

-  visitLocalFunctionDeclaration(

-      FunctionExpression node,

-      LocalFunctionElement function,

-      NodeList parameters,

-      Node body,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOCAL_FUNCTION_DECL,

-        element: function, parameters: parameters, body: body));

-    applyParameters(parameters, arg);

-    apply(body, arg);

-  }

-

-  @override

-  visitRedirectingFactoryConstructorDeclaration(

-      FunctionExpression node,

-      ConstructorElement constructor,

-      NodeList parameters,

-      InterfaceType redirectionType,

-      ConstructorElement redirectionTarget,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,

-        element: constructor,

-        parameters: parameters,

-        target: redirectionTarget,

-        type: redirectionType));

-    applyParameters(parameters, arg);

-  }

-

-  @override

-  visitRedirectingGenerativeConstructorDeclaration(

-      FunctionExpression node,

-      ConstructorElement constructor,

-      NodeList parameters,

-      NodeList initializers,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_DECL,

-        element: constructor,

-        parameters: parameters,

-        initializers: initializers));

-    applyParameters(parameters, arg);

-    applyInitializers(initializers, arg);

-  }

-

-  @override

-  visitStaticFunctionDeclaration(

-      FunctionExpression node,

-      MethodElement function,

-      NodeList parameters,

-      Node body,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_FUNCTION_DECL,

-        element: function, parameters: parameters, body: body));

-    applyParameters(parameters, arg);

-    apply(body, arg);

-  }

-

-  @override

-  visitSuperConstructorInvoke(

-      Send node,

-      ConstructorElement superConstructor,

-      InterfaceType type,

-      NodeList arguments,

-      Selector selector,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_SUPER_CONSTRUCTOR_INVOKE,

-        element: superConstructor, type: type,

-        arguments: arguments, selector: selector));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitThisConstructorInvoke(

-      Send node,

-      ConstructorElement thisConstructor,

-      NodeList arguments,

-      Selector selector,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_THIS_CONSTRUCTOR_INVOKE,

-        element: thisConstructor, arguments: arguments, selector: selector));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitTopLevelFunctionDeclaration(

-      FunctionExpression node,

-      MethodElement function,

-      NodeList parameters,

-      Node body,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

-        element: function, parameters: parameters, body: body));

-    applyParameters(parameters, arg);

-    apply(body, arg);

-  }

-

-  @override

-  errorUnresolvedFieldInitializer(

-      SendSet node,

-      Element element,

-      Node initializer,

-      arg) {

-    // TODO: implement errorUnresolvedFieldInitializer

-  }

-

-  @override

-  visitOptionalParameterDeclaration(

-      VariableDefinitions node,

-      Node definition,

-      ParameterElement parameter,

-      ConstantExpression defaultValue,

-      int index,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL,

-        element: parameter,

-        constant: defaultValue != null ? defaultValue.getText() : null,

-        index: index));

-  }

-

-  @override

-  visitParameterDeclaration(

-      VariableDefinitions node,

-      Node definition,

-      ParameterElement parameter,

-      int index,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

-        element: parameter, index: index));

-  }

-

-  @override

-  visitInitializingFormalDeclaration(

-      VariableDefinitions node,

-      Node definition,

-      InitializingFormalElement initializingFormal,

-      int index,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_REQUIRED_INITIALIZING_FORMAL_DECL,

-        element: initializingFormal, index: index));

-  }

-

-  @override

-  visitLocalVariableDeclaration(

-      VariableDefinitions node,

-      Node definition,

-      LocalVariableElement variable,

-      Node initializer,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,

-        element: variable, rhs: initializer));

-    if (initializer != null) {

-      apply(initializer, arg);

-    }

-  }

-

-  @override

-  visitLocalConstantDeclaration(

-      VariableDefinitions node,

-      Node definition,

-      LocalVariableElement variable,

-      ConstantExpression constant,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL,

-        element: variable, constant: constant.getText()));

-  }

-

-  @override

-  visitNamedInitializingFormalDeclaration(

-      VariableDefinitions node,

-      Node definition,

-      InitializingFormalElement initializingFormal,

-      ConstantExpression defaultValue,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_NAMED_INITIALIZING_FORMAL_DECL,

-        element: initializingFormal,

-        constant: defaultValue != null ? defaultValue.getText() : null));

-  }

-

-  @override

-  visitNamedParameterDeclaration(

-      VariableDefinitions node,

-      Node definition,

-      ParameterElement parameter,

-      ConstantExpression defaultValue,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL,

-        element: parameter,

-        constant: defaultValue != null ? defaultValue.getText() : null));

-  }

-

-  @override

-  visitOptionalInitializingFormalDeclaration(

-      VariableDefinitions node,

-      Node definition,

-      InitializingFormalElement initializingFormal,

-      ConstantExpression defaultValue,

-      int index,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_OPTIONAL_INITIALIZING_FORMAL_DECL,

-        element: initializingFormal,

-        constant: defaultValue != null ? defaultValue.getText() : null,

-        index: index));

-  }

-

-  @override

-  visitInstanceFieldDeclaration(

-      VariableDefinitions node,

-      Node definition,

-      FieldElement field,

-      Node initializer,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL,

-        element: field, rhs: initializer));

-    if (initializer != null) {

-      apply(initializer, arg);

-    }

-  }

-

-  @override

-  visitStaticConstantDeclaration(

-      VariableDefinitions node,

-      Node definition,

-      FieldElement field,

-      ConstantExpression constant,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_CONSTANT_DECL,

-        element: field, constant: constant.getText()));

-  }

-

-  @override

-  visitStaticFieldDeclaration(

-      VariableDefinitions node,

-      Node definition,

-      FieldElement field,

-      Node initializer,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_DECL,

-        element: field, rhs: initializer));

-    if (initializer != null) {

-      apply(initializer, arg);

-    }

-  }

-

-  @override

-  visitTopLevelConstantDeclaration(

-      VariableDefinitions node,

-      Node definition,

-      FieldElement field,

-      ConstantExpression constant,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_CONSTANT_DECL,

-        element: field, constant: constant.getText()));

-  }

-

-  @override

-  visitTopLevelFieldDeclaration(

-      VariableDefinitions node,

-      Node definition,

-      FieldElement field,

-      Node initializer,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL,

-        element: field, rhs: initializer));

-    if (initializer != null) {

-      apply(initializer, arg);

-    }

-  }

-

-  @override

-  visitAbstractGetterDeclaration(

-      FunctionExpression node,

-      MethodElement getter,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_ABSTRACT_GETTER_DECL,

-        element: getter));

-  }

-

-  @override

-  visitAbstractSetterDeclaration(

-      FunctionExpression node,

-      MethodElement setter,

-      NodeList parameters,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_ABSTRACT_SETTER_DECL,

-        element: setter, parameters: parameters));

-    applyParameters(parameters, arg);

-  }

-

-  @override

-  visitInstanceGetterDeclaration(

-      FunctionExpression node,

-      MethodElement getter,

-      Node body,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_INSTANCE_GETTER_DECL,

-        element: getter, body: body));

-    apply(body, arg);

-  }

-

-  @override

-  visitInstanceSetterDeclaration(

-      FunctionExpression node,

-      MethodElement setter,

-      NodeList parameters,

-      Node body,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_INSTANCE_SETTER_DECL,

-        element: setter, parameters: parameters, body: body));

-    applyParameters(parameters, arg);

-    apply(body, arg);

-  }

-

-  @override

-  visitTopLevelGetterDeclaration(

-      FunctionExpression node,

-      MethodElement getter,

-      Node body,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_DECL,

-        element: getter, body: body));

-    apply(body, arg);

-  }

-

-  @override

-  visitTopLevelSetterDeclaration(

-      FunctionExpression node,

-      MethodElement setter,

-      NodeList parameters,

-      Node body,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_DECL,

-        element: setter, parameters: parameters, body: body));

-    applyParameters(parameters, arg);

-    apply(body, arg);

-  }

-

-  @override

-  visitStaticGetterDeclaration(

-      FunctionExpression node,

-      MethodElement getter,

-      Node body,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_GETTER_DECL,

-        element: getter, body: body));

-    apply(body, arg);

-  }

-

-  @override

-  visitStaticSetterDeclaration(

-      FunctionExpression node,

-      MethodElement setter,

-      NodeList parameters,

-      Node body,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_STATIC_SETTER_DECL,

-        element: setter, parameters: parameters, body: body));

-    applyParameters(parameters, arg);

-    apply(body, arg);

-  }

-

-  @override

-  visitUnresolvedClassConstructorInvoke(

-      NewExpression node,

-      Element constructor,

-      MalformedType type,

-      NodeList arguments,

-      Selector selector,

-      arg) {

-    // TODO(johnniwinther): Test [type] and [selector].

-    visits.add(new Visit(

-        VisitKind.VISIT_UNRESOLVED_CLASS_CONSTRUCTOR_INVOKE,

-        arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitUnresolvedConstructorInvoke(

-      NewExpression node,

-      Element constructor,

-      DartType type,

-      NodeList arguments,

-      Selector selector,

-      arg) {

-    // TODO(johnniwinther): Test [type] and [selector].

-    visits.add(new Visit(

-        VisitKind.VISIT_UNRESOLVED_CONSTRUCTOR_INVOKE,

-        arguments: arguments));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitConstConstructorInvoke(

-      NewExpression node,

-      ConstructedConstantExpression constant,

-      arg) {

-    visits.add(new Visit(VisitKind.VISIT_CONST_CONSTRUCTOR_INVOKE,

-                         constant: constant.getText()));

-  }

-

-  @override

-  visitFactoryConstructorInvoke(

-      NewExpression node,

-      ConstructorElement constructor,

-      InterfaceType type,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_FACTORY_CONSTRUCTOR_INVOKE,

-        element: constructor,

-        type: type,

-        arguments: arguments,

-        selector: callStructure));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitGenerativeConstructorInvoke(

-      NewExpression node,

-      ConstructorElement constructor,

-      InterfaceType type,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE,

-        element: constructor,

-        type: type,

-        arguments: arguments,

-        selector: callStructure));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitRedirectingFactoryConstructorInvoke(

-      NewExpression node,

-      ConstructorElement constructor,

-      InterfaceType type,

-      ConstructorElement effectiveTarget,

-      InterfaceType effectiveTargetType,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

-        element: constructor,

-        type: type,

-        target: effectiveTarget,

-        targetType: effectiveTargetType,

-        arguments: arguments,

-        selector: callStructure));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitRedirectingGenerativeConstructorInvoke(

-      NewExpression node,

-      ConstructorElement constructor,

-      InterfaceType type,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_INVOKE,

-        element: constructor,

-        type: type,

-        arguments: arguments,

-        selector: callStructure));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitAbstractClassConstructorInvoke(

-      NewExpression node,

-      ConstructorElement constructor,

-      InterfaceType type,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_ABSTRACT_CLASS_CONSTRUCTOR_INVOKE,

-        element: constructor,

-        type: type,

-        arguments: arguments,

-        selector: callStructure));

-    apply(arguments, arg);

-  }

-

-  @override

-  visitUnresolvedRedirectingFactoryConstructorInvoke(

-      NewExpression node,

-      ConstructorElement constructor,

-      InterfaceType type,

-      NodeList arguments,

-      CallStructure callStructure,

-      arg) {

-    visits.add(new Visit(

-        VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

-        element: constructor,

-        type: type,

-        arguments: arguments,

-        selector: callStructure));

-    apply(arguments, arg);

-  }

-}

-

 enum VisitKind {

   VISIT_PARAMETER_GET,

   VISIT_PARAMETER_SET,

@@ -8041,6 +628,7 @@
   VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

 

   VISIT_SUPER_CONSTRUCTOR_INVOKE,

+  VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE,

   VISIT_THIS_CONSTRUCTOR_INVOKE,

   VISIT_FIELD_INITIALIZER,

 

diff --git a/tests/compiler/dart2js/semantic_visitor_test_decl_data.dart b/tests/compiler/dart2js/semantic_visitor_test_decl_data.dart
new file mode 100644
index 0000000..ab22664
--- /dev/null
+++ b/tests/compiler/dart2js/semantic_visitor_test_decl_data.dart
@@ -0,0 +1,870 @@
+// 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.

+

+part of dart2js.semantics_visitor_test;

+

+const Map<String, List<Test>> DECL_TESTS = const {

+  'Function declarations': const [

+    const Test(

+        '''

+        m(a, b) {}

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+              element: 'function(m)',

+              parameters: '(a,b)',

+              body: '{}'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#b)',

+              index: 1),

+        ]),

+    const Test(

+        '''

+        m(a, [b]) {}

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+              element: 'function(m)',

+              parameters: '(a,[b])',

+              body: '{}'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL,

+              element: 'parameter(m#b)',

+              index: 1,

+              constant: 'null'),

+        ]),

+    const Test(

+        '''

+        m(a, [b = null]) {}

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+              element: 'function(m)',

+              parameters: '(a,[b=null])',

+              body: '{}'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL,

+              element: 'parameter(m#b)',

+              constant: 'null',

+              index: 1),

+        ]),

+    const Test(

+        '''

+        m(a, [b = 42]) {}

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+              element: 'function(m)',

+              parameters: '(a,[b=42])',

+              body: '{}'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL,

+              element: 'parameter(m#b)',

+              constant: 42,

+              index: 1),

+        ]),

+    const Test(

+        '''

+        m(a, {b}) {}

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+              element: 'function(m)',

+              parameters: '(a,{b})',

+              body: '{}'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL,

+              element: 'parameter(m#b)',

+              constant: 'null'),

+        ]),

+    const Test(

+        '''

+        m(a, {b: null}) {}

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+              element: 'function(m)',

+              parameters: '(a,{b: null})',

+              body: '{}'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL,

+              element: 'parameter(m#b)',

+              constant: 'null'),

+        ]),

+    const Test(

+        '''

+        m(a, {b:42}) {}

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+              element: 'function(m)',

+              parameters: '(a,{b: 42})',

+              body: '{}'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL,

+              element: 'parameter(m#b)',

+              constant: 42),

+        ]),

+    const Test(

+        '''

+        get m => null;

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_DECL,

+              element: 'getter(m)',

+              body: '=>null;'),

+        ]),

+    const Test(

+        '''

+        set m(a) {}

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_DECL,

+              element: 'setter(m)',

+              parameters: '(a)',

+              body: '{}'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#a)',

+              index: 0),

+        ]),

+    const Test.clazz(

+        '''

+        class C {

+          static m(a, b) {}

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_STATIC_FUNCTION_DECL,

+              element: 'function(C#m)',

+              parameters: '(a,b)',

+              body: '{}'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#b)',

+              index: 1),

+        ]),

+    const Test.clazz(

+        '''

+        class C {

+          static get m => null;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_STATIC_GETTER_DECL,

+              element: 'getter(C#m)',

+              body: '=>null;'),

+        ]),

+    const Test.clazz(

+        '''

+        class C {

+          static set m(a) {}

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_STATIC_SETTER_DECL,

+              element: 'setter(C#m)',

+              parameters: '(a)',

+              body: '{}'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#a)',

+              index: 0),

+        ]),

+    const Test.clazz(

+        '''

+        class C {

+          m(a, b) {}

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_INSTANCE_METHOD_DECL,

+              element: 'function(C#m)',

+              parameters: '(a,b)',

+              body: '{}'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#b)',

+              index: 1),

+        ]),

+    const Test.clazz(

+        '''

+        class C {

+          get m => null;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_INSTANCE_GETTER_DECL,

+              element: 'getter(C#m)',

+              body: '=>null;'),

+        ]),

+    const Test.clazz(

+        '''

+        class C {

+          set m(a) {}

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_INSTANCE_SETTER_DECL,

+              element: 'setter(C#m)',

+              parameters: '(a)',

+              body: '{}'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#a)',

+              index: 0),

+        ]),

+    const Test.clazz(

+        '''

+        abstract class C {

+          m(a, b);

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_ABSTRACT_METHOD_DECL,

+              element: 'function(C#m)',

+              parameters: '(a,b)'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#b)',

+              index: 1),

+        ]),

+    const Test.clazz(

+        '''

+        abstract class C {

+          get m;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_ABSTRACT_GETTER_DECL,

+              element: 'getter(C#m)'),

+        ]),

+    const Test.clazz(

+        '''

+        abstract class C {

+          set m(a);

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_ABSTRACT_SETTER_DECL,

+              element: 'setter(C#m)',

+              parameters: '(a)'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#a)',

+              index: 0),

+        ]),

+    const Test(

+        '''

+        m(a, b) {}

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+              element: 'function(m)',

+              parameters: '(a,b)',

+              body: '{}'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(m#b)',

+              index: 1),

+        ]),

+    const Test(

+        '''

+        m() {

+          local(a, b) {}

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+               element: 'function(m)',

+               parameters: '()',

+               body: '{local(a,b){}}'),

+          const Visit(VisitKind.VISIT_LOCAL_FUNCTION_DECL,

+               element: 'function(m#local)',

+               parameters: '(a,b)',

+               body: '{}'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(local#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(local#b)',

+              index: 1),

+        ]),

+    const Test(

+        '''

+        m() => (a, b) {};

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+               element: 'function(m)',

+               parameters: '()',

+               body: '=>(a,b){};'),

+          const Visit(VisitKind.VISIT_CLOSURE_DECL,

+               element: 'function(m#)',

+               parameters: '(a,b)',

+               body: '{}'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#b)',

+              index: 1),

+        ]),

+  ],

+  'Constructor declarations': const [

+    const Test.clazz(

+        '''

+        class C {

+          C(a, b);

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

+              element: 'generative_constructor(C#)',

+              parameters: '(a,b)',

+              body: ';'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#b)',

+              index: 1),

+          const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE,

+              element: 'generative_constructor(Object#)',

+              type: 'Object'),

+        ],

+        method: ''),

+    const Test.clazz(

+        '''

+        class C {

+          var b;

+          C(a, this.b);

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

+              element: 'generative_constructor(C#)',

+              parameters: '(a,this.b)',

+              body: ';'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_INITIALIZING_FORMAL_DECL,

+              element: 'initializing_formal(#b)',

+              index: 1),

+          const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE,

+              element: 'generative_constructor(Object#)',

+              type: 'Object'),

+        ],

+        method: ''),

+    const Test.clazz(

+        '''

+        class C {

+          var b;

+          C(a, [this.b = 42]);

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

+              element: 'generative_constructor(C#)',

+              parameters: '(a,[this.b=42])',

+              body: ';'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_OPTIONAL_INITIALIZING_FORMAL_DECL,

+              element: 'initializing_formal(#b)',

+              constant: 42,

+              index: 1),

+          const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE,

+              element: 'generative_constructor(Object#)',

+              type: 'Object'),

+        ],

+        method: ''),

+    const Test.clazz(

+        '''

+        class C {

+          var b;

+          C(a, {this.b: 42});

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

+              element: 'generative_constructor(C#)',

+              parameters: '(a,{this.b: 42})',

+              body: ';'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_NAMED_INITIALIZING_FORMAL_DECL,

+              element: 'initializing_formal(#b)',

+              constant: 42),

+          const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE,

+              element: 'generative_constructor(Object#)',

+              type: 'Object'),

+        ],

+        method: ''),

+    const Test.clazz(

+        '''

+        class C {

+          C(a, b) : super();

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

+              element: 'generative_constructor(C#)',

+              parameters: '(a,b)',

+              body: ';'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#b)',

+              index: 1),

+          const Visit(VisitKind.VISIT_SUPER_CONSTRUCTOR_INVOKE,

+              element: 'generative_constructor(Object#)',

+              type: 'Object',

+              arguments: '()',

+              selector: 'CallStructure(arity=0)'),

+        ],

+        method: ''),

+    const Test.clazz(

+        '''

+        class C {

+          var field;

+          C(a, b) : this.field = a;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

+              element: 'generative_constructor(C#)',

+              parameters: '(a,b)',

+              body: ';'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#b)',

+              index: 1),

+          const Visit(VisitKind.VISIT_FIELD_INITIALIZER,

+              element: 'field(C#field)',

+              rhs: 'a'),

+          const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE,

+              element: 'generative_constructor(Object#)',

+              type: 'Object'),

+        ],

+        method: ''),

+    const Test.clazz(

+        '''

+        class C {

+          var field1;

+          var field2;

+          C(a, b) : this.field1 = a, this.field2 = b;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

+              element: 'generative_constructor(C#)',

+              parameters: '(a,b)',

+              body: ';'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#b)',

+              index: 1),

+          const Visit(VisitKind.VISIT_FIELD_INITIALIZER,

+              element: 'field(C#field1)',

+              rhs: 'a'),

+          const Visit(VisitKind.VISIT_FIELD_INITIALIZER,

+              element: 'field(C#field2)',

+              rhs: 'b'),

+          const Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE,

+              element: 'generative_constructor(Object#)',

+              type: 'Object'),

+        ],

+        method: ''),

+    const Test.clazz(

+        '''

+        class C {

+          C(a, b) : this._(a, b);

+          C._(a, b);

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_DECL,

+              element: 'generative_constructor(C#)',

+              parameters: '(a,b)',

+              initializers: ':this._(a,b)'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#b)',

+              index: 1),

+          const Visit(VisitKind.VISIT_THIS_CONSTRUCTOR_INVOKE,

+              element: 'generative_constructor(C#_)',

+              arguments: '(a,b)',

+              selector: 'CallStructure(arity=2)'),

+        ],

+        method: ''),

+    const Test.clazz(

+        '''

+        class C {

+          factory C(a, b) => null;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_FACTORY_CONSTRUCTOR_DECL,

+              element: 'function(C#)',

+              parameters: '(a,b)',

+              body: '=>null;'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#b)',

+              index: 1),

+        ],

+        method: ''),

+    const Test.clazz(

+        '''

+        class C {

+          factory C(a, b) = C._;

+          C._(a, b);

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,

+              element: 'function(C#)',

+              parameters: '(a,b)',

+              target: 'generative_constructor(C#_)',

+              type: 'C'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#b)',

+              index: 1),

+        ],

+        method: ''),

+    const Test.clazz(

+        '''

+        class C {

+          factory C(a, b) = D;

+        }

+        class D<T> {

+          D(a, b);

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,

+              element: 'function(C#)',

+              parameters: '(a,b)',

+              target: 'generative_constructor(D#)',

+              type: 'D'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#b)',

+              index: 1),

+        ],

+        method: ''),

+    const Test.clazz(

+        '''

+        class C {

+          factory C(a, b) = D<int>;

+        }

+        class D<T> {

+          D(a, b);

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,

+              element: 'function(C#)',

+              parameters: '(a,b)',

+              target: 'generative_constructor(D#)',

+              type: 'D<int>'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#b)',

+              index: 1),

+        ],

+        method: ''),

+    const Test.clazz(

+        '''

+        class C {

+          factory C(a, b) = D<int>;

+        }

+        class D<T> {

+          factory D(a, b) = E<D<T>>;

+        }

+        class E<S> {

+          E(a, b);

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,

+              element: 'function(C#)',

+              parameters: '(a,b)',

+              target: 'function(D#)',

+              type: 'D<int>'),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#a)',

+              index: 0),

+          const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+              element: 'parameter(#b)',

+              index: 1),

+        ],

+        method: ''),

+  ],

+  "Field declarations": const [

+    const Test.clazz(

+        '''

+        class C {

+          var m;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL,

+              element: 'field(C#m)'),

+        ]),

+    const Test.clazz(

+        '''

+        class C {

+          var m, n;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL,

+              element: 'field(C#m)'),

+        ]),

+    const Test.clazz(

+        '''

+        class C {

+          var m = 42;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL,

+              element: 'field(C#m)',

+              rhs: 42),

+        ]),

+    const Test(

+        '''

+        m() {

+          var local;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+              element: 'function(m)',

+              parameters: '()',

+              body: '{var local;}'),

+          const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,

+              element: 'variable(m#local)'),

+        ]),

+    const Test(

+        '''

+        m() {

+          var local = 42;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+              element: 'function(m)',

+              parameters: '()',

+              body: '{var local=42;}'),

+          const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,

+              element: 'variable(m#local)',

+              rhs: 42),

+        ]),

+    const Test(

+        '''

+        m() {

+          const local = 42;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+              element: 'function(m)',

+              parameters: '()',

+              body: '{const local=42;}'),

+          const Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL,

+              element: 'variable(m#local)',

+              constant: 42),

+        ]),

+    const Test(

+        '''

+        m() {

+          var local1, local2;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+              element: 'function(m)',

+              parameters: '()',

+              body: '{var local1,local2;}'),

+          const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,

+              element: 'variable(m#local1)'),

+          const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,

+              element: 'variable(m#local2)'),

+        ]),

+    const Test(

+        '''

+        m() {

+          var local1 = 42, local2 = true;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+              element: 'function(m)',

+              parameters: '()',

+              body: '{var local1=42,local2=true;}'),

+          const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,

+              element: 'variable(m#local1)',

+              rhs: 42),

+          const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,

+              element: 'variable(m#local2)',

+              rhs: true),

+        ]),

+    const Test(

+        '''

+        m() {

+          const local1 = 42, local2 = true;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+              element: 'function(m)',

+              parameters: '()',

+              body: '{const local1=42,local2=true;}'),

+          const Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL,

+              element: 'variable(m#local1)',

+              constant: 42),

+          const Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL,

+              element: 'variable(m#local2)',

+              constant: true),

+        ]),

+    const Test.clazz(

+        '''

+        class C {

+          static var m;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_STATIC_FIELD_DECL,

+                element: 'field(C#m)'),

+        ]),

+    const Test.clazz(

+        '''

+        class C {

+          static var m, n;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_STATIC_FIELD_DECL,

+                element: 'field(C#m)'),

+        ]),

+    const Test.clazz(

+        '''

+        class C {

+          static var k, l, m, n;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_STATIC_FIELD_DECL,

+                element: 'field(C#m)'),

+        ]),

+    const Test.clazz(

+        '''

+        class C {

+          static var m = 42;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_STATIC_FIELD_DECL,

+                element: 'field(C#m)',

+                rhs: 42),

+        ]),

+    const Test.clazz(

+        '''

+        class C {

+          static var m = 42, n = true;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_STATIC_FIELD_DECL,

+                element: 'field(C#m)',

+                rhs: 42),

+        ]),

+    const Test.clazz(

+        '''

+        class C {

+          static const m = 42;

+        }

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_STATIC_CONSTANT_DECL,

+                element: 'field(C#m)',

+                constant: 42),

+        ]),

+    const Test(

+        '''

+        var m;

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL,

+                element: 'field(m)'),

+        ]),

+    const Test(

+        '''

+        var m, n;

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL,

+                element: 'field(m)'),

+        ]),

+    const Test(

+        '''

+        var m = 42;

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL,

+                element: 'field(m)',

+                rhs: 42),

+        ]),

+    const Test(

+        '''

+        const m = 42;

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_TOP_LEVEL_CONSTANT_DECL,

+                element: 'field(m)',

+                constant: 42),

+        ]),

+  ],

+};

diff --git a/tests/compiler/dart2js/semantic_visitor_test_decl_visitor.dart b/tests/compiler/dart2js/semantic_visitor_test_decl_visitor.dart
new file mode 100644
index 0000000..d4d7600
--- /dev/null
+++ b/tests/compiler/dart2js/semantic_visitor_test_decl_visitor.dart
@@ -0,0 +1,628 @@
+// 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.

+

+part of dart2js.semantics_visitor_test;

+

+class SemanticDeclarationTestVisitor extends SemanticTestVisitor {

+

+  SemanticDeclarationTestVisitor(TreeElements elements) : super(elements);

+

+  @override

+  errorUnresolvedSuperConstructorInvoke(

+      Send node,

+      Element element,

+      NodeList arguments,

+      Selector selector,

+      arg) {

+    // TODO: implement errorUnresolvedSuperConstructorInvoke

+  }

+

+  @override

+  errorUnresolvedThisConstructorInvoke(

+      Send node,

+      Element element,

+      NodeList arguments,

+      Selector selector,

+      arg) {

+    // TODO: implement errorUnresolvedThisConstructorInvoke

+  }

+

+  @override

+  visitAbstractMethodDeclaration(

+      FunctionExpression node,

+      MethodElement method,

+      NodeList parameters,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_ABSTRACT_METHOD_DECL,

+        element: method, parameters: parameters));

+    applyParameters(parameters, arg);

+  }

+

+  @override

+  visitClosureDeclaration(

+      FunctionExpression node,

+      LocalFunctionElement function,

+      NodeList parameters,

+      Node body,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_CLOSURE_DECL,

+        element: function, parameters: parameters, body: body));

+    applyParameters(parameters, arg);

+    apply(body, arg);

+  }

+

+  @override

+  visitFactoryConstructorDeclaration(

+      FunctionExpression node,

+      ConstructorElement constructor,

+      NodeList parameters,

+      Node body,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_FACTORY_CONSTRUCTOR_DECL,

+        element: constructor, parameters: parameters, body: body));

+    applyParameters(parameters, arg);

+    apply(body, arg);

+  }

+

+  @override

+  visitFieldInitializer(

+      SendSet node,

+      FieldElement field,

+      Node initializer,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_FIELD_INITIALIZER,

+        element: field, rhs: initializer));

+    apply(initializer, arg);

+  }

+

+  @override

+  visitGenerativeConstructorDeclaration(

+      FunctionExpression node,

+      ConstructorElement constructor,

+      NodeList parameters,

+      NodeList initializers,

+      Node body,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,

+        element: constructor, parameters: parameters, body: body));

+    applyParameters(parameters, arg);

+    applyInitializers(node, arg);

+    apply(body, arg);

+  }

+

+  @override

+  visitInstanceMethodDeclaration(

+      FunctionExpression node,

+      MethodElement method,

+      NodeList parameters,

+      Node body,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_INSTANCE_METHOD_DECL,

+        element: method, parameters: parameters, body: body));

+    applyParameters(parameters, arg);

+    apply(body, arg);

+  }

+

+  @override

+  visitLocalFunctionDeclaration(

+      FunctionExpression node,

+      LocalFunctionElement function,

+      NodeList parameters,

+      Node body,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOCAL_FUNCTION_DECL,

+        element: function, parameters: parameters, body: body));

+    applyParameters(parameters, arg);

+    apply(body, arg);

+  }

+

+  @override

+  visitRedirectingFactoryConstructorDeclaration(

+      FunctionExpression node,

+      ConstructorElement constructor,

+      NodeList parameters,

+      InterfaceType redirectionType,

+      ConstructorElement redirectionTarget,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,

+        element: constructor,

+        parameters: parameters,

+        target: redirectionTarget,

+        type: redirectionType));

+    applyParameters(parameters, arg);

+  }

+

+  @override

+  visitRedirectingGenerativeConstructorDeclaration(

+      FunctionExpression node,

+      ConstructorElement constructor,

+      NodeList parameters,

+      NodeList initializers,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_DECL,

+        element: constructor,

+        parameters: parameters,

+        initializers: initializers));

+    applyParameters(parameters, arg);

+    applyInitializers(node, arg);

+  }

+

+  @override

+  visitStaticFunctionDeclaration(

+      FunctionExpression node,

+      MethodElement function,

+      NodeList parameters,

+      Node body,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_FUNCTION_DECL,

+        element: function, parameters: parameters, body: body));

+    applyParameters(parameters, arg);

+    apply(body, arg);

+  }

+

+  @override

+  visitSuperConstructorInvoke(

+      Send node,

+      ConstructorElement superConstructor,

+      InterfaceType type,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_CONSTRUCTOR_INVOKE,

+        element: superConstructor, type: type,

+        arguments: arguments, selector: callStructure));

+    super.visitSuperConstructorInvoke(

+        node, superConstructor, type, arguments, callStructure, arg);

+  }

+

+  @override

+  visitImplicitSuperConstructorInvoke(

+      FunctionExpression node,

+      ConstructorElement superConstructor,

+      InterfaceType type,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE,

+        element: superConstructor, type: type));

+    super.visitImplicitSuperConstructorInvoke(

+        node, superConstructor, type, arg);

+  }

+

+  @override

+  visitThisConstructorInvoke(

+      Send node,

+      ConstructorElement thisConstructor,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_THIS_CONSTRUCTOR_INVOKE,

+        element: thisConstructor,

+        arguments: arguments, selector: callStructure));

+    super.visitThisConstructorInvoke(

+        node, thisConstructor, arguments, callStructure, arg);

+  }

+

+  @override

+  visitTopLevelFunctionDeclaration(

+      FunctionExpression node,

+      MethodElement function,

+      NodeList parameters,

+      Node body,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,

+        element: function, parameters: parameters, body: body));

+    applyParameters(parameters, arg);

+    apply(body, arg);

+  }

+

+  @override

+  errorUnresolvedFieldInitializer(

+      SendSet node,

+      Element element,

+      Node initializer,

+      arg) {

+    // TODO: implement errorUnresolvedFieldInitializer

+  }

+

+  @override

+  visitOptionalParameterDeclaration(

+      VariableDefinitions node,

+      Node definition,

+      ParameterElement parameter,

+      ConstantExpression defaultValue,

+      int index,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL,

+        element: parameter,

+        constant: defaultValue != null ? defaultValue.getText() : null,

+        index: index));

+  }

+

+  @override

+  visitParameterDeclaration(

+      VariableDefinitions node,

+      Node definition,

+      ParameterElement parameter,

+      int index,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,

+        element: parameter, index: index));

+  }

+

+  @override

+  visitInitializingFormalDeclaration(

+      VariableDefinitions node,

+      Node definition,

+      InitializingFormalElement initializingFormal,

+      int index,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_REQUIRED_INITIALIZING_FORMAL_DECL,

+        element: initializingFormal, index: index));

+  }

+

+  @override

+  visitLocalVariableDeclaration(

+      VariableDefinitions node,

+      Node definition,

+      LocalVariableElement variable,

+      Node initializer,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,

+        element: variable, rhs: initializer));

+    if (initializer != null) {

+      apply(initializer, arg);

+    }

+  }

+

+  @override

+  visitLocalConstantDeclaration(

+      VariableDefinitions node,

+      Node definition,

+      LocalVariableElement variable,

+      ConstantExpression constant,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL,

+        element: variable, constant: constant.getText()));

+  }

+

+  @override

+  visitNamedInitializingFormalDeclaration(

+      VariableDefinitions node,

+      Node definition,

+      InitializingFormalElement initializingFormal,

+      ConstantExpression defaultValue,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_NAMED_INITIALIZING_FORMAL_DECL,

+        element: initializingFormal,

+        constant: defaultValue != null ? defaultValue.getText() : null));

+  }

+

+  @override

+  visitNamedParameterDeclaration(

+      VariableDefinitions node,

+      Node definition,

+      ParameterElement parameter,

+      ConstantExpression defaultValue,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL,

+        element: parameter,

+        constant: defaultValue != null ? defaultValue.getText() : null));

+  }

+

+  @override

+  visitOptionalInitializingFormalDeclaration(

+      VariableDefinitions node,

+      Node definition,

+      InitializingFormalElement initializingFormal,

+      ConstantExpression defaultValue,

+      int index,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_OPTIONAL_INITIALIZING_FORMAL_DECL,

+        element: initializingFormal,

+        constant: defaultValue != null ? defaultValue.getText() : null,

+        index: index));

+  }

+

+  @override

+  visitInstanceFieldDeclaration(

+      VariableDefinitions node,

+      Node definition,

+      FieldElement field,

+      Node initializer,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL,

+        element: field, rhs: initializer));

+    if (initializer != null) {

+      apply(initializer, arg);

+    }

+  }

+

+  @override

+  visitStaticConstantDeclaration(

+      VariableDefinitions node,

+      Node definition,

+      FieldElement field,

+      ConstantExpression constant,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_CONSTANT_DECL,

+        element: field, constant: constant.getText()));

+  }

+

+  @override

+  visitStaticFieldDeclaration(

+      VariableDefinitions node,

+      Node definition,

+      FieldElement field,

+      Node initializer,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_DECL,

+        element: field, rhs: initializer));

+    if (initializer != null) {

+      apply(initializer, arg);

+    }

+  }

+

+  @override

+  visitTopLevelConstantDeclaration(

+      VariableDefinitions node,

+      Node definition,

+      FieldElement field,

+      ConstantExpression constant,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_CONSTANT_DECL,

+        element: field, constant: constant.getText()));

+  }

+

+  @override

+  visitTopLevelFieldDeclaration(

+      VariableDefinitions node,

+      Node definition,

+      FieldElement field,

+      Node initializer,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL,

+        element: field, rhs: initializer));

+    if (initializer != null) {

+      apply(initializer, arg);

+    }

+  }

+

+  @override

+  visitAbstractGetterDeclaration(

+      FunctionExpression node,

+      MethodElement getter,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_ABSTRACT_GETTER_DECL,

+        element: getter));

+  }

+

+  @override

+  visitAbstractSetterDeclaration(

+      FunctionExpression node,

+      MethodElement setter,

+      NodeList parameters,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_ABSTRACT_SETTER_DECL,

+        element: setter, parameters: parameters));

+    applyParameters(parameters, arg);

+  }

+

+  @override

+  visitInstanceGetterDeclaration(

+      FunctionExpression node,

+      MethodElement getter,

+      Node body,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_INSTANCE_GETTER_DECL,

+        element: getter, body: body));

+    apply(body, arg);

+  }

+

+  @override

+  visitInstanceSetterDeclaration(

+      FunctionExpression node,

+      MethodElement setter,

+      NodeList parameters,

+      Node body,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_INSTANCE_SETTER_DECL,

+        element: setter, parameters: parameters, body: body));

+    applyParameters(parameters, arg);

+    apply(body, arg);

+  }

+

+  @override

+  visitTopLevelGetterDeclaration(

+      FunctionExpression node,

+      MethodElement getter,

+      Node body,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_DECL,

+        element: getter, body: body));

+    apply(body, arg);

+  }

+

+  @override

+  visitTopLevelSetterDeclaration(

+      FunctionExpression node,

+      MethodElement setter,

+      NodeList parameters,

+      Node body,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_DECL,

+        element: setter, parameters: parameters, body: body));

+    applyParameters(parameters, arg);

+    apply(body, arg);

+  }

+

+  @override

+  visitStaticGetterDeclaration(

+      FunctionExpression node,

+      MethodElement getter,

+      Node body,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_GETTER_DECL,

+        element: getter, body: body));

+    apply(body, arg);

+  }

+

+  @override

+  visitStaticSetterDeclaration(

+      FunctionExpression node,

+      MethodElement setter,

+      NodeList parameters,

+      Node body,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_SETTER_DECL,

+        element: setter, parameters: parameters, body: body));

+    applyParameters(parameters, arg);

+    apply(body, arg);

+  }

+

+  @override

+  visitUnresolvedClassConstructorInvoke(

+      NewExpression node,

+      Element constructor,

+      MalformedType type,

+      NodeList arguments,

+      Selector selector,

+      arg) {

+    // TODO(johnniwinther): Test [type] and [selector].

+    visits.add(new Visit(

+        VisitKind.VISIT_UNRESOLVED_CLASS_CONSTRUCTOR_INVOKE,

+        arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitUnresolvedConstructorInvoke(

+      NewExpression node,

+      Element constructor,

+      DartType type,

+      NodeList arguments,

+      Selector selector,

+      arg) {

+    // TODO(johnniwinther): Test [type] and [selector].

+    visits.add(new Visit(

+        VisitKind.VISIT_UNRESOLVED_CONSTRUCTOR_INVOKE,

+        arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitConstConstructorInvoke(

+      NewExpression node,

+      ConstructedConstantExpression constant,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_CONST_CONSTRUCTOR_INVOKE,

+                         constant: constant.getText()));

+  }

+

+  @override

+  visitFactoryConstructorInvoke(

+      NewExpression node,

+      ConstructorElement constructor,

+      InterfaceType type,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_FACTORY_CONSTRUCTOR_INVOKE,

+        element: constructor,

+        type: type,

+        arguments: arguments,

+        selector: callStructure));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitGenerativeConstructorInvoke(

+      NewExpression node,

+      ConstructorElement constructor,

+      InterfaceType type,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE,

+        element: constructor,

+        type: type,

+        arguments: arguments,

+        selector: callStructure));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitRedirectingFactoryConstructorInvoke(

+      NewExpression node,

+      ConstructorElement constructor,

+      InterfaceType type,

+      ConstructorElement effectiveTarget,

+      InterfaceType effectiveTargetType,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

+        element: constructor,

+        type: type,

+        target: effectiveTarget,

+        targetType: effectiveTargetType,

+        arguments: arguments,

+        selector: callStructure));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitRedirectingGenerativeConstructorInvoke(

+      NewExpression node,

+      ConstructorElement constructor,

+      InterfaceType type,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_INVOKE,

+        element: constructor,

+        type: type,

+        arguments: arguments,

+        selector: callStructure));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitAbstractClassConstructorInvoke(

+      NewExpression node,

+      ConstructorElement constructor,

+      InterfaceType type,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_ABSTRACT_CLASS_CONSTRUCTOR_INVOKE,

+        element: constructor,

+        type: type,

+        arguments: arguments,

+        selector: callStructure));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitUnresolvedRedirectingFactoryConstructorInvoke(

+      NewExpression node,

+      ConstructorElement constructor,

+      InterfaceType type,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

+        element: constructor,

+        type: type,

+        arguments: arguments,

+        selector: callStructure));

+    apply(arguments, arg);

+  }

+}

diff --git a/tests/compiler/dart2js/semantic_visitor_test_send_data.dart b/tests/compiler/dart2js/semantic_visitor_test_send_data.dart
new file mode 100644
index 0000000..87eecc3
--- /dev/null
+++ b/tests/compiler/dart2js/semantic_visitor_test_send_data.dart
@@ -0,0 +1,3251 @@
+// 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.

+

+part of dart2js.semantics_visitor_test;

+

+const Map<String, List<Test>> SEND_TESTS = const {

+  'Parameters': const [

+    // Parameters

+    const Test('m(o) => o;',

+        const Visit(VisitKind.VISIT_PARAMETER_GET,

+                    element: 'parameter(m#o)')),

+    const Test('m(o) { o = 42; }',

+        const Visit(VisitKind.VISIT_PARAMETER_SET,

+                    element: 'parameter(m#o)',

+                    rhs:'42')),

+    const Test('m(o) { o(null, 42); }',

+        const Visit(VisitKind.VISIT_PARAMETER_INVOKE,

+                    element: 'parameter(m#o)',

+                    arguments: '(null,42)',

+                    selector: 'CallStructure(arity=2)')),

+    // TODO(johnniwinther): Expect [VISIT_FINAL_PARAMETER_SET] instead.

+    const Test('m(final o) { o = 42; }',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs:'42')),

+  ],

+  'Local variables': const [

+    // Local variables

+    const Test('m() { var o; return o; }',

+        const Visit(VisitKind.VISIT_LOCAL_VARIABLE_GET,

+                    element: 'variable(m#o)')),

+    const Test('m() { var o; o = 42; }',

+        const Visit(VisitKind.VISIT_LOCAL_VARIABLE_SET,

+                    element: 'variable(m#o)',

+                    rhs:'42')),

+    const Test('m() { var o; o(null, 42); }',

+        const Visit(VisitKind.VISIT_LOCAL_VARIABLE_INVOKE,

+                    element: 'variable(m#o)',

+                    arguments: '(null,42)',

+                    selector: 'CallStructure(arity=2)')),

+    // TODO(johnniwinther): Expect [VISIT_FINAL_LOCAL_VARIABLE_SET] instead.

+    const Test('m() { final o = 0; o = 42; }',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs:'42')),

+    // TODO(johnniwinther): Expect [VISIT_FINAL_LOCAL_VARIABLE_SET] instead.

+    const Test('m() { const o = 0; o = 42; }',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs:'42')),

+  ],

+  'Local functions': const [

+    // Local functions

+    const Test('m() { o(a, b) {}; return o; }',

+        const Visit(VisitKind.VISIT_LOCAL_FUNCTION_GET,

+                    element: 'function(m#o)')),

+    const Test('m() { o(a, b) {}; o(null, 42); }',

+        const Visit(VisitKind.VISIT_LOCAL_FUNCTION_INVOKE,

+                    element: 'function(m#o)',

+                    arguments: '(null,42)',

+                    selector: 'CallStructure(arity=2)')),

+    // TODO(johnniwinther): Expect [VISIT_LOCAL_FUNCTION_SET] instead.

+    const Test('m() { o(a, b) {}; o = 42; }',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+  ],

+  'Static fields': const [

+    // Static fields

+    const Test(

+        '''

+        class C { static var o; }

+        m() => C.o;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_GET,

+                    element: 'field(C#o)')),

+    const Test.clazz(

+        '''

+        class C {

+          static var o;

+          m() => o;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_GET,

+                    element: 'field(C#o)')),

+    const Test.clazz(

+        '''

+        class C {

+          static var o;

+          m() => C.o;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_GET,

+                    element: 'field(C#o)')),

+    const Test.prefix(

+        '''

+        class C {

+          static var o;

+        }

+        ''',

+        'm() => p.C.o;',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_GET,

+                    element: 'field(C#o)')),

+    const Test(

+        '''

+        class C { static var o; }

+        m() { C.o = 42; }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_SET,

+                    element: 'field(C#o)',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static var o;

+          m() { o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_SET,

+                    element: 'field(C#o)',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static var o;

+          m() { C.o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_SET,

+                    element: 'field(C#o)',

+                    rhs: '42')),

+    const Test.prefix(

+        '''

+        class C {

+          static var o;

+        }

+        ''',

+        'm() { p.C.o = 42; }',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_SET,

+                    element: 'field(C#o)',

+                    rhs: '42')),

+    const Test(

+        '''

+        class C { static var o; }

+        m() { C.o(null, 42); }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE,

+                    element: 'field(C#o)',

+                    arguments: '(null,42)')),

+    const Test.clazz(

+        '''

+        class C {

+          static var o;

+          m() { o(null, 42); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE,

+                    element: 'field(C#o)',

+                    arguments: '(null,42)')),

+    const Test.clazz(

+        '''

+        class C {

+          static var o;

+          m() { C.o(null, 42); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE,

+                    element: 'field(C#o)',

+                    arguments: '(null,42)')),

+    const Test.prefix(

+        '''

+        class C {

+          static var o;

+        }

+        ''',

+        'm() { p.C.o(null, 42); }',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE,

+                    element: 'field(C#o)',

+                    arguments: '(null,42)')),

+    // TODO(johnniwinther): Expect [VISIT_FINAL_STATIC_FIELD_SET] instead.

+    const Test(

+        '''

+        class C { static final o = 0; }

+        m() { C.o = 42; }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static final o = 0;

+          m() { o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static final o = 0;

+          m() { C.o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.prefix(

+        '''

+        class C {

+          static final o = 0;

+        }

+        ''',

+        'm() { p.C.o = 42; }',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test(

+        '''

+        class C { static const o = 0; }

+        m() { C.o = 42; }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static const o = 0;

+          m() { o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static const o = 0;

+          m() { C.o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.prefix(

+        '''

+        class C {

+          static const o = 0;

+        }

+        ''',

+        'm() { p.C.o = 42; }',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+  ],

+  'Static properties': const [

+    // Static properties

+    const Test(

+        '''

+        class C {

+          static get o => null;

+        }

+        m() => C.o;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_GET,

+                    element: 'getter(C#o)')),

+    const Test.clazz(

+        '''

+        class C {

+          static get o => null;

+          m() => o;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_GET,

+                    element: 'getter(C#o)')),

+    const Test.clazz(

+        '''

+        class C {

+          static get o => null;

+          m() => C.o;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_GET,

+                    element: 'getter(C#o)')),

+    const Test.prefix(

+        '''

+        class C {

+          static get o => null;

+        }

+        ''',

+        'm() => p.C.o;',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_GET,

+                    element: 'getter(C#o)')),

+    // TODO(johnniwinther): Expected [VISIT_STATIC_GETTER_SET] instead.

+    const Test(

+        '''

+        class C { static get o => 42; }

+        m() { C.o = 42; }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static static get o => 42;

+          m() { o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static static get o => 42;

+          m() { C.o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.prefix(

+        '''

+        class C {

+          static static get o => 42;

+        }

+        ''',

+        'm() { p.C.o = 42; }',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    // TODO(johnniwinther): Expected [VISIT_STATIC_SETTER_GET] instead.

+    const Test(

+        '''

+        class C {

+          static set o(_) {}

+        }

+        m() => C.o;

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_GET,

+                    name: 'o')),

+    const Test.clazz(

+        '''

+        class C {

+          static set o(_) {}

+          m() => o;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_GET,

+                    name: 'o')),

+    const Test.clazz(

+        '''

+        class C {

+          static set o(_) {}

+          m() => C.o;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_GET,

+                    name: 'o')),

+    const Test.prefix(

+        '''

+        class C {

+          static set o(_) {}

+        }

+        ''',

+        'm() => p.C.o;',

+        const Visit(VisitKind.VISIT_UNRESOLVED_GET,

+                    name: 'o')),

+    const Test(

+        '''

+        class C { static set o(_) {} }

+        m() { C.o = 42; }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_SETTER_SET,

+                    element: 'setter(C#o)',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static set o(_) {}

+          m() { o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_SETTER_SET,

+                    element: 'setter(C#o)',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static set o(_) {}

+          m() { C.o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_SETTER_SET,

+                    element: 'setter(C#o)',

+                    rhs: '42')),

+    const Test.prefix(

+        '''

+        class C {

+          static set o(_) {}

+        }

+        ''',

+        'm() { p.C.o = 42; }',

+        const Visit(VisitKind.VISIT_STATIC_SETTER_SET,

+                    element: 'setter(C#o)',

+                    rhs: '42')),

+    const Test(

+        '''

+        class C { static get o => null; }

+        m() => C.o(null, 42);

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE,

+                    element: 'getter(C#o)',

+                    arguments: '(null,42)')),

+    const Test.clazz(

+        '''

+        class C {

+          static get o => null;

+          m() { o(null, 42); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE,

+                    element: 'getter(C#o)',

+                    arguments: '(null,42)')),

+    const Test.clazz(

+        '''

+        class C {

+          static get o => null;

+          m() { C.o(null, 42); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE,

+                    element: 'getter(C#o)',

+                    arguments: '(null,42)')),

+    const Test.prefix(

+        '''

+        class C {

+          static get o => null;

+        }

+        ''',

+        'm() { p.C.o(null, 42); }',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE,

+                    element: 'getter(C#o)',

+                    arguments: '(null,42)')),

+    // TODO(johnniwinther): Expect [VISIT_STATIC_SETTER_INVOKE] instead.

+    const Test(

+        '''

+        class C { static set o(_) {} }

+        m() => C.o(null, 42);

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

+                    name: 'o',

+                    arguments: '(null,42)')),

+    const Test.clazz(

+        '''

+        class C {

+          static set o(_) {}

+          m() { o(null, 42); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

+                    name: 'o',

+                    arguments: '(null,42)')),

+    const Test.clazz(

+        '''

+        class C {

+          static set o(_) {}

+          m() { C.o(null, 42); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

+                    name: 'o',

+                    arguments: '(null,42)')),

+    const Test.prefix(

+        '''

+        class C {

+          static set o(_) {}

+        }

+        ''',

+        'm() { p.C.o(null, 42); }',

+        const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

+                    name: 'o',

+                    arguments: '(null,42)')),

+  ],

+  'Static functions': const [

+    // Static functions

+    const Test(

+        '''

+        class C { static o(a, b) {} }

+        m() => C.o;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET,

+                    element: 'function(C#o)')),

+    const Test.clazz(

+        '''

+        class C {

+          static o(a, b) {}

+          m() => o;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET,

+                    element: 'function(C#o)')),

+    const Test.clazz(

+        '''

+        class C {

+          static o(a, b) {}

+          m() => C.o;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET,

+                    element: 'function(C#o)')),

+    const Test.prefix(

+        '''

+        class C { static o(a, b) {} }

+        ''',

+        '''

+        m() => p.C.o;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET,

+                    element: 'function(C#o)')),

+    // TODO(johnniwinther): Expect [VISIT_STATIC_FUNCTION_SET] instead.

+    const Test(

+        '''

+        class C { static o(a, b) {} }

+        m() { C.o = 42; }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static o(a, b) {}

+          m() { o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static o(a, b) {}

+          m() { C.o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.prefix(

+        '''

+        class C { static o(a, b) {} }

+        ''',

+        '''

+        m() { p.C.o = 42; }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test(

+        '''

+        class C { static o(a, b) {} }

+        m() => C.o(null, 42);

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE,

+                    element: 'function(C#o)',

+                    arguments: '(null,42)')),

+    const Test.clazz(

+        '''

+        class C {

+          static o(a, b) {}

+          m() { o(null, 42); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE,

+                    element: 'function(C#o)',

+                    arguments: '(null,42)')),

+    const Test.clazz(

+        '''

+        class C {

+          static o(a, b) {}

+          m() { C.o(null, 42); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE,

+                    element: 'function(C#o)',

+                    arguments: '(null,42)')),

+    const Test.prefix(

+        '''

+        class C {

+          static o(a, b) {}

+        }

+        ''',

+        'm() { p.C.o(null, 42); }',

+        const Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE,

+                    element: 'function(C#o)',

+                    arguments: '(null,42)')),

+    const Test(

+        '''

+        class C { static o(a, b) {} }

+        m() => C.o(null);

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FUNCTION_INCOMPATIBLE_INVOKE,

+                    element: 'function(C#o)',

+                    arguments: '(null)')),

+  ],

+  'Top level fields': const [

+    // Top level fields

+    const Test(

+        '''

+        var o;

+        m() => o;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_GET,

+                    element: 'field(o)')),

+    const Test.prefix(

+        '''

+        var o;

+        ''',

+        'm() => p.o;',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_GET,

+                    element: 'field(o)')),

+    const Test(

+        '''

+        var o;

+        m() { o = 42; }

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_SET,

+                    element: 'field(o)',

+                    rhs: '42')),

+    const Test.prefix(

+        '''

+        var o;

+        ''',

+        'm() { p.o = 42; }',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_SET,

+                    element: 'field(o)',

+                    rhs: '42')),

+    // TODO(johnniwinther): Expect [VISIT_FINAL_TOP_LEVEL_FIELD_SET] instead.

+    const Test(

+        '''

+        final o = 0;

+        m() { o = 42; }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.prefix(

+        '''

+        final o = 0;

+        ''',

+        'm() { p.o = 42; }',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test(

+        '''

+        const o = 0;

+        m() { o = 42; }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.prefix(

+        '''

+        const o = 0;

+        ''',

+        'm() { p.o = 42; }',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test(

+        '''

+        var o;

+        m() { o(null, 42); }

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_INVOKE,

+                    element: 'field(o)',

+                    arguments: '(null,42)')),

+    const Test.prefix(

+        '''

+        var o;

+        ''',

+        'm() { p.o(null, 42); }',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_INVOKE,

+                    element: 'field(o)',

+                    arguments: '(null,42)')),

+    const Test(

+        '''

+        m() => o;

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_GET,

+                    name: 'o')),

+  ],

+  'Top level properties': const [

+    // Top level properties

+    const Test(

+        '''

+        get o => null;

+        m() => o;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_GET,

+                    element: 'getter(o)')),

+    const Test.prefix(

+        '''

+        get o => null;

+        ''',

+        '''

+        m() => p.o;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_GET,

+                    element: 'getter(o)')),

+    // TODO(johnniwinther): Expect [VISIT_TOP_LEVEL_SETTER_GET] instead.

+    const Test(

+        '''

+        set o(_) {}

+        m() => o;

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_GET,

+                    name: 'o')),

+    const Test.prefix(

+        '''

+        set o(_) {}

+        ''',

+        '''

+        m() => p.o;

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_GET,

+                    name: 'o')),

+    // TODO(johnniwinther): Expect [VISIT_TOP_LEVEL_GETTER_SET] instead.

+    const Test(

+        '''

+        get o => null;

+        m() { o = 42; }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.prefix(

+        '''

+        get o => null;

+        ''',

+        'm() { p.o = 42; }',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test(

+        '''

+        set o(_) {}

+        m() { o = 42; }

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_SET,

+                    element: 'setter(o)',

+                    rhs: '42')),

+    const Test.prefix(

+        '''

+        set o(_) {}

+        ''',

+        'm() { p.o = 42; }',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_SET,

+                    element: 'setter(o)',

+                    rhs: '42')),

+    const Test(

+        '''

+        get o => null;

+        m() => o(null, 42);

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_INVOKE,

+                    element: 'getter(o)',

+                    arguments: '(null,42)')),

+    const Test.prefix(

+        '''

+        get o => null;

+        ''',

+        'm() { p.o(null, 42); }',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_INVOKE,

+                    element: 'getter(o)',

+                    arguments: '(null,42)')),

+    // TODO(johnniwinther): Expected [VISIT_TOP_LEVEL_SETTER_INVOKE] instead.

+    const Test(

+        '''

+        set o(_) {}

+        m() => o(null, 42);

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

+                    name: 'o',

+                    arguments: '(null,42)')),

+    const Test.prefix(

+        '''

+        set o(_) {}

+        ''',

+        'm() { p.o(null, 42); }',

+        const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

+                    name: 'o',

+                    arguments: '(null,42)')),

+  ],

+  'Top level functions': const [

+    // Top level functions

+    const Test(

+        '''

+        o(a, b) {}

+        m() => o;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_GET,

+                    element: 'function(o)')),

+    const Test(

+        '''

+        o(a, b) {}

+        m() => o(null, 42);

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INVOKE,

+                    element: 'function(o)',

+                    arguments: '(null,42)')),

+    const Test(

+        '''

+        o(a, b) {}

+        m() => o(null);

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INCOMPATIBLE_INVOKE,

+                    element: 'function(o)',

+                    arguments: '(null)')),

+    const Test.prefix(

+        '''

+        o(a, b) {}

+        ''',

+        'm() { p.o(null, 42); }',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INVOKE,

+                    element: 'function(o)',

+                    arguments: '(null,42)')),

+    const Test(

+        '''

+        m() => o(null, 42);

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

+                    name: 'o',

+                    arguments: '(null,42)')),

+    // TODO(johnniwinther): Expect [VISIT_TOP_LEVEL_FUNCTION_SET] instead.

+    const Test(

+        '''

+        o(a, b) {}

+        m() { o = 42; }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.prefix(

+        '''

+        o(a, b) {}

+        ''',

+        'm() { p.o = 42; }',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+  ],

+  'Dynamic properties': const [

+    // Dynamic properties

+    const Test('m(o) => o.foo;',

+        const [

+          const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_GET,

+                      receiver: 'o',

+                      name: 'foo'),

+          const Visit(VisitKind.VISIT_PARAMETER_GET,

+                      element: 'parameter(m#o)'),

+        ]),

+    const Test('m(o) { o.foo = 42; }',

+        const [

+          const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_SET,

+                      receiver: 'o',

+                      name: 'foo',

+                      rhs: '42'),

+          const Visit(VisitKind.VISIT_PARAMETER_GET,

+                      element: 'parameter(m#o)'),

+        ]),

+    const Test('m(o) { o.foo(null, 42); }',

+        const [

+          const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_INVOKE,

+                      receiver: 'o',

+                      name: 'foo',

+                      arguments: '(null,42)'),

+          const Visit(VisitKind.VISIT_PARAMETER_GET,

+                      element: 'parameter(m#o)'),

+        ]),

+  ],

+  'This access': const [

+    // This access

+    const Test.clazz(

+        '''

+        class C {

+          m() => this;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_GET)),

+    const Test.clazz(

+        '''

+        class C {

+          call(a, b) {}

+          m() { this(null, 42); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_INVOKE,

+                    arguments: '(null,42)')),

+  ],

+  'This properties': const [

+    // This properties

+    const Test.clazz(

+        '''

+        class C {

+          var foo;

+          m() => foo;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_GET,

+                    name: 'foo')),

+    const Test.clazz(

+        '''

+        class C {

+          var foo;

+          m() => this.foo;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_GET,

+                    name: 'foo')),

+    const Test.clazz(

+        '''

+        class C {

+          get foo => null;

+          m() => foo;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_GET,

+                    name: 'foo')),

+    const Test.clazz(

+        '''

+        class C {

+          get foo => null;

+          m() => this.foo;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_GET,

+                    name: 'foo')),

+    const Test.clazz(

+        '''

+        class C {

+          var foo;

+          m() { foo = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_SET,

+                    name: 'foo',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          var foo;

+          m() { this.foo = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_SET,

+                    name: 'foo',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          set foo(_) {}

+          m() { foo = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_SET,

+                    name: 'foo',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          set foo(_) {}

+          m() { this.foo = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_SET,

+                    name: 'foo',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          var foo;

+          m() { foo(null, 42); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_INVOKE,

+                    name: 'foo',

+                    arguments: '(null,42)')),

+    const Test.clazz(

+        '''

+        class C {

+          var foo;

+          m() { this.foo(null, 42); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_INVOKE,

+                    name: 'foo',

+                    arguments: '(null,42)')),

+  ],

+  'Super fields': const [

+    // Super fields

+    const Test.clazz(

+        '''

+        class B {

+          var o;

+        }

+        class C extends B {

+          m() => super.o;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_FIELD_GET,

+                    element: 'field(B#o)')),

+    const Test.clazz(

+        '''

+        class B {

+          var o;

+        }

+        class C extends B {

+          m() { super.o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_FIELD_SET,

+                    element: 'field(B#o)',

+                    rhs: '42')),

+    // TODO(johnniwinther): Expect [VISIT_FINAL_SUPER_FIELD_SET] instead.

+    const Test.clazz(

+        '''

+        class B {

+          final o = 0;

+        }

+        class C extends B {

+          m() { super.o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class B {

+          var o;

+        }

+        class C extends B {

+          m() { super.o(null, 42); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_FIELD_INVOKE,

+                element: 'field(B#o)',

+                arguments: '(null,42)')),

+    const Test.clazz(

+            '''

+        class B {

+        }

+        class C extends B {

+          m() => super.o;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GET)),

+  ],

+  'Super properties': const [

+    // Super properties

+    const Test.clazz(

+        '''

+        class B {

+          get o => null;

+        }

+        class C extends B {

+          m() => super.o;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_GETTER_GET,

+                    element: 'getter(B#o)')),

+    const Test.clazz(

+        '''

+        class B {

+          set o(_) {}

+        }

+        class C extends B {

+          m() => super.o;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_SETTER_GET,

+                    element: 'setter(B#o)')),

+    // TODO(johnniwinther): Expect [VISIT_SUPER_GETTER_SET] instead.

+    const Test.clazz(

+        '''

+        class B {

+          get o => 0;

+        }

+        class C extends B {

+          m() { super.o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                    name: 'o',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class B {

+          set o(_) {}

+        }

+        class C extends B {

+          m() { super.o = 42; }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_SETTER_SET,

+                    element: 'setter(B#o)',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class B {

+          get o => null;

+        }

+        class C extends B {

+          m() { super.o(null, 42); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_GETTER_INVOKE,

+                    element: 'getter(B#o)',

+                    arguments: '(null,42)')),

+    const Test.clazz(

+        '''

+        class B {

+          set o(_) {}

+        }

+        class C extends B {

+          m() { super.o(null, 42); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_SETTER_INVOKE,

+                    element: 'setter(B#o)',

+                    arguments: '(null,42)')),

+  ],

+  'Super methods': const [

+    // Super methods

+    const Test.clazz(

+        '''

+        class B {

+          o(a, b) {}

+        }

+        class C extends B {

+          m() => super.o;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_METHOD_GET,

+                    element: 'function(B#o)')),

+    const Test.clazz(

+        '''

+        class B {

+          o(a, b) {}

+        }

+        class C extends B {

+          m() { super.o(null, 42); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_METHOD_INVOKE,

+                    element: 'function(B#o)',

+                    arguments: '(null,42)')),

+    const Test.clazz(

+        '''

+        class B {

+          o(a, b) {}

+        }

+        class C extends B {

+          m() { super.o(null); }

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_METHOD_INCOMPATIBLE_INVOKE,

+                    element: 'function(B#o)',

+                    arguments: '(null)')),

+    const Test.clazz(

+            '''

+            class B {

+            }

+            class C extends B {

+              m() => super.o(null, 42);

+            }

+            ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INVOKE,

+                    arguments: '(null,42)')),

+  ],

+  'Expression invoke': const [

+    // Expression invoke

+    const Test('m() => (a, b){}(null, 42);',

+        const Visit(VisitKind.VISIT_EXPRESSION_INVOKE,

+                    receiver: '(a,b){}',

+                    arguments: '(null,42)')),

+  ],

+  'Class type literals': const [

+    // Class type literals

+    const Test(

+        '''

+        class C {}

+        m() => C;

+        ''',

+        const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_GET,

+                    constant: 'C')),

+    const Test(

+        '''

+        class C {}

+        m() => C(null, 42);

+        ''',

+        const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_INVOKE,

+                    constant: 'C',

+                    arguments: '(null,42)')),

+    const Test(

+        '''

+        class C {}

+        m() => C += 42;

+        ''',

+        const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_COMPOUND,

+                    constant: 'C',

+                    operator: '+=',

+                    rhs: '42')),

+    const Test(

+        '''

+        class C {}

+        m() => ++C;

+        ''',

+        const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_PREFIX,

+                    constant: 'C',

+                    operator: '++')),

+    const Test(

+        '''

+        class C {}

+        m() => C--;

+        ''',

+        const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_POSTFIX,

+                    constant: 'C',

+                    operator: '--')),

+    const Test(

+        '''

+        class C {}

+        m() => C;

+        ''',

+        const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_GET,

+                    constant: 'C')),

+  ],

+  'Typedef type literals': const [

+    // Typedef type literals

+    const Test(

+        '''

+        typedef F();

+        m() => F;

+        ''',

+        const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_GET,

+                    constant: 'F')),

+    const Test(

+        '''

+        typedef F();

+        m() => F(null, 42);

+        ''',

+        const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_INVOKE,

+                    constant: 'F',

+                    arguments: '(null,42)')),

+    const Test(

+        '''

+        typedef F();

+        m() => F += 42;

+        ''',

+        const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_COMPOUND,

+                    constant: 'F',

+                    operator: '+=',

+                    rhs: '42')),

+    const Test(

+        '''

+        typedef F();

+        m() => ++F;

+        ''',

+        const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_PREFIX,

+                    constant: 'F',

+                    operator: '++')),

+    const Test(

+        '''

+        typedef F();

+        m() => F--;

+        ''',

+        const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_POSTFIX,

+                    constant: 'F',

+                    operator: '--')),

+  ],

+  'Type variable type literals': const [

+    // Type variable type literals

+    const Test.clazz(

+        '''

+        class C<T> {

+          m() => T;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_GET,

+                    element: 'type_variable(C#T)')),

+    const Test.clazz(

+        '''

+        class C<T> {

+          m() => T(null, 42);

+        }

+        ''',

+        const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_INVOKE,

+                    element: 'type_variable(C#T)',

+                    arguments: '(null,42)')),

+    const Test.clazz(

+        '''

+        class C<T> {

+          m() => T += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_COMPOUND,

+                    element: 'type_variable(C#T)',

+                    operator: '+=',

+                    rhs: '42')),

+    const Test.clazz(

+        '''

+        class C<T> {

+          m() => ++T;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_PREFIX,

+                    element: 'type_variable(C#T)',

+                    operator: '++')),

+    const Test.clazz(

+        '''

+        class C<T> {

+          m() => T--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_POSTFIX,

+                    element: 'type_variable(C#T)',

+                    operator: '--')),

+

+  ],

+  'Dynamic type literals': const [

+    // Dynamic type literals

+    const Test(

+        '''

+        m() => dynamic;

+        ''',

+        const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_GET,

+                    constant: 'dynamic')),

+    // TODO(johnniwinther): Update these to expect the constant to be `dynamic`

+    // instead of `Type`. Currently the compile time constant evaluator cannot

+    // detect `dynamic` as a constant subexpression.

+    const Test(

+        '''

+        m() { dynamic(null, 42); }

+        ''',

+        const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_INVOKE,

+                    constant: 'Type',

+                    arguments: '(null,42)')),

+    const Test(

+        '''

+        m() => dynamic += 42;

+        ''',

+        const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_COMPOUND,

+                    constant: 'Type',

+                    operator: '+=',

+                    rhs: '42')),

+    const Test(

+        '''

+        m() => ++dynamic;

+        ''',

+        const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_PREFIX,

+                    constant: 'Type',

+                    operator: '++')),

+    const Test(

+        '''

+        m() => dynamic--;

+        ''',

+        const Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_POSTFIX,

+                    constant: 'Type',

+                    operator: '--')),

+  ],

+  'Assert': const [

+    // Assert

+    const Test(

+        '''

+        m() { assert(false); }

+        ''',

+        const Visit(VisitKind.VISIT_ASSERT, expression: 'false')),

+  ],

+  'Logical and': const [

+    // Logical and

+    const Test(

+        '''

+        m() => true && false;

+        ''',

+        const Visit(VisitKind.VISIT_LOGICAL_AND, left: 'true', right: 'false')),

+  ],

+  'Logical or': const [

+    // Logical or

+    const Test(

+        '''

+        m() => true || false;

+        ''',

+        const Visit(VisitKind.VISIT_LOGICAL_OR, left: 'true', right: 'false')),

+  ],

+  'Is test': const [

+    // Is test

+    const Test(

+        '''

+        class C {}

+        m() => 0 is C;

+        ''',

+        const Visit(VisitKind.VISIT_IS, expression: '0', type: 'C')),

+  ],

+  'Is not test': const [

+    // Is not test

+    const Test(

+        '''

+        class C {}

+        m() => 0 is! C;

+        ''',

+        const Visit(VisitKind.VISIT_IS_NOT, expression: '0', type: 'C')),

+  ],

+  'As test': const [

+    // As test

+    const Test(

+        '''

+        class C {}

+        m() => 0 as C;

+        ''',

+        const Visit(VisitKind.VISIT_AS, expression: '0', type: 'C')),

+  ],

+  'Binary operators': const [

+    // Binary operators

+    const Test(

+        '''

+        m() => 2 + 3;

+        ''',

+        const Visit(VisitKind.VISIT_BINARY,

+                    left: '2', operator: '+', right: '3')),

+    const Test(

+        '''

+        m() => 2 - 3;

+        ''',

+        const Visit(VisitKind.VISIT_BINARY,

+                    left: '2', operator: '-', right: '3')),

+    const Test(

+        '''

+        m() => 2 * 3;

+        ''',

+        const Visit(VisitKind.VISIT_BINARY,

+                    left: '2', operator: '*', right: '3')),

+    const Test(

+        '''

+        m() => 2 / 3;

+        ''',

+        const Visit(VisitKind.VISIT_BINARY,

+                    left: '2', operator: '/', right: '3')),

+    const Test(

+        '''

+        m() => 2 ~/ 3;

+        ''',

+        const Visit(VisitKind.VISIT_BINARY,

+                    left: '2', operator: '~/', right: '3')),

+    const Test(

+        '''

+        m() => 2 % 3;

+        ''',

+        const Visit(VisitKind.VISIT_BINARY,

+                    left: '2', operator: '%', right: '3')),

+    const Test(

+        '''

+        m() => 2 << 3;

+        ''',

+        const Visit(VisitKind.VISIT_BINARY,

+                    left: '2', operator: '<<', right: '3')),

+    const Test(

+        '''

+        m() => 2 >> 3;

+        ''',

+        const Visit(VisitKind.VISIT_BINARY,

+                    left: '2', operator: '>>', right: '3')),

+    const Test(

+        '''

+        m() => 2 <= 3;

+        ''',

+        const Visit(VisitKind.VISIT_BINARY,

+                    left: '2', operator: '<=', right: '3')),

+    const Test(

+        '''

+        m() => 2 < 3;

+        ''',

+        const Visit(VisitKind.VISIT_BINARY,

+                    left: '2', operator: '<', right: '3')),

+    const Test(

+        '''

+        m() => 2 >= 3;

+        ''',

+        const Visit(VisitKind.VISIT_BINARY,

+                    left: '2', operator: '>=', right: '3')),

+    const Test(

+        '''

+        m() => 2 > 3;

+        ''',

+        const Visit(VisitKind.VISIT_BINARY,

+                    left: '2', operator: '>', right: '3')),

+    const Test(

+        '''

+        m() => 2 & 3;

+        ''',

+        const Visit(VisitKind.VISIT_BINARY,

+                    left: '2', operator: '&', right: '3')),

+    const Test(

+        '''

+        m() => 2 | 3;

+        ''',

+        const Visit(VisitKind.VISIT_BINARY,

+                    left: '2', operator: '|', right: '3')),

+    const Test(

+        '''

+        m() => 2 ^ 3;

+        ''',

+        const Visit(VisitKind.VISIT_BINARY,

+                    left: '2', operator: '^', right: '3')),

+    const Test.clazz(

+        '''

+        class B {

+          operator +(_) => null;

+        }

+        class C extends B {

+          m() => super + 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_BINARY,

+                    element: 'function(B#+)',

+                    operator: '+',

+                    right: '42')),

+    const Test.clazz(

+        '''

+        class B {}

+        class C extends B {

+          m() => super + 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_BINARY,

+                    operator: '+',

+                    right: '42')),

+  ],

+  'Index': const [

+    // Index

+    const Test(

+        '''

+        m() => 2[3];

+        ''',

+        const Visit(VisitKind.VISIT_INDEX,

+                    receiver: '2', index: '3')),

+    const Test(

+        '''

+        m() => --2[3];

+        ''',

+        const Visit(VisitKind.VISIT_INDEX_PREFIX,

+                    receiver: '2', index: '3', operator: '--')),

+    const Test(

+        '''

+        m() => 2[3]++;

+        ''',

+        const Visit(VisitKind.VISIT_INDEX_POSTFIX,

+                    receiver: '2', index: '3', operator: '++')),

+    const Test.clazz(

+        '''

+        class B {

+          operator [](_) => null;

+        }

+        class C extends B {

+          m() => super[42];

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_INDEX,

+                    element: 'function(B#[])',

+                    index: '42')),

+    const Test.clazz(

+        '''

+        class B {

+        }

+        class C extends B {

+          m() => super[42];

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX,

+                    index: '42')),

+    const Test.clazz(

+        '''

+        class B {

+          operator [](_) => null;

+          operator []=(a, b) {}

+        }

+        class C extends B {

+          m() => ++super[42];

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_INDEX_PREFIX,

+                    getter: 'function(B#[])',

+                    setter: 'function(B#[]=)',

+                    index: '42',

+                    operator: '++')),

+    const Test.clazz(

+        '''

+        class B {

+          operator []=(a, b) {}

+        }

+        class C extends B {

+          m() => ++super[42];

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_INDEX_PREFIX,

+                    setter: 'function(B#[]=)',

+                    index: '42',

+                    operator: '++')),

+    const Test.clazz(

+        '''

+        class B {

+        }

+        class C extends B {

+          m() => ++super[42];

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_PREFIX,

+                    index: '42',

+                    operator: '++')),

+    const Test.clazz(

+        '''

+        class B {

+          operator [](_) => null;

+        }

+        class C extends B {

+          m() => ++super[42];

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_PREFIX,

+                    getter: 'function(B#[])',

+                    index: '42',

+                    operator: '++')),

+    const Test.clazz(

+        '''

+        class B {

+          operator [](_) => null;

+          operator []=(a, b) {}

+        }

+        class C extends B {

+          m() => super[42]--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_INDEX_POSTFIX,

+                    getter: 'function(B#[])',

+                    setter: 'function(B#[]=)',

+                    index: '42',

+                    operator: '--')),

+    const Test.clazz(

+        '''

+        class B {

+          operator []=(a, b) {}

+        }

+        class C extends B {

+          m() => super[42]--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_INDEX_POSTFIX,

+                    setter: 'function(B#[]=)',

+                    index: '42',

+                    operator: '--')),

+    const Test.clazz(

+        '''

+        class B {

+        }

+        class C extends B {

+          m() => super[42]--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_POSTFIX,

+                    index: '42',

+                    operator: '--')),

+    const Test.clazz(

+        '''

+        class B {

+          operator [](_) => null;

+        }

+        class C extends B {

+          m() => super[42]--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_POSTFIX,

+                    getter: 'function(B#[])',

+                    index: '42',

+                    operator: '--')),

+  ],

+  'Equals': const [

+    // Equals

+    const Test(

+        '''

+        m() => 2 == 3;

+        ''',

+        const Visit(VisitKind.VISIT_EQUALS,

+                    left: '2', right: '3')),

+    const Test.clazz(

+        '''

+        class B {

+          operator ==(_) => null;

+        }

+        class C extends B {

+          m() => super == 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_EQUALS,

+                    element: 'function(B#==)',

+                    right: '42')),

+  ],

+  'Not equals': const [

+    // Not equals

+    const Test(

+        '''

+        m() => 2 != 3;

+        ''',

+        const Visit(VisitKind.VISIT_NOT_EQUALS,

+                    left: '2', right: '3')),

+    const Test.clazz(

+        '''

+        class B {

+          operator ==(_) => null;

+        }

+        class C extends B {

+          m() => super != 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_NOT_EQUALS,

+                    element: 'function(B#==)',

+                    right: '42')),

+  ],

+  'Unary expression': const [

+    // Unary expression

+    const Test(

+        '''

+        m() => -false;

+        ''',

+        const Visit(VisitKind.VISIT_UNARY,

+                    expression: 'false', operator: '-')),

+    const Test(

+        '''

+        m() => ~false;

+        ''',

+        const Visit(VisitKind.VISIT_UNARY,

+                    expression: 'false', operator: '~')),

+    const Test.clazz(

+        '''

+        class B {

+          operator -() => null;

+        }

+        class C extends B {

+          m() => -super;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_UNARY,

+                    element: 'function(B#unary-)', operator: '-')),

+    const Test.clazz(

+        '''

+        class B {

+        }

+        class C extends B {

+          m() => -super;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_UNARY,

+                    operator: '-')),

+    const Test.clazz(

+        '''

+        class B {

+          operator ~() => null;

+        }

+        class C extends B {

+          m() => ~super;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_UNARY,

+                    element: 'function(B#~)', operator: '~')),

+    const Test(

+        '''

+        m() => !0;

+        ''',

+        const Visit(VisitKind.VISIT_NOT, expression: '0')),

+  ],

+  'Index set': const [

+    // Index set

+    const Test(

+        '''

+        m() => 0[1] = 2;

+        ''',

+        const Visit(VisitKind.VISIT_INDEX_SET,

+            receiver: '0', index: '1', rhs: '2')),

+    const Test.clazz(

+        '''

+        class B {

+          operator []=(a, b) {}

+        }

+        class C extends B {

+          m() => super[1] = 2;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_INDEX_SET,

+            element: 'function(B#[]=)', index: '1', rhs: '2')),

+    const Test.clazz(

+        '''

+        class B {

+        }

+        class C extends B {

+          m() => super[1] = 2;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_SET,

+            index: '1', rhs: '2')),

+  ],

+  'Compound assignment': const [

+    // Compound assignment

+    const Test(

+        '''

+        m(a) => a.b += 42;

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_COMPOUND,

+              receiver: 'a', operator: '+=', rhs: '42',

+              getter: 'Selector(getter, b, arity=0)',

+              setter: 'Selector(setter, b, arity=1)'),

+          const Visit(VisitKind.VISIT_PARAMETER_GET,

+              element: 'parameter(m#a)')

+        ]),

+    const Test(

+        '''

+        m(a) => a += 42;

+        ''',

+        const Visit(VisitKind.VISIT_PARAMETER_COMPOUND,

+            element: 'parameter(m#a)', operator: '+=', rhs: '42')),

+    const Test(

+        '''

+        m(final a) => a += 42;

+        ''',

+        const Visit(VisitKind.VISIT_FINAL_PARAMETER_COMPOUND,

+            element: 'parameter(m#a)', operator: '+=', rhs: '42')),

+    const Test(

+        '''

+        m() {

+          var a;

+          a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_LOCAL_VARIABLE_COMPOUND,

+            element: 'variable(m#a)', operator: '+=', rhs: '42')),

+    const Test(

+        '''

+        m() {

+          final a;

+          a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_COMPOUND,

+            element: 'variable(m#a)', operator: '+=', rhs: '42')),

+    const Test(

+        '''

+        m() {

+          a() {}

+          a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_LOCAL_FUNCTION_COMPOUND,

+            element: 'function(m#a)', operator: '+=', rhs: '42')),

+    const Test(

+        '''

+        var a;

+        m() => a += 42;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_COMPOUND,

+            element: 'field(a)', operator: '+=', rhs: '42')),

+    const Test(

+        '''

+        get a => 0;

+        set a(_) {}

+        m() => a += 42;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_COMPOUND,

+            getter: 'getter(a)', setter: 'setter(a)',

+            operator: '+=', rhs: '42')),

+    const Test(

+        '''

+        class C {

+          static var a;

+        }

+        m() => C.a += 42;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_COMPOUND,

+            element: 'field(C#a)', operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static var a;

+          m() => C.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_COMPOUND,

+            element: 'field(C#a)', operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static var a;

+          m() => a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_COMPOUND,

+            element: 'field(C#a)', operator: '+=', rhs: '42')),

+    const Test.prefix(

+        '''

+        class C {

+          static var a;

+        }

+        ''',

+        '''

+        m() => p.C.a += 42;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_COMPOUND,

+            element: 'field(C#a)', operator: '+=', rhs: '42')),

+    const Test(

+        '''

+        class C {

+          static get a => 0;

+          static set a(_) {}

+        }

+        m() => C.a += 42;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND,

+            getter: 'getter(C#a)', setter: 'setter(C#a)',

+            operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static get a => 0;

+          static set a(_) {}

+          m() => C.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND,

+            getter: 'getter(C#a)', setter: 'setter(C#a)',

+            operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static get a => 0;

+          static set a(_) {}

+          m() => a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND,

+            getter: 'getter(C#a)', setter: 'setter(C#a)',

+            operator: '+=', rhs: '42')),

+    const Test.prefix(

+        '''

+        class C {

+          static get a => 0;

+          static set a(_) {}

+        }

+        ''',

+        '''

+        m() => p.C.a += 42;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND,

+            getter: 'getter(C#a)', setter: 'setter(C#a)',

+            operator: '+=', rhs: '42')),

+    // TODO(johnniwinther): Enable these when dart2js supports method and setter

+    // with the same name.

+    /*const Test(

+        '''

+        class C {

+          static a() {}

+          static set a(_) {}

+        }

+        m() => C.a += 42;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_METHOD_SETTER_COMPOUND,

+            getter: 'function(C#a)', setter: 'setter(C#a)',

+            operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static a() {}

+          static set a(_) {}

+          m() => C.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_METHOD_SETTER_COMPOUND,

+            getter: 'function(C#a)', setter: 'setter(C#a)',

+            operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class C {

+          static a() {}

+          static set a(_) {}

+          m() => a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_METHOD_SETTER_COMPOUND,

+            getter: 'function(C#a)', setter: 'setter(C#a)',

+            operator: '+=', rhs: '42')),

+    const Test.prefix(

+        '''

+        class C {

+          static a() {}

+          static set a(_) {}

+        }

+        ''',

+        '''

+        m() => p.C.a += 42;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_METHOD_SETTER_COMPOUND,

+            getter: 'function(C#a)', setter: 'setter(C#a)',

+            operator: '+=', rhs: '42')),*/

+    const Test.clazz(

+        '''

+        class C {

+          var a;

+          m() => a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_COMPOUND,

+            operator: '+=', rhs: '42',

+            getter: 'Selector(getter, a, arity=0)',

+            setter: 'Selector(setter, a, arity=1)')),

+    const Test.clazz(

+        '''

+        class C {

+          var a = 0;

+          m() => this.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_COMPOUND,

+            operator: '+=', rhs: '42',

+            getter: 'Selector(getter, a, arity=0)',

+            setter: 'Selector(setter, a, arity=1)')),

+    const Test.clazz(

+        '''

+        class B {

+          var a = 0;

+        }

+        class C extends B {

+          m() => super.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_FIELD_COMPOUND,

+            element: 'field(B#a)', operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class B {

+          final a = 0;

+        }

+        class C extends B {

+          m() => super.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_COMPOUND,

+            element: 'field(B#a)', operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class B {

+          get a => 0;

+          set a (_) {}

+        }

+        class C extends B {

+          m() => super.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_COMPOUND,

+            getter: 'getter(B#a)', setter: 'setter(B#a)',

+            operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class A {

+          get a => 0;

+        }

+        class B extends A {

+          set a (_) {}

+        }

+        class C extends B {

+          m() => super.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_COMPOUND,

+            getter: 'getter(A#a)', setter: 'setter(B#a)',

+            operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class A {

+          var a;

+        }

+        class B extends A {

+          get a => 0;

+        }

+

+        class C extends B {

+          m() => super.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_COMPOUND,

+            getter: 'getter(B#a)', setter: 'field(A#a)',

+            operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class A {

+          var a;

+        }

+        class B extends A {

+          set a(_) {}

+        }

+

+        class C extends B {

+          m() => super.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_COMPOUND,

+            getter: 'field(A#a)', setter: 'setter(B#a)',

+            operator: '+=', rhs: '42')),

+    // TODO(johnniwinther): Enable this when dart2js supports shadow setters.

+    /*const Test.clazz(

+        '''

+        class A {

+          var a;

+        }

+        class B extends A {

+          final a;

+        }

+

+        class C extends B {

+          m() => super.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_FIELD_FIELD_COMPOUND,

+            getter: 'field(B#a)', setter: 'field(A#a)',

+            operator: '+=', rhs: '42')),*/

+    const Test.clazz(

+        '''

+        class B {

+          a() {}

+        }

+        class C extends B {

+          m() => super.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_METHOD_COMPOUND,

+            element: 'function(B#a)',

+            operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class B {

+        }

+        class C extends B {

+          m() => super.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_COMPOUND,

+            operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class B {

+          set a(_) {}

+        }

+        class C extends B {

+          m() => super.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_COMPOUND,

+            setter: 'setter(B#a)', operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class B {

+          get a => 42;

+        }

+        class C extends B {

+          m() => super.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_COMPOUND,

+            getter: 'getter(B#a)', operator: '+=', rhs: '42')),

+

+    const Test.clazz(

+        '''

+        class C {

+          static set a(var value) { }

+          m() => a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_STATIC_GETTER_COMPOUND,

+            setter: 'setter(C#a)', operator: '+=', rhs: '42')),

+

+    const Test.clazz(

+        '''

+        class C {

+          static get a => 42;

+          m() => C.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_STATIC_SETTER_COMPOUND,

+            getter: 'getter(C#a)', operator: '+=', rhs: '42')),

+

+    const Test.clazz(

+        '''

+        class C {

+          static final a = 42;

+          m() => C.a += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FINAL_FIELD_COMPOUND,

+            element: 'field(C#a)', operator: '+=', rhs: '42')),

+

+    const Test(

+        '''

+        class C {

+          static a(var value) { }

+        }

+        m() => C.a += 42;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_METHOD_COMPOUND,

+            element: 'function(C#a)', operator: '+=', rhs: '42')),

+

+    const Test(

+        '''

+        set a(var value) { }

+        m() => a += 42;

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_GETTER_COMPOUND,

+            setter: 'setter(a)', operator: '+=', rhs: '42')),

+

+    const Test(

+        '''

+        get a => 42;

+        m() => a += 42;

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_SETTER_COMPOUND,

+            getter: 'getter(a)', operator: '+=', rhs: '42')),

+

+    const Test(

+        '''

+        a(var value) { }

+        m() => a += 42;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_COMPOUND,

+            element: 'function(a)', operator: '+=', rhs: '42')),

+

+    const Test(

+        '''

+        final a = 42;

+        m() => a += 42;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_COMPOUND,

+            element: 'field(a)', operator: '+=', rhs: '42')),

+

+    const Test(

+        '''

+        m() => unresolved += 42;

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_COMPOUND,

+            operator: '+=', rhs: '42')),

+  ],

+  'Compound index assignment': const [

+    // Compound index assignment

+    const Test(

+        '''

+        m() => 0[1] += 42;

+        ''',

+        const Visit(VisitKind.VISIT_COMPOUND_INDEX_SET,

+            receiver: '0', index: '1', operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class B {

+          operator [](_) {}

+          operator []=(a, b) {}

+        }

+        class C extends B {

+          m() => super[1] += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_COMPOUND_INDEX_SET,

+            getter: 'function(B#[])', setter: 'function(B#[]=)',

+            index: '1', operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class B {

+          operator []=(a, b) {}

+        }

+        class C extends B {

+          m() => super[1] += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_COMPOUND_INDEX_SET,

+            setter: 'function(B#[]=)',

+            index: '1', operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class B {

+        }

+        class C extends B {

+          m() => super[1] += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_COMPOUND_INDEX_SET,

+            index: '1', operator: '+=', rhs: '42')),

+    const Test.clazz(

+        '''

+        class B {

+          operator [](_) {}

+        }

+        class C extends B {

+          m() => super[1] += 42;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_COMPOUND_INDEX_SET,

+            getter: 'function(B#[])',

+            index: '1', operator: '+=', rhs: '42')),

+  ],

+  'Prefix expression': const [

+    // Prefix expression

+    const Test(

+        '''

+        m(a) => --a.b;

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_PREFIX,

+              receiver: 'a', operator: '--',

+              getter: 'Selector(getter, b, arity=0)',

+              setter: 'Selector(setter, b, arity=1)'),

+          const Visit(VisitKind.VISIT_PARAMETER_GET,

+              element: 'parameter(m#a)')

+        ]),

+    const Test(

+        '''

+        m(a) => ++a;

+        ''',

+        const Visit(VisitKind.VISIT_PARAMETER_PREFIX,

+            element: 'parameter(m#a)', operator: '++')),

+    const Test(

+        '''

+        m(final a) => ++a;

+        ''',

+        const Visit(VisitKind.VISIT_FINAL_PARAMETER_PREFIX,

+            element: 'parameter(m#a)', operator: '++')),

+    const Test(

+        '''

+        m() {

+          var a;

+          --a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_LOCAL_VARIABLE_PREFIX,

+            element: 'variable(m#a)', operator: '--')),

+    const Test(

+        '''

+        m() {

+          final a = 42;

+          --a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_PREFIX,

+            element: 'variable(m#a)', operator: '--')),

+    const Test(

+        '''

+        m() {

+          a() {}

+          --a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_LOCAL_FUNCTION_PREFIX,

+            element: 'function(m#a)', operator: '--')),

+    const Test(

+        '''

+        var a;

+        m() => ++a;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_PREFIX,

+            element: 'field(a)', operator: '++')),

+    const Test(

+        '''

+        get a => 0;

+        set a(_) {}

+        m() => --a;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_PREFIX,

+            getter: 'getter(a)', setter: 'setter(a)',

+            operator: '--')),

+    const Test(

+        '''

+        class C {

+          static var a;

+        }

+        m() => ++C.a;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_PREFIX,

+            element: 'field(C#a)', operator: '++')),

+    const Test.clazz(

+        '''

+        class C {

+          static var a;

+          m() => ++C.a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_PREFIX,

+            element: 'field(C#a)', operator: '++')),

+    const Test.clazz(

+        '''

+        class C {

+          static var a;

+          m() => --a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_PREFIX,

+            element: 'field(C#a)', operator: '--')),

+    const Test.prefix(

+        '''

+        class C {

+          static var a;

+        }

+        ''',

+        '''

+        m() => --p.C.a;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_PREFIX,

+            element: 'field(C#a)', operator: '--')),

+    const Test(

+        '''

+        class C {

+          static get a => 0;

+          static set a(_) {}

+        }

+        m() => ++C.a;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX,

+            getter: 'getter(C#a)', setter: 'setter(C#a)',

+            operator: '++')),

+    const Test.clazz(

+        '''

+        class C {

+          static get a => 0;

+          static set a(_) {}

+          m() => --C.a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX,

+            getter: 'getter(C#a)', setter: 'setter(C#a)',

+            operator: '--')),

+    const Test.clazz(

+        '''

+        class C {

+          static get a => 0;

+          static set a(_) {}

+          m() => --a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX,

+            getter: 'getter(C#a)', setter: 'setter(C#a)',

+            operator: '--')),

+    const Test.prefix(

+        '''

+        class C {

+          static get a => 0;

+          static set a(_) {}

+        }

+        ''',

+        '''

+        m() => ++p.C.a;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX,

+            getter: 'getter(C#a)', setter: 'setter(C#a)',

+            operator: '++')),

+    const Test.clazz(

+        '''

+        class C {

+          var a;

+          m() => --a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_PREFIX,

+            operator: '--',

+            getter: 'Selector(getter, a, arity=0)',

+            setter: 'Selector(setter, a, arity=1)')),

+    const Test.clazz(

+        '''

+        class C {

+          var a = 0;

+          m() => ++this.a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_PREFIX,

+            operator: '++',

+            getter: 'Selector(getter, a, arity=0)',

+            setter: 'Selector(setter, a, arity=1)')),

+    const Test.clazz(

+        '''

+        class B {

+          var a = 0;

+        }

+        class C extends B {

+          m() => --super.a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_FIELD_PREFIX,

+            element: 'field(B#a)', operator: '--')),

+    const Test.clazz(

+        '''

+        class B {

+          final a = 0;

+        }

+        class C extends B {

+          m() => --super.a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_PREFIX,

+            element: 'field(B#a)', operator: '--')),

+    const Test.clazz(

+        '''

+        class B {

+          get a => 0;

+          set a (_) {}

+        }

+        class C extends B {

+          m() => --super.a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_PREFIX,

+            getter: 'getter(B#a)', setter: 'setter(B#a)',

+            operator: '--')),

+    const Test.clazz(

+        '''

+        class A {

+          get a => 0;

+        }

+        class B extends A {

+          set a (_) {}

+        }

+        class C extends B {

+          m() => ++super.a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_PREFIX,

+            getter: 'getter(A#a)', setter: 'setter(B#a)',

+            operator: '++')),

+    const Test.clazz(

+        '''

+        class A {

+          var a;

+        }

+        class B extends A {

+          get a => 0;

+        }

+

+        class C extends B {

+          m() => --super.a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_PREFIX,

+            getter: 'getter(B#a)', setter: 'field(A#a)',

+            operator: '--')),

+    const Test.clazz(

+        '''

+        class A {

+          var a;

+        }

+        class B extends A {

+          set a(_) {}

+        }

+

+        class C extends B {

+          m() => ++super.a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_PREFIX,

+            getter: 'field(A#a)', setter: 'setter(B#a)',

+            operator: '++')),

+    const Test.clazz(

+        '''

+        class B {

+          a() {}

+        }

+        class C extends B {

+          m() => ++super.a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_METHOD_PREFIX,

+            element: 'function(B#a)',

+            operator: '++')),

+    const Test.clazz(

+        '''

+        class B {

+        }

+        class C extends B {

+          m() => ++super.a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_PREFIX,

+            operator: '++')),

+    const Test.clazz(

+        '''

+        class B {

+          set a(_) {}

+        }

+        class C extends B {

+          m() => ++super.a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_PREFIX,

+            setter: 'setter(B#a)', operator: '++')),

+    const Test.clazz(

+        '''

+        class B {

+          get a => 42;

+        }

+        class C extends B {

+          m() => ++super.a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_PREFIX,

+            getter: 'getter(B#a)', operator: '++')),

+

+    const Test.clazz(

+        '''

+        class C {

+          static set a(var value) { }

+          m() => ++a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_STATIC_GETTER_PREFIX,

+            setter: 'setter(C#a)', operator: '++')),

+

+    const Test.clazz(

+        '''

+        class C {

+          static get a => 42;

+          m() => ++C.a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_STATIC_SETTER_PREFIX,

+            getter: 'getter(C#a)', operator: '++')),

+

+    const Test.clazz(

+        '''

+        class C {

+          static final a = 42;

+          m() => ++C.a;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FINAL_FIELD_PREFIX,

+            element: 'field(C#a)', operator: '++')),

+

+    const Test(

+        '''

+        class C {

+          static a(var value) { }

+        }

+        m() => ++C.a;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_METHOD_PREFIX,

+            element: 'function(C#a)', operator: '++')),

+

+    const Test(

+        '''

+        set a(var value) { }

+        m() => ++a;

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_GETTER_PREFIX,

+            setter: 'setter(a)', operator: '++')),

+

+    const Test(

+        '''

+        get a => 42;

+        m() => ++a;

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_SETTER_PREFIX,

+            getter: 'getter(a)', operator: '++')),

+

+    const Test(

+        '''

+        a(var value) { }

+        m() => ++a;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_PREFIX,

+            element: 'function(a)', operator: '++')),

+

+    const Test(

+        '''

+        final a = 42;

+        m() => ++a;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_PREFIX,

+            element: 'field(a)', operator: '++')),

+

+    const Test(

+        '''

+        m() => ++unresolved;

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_PREFIX,

+            operator: '++')),

+  ],

+  'Postfix expression': const [

+    // Postfix expression

+    const Test(

+        '''

+        m(a) => a.b--;

+        ''',

+        const [

+          const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_POSTFIX,

+              receiver: 'a', operator: '--',

+              getter: 'Selector(getter, b, arity=0)',

+              setter: 'Selector(setter, b, arity=1)'),

+          const Visit(VisitKind.VISIT_PARAMETER_GET,

+              element: 'parameter(m#a)')

+        ]),

+    const Test(

+        '''

+        m(a) => a++;

+        ''',

+        const Visit(VisitKind.VISIT_PARAMETER_POSTFIX,

+            element: 'parameter(m#a)', operator: '++')),

+    const Test(

+        '''

+        m(final a) => a++;

+        ''',

+        const Visit(VisitKind.VISIT_FINAL_PARAMETER_POSTFIX,

+            element: 'parameter(m#a)', operator: '++')),

+    const Test(

+        '''

+        m() {

+          var a;

+          a--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_LOCAL_VARIABLE_POSTFIX,

+            element: 'variable(m#a)', operator: '--')),

+    const Test(

+        '''

+        m() {

+          final a = 42;

+          a--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_POSTFIX,

+            element: 'variable(m#a)', operator: '--')),

+    const Test(

+        '''

+        m() {

+          a() {}

+          a--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_LOCAL_FUNCTION_POSTFIX,

+            element: 'function(m#a)', operator: '--')),

+    const Test(

+        '''

+        var a;

+        m() => a++;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_POSTFIX,

+            element: 'field(a)', operator: '++')),

+    const Test(

+        '''

+        get a => 0;

+        set a(_) {}

+        m() => a--;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_POSTFIX,

+            getter: 'getter(a)', setter: 'setter(a)',

+            operator: '--')),

+    const Test(

+        '''

+        class C {

+          static var a;

+        }

+        m() => C.a++;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_POSTFIX,

+            element: 'field(C#a)', operator: '++')),

+    const Test.clazz(

+        '''

+        class C {

+          static var a;

+          m() => C.a++;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_POSTFIX,

+            element: 'field(C#a)', operator: '++')),

+    const Test.clazz(

+        '''

+        class C {

+          static var a;

+          m() => a--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_POSTFIX,

+            element: 'field(C#a)', operator: '--')),

+    const Test.prefix(

+        '''

+        class C {

+          static var a;

+        }

+        ''',

+        '''

+        m() => p.C.a--;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FIELD_POSTFIX,

+            element: 'field(C#a)', operator: '--')),

+    const Test(

+        '''

+        class C {

+          static get a => 0;

+          static set a(_) {}

+        }

+        m() => C.a++;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX,

+            getter: 'getter(C#a)', setter: 'setter(C#a)',

+            operator: '++')),

+    const Test.clazz(

+        '''

+        class C {

+          static get a => 0;

+          static set a(_) {}

+          m() => C.a--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX,

+            getter: 'getter(C#a)', setter: 'setter(C#a)',

+            operator: '--')),

+    const Test.clazz(

+        '''

+        class C {

+          static get a => 0;

+          static set a(_) {}

+          m() => a--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX,

+            getter: 'getter(C#a)', setter: 'setter(C#a)',

+            operator: '--')),

+    const Test.prefix(

+        '''

+        class C {

+          static get a => 0;

+          static set a(_) {}

+        }

+        ''',

+        '''

+        m() => p.C.a++;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX,

+            getter: 'getter(C#a)', setter: 'setter(C#a)',

+            operator: '++')),

+    const Test.clazz(

+        '''

+        class C {

+          var a;

+          m() => a--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_POSTFIX,

+            operator: '--',

+            getter: 'Selector(getter, a, arity=0)',

+            setter: 'Selector(setter, a, arity=1)')),

+    const Test.clazz(

+        '''

+        class C {

+          var a = 0;

+          m() => this.a++;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_THIS_PROPERTY_POSTFIX,

+            operator: '++',

+            getter: 'Selector(getter, a, arity=0)',

+            setter: 'Selector(setter, a, arity=1)')),

+    const Test.clazz(

+        '''

+        class B {

+          var a = 0;

+        }

+        class C extends B {

+          m() => super.a--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_FIELD_POSTFIX,

+            element: 'field(B#a)', operator: '--')),

+    const Test.clazz(

+        '''

+        class B {

+          final a = 0;

+        }

+        class C extends B {

+          m() => super.a--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_POSTFIX,

+            element: 'field(B#a)', operator: '--')),

+    const Test.clazz(

+        '''

+        class B {

+          get a => 0;

+          set a (_) {}

+        }

+        class C extends B {

+          m() => super.a--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_POSTFIX,

+            getter: 'getter(B#a)', setter: 'setter(B#a)',

+            operator: '--')),

+    const Test.clazz(

+        '''

+        class A {

+          get a => 0;

+        }

+        class B extends A {

+          set a (_) {}

+        }

+        class C extends B {

+          m() => super.a++;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_POSTFIX,

+            getter: 'getter(A#a)', setter: 'setter(B#a)',

+            operator: '++')),

+    const Test.clazz(

+        '''

+        class A {

+          var a;

+        }

+        class B extends A {

+          get a => 0;

+        }

+

+        class C extends B {

+          m() => super.a--;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_POSTFIX,

+            getter: 'getter(B#a)', setter: 'field(A#a)',

+            operator: '--')),

+    const Test.clazz(

+        '''

+        class A {

+          var a;

+        }

+        class B extends A {

+          set a(_) {}

+        }

+

+        class C extends B {

+          m() => super.a++;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_POSTFIX,

+            getter: 'field(A#a)', setter: 'setter(B#a)',

+            operator: '++')),

+    const Test.clazz(

+        '''

+        class B {

+          a() {}

+        }

+        class C extends B {

+          m() => super.a++;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_SUPER_METHOD_POSTFIX,

+            element: 'function(B#a)',

+            operator: '++')),

+    const Test.clazz(

+        '''

+        class B {

+        }

+        class C extends B {

+          m() => super.a++;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_POSTFIX,

+            operator: '++')),

+    const Test.clazz(

+        '''

+        class B {

+          set a(_) {}

+        }

+        class C extends B {

+          m() => super.a++;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_POSTFIX,

+            setter: 'setter(B#a)', operator: '++')),

+    const Test.clazz(

+        '''

+        class B {

+          get a => 42;

+        }

+        class C extends B {

+          m() => super.a++;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_POSTFIX,

+            getter: 'getter(B#a)', operator: '++')),

+

+    const Test.clazz(

+        '''

+        class C {

+          static set a(var value) { }

+          m() => a++;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_STATIC_GETTER_POSTFIX,

+            setter: 'setter(C#a)', operator: '++')),

+

+    const Test.clazz(

+        '''

+        class C {

+          static get a => 42;

+          m() => C.a++;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_STATIC_SETTER_POSTFIX,

+            getter: 'getter(C#a)', operator: '++')),

+

+    const Test.clazz(

+        '''

+        class C {

+          static final a = 42;

+          m() => C.a++;

+        }

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_FINAL_FIELD_POSTFIX,

+            element: 'field(C#a)', operator: '++')),

+

+    const Test(

+        '''

+        class C {

+          static a(var value) { }

+        }

+        m() => C.a++;

+        ''',

+        const Visit(VisitKind.VISIT_STATIC_METHOD_POSTFIX,

+            element: 'function(C#a)', operator: '++')),

+

+    const Test(

+        '''

+        set a(var value) { }

+        m() => a++;

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_GETTER_POSTFIX,

+            setter: 'setter(a)', operator: '++')),

+

+    const Test(

+        '''

+        get a => 42;

+        m() => a++;

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_SETTER_POSTFIX,

+            getter: 'getter(a)', operator: '++')),

+

+    const Test(

+        '''

+        a(var value) { }

+        m() => a++;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_POSTFIX,

+            element: 'function(a)', operator: '++')),

+

+    const Test(

+        '''

+        final a = 42;

+        m() => a++;

+        ''',

+        const Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_POSTFIX,

+            element: 'field(a)', operator: '++')),

+

+    const Test(

+        '''

+        m() => unresolved++;

+        ''',

+        const Visit(VisitKind.VISIT_UNRESOLVED_POSTFIX,

+            operator: '++')),

+  ],

+  'Constructor invocations': const [

+    const Test(

+        '''

+        class Class {

+          const Class(a, b);

+        }

+        m() => const Class(true, 42);

+        ''',

+        const Visit(VisitKind.VISIT_CONST_CONSTRUCTOR_INVOKE,

+            constant: 'const Class(true, 42)')),

+    const Test(

+        '''

+        class Class {}

+        m() => new Class();

+        ''',

+        const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE,

+            element: 'generative_constructor(Class#)',

+            arguments: '()',

+            type: 'Class',

+            selector: 'CallStructure(arity=0)')),

+    const Test(

+        '''

+        class Class {

+          Class(a, b);

+        }

+        m() => new Class(true, 42);

+        ''',

+        const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE,

+            element: 'generative_constructor(Class#)',

+            arguments: '(true,42)',

+            type: 'Class',

+            selector: 'CallStructure(arity=2)')),

+    const Test(

+        '''

+        class Class {

+          Class.named(a, b);

+        }

+        m() => new Class.named(true, 42);

+        ''',

+        const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE,

+            element: 'generative_constructor(Class#named)',

+            arguments: '(true,42)',

+            type: 'Class',

+            selector: 'CallStructure(arity=2)')),

+    const Test(

+        '''

+        class Class {

+          Class(a, b) : this._(a, b);

+          Class._(a, b);

+        }

+        m() => new Class(true, 42);

+        ''',

+        const Visit(VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_INVOKE,

+            element: 'generative_constructor(Class#)',

+            arguments: '(true,42)',

+            type: 'Class',

+            selector: 'CallStructure(arity=2)')),

+    const Test(

+        '''

+        class Class {

+          factory Class(a, b) => new Class._(a, b);

+          Class._(a, b);

+        }

+        m() => new Class(true, 42);

+        ''',

+        const Visit(VisitKind.VISIT_FACTORY_CONSTRUCTOR_INVOKE,

+            element: 'function(Class#)',

+            arguments: '(true,42)',

+            type: 'Class',

+            selector: 'CallStructure(arity=2)')),

+    const Test(

+        '''

+        class Class<T> {

+          factory Class(a, b) = Class<int>.a;

+          factory Class.a(a, b) = Class<Class<T>>.b;

+          Class.b(a, b);

+        }

+        m() => new Class<double>(true, 42);

+        ''',

+        const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

+            element: 'function(Class#)',

+            arguments: '(true,42)',

+            type: 'Class<double>',

+            target: 'generative_constructor(Class#b)',

+            targetType: 'Class<Class<int>>',

+            selector: 'CallStructure(arity=2)')),

+    const Test(

+        '''

+        class Class {

+          Class(a, b);

+        }

+        m() => new Class.unresolved(true, 42);

+        ''',

+        const Visit(

+            VisitKind.VISIT_UNRESOLVED_CONSTRUCTOR_INVOKE,

+            arguments: '(true,42)')),

+    const Test(

+        '''

+        m() => new Unresolved(true, 42);

+        ''',

+        const Visit(

+            VisitKind.VISIT_UNRESOLVED_CLASS_CONSTRUCTOR_INVOKE,

+            arguments: '(true,42)')),

+    const Test(

+        '''

+        abstract class AbstractClass {}

+        m() => new AbstractClass();

+        ''',

+        const Visit(

+            VisitKind.VISIT_ABSTRACT_CLASS_CONSTRUCTOR_INVOKE,

+            element: 'generative_constructor(AbstractClass#)',

+            type: 'AbstractClass',

+            arguments: '()',

+            selector: 'CallStructure(arity=0)')),

+    const Test(

+        '''

+        class Class {

+          factory Class(a, b) = Unresolved;

+        }

+        m() => new Class(true, 42);

+        ''',

+        const Visit(

+            VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

+            element: 'function(Class#)',

+            arguments: '(true,42)',

+            type: 'Class',

+            selector: 'CallStructure(arity=2)')),

+    const Test(

+        '''

+        class Class {

+          factory Class(a, b) = Class.named;

+        }

+        m() => new Class(true, 42);

+        ''',

+        const Visit(

+            VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

+            element: 'function(Class#)',

+            arguments: '(true,42)',

+            type: 'Class',

+            selector: 'CallStructure(arity=2)')),

+    const Test(

+        '''

+        class Class {

+          factory Class(a, b) = Class.named;

+          factory Class.named(a, b) = Class.unresolved;

+        }

+        m() => new Class(true, 42);

+        ''',

+        const Visit(

+            VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

+            element: 'function(Class#)',

+            arguments: '(true,42)',

+            type: 'Class',

+            selector: 'CallStructure(arity=2)')),

+    const Test(

+        '''

+        abstract class AbstractClass {

+          AbstractClass(a, b);

+        }

+        class Class {

+          factory Class(a, b) = AbstractClass;

+        }

+        m() => new Class(true, 42);

+        ''',

+        const Visit(

+            VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

+            element: 'function(Class#)',

+            arguments: '(true,42)',

+            type: 'Class',

+            selector: 'CallStructure(arity=2)')),

+  ],

+};

diff --git a/tests/compiler/dart2js/semantic_visitor_test_send_visitor.dart b/tests/compiler/dart2js/semantic_visitor_test_send_visitor.dart
new file mode 100644
index 0000000..f5a3953
--- /dev/null
+++ b/tests/compiler/dart2js/semantic_visitor_test_send_visitor.dart
@@ -0,0 +1,2720 @@
+// 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.

+

+part of dart2js.semantics_visitor_test;

+

+class SemanticSendTestVisitor extends SemanticTestVisitor {

+

+  SemanticSendTestVisitor(TreeElements elements) : super(elements);

+

+  @override

+  visitAs(

+      Send node,

+      Node expression,

+      DartType type,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_AS,

+        expression: expression, type: type));

+    apply(expression, arg);

+  }

+

+  @override

+  visitAssert(

+      Send node,

+      Node expression,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_ASSERT, expression: expression));

+    apply(expression, arg);

+  }

+

+  @override

+  visitBinary(

+      Send node,

+      Node left,

+      BinaryOperator operator,

+      Node right,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_BINARY,

+        left: left, operator: operator, right: right));

+    apply(left, arg);

+    apply(right, arg);

+  }

+

+  @override

+  visitIndex(

+      Send node,

+      Node receiver,

+      Node index,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_INDEX,

+        receiver: receiver, index: index));

+    apply(receiver, arg);

+    apply(index, arg);

+  }

+

+  @override

+  visitClassTypeLiteralGet(

+      Send node,

+      ConstantExpression constant,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_GET,

+        constant: constant.getText()));

+  }

+

+  @override

+  visitClassTypeLiteralInvoke(

+      Send node,

+      ConstantExpression constant,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_INVOKE,

+        constant: constant.getText(), arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitClassTypeLiteralSet(

+      SendSet node,

+      ConstantExpression constant,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_INVOKE,

+        constant: constant.getText(), rhs: rhs));

+    super.visitClassTypeLiteralSet(node, constant, rhs, arg);

+  }

+

+  @override

+  visitNotEquals(

+      Send node,

+      Node left,

+      Node right,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_NOT_EQUALS,

+        left: left, right: right));

+    apply(left, arg);

+    apply(right, arg);

+  }

+

+  @override

+  visitDynamicPropertyPrefix(

+      Send node,

+      Node receiver,

+      IncDecOperator operator,

+      Selector getterSelector,

+      Selector setterSelector,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_PREFIX,

+        receiver: receiver, operator: operator,

+        getter: getterSelector, setter: setterSelector));

+    apply(receiver, arg);

+  }

+

+  @override

+  visitDynamicPropertyPostfix(

+      Send node,

+      Node receiver,

+      IncDecOperator operator,

+      Selector getterSelector,

+      Selector setterSelector,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_POSTFIX,

+        receiver: receiver, operator: operator,

+        getter: getterSelector, setter: setterSelector));

+    apply(receiver, arg);

+  }

+

+  @override

+  visitDynamicPropertyGet(

+      Send node,

+      Node receiver,

+      Selector selector,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_GET,

+        receiver: receiver, name: selector.name));

+    apply(receiver, arg);

+  }

+

+  @override

+  visitDynamicPropertyInvoke(

+      Send node,

+      Node receiver,

+      NodeList arguments,

+      Selector selector,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_INVOKE,

+        receiver: receiver, name: selector.name, arguments: arguments));

+    apply(receiver, arg);

+    apply(arguments, arg);

+  }

+

+  @override

+  visitDynamicPropertySet(

+      SendSet node,

+      Node receiver,

+      Selector selector,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_SET,

+        receiver: receiver, name: selector.name, rhs: rhs));

+    super.visitDynamicPropertySet(node, receiver, selector, rhs, arg);

+  }

+

+  @override

+  visitDynamicTypeLiteralGet(

+      Send node,

+      ConstantExpression constant,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_GET,

+        constant: constant.getText()));

+  }

+

+  @override

+  visitDynamicTypeLiteralInvoke(

+      Send node,

+      ConstantExpression constant,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_INVOKE,

+        constant: constant.getText(), arguments: arguments));

+  }

+

+  @override

+  visitDynamicTypeLiteralSet(

+      Send node,

+      ConstantExpression constant,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_SET,

+        rhs: rhs));

+    super.visitDynamicTypeLiteralSet(node, constant, rhs, arg);

+  }

+

+  @override

+  visitExpressionInvoke(

+      Send node,

+      Node expression,

+      NodeList arguments,

+      Selector selector,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_EXPRESSION_INVOKE,

+        receiver: expression, arguments: arguments));

+  }

+

+  @override

+  visitIs(

+      Send node,

+      Node expression,

+      DartType 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) {

+    visits.add(new Visit(VisitKind.VISIT_IS_NOT,

+        expression: expression, type: type));

+    apply(expression, arg);

+  }

+

+  @override

+  visitLogicalAnd(

+      Send node,

+      Node left,

+      Node right,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOGICAL_AND,

+        left: left, right: right));

+    apply(left, arg);

+    apply(right, arg);

+  }

+

+  @override

+  visitLogicalOr(

+      Send node,

+      Node left,

+      Node right,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOGICAL_OR,

+        left: left, right: right));

+    apply(left, arg);

+    apply(right, arg);

+  }

+

+  @override

+  visitLocalFunctionGet(

+      Send node,

+      LocalFunctionElement function,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOCAL_FUNCTION_GET,

+                         element: function));

+  }

+

+  @override

+  visitLocalFunctionSet(

+      SendSet node,

+      LocalFunctionElement function,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOCAL_FUNCTION_SET,

+        element: function, rhs: rhs));

+    super.visitLocalFunctionSet(node, function, rhs, arg);

+  }

+

+  @override

+  visitLocalFunctionInvoke(

+      Send node,

+      LocalFunctionElement function,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOCAL_FUNCTION_INVOKE,

+        element: function, arguments: arguments, selector: callStructure));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitLocalVariableGet(

+      Send node,

+      LocalVariableElement variable,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOCAL_VARIABLE_GET,

+                         element: variable));

+  }

+

+  @override

+  visitLocalVariableInvoke(

+      Send node,

+      LocalVariableElement variable,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOCAL_VARIABLE_INVOKE,

+        element: variable, arguments: arguments, selector: callStructure));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitLocalVariableSet(

+      SendSet node,

+      LocalVariableElement variable,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOCAL_VARIABLE_SET,

+        element: variable, rhs: rhs));

+    super.visitLocalVariableSet(node, variable, rhs, arg);

+  }

+

+  @override

+  visitFinalLocalVariableSet(

+      SendSet node,

+      LocalVariableElement variable,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_SET,

+        element: variable, rhs: rhs));

+    super.visitFinalLocalVariableSet(node, variable, rhs, arg);

+  }

+

+  @override

+  visitParameterGet(

+      Send node,

+      ParameterElement parameter,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_PARAMETER_GET, element: parameter));

+  }

+

+  @override

+  visitParameterInvoke(

+      Send node,

+      ParameterElement parameter,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_PARAMETER_INVOKE,

+        element: parameter, arguments: arguments, selector: callStructure));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitParameterSet(

+      SendSet node,

+      ParameterElement parameter,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_PARAMETER_SET,

+                         element: parameter, rhs: rhs));

+    super.visitParameterSet(node, parameter, rhs, arg);

+  }

+

+  @override

+  visitFinalParameterSet(

+      SendSet node,

+      ParameterElement parameter,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_FINAL_PARAMETER_SET,

+                         element: parameter, rhs: rhs));

+    super.visitFinalParameterSet(node, parameter, rhs, arg);

+  }

+

+  @override

+  visitStaticFieldGet(

+      Send node,

+      FieldElement field,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_GET, element: field));

+  }

+

+  @override

+  visitStaticFieldInvoke(

+      Send node,

+      FieldElement field,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE,

+        element: field, arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitStaticFieldSet(

+      SendSet node,

+      FieldElement field,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_SET,

+        element: field, rhs: rhs));

+    super.visitStaticFieldSet(node, field, rhs, arg);

+  }

+

+  @override

+  visitFinalStaticFieldSet(

+      SendSet node,

+      FieldElement field,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_FINAL_STATIC_FIELD_SET,

+        element: field, rhs: rhs));

+    super.visitFinalStaticFieldSet(node, field, rhs, arg);

+  }

+

+  @override

+  visitStaticFunctionGet(

+      Send node,

+      MethodElement function,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_FUNCTION_GET,

+        element: function));

+  }

+

+  @override

+  visitStaticFunctionSet(

+      SendSet node,

+      MethodElement function,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_FUNCTION_SET,

+        element: function, rhs: rhs));

+    super.visitStaticFunctionSet(node, function, rhs, arg);

+  }

+

+  @override

+  visitStaticFunctionInvoke(

+      Send node,

+      MethodElement function,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_FUNCTION_INVOKE,

+        element: function, arguments: arguments));

+    super.visitStaticFunctionInvoke(

+        node, function, arguments, callStructure, arg);

+  }

+

+  @override

+  visitStaticFunctionIncompatibleInvoke(

+      Send node,

+      MethodElement function,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_FUNCTION_INCOMPATIBLE_INVOKE,

+        element: function, arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitStaticGetterGet(

+      Send node,

+      FunctionElement getter,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_GETTER_GET,

+        element: getter));

+    super.visitStaticGetterGet(node, getter, arg);

+  }

+

+  @override

+  visitStaticGetterSet(

+      SendSet node,

+      MethodElement getter,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_GETTER_SET,

+        element: getter, rhs: rhs));

+    super.visitStaticGetterSet(node, getter, rhs, arg);

+  }

+

+  @override

+  visitStaticGetterInvoke(

+      Send node,

+      FunctionElement getter,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE,

+        element: getter, arguments: arguments));

+    super.visitStaticGetterInvoke(node, getter, arguments, callStructure, arg);

+  }

+

+  @override

+  visitStaticSetterInvoke(

+      Send node,

+      FunctionElement setter,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_SETTER_INVOKE,

+        element: setter, arguments: arguments));

+    super.visitStaticSetterInvoke(node, setter, arguments, callStructure, arg);

+  }

+

+  @override

+  visitStaticSetterGet(

+      Send node,

+      FunctionElement getter,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_SETTER_GET,

+        element: getter));

+    super.visitStaticSetterGet(node, getter, arg);

+  }

+

+  @override

+  visitStaticSetterSet(

+      SendSet node,

+      FunctionElement setter,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_SETTER_SET,

+        element: setter, rhs: rhs));

+    super.visitStaticSetterSet(node, setter, rhs, arg);

+  }

+

+  @override

+  visitSuperBinary(

+      Send node,

+      FunctionElement function,

+      BinaryOperator operator,

+      Node argument,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_BINARY,

+        element: function, operator: operator, right: argument));

+    apply(argument, arg);

+  }

+

+  @override

+  visitUnresolvedSuperBinary(

+      Send node,

+      Element element,

+      BinaryOperator operator,

+      Node argument,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_BINARY,

+        operator: operator, right: argument));

+    apply(argument, arg);

+  }

+

+  @override

+  visitSuperIndex(

+      Send node,

+      FunctionElement function,

+      Node index,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_INDEX,

+            element: function, index: index));

+    apply(index, arg);

+  }

+

+  @override

+  visitUnresolvedSuperIndex(

+      Send node,

+      Element element,

+      Node index,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX,

+        index: index));

+    apply(index, arg);

+  }

+

+  @override

+  visitSuperNotEquals(

+      Send node,

+      FunctionElement function,

+      Node argument,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_NOT_EQUALS,

+            element: function, right: argument));

+    apply(argument, arg);

+  }

+

+  @override

+  visitThisGet(Identifier node, arg) {

+    visits.add(new Visit(VisitKind.VISIT_THIS_GET));

+  }

+

+  @override

+  visitThisInvoke(

+      Send node,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_THIS_INVOKE, arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitThisPropertyGet(

+      Send node,

+      Selector selector,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_THIS_PROPERTY_GET,

+                         name: selector.name));

+  }

+

+  @override

+  visitThisPropertyInvoke(

+      Send node,

+      NodeList arguments,

+      Selector selector,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_THIS_PROPERTY_INVOKE,

+                         name: selector.name, arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitThisPropertySet(

+      SendSet node,

+      Selector selector,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_THIS_PROPERTY_SET,

+                         name: selector.name, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitTopLevelFieldGet(

+      Send node,

+      FieldElement field,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_GET, element: field));

+  }

+

+  @override

+  visitTopLevelFieldInvoke(

+      Send node,

+      FieldElement field,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_INVOKE,

+        element: field, arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitTopLevelFieldSet(

+      SendSet node,

+      FieldElement field,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_SET,

+        element: field, rhs: rhs));

+    super.visitTopLevelFieldSet(node, field, rhs, arg);

+  }

+

+  @override

+  visitFinalTopLevelFieldSet(

+      SendSet node,

+      FieldElement field,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_FINAL_TOP_LEVEL_FIELD_SET,

+        element: field, rhs: rhs));

+    super.visitFinalTopLevelFieldSet(node, field, rhs, arg);

+  }

+

+  @override

+  visitTopLevelFunctionGet(

+      Send node,

+      MethodElement function,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_GET,

+        element: function));

+  }

+

+  @override

+  visitTopLevelFunctionSet(

+      SendSet node,

+      MethodElement function,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_SET,

+        element: function, rhs: rhs));

+    super.visitTopLevelFunctionSet(node, function, rhs, arg);

+  }

+

+  @override

+  visitTopLevelFunctionInvoke(

+      Send node,

+      MethodElement function,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INVOKE,

+        element: function, arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitTopLevelFunctionIncompatibleInvoke(

+      Send node,

+      MethodElement function,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_INCOMPATIBLE_INVOKE,

+        element: function, arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitTopLevelGetterGet(

+      Send node,

+      FunctionElement getter,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_GET,

+        element: getter));

+    super.visitTopLevelGetterGet(node, getter, arg);

+  }

+

+  @override

+  visitTopLevelSetterGet(

+      Send node,

+      FunctionElement setter,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_GET,

+        element: setter));

+    super.visitTopLevelSetterGet(node, setter, arg);

+  }

+

+  @override

+  visitTopLevelGetterInvoke(

+      Send node,

+      FunctionElement getter,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_INVOKE,

+        element: getter, arguments: arguments));

+    super.visitTopLevelGetterInvoke(

+        node, getter, arguments, callStructure, arg);

+  }

+

+  @override

+  visitTopLevelSetterInvoke(

+      Send node,

+      FunctionElement setter,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_INVOKE,

+        element: setter, arguments: arguments));

+    super.visitTopLevelSetterInvoke(

+        node, setter, arguments, callStructure, arg);

+  }

+

+  @override

+  visitTopLevelGetterSet(

+      SendSet node,

+      FunctionElement getter,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SET,

+        element: getter, rhs: rhs));

+    super.visitTopLevelGetterSet(node, getter, rhs, arg);

+  }

+

+  @override

+  visitTopLevelSetterSet(

+      SendSet node,

+      FunctionElement setter,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_SET,

+        element: setter, rhs: rhs));

+    super.visitTopLevelSetterSet(node, setter, rhs, arg);

+  }

+

+  @override

+  visitTypeVariableTypeLiteralGet(

+      Send node,

+      TypeVariableElement element,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_GET,

+        element: element));

+  }

+

+  @override

+  visitTypeVariableTypeLiteralInvoke(

+      Send node,

+      TypeVariableElement element,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_INVOKE,

+        element: element, arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitTypeVariableTypeLiteralSet(

+      SendSet node,

+      TypeVariableElement element,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_SET,

+        element: element, rhs: rhs));

+    super.visitTypeVariableTypeLiteralSet(node, element, rhs, arg);

+  }

+

+  @override

+  visitTypedefTypeLiteralGet(

+      Send node,

+      ConstantExpression constant,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_GET,

+        constant: constant.getText()));

+  }

+

+  @override

+  visitTypedefTypeLiteralInvoke(

+      Send node,

+      ConstantExpression constant,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_INVOKE,

+        constant: constant.getText(), arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitTypedefTypeLiteralSet(

+      SendSet node,

+      ConstantExpression constant,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_SET,

+        constant: constant.getText(), rhs: rhs));

+    super.visitTypedefTypeLiteralSet(node, constant, rhs, arg);

+  }

+

+  @override

+  visitUnary(

+      Send node,

+      UnaryOperator operator,

+      Node expression,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNARY,

+        expression: expression, operator: operator));

+    apply(expression, arg);

+  }

+

+  @override

+  visitNot(

+      Send node,

+      Node expression,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_NOT, expression: expression));

+    apply(expression, arg);

+  }

+

+  @override

+  visitSuperFieldGet(

+      Send node,

+      FieldElement field,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_GET, element: field));

+  }

+

+  @override

+  visitUnresolvedSuperGet(

+      Send node,

+      Element element,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GET));

+  }

+

+  @override

+  visitSuperFieldInvoke(

+      Send node,

+      FieldElement field,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_INVOKE,

+        element: field, arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitUnresolvedSuperInvoke(

+      Send node,

+      Element element,

+      NodeList arguments,

+      Selector selector,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INVOKE,

+        arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitSuperFieldSet(

+      SendSet node,

+      FieldElement field,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_SET,

+        element: field, rhs: rhs));

+    super.visitSuperFieldSet(node, field, rhs, arg);

+  }

+

+  @override

+  visitFinalSuperFieldSet(

+      SendSet node,

+      FieldElement field,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_FINAL_SUPER_FIELD_SET,

+        element: field, rhs: rhs));

+    super.visitFinalSuperFieldSet(node, field, rhs, arg);

+  }

+

+  @override

+  visitSuperMethodGet(

+      Send node,

+      MethodElement method,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_GET, element: method));

+  }

+

+  @override

+  visitSuperMethodSet(

+      SendSet node,

+      MethodElement method,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_SET,

+        element: method, rhs: rhs));

+    super.visitSuperMethodSet(node, method, rhs, arg);

+  }

+

+  @override

+  visitSuperMethodInvoke(

+      Send node,

+      MethodElement method,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_INVOKE,

+        element: method, arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitSuperMethodIncompatibleInvoke(

+      Send node,

+      MethodElement method,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_INCOMPATIBLE_INVOKE,

+        element: method, arguments: arguments));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitSuperGetterGet(

+      Send node,

+      FunctionElement getter,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_GET, element: getter));

+    super.visitSuperGetterGet(node, getter, arg);

+  }

+

+  @override

+  visitSuperSetterGet(

+      Send node,

+      FunctionElement setter,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_SETTER_GET, element: setter));

+    super.visitSuperSetterGet(node, setter, arg);

+  }

+

+  @override

+  visitSuperGetterInvoke(

+      Send node,

+      FunctionElement getter,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_INVOKE,

+        element: getter, arguments: arguments));

+    super.visitSuperGetterInvoke(node, getter, arguments, callStructure, arg);

+  }

+

+  @override

+  visitSuperSetterInvoke(

+      Send node,

+      FunctionElement setter,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_SETTER_INVOKE,

+        element: setter, arguments: arguments));

+    super.visitSuperSetterInvoke(node, setter, arguments, callStructure, arg);

+  }

+

+  @override

+  visitSuperGetterSet(

+      SendSet node,

+      FunctionElement getter,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_SET,

+        element: getter, rhs: rhs));

+    super.visitSuperGetterSet(node, getter, rhs, arg);

+  }

+

+  @override

+  visitSuperSetterSet(

+      SendSet node,

+      FunctionElement setter,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_SETTER_SET,

+        element: setter, rhs: rhs));

+    super.visitSuperSetterSet(node, setter, rhs, arg);

+  }

+

+  @override

+  visitSuperUnary(

+      Send node,

+      UnaryOperator operator,

+      FunctionElement function,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_UNARY,

+        element: function, operator: operator));

+  }

+

+  @override

+  visitUnresolvedSuperUnary(

+      Send node,

+      UnaryOperator operator,

+      Element element,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_UNARY,

+        operator: operator));

+  }

+

+  @override

+  visitEquals(

+      Send node,

+      Node left,

+      Node right,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_EQUALS, left: left, right: right));

+    apply(left, arg);

+    apply(right, arg);

+  }

+

+  @override

+  visitSuperEquals(

+      Send node,

+      FunctionElement function,

+      Node argument,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_EQUALS,

+        element: function, right: argument));

+    apply(argument, arg);

+  }

+

+  @override

+  visitIndexSet(

+      Send node,

+      Node receiver,

+      Node index,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_INDEX_SET,

+        receiver: receiver, index: index, rhs: rhs));

+    apply(receiver, arg);

+    apply(index, arg);

+    apply(rhs, arg);

+  }

+

+  @override

+  visitSuperIndexSet(

+      Send node,

+      FunctionElement function,

+      Node index,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_INDEX_SET,

+        element: function, index: index, rhs: rhs));

+    apply(index, arg);

+    apply(rhs, arg);

+  }

+

+  @override

+  visitDynamicPropertyCompound(

+      Send node,

+      Node receiver,

+      AssignmentOperator operator,

+      Node rhs,

+      Selector getterSelector,

+      Selector setterSelector,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_COMPOUND,

+        receiver: receiver, operator: operator, rhs: rhs,

+        getter: getterSelector, setter: setterSelector));

+    apply(receiver, arg);

+    apply(rhs, arg);

+  }

+

+  @override

+  visitFinalLocalVariableCompound(

+      Send node,

+      LocalVariableElement variable,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_COMPOUND,

+        element: variable, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitFinalLocalVariablePrefix(

+      Send node,

+      LocalVariableElement variable,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_PREFIX,

+        element: variable, operator: operator));

+  }

+

+  @override

+  visitFinalLocalVariablePostfix(

+      Send node,

+      LocalVariableElement variable,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_FINAL_LOCAL_VARIABLE_POSTFIX,

+        element: variable, operator: operator));

+  }

+

+  @override

+  visitFinalParameterCompound(

+      Send node,

+      ParameterElement parameter,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_FINAL_PARAMETER_COMPOUND,

+        element: parameter, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitFinalParameterPrefix(

+      Send node,

+      ParameterElement parameter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_FINAL_PARAMETER_PREFIX,

+        element: parameter, operator: operator));

+  }

+

+  @override

+  visitFinalParameterPostfix(

+      Send node,

+      ParameterElement parameter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_FINAL_PARAMETER_POSTFIX,

+        element: parameter, operator: operator));

+  }

+

+  @override

+  visitFinalStaticFieldCompound(

+      Send node,

+      FieldElement field,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_FINAL_FIELD_COMPOUND,

+        element: field, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitFinalStaticFieldPostfix(

+      Send node,

+      FieldElement field,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_FINAL_FIELD_POSTFIX,

+        element: field, operator: operator));

+  }

+

+  @override

+  visitFinalStaticFieldPrefix(

+      Send node,

+      FieldElement field,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_FINAL_FIELD_PREFIX,

+        element: field, operator: operator));

+  }

+

+  @override

+  visitFinalSuperFieldCompound(

+      Send node,

+      FieldElement field,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_COMPOUND,

+        element: field, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitFinalTopLevelFieldCompound(

+      Send node,

+      FieldElement field,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_COMPOUND,

+        element: field, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitFinalTopLevelFieldPostfix(

+      Send node,

+      FieldElement field,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_POSTFIX,

+        element: field, operator: operator));

+  }

+

+  @override

+  visitFinalTopLevelFieldPrefix(

+      Send node,

+      FieldElement field,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FINAL_FIELD_PREFIX,

+        element: field, operator: operator));

+  }

+

+  @override

+  visitLocalFunctionCompound(

+      Send node,

+      LocalFunctionElement function,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOCAL_FUNCTION_COMPOUND,

+        element: function, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitLocalVariableCompound(

+      Send node,

+      LocalVariableElement variable,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOCAL_VARIABLE_COMPOUND,

+        element: variable, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitParameterCompound(

+      Send node,

+      ParameterElement parameter,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_PARAMETER_COMPOUND,

+        element: parameter, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitStaticFieldCompound(

+      Send node,

+      FieldElement field,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_COMPOUND,

+        element: field, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitStaticGetterSetterCompound(

+      Send node,

+      FunctionElement getter,

+      FunctionElement setter,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_COMPOUND,

+        operator: operator, rhs: rhs,

+        getter: getter, setter: setter));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitSuperFieldCompound(

+      Send node,

+      FieldElement field,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_COMPOUND,

+        element: field, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitSuperGetterSetterCompound(

+      Send node,

+      FunctionElement getter,

+      FunctionElement setter,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_COMPOUND,

+        operator: operator, rhs: rhs,

+        getter: getter, setter: setter));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitThisPropertyCompound(

+      Send node,

+      AssignmentOperator operator,

+      Node rhs,

+      Selector getterSelector,

+      Selector setterSelector,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_THIS_PROPERTY_COMPOUND,

+        operator: operator, rhs: rhs,

+        getter: getterSelector, setter: setterSelector));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitTopLevelFieldCompound(

+      Send node,

+      FieldElement field,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_COMPOUND,

+        element: field, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitTopLevelGetterSetterCompound(

+      Send node,

+      FunctionElement getter,

+      FunctionElement setter,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_COMPOUND,

+        operator: operator, rhs: rhs,

+        getter: getter, setter: setter));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitStaticMethodSetterCompound(

+      Send node,

+      FunctionElement method,

+      FunctionElement setter,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_METHOD_SETTER_COMPOUND,

+        operator: operator, rhs: rhs,

+        getter: method, setter: setter));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitSuperFieldSetterCompound(

+      Send node,

+      FieldElement field,

+      FunctionElement setter,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_COMPOUND,

+        operator: operator, rhs: rhs,

+        getter: field, setter: setter));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitSuperGetterFieldCompound(

+      Send node,

+      FunctionElement getter,

+      FieldElement field,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_COMPOUND,

+        operator: operator, rhs: rhs,

+        getter: getter, setter: field));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitSuperMethodSetterCompound(

+      Send node,

+      FunctionElement method,

+      FunctionElement setter,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_SETTER_COMPOUND,

+        getter: method, setter: setter, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitSuperMethodCompound(

+      Send node,

+      FunctionElement method,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_COMPOUND,

+        element: method, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitSuperMethodPrefix(

+      Send node,

+      FunctionElement method,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_PREFIX,

+        element: method, operator: operator));

+  }

+

+  @override

+  visitSuperMethodPostfix(

+      Send node,

+      FunctionElement method,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_POSTFIX,

+        element: method, operator: operator));

+  }

+

+  @override

+  visitUnresolvedSuperCompound(

+      Send node,

+      Element element,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_COMPOUND,

+        operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitUnresolvedSuperPrefix(

+      Send node,

+      Element element,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_PREFIX,

+        operator: operator));

+  }

+

+  @override

+  visitUnresolvedSuperPostfix(

+      Send node,

+      Element element,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_POSTFIX,

+        operator: operator));

+  }

+

+  @override

+  visitTopLevelMethodSetterCompound(

+      Send node,

+      FunctionElement method,

+      FunctionElement setter,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_SETTER_COMPOUND,

+        getter: method, setter: setter, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitCompoundIndexSet(

+      Send node,

+      Node receiver,

+      Node index,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_COMPOUND_INDEX_SET,

+        receiver: receiver, index: index, rhs: rhs, operator: operator));

+    apply(receiver, arg);

+    apply(index, arg);

+    apply(rhs, arg);

+  }

+

+  @override

+  visitSuperCompoundIndexSet(

+      Send node,

+      FunctionElement getter,

+      FunctionElement setter,

+      Node index,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_COMPOUND_INDEX_SET,

+        getter: getter, setter: setter,

+        index: index, rhs: rhs, operator: operator));

+    apply(index, arg);

+    apply(rhs, arg);

+  }

+

+  @override

+  visitClassTypeLiteralCompound(

+      Send node,

+      ConstantExpression constant,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_COMPOUND,

+        constant: constant.getText(), operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitDynamicTypeLiteralCompound(

+      Send node,

+      ConstantExpression constant,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_COMPOUND,

+        constant: constant.getText(), operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitTypeVariableTypeLiteralCompound(

+      Send node,

+      TypeVariableElement element,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_COMPOUND,

+        element: element, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitTypedefTypeLiteralCompound(

+      Send node,

+      ConstantExpression constant,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_COMPOUND,

+        constant: constant.getText(), operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitLocalFunctionPrefix(

+      Send node,

+      LocalFunctionElement function,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOCAL_FUNCTION_PREFIX,

+        element: function, operator: operator));

+  }

+

+  @override

+  visitClassTypeLiteralPrefix(

+      Send node,

+      ConstantExpression constant,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_PREFIX,

+        constant: constant.getText(), operator: operator));

+  }

+

+  @override

+  visitDynamicTypeLiteralPrefix(

+      Send node,

+      ConstantExpression constant,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_PREFIX,

+        constant: constant.getText(), operator: operator));

+  }

+

+  @override

+  visitLocalVariablePrefix(

+      Send node,

+      LocalVariableElement variable,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOCAL_VARIABLE_PREFIX,

+        element: variable, operator: operator));

+  }

+

+  @override

+  visitParameterPrefix(

+      Send node,

+      ParameterElement parameter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_PARAMETER_PREFIX,

+        element: parameter, operator: operator));

+  }

+

+  @override

+  visitStaticFieldPrefix(

+      Send node,

+      FieldElement field,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_PREFIX,

+        element: field, operator: operator));

+  }

+

+  @override

+  visitStaticGetterSetterPrefix(

+      Send node,

+      FunctionElement getter,

+      FunctionElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_PREFIX,

+        getter: getter, setter: setter, operator: operator));

+  }

+

+  @override

+  visitStaticMethodSetterPrefix(

+      Send node,

+      FunctionElement getter,

+      FunctionElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_METHOD_SETTER_PREFIX,

+        getter: getter, setter: setter, operator: operator));

+  }

+

+  @override

+  visitSuperFieldFieldCompound(

+      Send node,

+      FieldElement readField,

+      FieldElement writtenField,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_FIELD_COMPOUND,

+        getter: readField, setter: writtenField, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitSuperFieldFieldPrefix(

+      Send node,

+      FieldElement readField,

+      FieldElement writtenField,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_FIELD_PREFIX,

+        getter: readField, setter: writtenField, operator: operator));

+  }

+

+  @override

+  visitSuperFieldPrefix(

+      Send node,

+      FieldElement field,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_PREFIX,

+        element: field, operator: operator));

+  }

+

+  @override

+  visitFinalSuperFieldPrefix(

+      Send node,

+      FieldElement field,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_PREFIX,

+        element: field, operator: operator));

+  }

+

+  @override

+  visitSuperFieldSetterPrefix(

+      Send node,

+      FieldElement field,

+      FunctionElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_PREFIX,

+        getter: field, setter: setter, operator: operator));

+  }

+

+  @override

+  visitSuperGetterFieldPrefix(

+      Send node,

+      FunctionElement getter,

+      FieldElement field,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_PREFIX,

+        getter: getter, setter: field, operator: operator));

+  }

+

+  @override

+  visitSuperGetterSetterPrefix(

+      Send node,

+      FunctionElement getter,

+      FunctionElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_PREFIX,

+        getter: getter, setter: setter, operator: operator));

+  }

+

+  @override

+  visitSuperMethodSetterPrefix(

+      Send node,

+      FunctionElement method,

+      FunctionElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_SETTER_PREFIX,

+        getter: method, setter: setter, operator: operator));

+  }

+

+  @override

+  visitThisPropertyPrefix(

+      Send node,

+      IncDecOperator operator,

+      Selector getterSelector,

+      Selector setterSelector,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_THIS_PROPERTY_PREFIX,

+        operator: operator,

+        getter: getterSelector, setter: setterSelector));

+  }

+

+  @override

+  visitTopLevelFieldPrefix(

+      Send node,

+      FieldElement field,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_PREFIX,

+        element: field, operator: operator));

+  }

+

+  @override

+  visitTopLevelGetterSetterPrefix(

+      Send node,

+      FunctionElement getter,

+      FunctionElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_PREFIX,

+        getter: getter, setter: setter, operator: operator));

+  }

+

+  @override

+  visitTopLevelMethodSetterPrefix(

+      Send node,

+      FunctionElement method,

+      FunctionElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_SETTER_PREFIX,

+        getter: method, setter: setter, operator: operator));

+  }

+

+  @override

+  visitTypeVariableTypeLiteralPrefix(

+      Send node,

+      TypeVariableElement element,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_PREFIX,

+        element: element, operator: operator));

+  }

+

+  @override

+  visitTypedefTypeLiteralPrefix(

+      Send node,

+      ConstantExpression constant,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_PREFIX,

+        constant: constant.getText(), operator: operator));

+  }

+

+  @override

+  visitLocalFunctionPostfix(

+      Send node,

+      LocalFunctionElement function,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOCAL_FUNCTION_POSTFIX,

+        element: function, operator: operator));

+  }

+

+  @override

+  visitClassTypeLiteralPostfix(

+      Send node,

+      ConstantExpression constant,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_POSTFIX,

+        constant: constant.getText(), operator: operator));

+  }

+

+  @override

+  visitDynamicTypeLiteralPostfix(

+      Send node,

+      ConstantExpression constant,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_DYNAMIC_TYPE_LITERAL_POSTFIX,

+        constant: constant.getText(), operator: operator));

+  }

+

+  @override

+  visitLocalVariablePostfix(

+      Send node,

+      LocalVariableElement variable,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_LOCAL_VARIABLE_POSTFIX,

+        element: variable, operator: operator));

+  }

+

+  @override

+  visitParameterPostfix(

+      Send node,

+      ParameterElement parameter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_PARAMETER_POSTFIX,

+        element: parameter, operator: operator));

+  }

+

+  @override

+  visitStaticFieldPostfix(

+      Send node,

+      FieldElement field,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_POSTFIX,

+        element: field, operator: operator));

+  }

+

+  @override

+  visitStaticGetterSetterPostfix(

+      Send node,

+      FunctionElement getter,

+      FunctionElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_GETTER_SETTER_POSTFIX,

+        getter: getter, setter: setter, operator: operator));

+  }

+

+  @override

+  visitStaticMethodSetterPostfix(

+      Send node,

+      FunctionElement getter,

+      FunctionElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_METHOD_SETTER_POSTFIX,

+        getter: getter, setter: setter, operator: operator));

+  }

+

+  @override

+  visitSuperFieldFieldPostfix(

+      Send node,

+      FieldElement readField,

+      FieldElement writtenField,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_FIELD_POSTFIX,

+        getter: readField, setter: writtenField, operator: operator));

+  }

+

+  @override

+  visitSuperFieldPostfix(

+      Send node,

+      FieldElement field,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_POSTFIX,

+        element: field, operator: operator));

+  }

+

+  @override

+  visitFinalSuperFieldPostfix(

+      Send node,

+      FieldElement field,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_FINAL_FIELD_POSTFIX,

+        element: field, operator: operator));

+  }

+

+  @override

+  visitSuperFieldSetterPostfix(

+      Send node,

+      FieldElement field,

+      FunctionElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_FIELD_SETTER_POSTFIX,

+        getter: field, setter: setter, operator: operator));

+  }

+

+  @override

+  visitSuperGetterFieldPostfix(

+      Send node,

+      FunctionElement getter,

+      FieldElement field,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_FIELD_POSTFIX,

+        getter: getter, setter: field, operator: operator));

+  }

+

+  @override

+  visitSuperGetterSetterPostfix(

+      Send node,

+      FunctionElement getter,

+      FunctionElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_GETTER_SETTER_POSTFIX,

+        getter: getter, setter: setter, operator: operator));

+  }

+

+  @override

+  visitSuperMethodSetterPostfix(

+      Send node,

+      FunctionElement method,

+      FunctionElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_METHOD_SETTER_POSTFIX,

+        getter: method, setter: setter, operator: operator));

+  }

+

+  @override

+  visitThisPropertyPostfix(

+      Send node,

+      IncDecOperator operator,

+      Selector getterSelector,

+      Selector setterSelector,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_THIS_PROPERTY_POSTFIX,

+        operator: operator,

+        getter: getterSelector, setter: setterSelector));

+  }

+

+  @override

+  visitTopLevelFieldPostfix(

+      Send node,

+      FieldElement field,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_POSTFIX,

+        element: field, operator: operator));

+  }

+

+  @override

+  visitTopLevelGetterSetterPostfix(

+      Send node,

+      FunctionElement getter,

+      FunctionElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_SETTER_POSTFIX,

+        getter: getter, setter: setter, operator: operator));

+  }

+

+  @override

+  visitTopLevelMethodSetterPostfix(

+      Send node,

+      FunctionElement method,

+      FunctionElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_SETTER_POSTFIX,

+        getter: method, setter: setter, operator: operator));

+  }

+

+  @override

+  visitTypeVariableTypeLiteralPostfix(

+      Send node,

+      TypeVariableElement element,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TYPE_VARIABLE_TYPE_LITERAL_POSTFIX,

+        element: element, operator: operator));

+  }

+

+  @override

+  visitTypedefTypeLiteralPostfix(

+      Send node,

+      ConstantExpression constant,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_POSTFIX,

+        constant: constant.getText(), operator: operator));

+  }

+

+  @override

+  visitUnresolvedCompound(

+      Send node,

+      ErroneousElement element,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_COMPOUND,

+        operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitUnresolvedGet(

+      Send node,

+      Element element,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_GET, name: element.name));

+  }

+

+  @override

+  visitUnresolvedSet(

+      Send node,

+      Element element,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SET,

+                         name: element.name, rhs: rhs));

+    super.visitUnresolvedSet(node, element, rhs, arg);

+  }

+

+  @override

+  visitUnresolvedInvoke(

+      Send node,

+      Element element,

+      NodeList arguments,

+      Selector selector,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,

+                         name: element.name, arguments: arguments));

+    super.visitUnresolvedInvoke(node, element, arguments, selector, arg);

+  }

+

+  @override

+  visitUnresolvedPostfix(

+      Send node,

+      ErroneousElement element,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_UNRESOLVED_POSTFIX, operator: operator));

+  }

+

+  @override

+  visitUnresolvedPrefix(

+      Send node,

+      ErroneousElement element,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_UNRESOLVED_PREFIX, operator: operator));

+  }

+

+  @override

+  visitUnresolvedSuperCompoundIndexSet(

+      Send node,

+      Element element,

+      Node index,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_UNRESOLVED_SUPER_COMPOUND_INDEX_SET,

+        index: index, operator: operator, rhs: rhs));

+    apply(index, arg);

+    apply(rhs, arg);

+  }

+

+  @override

+  visitUnresolvedSuperGetterCompoundIndexSet(

+      Send node,

+      Element element,

+      MethodElement setter,

+      Node index,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_COMPOUND_INDEX_SET,

+        setter: setter, index: index, operator: operator, rhs: rhs));

+    apply(index, arg);

+    apply(rhs, arg);

+  }

+

+  @override

+  visitUnresolvedSuperSetterCompoundIndexSet(

+      Send node,

+      MethodElement getter,

+      Element element,

+      Node index,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_COMPOUND_INDEX_SET,

+        getter: getter, index: index, operator: operator, rhs: rhs));

+    apply(index, arg);

+    apply(rhs, arg);

+  }

+

+  @override

+  visitUnresolvedSuperIndexSet(

+      Send node,

+      ErroneousElement element,

+      Node index,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_SET,

+               index: index, rhs: rhs));

+    apply(index, arg);

+    apply(rhs, arg);

+  }

+

+  @override

+  visitUnresolvedSuperIndexPostfix(

+      Send node,

+      Element element,

+      Node index,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_POSTFIX,

+               index: index, operator: operator));

+    apply(index, arg);

+  }

+

+  @override

+  visitUnresolvedSuperGetterIndexPostfix(

+      Send node,

+      Element element,

+      MethodElement setter,

+      Node index,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_INDEX_POSTFIX,

+               setter: setter, index: index, operator: operator));

+    apply(index, arg);

+  }

+

+  @override

+  visitUnresolvedSuperSetterIndexPostfix(

+      Send node,

+      MethodElement getter,

+      Element element,

+      Node index,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_POSTFIX,

+               getter: getter, index: index, operator: operator));

+    apply(index, arg);

+  }

+

+  @override

+  visitUnresolvedSuperIndexPrefix(

+      Send node,

+      Element element,

+      Node index,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_PREFIX,

+               index: index, operator: operator));

+    apply(index, arg);

+  }

+

+  @override

+  visitUnresolvedSuperGetterIndexPrefix(

+      Send node,

+      Element element,

+      MethodElement setter,

+      Node index,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_INDEX_PREFIX,

+               setter: setter, index: index, operator: operator));

+    apply(index, arg);

+  }

+

+  @override

+  visitUnresolvedSuperSetterIndexPrefix(

+      Send node,

+      MethodElement getter,

+      Element element,

+      Node index,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_PREFIX,

+               getter: getter, index: index, operator: operator));

+    apply(index, arg);

+  }

+

+  @override

+  visitIndexPostfix(

+      Send node,

+      Node receiver,

+      Node index,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_INDEX_POSTFIX,

+        receiver: receiver, index: index, operator: operator));

+    apply(receiver, arg);

+    apply(index, arg);

+  }

+

+  @override

+  visitIndexPrefix(

+      Send node,

+      Node receiver,

+      Node index,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_INDEX_PREFIX,

+        receiver: receiver, index: index, operator: operator));

+    apply(receiver, arg);

+    apply(index, arg);

+  }

+

+  @override

+  visitSuperIndexPostfix(

+      Send node,

+      FunctionElement indexFunction,

+      FunctionElement indexSetFunction,

+      Node index,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_INDEX_POSTFIX,

+        getter: indexFunction, setter: indexSetFunction,

+        index: index, operator: operator));

+    apply(index, arg);

+  }

+

+  @override

+  visitSuperIndexPrefix(

+      Send node,

+      FunctionElement indexFunction,

+      FunctionElement indexSetFunction,

+      Node index,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_SUPER_INDEX_PREFIX,

+        getter: indexFunction, setter: indexSetFunction,

+        index: index, operator: operator));

+    apply(index, arg);

+  }

+

+  @override

+  visitUnresolvedClassConstructorInvoke(

+      NewExpression node,

+      Element constructor,

+      DartType 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));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitUnresolvedConstructorInvoke(

+      NewExpression node,

+      Element constructor,

+      DartType 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));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitConstConstructorInvoke(

+      NewExpression node,

+      ConstructedConstantExpression constant,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_CONST_CONSTRUCTOR_INVOKE,

+                         constant: constant.getText()));

+  }

+

+  @override

+  visitFactoryConstructorInvoke(

+      NewExpression node,

+      ConstructorElement constructor,

+      InterfaceType type,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_FACTORY_CONSTRUCTOR_INVOKE,

+        element: constructor,

+        type: type,

+        arguments: arguments,

+        selector: callStructure));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitGenerativeConstructorInvoke(

+      NewExpression node,

+      ConstructorElement constructor,

+      InterfaceType type,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE,

+        element: constructor,

+        type: type,

+        arguments: arguments,

+        selector: callStructure));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitRedirectingFactoryConstructorInvoke(

+      NewExpression node,

+      ConstructorElement constructor,

+      InterfaceType type,

+      ConstructorElement effectiveTarget,

+      InterfaceType effectiveTargetType,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

+        element: constructor,

+        type: type,

+        target: effectiveTarget,

+        targetType: effectiveTargetType,

+        arguments: arguments,

+        selector: callStructure));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitRedirectingGenerativeConstructorInvoke(

+      NewExpression node,

+      ConstructorElement constructor,

+      InterfaceType type,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_INVOKE,

+        element: constructor,

+        type: type,

+        arguments: arguments,

+        selector: callStructure));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitAbstractClassConstructorInvoke(

+      NewExpression node,

+      ConstructorElement constructor,

+      InterfaceType type,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_ABSTRACT_CLASS_CONSTRUCTOR_INVOKE,

+        element: constructor,

+        type: type,

+        arguments: arguments,

+        selector: callStructure));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitUnresolvedRedirectingFactoryConstructorInvoke(

+      NewExpression node,

+      ConstructorElement constructor,

+      InterfaceType type,

+      NodeList arguments,

+      CallStructure callStructure,

+      arg) {

+    visits.add(new Visit(

+        VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,

+        element: constructor,

+        type: type,

+        arguments: arguments,

+        selector: callStructure));

+    apply(arguments, arg);

+  }

+

+  @override

+  visitUnresolvedStaticGetterCompound(

+      Send node,

+      Element element,

+      MethodElement setter,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_STATIC_GETTER_COMPOUND,

+        setter: setter, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitUnresolvedTopLevelGetterCompound(

+      Send node,

+      Element element,

+      MethodElement setter,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_GETTER_COMPOUND,

+        setter: setter, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitUnresolvedStaticSetterCompound(

+      Send node,

+      MethodElement getter,

+      Element element,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_STATIC_SETTER_COMPOUND,

+        getter: getter, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitUnresolvedTopLevelSetterCompound(

+      Send node,

+      MethodElement getter,

+      Element element,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_SETTER_COMPOUND,

+        getter: getter, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitStaticMethodCompound(

+      Send node,

+      MethodElement method,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_METHOD_COMPOUND,

+        element: method, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitTopLevelMethodCompound(

+      Send node,

+      MethodElement method,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_COMPOUND,

+        element: method, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitUnresolvedStaticGetterPrefix(

+      Send node,

+      Element element,

+      MethodElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_STATIC_GETTER_PREFIX,

+        setter: setter, operator: operator));

+  }

+

+  @override

+  visitUnresolvedTopLevelGetterPrefix(

+      Send node,

+      Element element,

+      MethodElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_GETTER_PREFIX,

+        setter: setter, operator: operator));

+  }

+

+  @override

+  visitUnresolvedStaticSetterPrefix(

+      Send node,

+      MethodElement getter,

+      Element element,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_STATIC_SETTER_PREFIX,

+        getter: getter, operator: operator));

+  }

+

+  @override

+  visitUnresolvedTopLevelSetterPrefix(

+      Send node,

+      MethodElement getter,

+      Element element,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_SETTER_PREFIX,

+        getter: getter, operator: operator));

+  }

+

+  @override

+  visitStaticMethodPrefix(

+      Send node,

+      MethodElement method,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_METHOD_PREFIX,

+        element: method, operator: operator));

+  }

+

+  @override

+  visitTopLevelMethodPrefix(

+      Send node,

+      MethodElement method,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_PREFIX,

+        element: method, operator: operator));

+  }

+

+  @override

+  visitUnresolvedStaticGetterPostfix(

+      Send node,

+      Element element,

+      MethodElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_STATIC_GETTER_POSTFIX,

+        setter: setter, operator: operator));

+  }

+

+  @override

+  visitUnresolvedTopLevelGetterPostfix(

+      Send node,

+      Element element,

+      MethodElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_GETTER_POSTFIX,

+        setter: setter, operator: operator));

+  }

+

+  @override

+  visitUnresolvedStaticSetterPostfix(

+      Send node,

+      MethodElement getter,

+      Element element,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_STATIC_SETTER_POSTFIX,

+        getter: getter, operator: operator));

+  }

+

+  @override

+  visitUnresolvedTopLevelSetterPostfix(

+      Send node,

+      MethodElement getter,

+      Element element,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_TOP_LEVEL_SETTER_POSTFIX,

+        getter: getter, operator: operator));

+  }

+

+  @override

+  visitStaticMethodPostfix(

+      Send node,

+      MethodElement method,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_STATIC_METHOD_POSTFIX,

+        element: method, operator: operator));

+  }

+

+  @override

+  visitTopLevelMethodPostfix(

+      Send node,

+      MethodElement method,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_METHOD_POSTFIX,

+        element: method, operator: operator));

+  }

+

+  @override

+  visitUnresolvedSuperGetterCompound(

+      Send node, Element element,

+      MethodElement setter,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_COMPOUND,

+        setter: setter, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitUnresolvedSuperGetterPostfix(

+      Send node,

+      Element element,

+      MethodElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_POSTFIX,

+        setter: setter, operator: operator));

+  }

+

+  @override

+  visitUnresolvedSuperGetterPrefix(

+      Send node,

+      Element element,

+      MethodElement setter,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_GETTER_PREFIX,

+        setter: setter, operator: operator));

+  }

+

+  @override

+  visitUnresolvedSuperSetterCompound(

+      Send node, MethodElement getter,

+      Element element,

+      AssignmentOperator operator,

+      Node rhs,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_COMPOUND,

+        getter: getter, operator: operator, rhs: rhs));

+    apply(rhs, arg);

+  }

+

+  @override

+  visitUnresolvedSuperSetterPostfix(

+      Send node,

+      MethodElement getter,

+      Element element,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_POSTFIX,

+        getter: getter, operator: operator));

+  }

+

+  @override

+  visitUnresolvedSuperSetterPrefix(

+      Send node,

+      MethodElement getter,

+      Element element,

+      IncDecOperator operator,

+      arg) {

+    visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_PREFIX,

+        getter: getter, operator: operator));

+  }

+}

diff --git a/tests/compiler/dart2js/type_checker_test.dart b/tests/compiler/dart2js/type_checker_test.dart
index 939640d..f6be4cf 100644
--- a/tests/compiler/dart2js/type_checker_test.dart
+++ b/tests/compiler/dart2js/type_checker_test.dart
@@ -2197,12 +2197,14 @@
           if (!e.isSynthesized) {
             element = e;
             node = element.parseNode(compiler);
-            mapping = compiler.resolver.resolve(element);
+            compiler.resolver.resolve(element);
+            mapping = element.treeElements;
           }
         });
       } else {
         node = element.parseNode(compiler);
-        mapping = compiler.resolver.resolve(element);
+        compiler.resolver.resolve(element);
+        mapping = element.treeElements;
       }
     }
     // Type check last class declaration or member.
diff --git a/tests/compiler/dart2js/type_combination_test.dart b/tests/compiler/dart2js/type_combination_test.dart
index 6063513..fa2b503d 100644
--- a/tests/compiler/dart2js/type_combination_test.dart
+++ b/tests/compiler/dart2js/type_combination_test.dart
@@ -733,12 +733,13 @@
     World world = compiler.world;
     backend.interceptorsLibrary.forEachLocalMember((element) {
       if (element.isClass) {
-        compiler.enqueuer.resolution.registerInstantiatedClass(
-            element, compiler.globalDependencies);
+        element.ensureResolved(compiler);
+        compiler.enqueuer.resolution.registerInstantiatedType(
+            element.rawType, compiler.globalDependencies);
       }
     });
-    compiler.enqueuer.resolution.registerInstantiatedClass(
-        compiler.mapClass, compiler.globalDependencies);
+    compiler.enqueuer.resolution.registerInstantiatedType(
+        compiler.coreTypes.mapType(), compiler.globalDependencies);
     compiler.world.populate();
 
     // Grab hold of a supertype for String so we can produce potential
diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status
index dec2c23..423c545 100644
--- a/tests/compiler/dart2js_extra/dart2js_extra.status
+++ b/tests/compiler/dart2js_extra/dart2js_extra.status
@@ -65,6 +65,7 @@
 10216a_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 10216b_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 12320_test: Crash #  Unhandled node
+16407_test: Pass # Please triage this failure.
 17094_test: RuntimeError # Please triage this failure.
 21666_test: Crash # Instance of 'TypeOperator': type check unimplemented for fInt.
 22868_test: Crash #  cannot handle async/sync*/async* functions
@@ -94,14 +95,10 @@
 deferred/deferred_overlapping_test: Crash # (lib1.loadLibrary()): handleStaticGetterInvoke: foreign: getter(loadLibrary)
 deferred_fail_and_retry_test: Crash # (lib.loadLibrary()): handleStaticGetterInvoke: foreign: getter(loadLibrary)
 deferred_fail_and_retry_worker_test: Crash # (lib.loadLibrary()): handleStaticGetterInvoke: foreign: getter(loadLibrary)
-do_test: Timeout # Please triage this failure.
-for_test: Timeout # Please triage this failure.
 generics_factories_test: Crash # Please triage this failure.
-if_null_test: Crash # Please triage this failure.
 inference_nsm_mirrors_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 inferrer_is_int_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 interface_type_optimization_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-is_check_instanceof_test: Crash # Instance of 'TypeOperator': type check unimplemented for T.
 mirror_invalid_field_access2_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mirror_invalid_field_access3_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mirror_invalid_field_access4_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -125,6 +122,4 @@
 switch_test/none: Crash # (switch (val){}): Unhandled node
 this_phi_elimination_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 type_constant_switch_test/none: Crash # (switch (v){}): Unhandled node
-typevariable_factory_test: Crash # Instance of 'TypeOperator': type check unimplemented for A<T>.
-while_test: Timeout # Please triage this failure.
-16407_test : Pass
+typevariable_factory_test: Crash # Please triage this failure.
diff --git a/tests/corelib/corelib.status b/tests/corelib/corelib.status
index 461f169..477641c 100644
--- a/tests/corelib/corelib.status
+++ b/tests/corelib/corelib.status
@@ -230,7 +230,7 @@
 expando_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 growable_list_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 has_next_iterator_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-hash_map2_test: Crash # Instance of 'TypeOperator': type check unimplemented for Map<int, String>.
+hash_map2_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 hash_set_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 hash_set_test/none: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 hash_set_type_check_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -240,7 +240,7 @@
 int_parse_radix_test/02: Crash # Please triage this failure.
 int_parse_radix_test/none: Crash # Please triage this failure.
 iterable_element_at_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-iterable_empty_test: Crash # Instance of 'TypeOperator': type check unimplemented for Iterable<int>.
+iterable_empty_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 iterable_expand_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 iterable_first_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 iterable_first_where_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -248,16 +248,14 @@
 iterable_last_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 iterable_last_where_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 iterable_reduce_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-iterable_return_type_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for Map<int, int>.
-iterable_return_type_test/02: Crash # Instance of 'TypeOperator': type check unimplemented for Map<int, int>.
-iterable_return_type_test/none : RuntimeError
+iterable_return_type_test/none: RuntimeError # Please triage this failure.
 iterable_single_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 iterable_single_where_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 iterable_skip_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 iterable_take_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-iterable_to_list_test : RuntimeError
-iterable_to_set_test : RuntimeError
-linked_hash_map_from_iterables_test: Crash # Instance of 'TypeOperator': type check unimplemented for Map<int, String>.
+iterable_to_list_test: RuntimeError # Please triage this failure.
+iterable_to_set_test: RuntimeError # Please triage this failure.
+linked_hash_map_from_iterables_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 list_as_map_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 list_fill_range_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 list_first_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -279,12 +277,12 @@
 list_test/none: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 list_to_string2_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 list_to_string_test: RuntimeError # Please triage this failure.
-map_from_iterables_test: Crash # Instance of 'TypeOperator': type check unimplemented for Map<int, String>.
-map_test: Crash # Please triage this failure.
+map_from_iterables_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+map_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 map_to_string_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-map_values2_test : RuntimeError
-map_values3_test : RuntimeError
-map_values4_test : RuntimeError
+map_values2_test: RuntimeError # Please triage this failure.
+map_values3_test: RuntimeError # Please triage this failure.
+map_values4_test: RuntimeError # Please triage this failure.
 null_nosuchmethod_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 num_clamp_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 num_parse_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -304,8 +302,7 @@
 regexp/regexp_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 set_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 set_to_string_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-shuffle_test: RuntimeError # Please triage this failure.
-splay_tree_from_iterables_test: Crash # Instance of 'TypeOperator': type check unimplemented for Map<int, String>.
+splay_tree_from_iterables_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 splay_tree_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 string_buffer_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 string_codeunits_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -329,7 +326,6 @@
 uri_file_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 uri_ipv4_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 uri_ipv6_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-uri_normalize_path_test: RuntimeError # Please triage this failure.
 uri_path_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 uri_query_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 uri_scheme_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
diff --git a/tests/corelib/growable_list_test.dart b/tests/corelib/growable_list_test.dart
index 0e26138..98b4e1f 100644
--- a/tests/corelib/growable_list_test.dart
+++ b/tests/corelib/growable_list_test.dart
@@ -5,11 +5,11 @@
 // Sanity check on the growing behavior of a growable list.
 
 import "package:expect/expect.dart";
-import "dart:collection" show EfficientLengthIterable;
+import "dart:collection" show IterableBase;
 
 // Iterable generating numbers in range [0..count).
 // May perform callback at some point underways.
-class TestIterableBase extends Iterable<int> {
+class TestIterableBase extends IterableBase<int> {
   final int length;
   final int count;
   // call [callback] if generating callbackIndex.
@@ -26,8 +26,9 @@
   int get length => throw "SHOULD NOT BE CALLED";
 }
 
+// Implement Set for private EfficientLength interface.
 class EfficientTestIterable extends TestIterableBase
-                            implements EfficientLengthIterable<int> {
+                            implements Set<int> {
   EfficientTestIterable(length, count, [callbackIndex = -1, callback])
       : super(length, count, callbackIndex, callback);
   // Avoid warnings because we don't actually implement Set.
@@ -56,7 +57,7 @@
 
 
 void main() {
-  // Without EfficientLengthIterable interface
+  // Without EfficientLength interface
   {
     // Change length of list after 20 additions.
     var l = [];
@@ -79,7 +80,7 @@
     }, (e) => e is ConcurrentModificationError);
   }
 
-  // With EfficientLengthIterable interface (uses length).
+  // With EfficientLength interface (uses length).
   {
     // Change length of list after 20 additions.
     var l = [];
diff --git a/tests/html/html.status b/tests/html/html.status
index 38c4a2e..f7ff39d 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -426,10 +426,10 @@
 canvas_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 canvasrenderingcontext2d_test: Crash #  try/finally
 cdata_test: Crash # Instance of 'TypeOperator': type casts not implemented.
-client_rect_test: Crash # Instance of 'TypeOperator': type check unimplemented for List<Rectangle>.
+client_rect_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 cross_domain_iframe_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 crypto_test: Crash #  try/finally
-css_rule_list_test: Crash # Instance of 'TypeOperator': type check unimplemented for List<CssRule>.
+css_rule_list_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 css_test: Crash #  try/finally
 cssstyledeclaration_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 custom/attribute_changed_callback_test: Crash #  try/finally
@@ -485,7 +485,7 @@
 htmlelement_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 htmloptionscollection_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 indexeddb_1_test: Crash #  try/finally
-indexeddb_2_test: Crash # Please triage this failure.
+indexeddb_2_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 indexeddb_3_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 indexeddb_4_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 indexeddb_5_test: Crash # Instance of 'TypeOperator': type casts not implemented.
@@ -541,7 +541,7 @@
 typed_arrays_dataview_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 typed_arrays_range_checks_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 typed_arrays_simd_test: Crash # Instance of 'TypeOperator': type casts not implemented.
-typing_test: Crash # Instance of 'TypeOperator': type check unimplemented for List<StyleSheet>.
+typing_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 unknownelement_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 uri_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 url_test: Crash #  try/finally
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index 5cd9387..776f8f2 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -130,8 +130,6 @@
 
 [ $compiler == dart2js ]
 malformed_test/none: Fail # Expect failure in lib/_internal/compiler/js_lib/preambles/d8.js
-generic_field_mixin4_test: Crash # Issue 18651
-generic_field_mixin5_test: Crash # Issue 18651
 
 type_variable_conflict2_test/01: RuntimeError # Issue 19725
 
@@ -156,7 +154,6 @@
 infinity_test: RuntimeError # Issue 4984
 mixin_mixin2_test: RuntimeError # Issue 13109.
 mixin_mixin3_test: RuntimeError # Issue 13109.
-mixin_mixin7_test: RuntimeError # Issue 13109.
 mixin_regress_13688_test: RuntimeError # Issue 13109.
 modulo_test: RuntimeError # Issue 15246
 truncdiv_test: RuntimeError # Issue 15246
@@ -217,6 +214,11 @@
 cha_deopt*: Pass,RuntimeError # Issue 17458
 regress_22443_test: Pass,RuntimeError # Issue 17458
 
+[ $compiler == dart2js && $cps_ir == false ]
+generic_field_mixin4_test: Crash # Issue 18651
+generic_field_mixin5_test: Crash # Issue 18651
+mixin_mixin7_test: RuntimeError # Issue 13109.
+
 [ $compiler == dart2js && $cps_ir ]
 aborting_switch_case_test: Crash # (switch (42){case 42:foo();foo();break;}): Unhandled node
 abstract_getter_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -415,53 +417,20 @@
 class_override_test/00: Crash # (try {instance.foo();}on NoSuchMethodError catch (error){}finally {}): try/finally
 class_override_test/none: Crash # (try {instance.foo();}finally {}): try/finally
 closure3_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-closure_in_constructor_test: Crash # Instance of 'TypeOperator': type check unimplemented for List<int>.
+closure_in_constructor_test: Crash # Please triage this failure.
 closure_internals_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 closure_self_reference_test: Crash # (try {return inner(value-1);}finally {counter++ ;}): try/finally
-closure_type_variables_test: Crash # Instance of 'TypeOperator': type check unimplemented for A<int>.
-closures_initializer2_test: Crash # Please triage this failure.
-closures_initializer_test: Crash # Instance of 'TypeOperator': type check unimplemented for List<int>.
+closure_type_variables_test: Crash # Please triage this failure.
 compile_time_constant_a_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 compile_time_constant_b_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-conditional_method_invocation_test/01: RuntimeError # Please triage this failure.
-conditional_method_invocation_test/02: RuntimeError # Please triage this failure.
-conditional_method_invocation_test/03: RuntimeError # Please triage this failure.
-conditional_method_invocation_test/04: RuntimeError # Please triage this failure.
-conditional_method_invocation_test/05: RuntimeError # Please triage this failure.
-conditional_method_invocation_test/06: RuntimeError # Please triage this failure.
-conditional_method_invocation_test/07: RuntimeError # Please triage this failure.
-conditional_method_invocation_test/08: RuntimeError # Please triage this failure.
 conditional_method_invocation_test/09: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 conditional_method_invocation_test/10: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 conditional_method_invocation_test/11: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-conditional_method_invocation_test/12: RuntimeError # Please triage this failure.
-conditional_method_invocation_test/13: RuntimeError # Please triage this failure.
-conditional_method_invocation_test/none: RuntimeError # Please triage this failure.
-conditional_property_access_test/01: RuntimeError # Please triage this failure.
-conditional_property_access_test/02: RuntimeError # Please triage this failure.
-conditional_property_access_test/03: RuntimeError # Please triage this failure.
-conditional_property_access_test/04: RuntimeError # Please triage this failure.
-conditional_property_access_test/05: RuntimeError # Please triage this failure.
-conditional_property_access_test/06: RuntimeError # Please triage this failure.
 conditional_property_access_test/07: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 conditional_property_access_test/08: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 conditional_property_access_test/09: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-conditional_property_access_test/10: RuntimeError # Please triage this failure.
-conditional_property_access_test/11: RuntimeError # Please triage this failure.
-conditional_property_access_test/none: RuntimeError # Please triage this failure.
-conditional_property_assignment_test/01: RuntimeError # Please triage this failure.
-conditional_property_assignment_test/02: RuntimeError # Please triage this failure.
-conditional_property_assignment_test/03: RuntimeError # Please triage this failure.
-conditional_property_assignment_test/04: RuntimeError # Please triage this failure.
-conditional_property_assignment_test/05: RuntimeError # Please triage this failure.
 conditional_property_assignment_test/06: Crash # Instance of 'TypeOperator': type casts not implemented.
-conditional_property_assignment_test/07: RuntimeError # Please triage this failure.
-conditional_property_assignment_test/08: RuntimeError # Please triage this failure.
-conditional_property_assignment_test/09: RuntimeError # Please triage this failure.
-conditional_property_assignment_test/10: RuntimeError # Please triage this failure.
 conditional_property_assignment_test/11: Crash # Instance of 'TypeOperator': type casts not implemented.
-conditional_property_assignment_test/12: RuntimeError # Please triage this failure.
-conditional_property_assignment_test/13: RuntimeError # Please triage this failure.
 conditional_property_assignment_test/14: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 conditional_property_assignment_test/15: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 conditional_property_assignment_test/16: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -471,7 +440,6 @@
 conditional_property_assignment_test/20: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 conditional_property_assignment_test/21: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 conditional_property_assignment_test/22: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-conditional_property_assignment_test/none: RuntimeError # Please triage this failure.
 const_evaluation_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 const_nested_test: Crash # Please triage this failure.
 const_objects_are_immutable_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -484,7 +452,7 @@
 constructor10_test/01: Crash # Please triage this failure.
 constructor10_test/02: Crash # Please triage this failure.
 constructor11_test: Crash # Please triage this failure.
-constructor12_test: RuntimeError
+constructor12_test: RuntimeError # Please triage this failure.
 constructor3_negative_test: Crash # Please triage this failure.
 constructor5_test: Crash # Please triage this failure.
 constructor_call_wrong_argument_count_negative_test: Crash # Please triage this failure.
@@ -555,7 +523,7 @@
 double_to_string_as_fixed2_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 double_to_string_as_precision2_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 dynamic_prefix_core_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-dynamic_test: Crash # Instance of 'TypeOperator': type check unimplemented for Iface<dynamic, num>.
+dynamic_test: Crash # Instance of 'TypeOperator': type check unimplemented for F1<int>.
 empty_block_case_test: Crash # (switch (1){case 1:{}case 2:Expect.equals(true,false);}): Unhandled node
 enum_mirror_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 enum_private_test/02: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -573,16 +541,13 @@
 execute_finally7_test: Crash #  try/finally
 execute_finally8_test: Crash # (try {sum+= 1;return 'hi';}finally {sum+= 1;throw 'ball';sum+= 1;}): try/finally
 execute_finally9_test: Crash #  try/finally
-factory3_test: Crash # Instance of 'TypeOperator': type check unimplemented for T.
 factory_redirection3_cyclic_test/01: Crash # Please triage this failure.
-factory_redirection_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for A<List>.
-factory_redirection_test/04: Crash # Instance of 'TypeOperator': type check unimplemented for A<List>.
-factory_redirection_test/05: MissingRuntimeError
-factory_redirection_test/06: MissingRuntimeError
+factory_redirection_test/04: Crash # Please triage this failure.
+factory_redirection_test/05: MissingRuntimeError # Please triage this failure.
+factory_redirection_test/06: MissingRuntimeError # Please triage this failure.
 factory_return_type_checked_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 factory_type_parameter2_test: Crash # Please triage this failure.
-factory_type_parameter_test: Crash # Instance of 'TypeOperator': type check unimplemented for A<List>.
-fast_method_extraction_test: Crash # Instance of 'TypeOperator': type check unimplemented for T.
+factory_type_parameter_test: Crash # Please triage this failure.
 final_super_field_set_test/01: RuntimeError # Please triage this failure.
 finally_test: Crash # (try {i=12;}finally {Expect.equals(12,i);executedFinally=true;}): try/finally
 first_class_types_literals_test/03: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -595,12 +560,6 @@
 first_class_types_literals_test/10: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 first_class_types_literals_test/11: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 first_class_types_literals_test/12: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-fixed_type_variable2_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for T.
-fixed_type_variable2_test/02: Crash # Instance of 'TypeOperator': type check unimplemented for T.
-fixed_type_variable2_test/03: Crash # Instance of 'TypeOperator': type check unimplemented for T.
-fixed_type_variable2_test/04: Crash # Instance of 'TypeOperator': type check unimplemented for T.
-fixed_type_variable2_test/05: Crash # Instance of 'TypeOperator': type check unimplemented for T.
-fixed_type_variable2_test/06: Crash # Instance of 'TypeOperator': type check unimplemented for T.
 flatten_test/01: Crash # (test()async{int x=await new Derived<int>();}): cannot handle async/sync*/async* functions
 flatten_test/02: Crash # (test()async{Future<int> f()async=>new Derived<int>();}): cannot handle async/sync*/async* functions
 flatten_test/03: Crash #  cannot handle async/sync*/async* functions
@@ -618,7 +577,7 @@
 for_variable_capture_test: Crash # (i=0): For-loop variable captured in loop header
 function_propagation_test: Crash # Instance of 'TypeOperator': type check unimplemented for F.
 function_subtype0_test: Crash # Instance of 'TypeOperator': type check unimplemented for t__.
-function_subtype1_test: Crash # Please triage this failure.
+function_subtype1_test: Crash # type expression int_ (typedef)
 function_subtype2_test: Crash # Instance of 'TypeOperator': type check unimplemented for T1.
 function_subtype_bound_closure0_test: Crash # Instance of 'TypeOperator': type check unimplemented for Foo.
 function_subtype_bound_closure1_test: Crash # Instance of 'TypeOperator': type check unimplemented for Foo<bool>.
@@ -639,7 +598,7 @@
 function_subtype_checked0_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 function_subtype_closure0_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 function_subtype_closure1_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-function_subtype_factory0_test: Crash # Instance of 'TypeOperator': type check unimplemented for Foo<T>.
+function_subtype_factory0_test: Crash # Please triage this failure.
 function_subtype_inline0_test: Crash # Instance of 'TypeOperator': type check unimplemented for Foo.
 function_subtype_local0_test: Crash # Instance of 'TypeOperator': type check unimplemented for Foo.
 function_subtype_local1_test: Crash # Instance of 'TypeOperator': type check unimplemented for Foo<bool>.
@@ -648,24 +607,24 @@
 function_subtype_local4_test: Crash # Instance of 'TypeOperator': type check unimplemented for Foo.
 function_subtype_local5_test: Crash # Instance of 'TypeOperator': type check unimplemented for Foo<T>.
 function_subtype_named1_test: Crash # Instance of 'TypeOperator': type check unimplemented for t_void_.
-function_subtype_named2_test: Crash # Please triage this failure.
+function_subtype_named2_test: Crash # type expression void___a_int (typedef)
 function_subtype_not0_test: Crash # Instance of 'TypeOperator': type check unimplemented for Foo.
 function_subtype_not1_test: Crash # Instance of 'TypeOperator': type check unimplemented for Foo.
 function_subtype_not2_test: Crash # Instance of 'TypeOperator': type check unimplemented for Foo<T>.
 function_subtype_not3_test: Crash # Instance of 'TypeOperator': type check unimplemented for Foo<T>.
 function_subtype_optional1_test: Crash # Instance of 'TypeOperator': type check unimplemented for t_void_.
-function_subtype_optional2_test: Crash # Please triage this failure.
+function_subtype_optional2_test: Crash # type expression void___int (typedef)
 function_subtype_setter0_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 function_subtype_simple0_test: Crash # Instance of 'TypeOperator': type check unimplemented for Args0.
 function_subtype_simple1_test: Crash # Instance of 'TypeOperator': type check unimplemented for Args0.
 function_subtype_simple2_test: Crash # Instance of 'TypeOperator': type check unimplemented for Args0.
 function_subtype_top_level0_test: Crash # Instance of 'TypeOperator': type check unimplemented for Foo.
 function_subtype_top_level1_test: Crash # Instance of 'TypeOperator': type check unimplemented for Foo<T>.
-function_subtype_typearg0_test: Crash # Please triage this failure.
-function_subtype_typearg1_test: Crash # Please triage this failure.
-function_subtype_typearg2_test: Crash # Please triage this failure.
-function_subtype_typearg3_test: Crash # Please triage this failure.
-function_subtype_typearg4_test: Crash # Please triage this failure.
+function_subtype_typearg0_test: Crash # type expression Foo (typedef)
+function_subtype_typearg1_test: Crash # type expression f2 (typedef)
+function_subtype_typearg2_test: Crash # type expression f1 (typedef)
+function_subtype_typearg3_test: Crash # type expression f1 (typedef)
+function_subtype_typearg4_test: Crash # type expression f1 (typedef)
 function_type3_test: Crash # Instance of 'TypeOperator': type check unimplemented for F.
 function_type_alias2_test: Crash # Instance of 'TypeOperator': type check unimplemented for f1.
 function_type_alias3_test: Crash # Instance of 'TypeOperator': type check unimplemented for F.
@@ -673,121 +632,58 @@
 function_type_alias6_test/none: Crash # Instance of 'TypeOperator': type check unimplemented for F.
 function_type_alias_test: Crash # Instance of 'TypeOperator': type check unimplemented for Fun.
 function_type_call_getter_test: Crash # Instance of 'TypeOperator': type check unimplemented for F.
-generic2_test: Crash # Instance of 'TypeOperator': type check unimplemented for T.
 generic_closure_test: Crash # Instance of 'TypeOperator': type check unimplemented for F.
 generic_constructor_mixin2_test: Crash # Please triage this failure.
 generic_constructor_mixin3_test: Crash # Please triage this failure.
 generic_constructor_mixin_test: Crash # Please triage this failure.
-generic_field_mixin2_test: Crash # Please triage this failure.
-generic_field_mixin3_test: Crash # Instance of 'TypeOperator': type check unimplemented for A<T>.
-generic_field_mixin_test: Crash # Instance of 'TypeOperator': type check unimplemented for A<int>.
-generic_instanceof2_test: Crash # Instance of 'TypeOperator': type check unimplemented for Foo<int, num>.
-generic_instanceof4_test: Crash # Instance of 'TypeOperator': type check unimplemented for T.
-generic_instanceof5_test: Crash # Instance of 'TypeOperator': type check unimplemented for T.
-generic_instanceof_test: Crash # Instance of 'TypeOperator': type check unimplemented for List<T>.
+generic_field_mixin3_test: RuntimeError # Please triage this failure.
+generic_instanceof2_test: Crash # Please triage this failure.
 generic_list_checked_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-generic_native_test: Crash # Instance of 'TypeOperator': type check unimplemented for T.
-generic_object_type_test: Crash # Instance of 'TypeOperator': type check unimplemented for T.
-generic_test: Crash # Instance of 'TypeOperator': type check unimplemented for B<AA>.
-if_null_assignment_behavior_test/01: Crash # Please triage this failure.
-if_null_assignment_behavior_test/02: Crash # Please triage this failure.
-if_null_assignment_behavior_test/03: Crash # Please triage this failure.
-if_null_assignment_behavior_test/04: Crash # Please triage this failure.
-if_null_assignment_behavior_test/05: Crash # Please triage this failure.
-if_null_assignment_behavior_test/06: Crash # Please triage this failure.
-if_null_assignment_behavior_test/07: Crash # Please triage this failure.
-if_null_assignment_behavior_test/08: Crash # Please triage this failure.
-if_null_assignment_behavior_test/09: Crash # Please triage this failure.
-if_null_assignment_behavior_test/10: Crash # Please triage this failure.
-if_null_assignment_behavior_test/11: Crash # Please triage this failure.
-if_null_assignment_behavior_test/12: Crash # Please triage this failure.
-if_null_assignment_behavior_test/15: Crash # Please triage this failure.
-if_null_assignment_behavior_test/16: Crash # Please triage this failure.
-if_null_assignment_behavior_test/17: Crash # Please triage this failure.
-if_null_assignment_behavior_test/18: Crash # Please triage this failure.
-if_null_assignment_behavior_test/19: Crash # Please triage this failure.
-if_null_assignment_behavior_test/20: Crash # Please triage this failure.
-if_null_assignment_behavior_test/21: Crash # Please triage this failure.
-if_null_assignment_behavior_test/22: Crash # Please triage this failure.
-if_null_assignment_behavior_test/23: Crash # Please triage this failure.
-if_null_assignment_behavior_test/24: Crash # Please triage this failure.
-if_null_assignment_behavior_test/25: Crash # Please triage this failure.
-if_null_assignment_behavior_test/26: Crash # Please triage this failure.
-if_null_assignment_behavior_test/27: Crash # Please triage this failure.
-if_null_assignment_behavior_test/28: Crash # Please triage this failure.
-if_null_assignment_behavior_test/none: Crash # Please triage this failure.
-if_null_assignment_static_test/01: Crash # Please triage this failure.
-if_null_assignment_static_test/02: Crash # Please triage this failure.
-if_null_assignment_static_test/03: Crash # Please triage this failure.
-if_null_assignment_static_test/04: Crash # Please triage this failure.
-if_null_assignment_static_test/05: Crash # Please triage this failure.
-if_null_assignment_static_test/06: Crash # Please triage this failure.
-if_null_assignment_static_test/07: Crash # Please triage this failure.
-if_null_assignment_static_test/08: Crash # Please triage this failure.
-if_null_assignment_static_test/09: Crash # Please triage this failure.
-if_null_assignment_static_test/10: Crash # Please triage this failure.
-if_null_assignment_static_test/11: Crash # Please triage this failure.
-if_null_assignment_static_test/12: Crash # Please triage this failure.
-if_null_assignment_static_test/13: Crash # Please triage this failure.
-if_null_assignment_static_test/14: Crash # Please triage this failure.
-if_null_assignment_static_test/15: Crash # Please triage this failure.
-if_null_assignment_static_test/16: Crash # Please triage this failure.
-if_null_assignment_static_test/17: Crash # Please triage this failure.
-if_null_assignment_static_test/18: Crash # Please triage this failure.
-if_null_assignment_static_test/19: Crash # Please triage this failure.
-if_null_assignment_static_test/20: Crash # Please triage this failure.
-if_null_assignment_static_test/21: Crash # Please triage this failure.
-if_null_assignment_static_test/22: Crash # Please triage this failure.
-if_null_assignment_static_test/23: Crash # Please triage this failure.
-if_null_assignment_static_test/24: Crash # Please triage this failure.
-if_null_assignment_static_test/25: Crash # Please triage this failure.
-if_null_assignment_static_test/26: Crash # Please triage this failure.
-if_null_assignment_static_test/27: Crash # Please triage this failure.
-if_null_assignment_static_test/28: Crash # Please triage this failure.
-if_null_assignment_static_test/29: Crash # Please triage this failure.
-if_null_assignment_static_test/30: Crash # Please triage this failure.
-if_null_assignment_static_test/31: Crash # Please triage this failure.
-if_null_assignment_static_test/32: Crash # Please triage this failure.
-if_null_assignment_static_test/33: Crash # Please triage this failure.
-if_null_assignment_static_test/34: Crash # Please triage this failure.
-if_null_assignment_static_test/35: Crash # Please triage this failure.
-if_null_assignment_static_test/36: Crash # Please triage this failure.
-if_null_assignment_static_test/37: Crash # Please triage this failure.
-if_null_assignment_static_test/38: Crash # Please triage this failure.
-if_null_assignment_static_test/39: Crash # Please triage this failure.
-if_null_assignment_static_test/40: Crash # Please triage this failure.
-if_null_assignment_static_test/41: Crash # Please triage this failure.
-if_null_assignment_static_test/42: Crash # Please triage this failure.
-if_null_assignment_static_test/none: Crash # Please triage this failure.
-if_null_behavior_test/01: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/02: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/03: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/04: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/05: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/06: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/07: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/08: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/09: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/10: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/11: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/12: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/13: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/14: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/15: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/16: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_behavior_test/none: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_evaluation_order_test/01: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_evaluation_order_test/02: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_evaluation_order_test/none: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_precedence_test/01: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_precedence_test/02: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_precedence_test/03: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_precedence_test/04: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_precedence_test/05: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_precedence_test/06: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_precedence_test/07: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_precedence_test/08: Crash # (null??null): If-null not yet implemented in cps_ir
-if_null_precedence_test/none: Crash # (null??null): If-null not yet implemented in cps_ir
+if_null_assignment_behavior_test/04: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_assignment_static_test/01: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/02: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_assignment_static_test/03: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/04: RuntimeError # B.b incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/05: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/06: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_assignment_static_test/08: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/09: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_assignment_static_test/10: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/11: RuntimeError # B.b incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/12: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/13: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_assignment_static_test/15: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/16: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_assignment_static_test/17: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/18: RuntimeError # B.b incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/19: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/20: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_assignment_static_test/22: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/23: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_assignment_static_test/24: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/25: RuntimeError # B.b incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/26: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/27: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_assignment_static_test/29: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/30: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_assignment_static_test/31: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/32: RuntimeError # B.b incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/33: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/34: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_assignment_static_test/36: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/37: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_assignment_static_test/38: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/39: RuntimeError # B.b incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/40: RuntimeError # A.a incorrectly tree-shaken (issue 23548)
+if_null_assignment_static_test/41: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_behavior_test/07: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_behavior_test/10: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_behavior_test/12: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_behavior_test/14: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_behavior_test/15: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_behavior_test/16: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_precedence_test/07: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+if_null_precedence_test/08: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 implicit_super_constructor_call_test: Crash # Please triage this failure.
 import_self_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 inference_captured_variable2_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -806,9 +702,7 @@
 infinite_switch_label_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 inlined_throw_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 instance_creation_in_function_annotation_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-instanceof3_test: Crash # Instance of 'TypeOperator': type check unimplemented for UndeclaredType.
-instanceof4_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for List<T>.
-instanceof4_test/none: Crash # Instance of 'TypeOperator': type check unimplemented for List<T>.
+instanceof4_test/01: RuntimeError # Please triage this failure.
 integer_division_by_zero_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 interceptor6_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 interceptor_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -816,17 +710,11 @@
 invocation_mirror_invoke_on2_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 invocation_mirror_invoke_on_test: RuntimeError # Please triage this failure.
 invocation_mirror_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-is_malformed_type_test/94: Crash # Instance of 'TypeOperator': type casts not implemented.
-is_malformed_type_test/95: Crash # Instance of 'TypeOperator': type check unimplemented for Undefined.
-is_malformed_type_test/96: Crash # Instance of 'TypeOperator': type casts not implemented.
-is_malformed_type_test/97: Crash # Instance of 'TypeOperator': type check unimplemented for Undefined.
-is_malformed_type_test/98: Crash # Instance of 'TypeOperator': type casts not implemented.
-is_malformed_type_test/99: Crash # Instance of 'TypeOperator': type check unimplemented for Undefined.
 is_nan_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 is_not_class2_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 isnot_malformed_type_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 issue10581_test: Crash #  Unhandled node
-issue10721_test: RuntimeError
+issue10721_test: RuntimeError # Please triage this failure.
 issue10747_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 issue10783_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 issue11724_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -834,31 +722,29 @@
 issue12284_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 issue12336_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 issue13474_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-issue14014_3_test: Crash # Please triage this failure.
+issue14014_3_test: Crash # Instance of 'TypeOperator': type check unimplemented for foo<T>.
 issue20476_test: Crash # (try {try {return 1;}catch (e1){}finally {return 3;}}catch (e2){}finally {return 5;}): try/finally
 issue7525_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 issue_1751477_test: Crash # (lib1.loadLibrary()): handleStaticGetterInvoke: foreign: getter(loadLibrary)
 label_test: Crash # (switch (i){case 111:while(doAgain()){break L;}default:i-- ;}): Unhandled node
 large_class_declaration_test: Crash # Please triage this failure.
 lazy_static3_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-library_ambiguous_test/04: Crash # Instance of 'TypeOperator': type check unimplemented for bax.
 licm2_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 licm3_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 list_double_index_in_loop2_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 list_double_index_in_loop_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 list_length_tracer_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 list_literal3_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-list_test: Crash # Instance of 'TypeOperator': type check unimplemented for List<A>.
+list_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 malbounded_type_cast2_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 malbounded_type_cast_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-malbounded_type_test2_test: Crash # Instance of 'TypeOperator': type check unimplemented for A<T>.
-malformed2_test/00: Crash # Instance of 'TypeOperator': type check unimplemented for List<Unresolved>.
+malbounded_type_test2_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+malformed2_test/00: Crash # Instance of 'TypeOperator': type casts not implemented.
 malformed_inheritance_test/03: Crash # Please triage this failure.
 malformed_inheritance_test/09: Crash # Please triage this failure.
 malformed_inheritance_test/10: Crash # Please triage this failure.
-malformed_test/06: Crash # Please triage this failure.
-malformed_test/none: Crash # Please triage this failure.
-many_generic_instanceof_test: Crash # Instance of 'TypeOperator': type check unimplemented for List<T>.
+malformed_test/06: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+malformed_test/none: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 many_overridden_no_such_method_test: RuntimeError # Please triage this failure.
 megamorphic_no_such_method_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 method_override4_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -887,7 +773,6 @@
 mixin_lib_extends_field_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mixin_lib_extends_method_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mixin_method_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-mixin_only_for_rti_test: Crash # Instance of 'TypeOperator': type check unimplemented for T.
 mixin_super_constructor2_test: Crash # Please triage this failure.
 mixin_super_constructor_default_test: Crash # Please triage this failure.
 mixin_super_constructor_multiple_test: Crash # Please triage this failure.
@@ -896,12 +781,12 @@
 mixin_super_constructor_positionals_test/01: Crash # Please triage this failure.
 mixin_super_constructor_positionals_test/none: Crash # Please triage this failure.
 mixin_super_constructor_test: Crash # Please triage this failure.
-mixin_type_parameter2_test: Crash # Instance of 'TypeOperator': type check unimplemented for Mixin1<num>.
-mixin_type_parameter3_test: Crash # Instance of 'TypeOperator': type check unimplemented for Mixin1<num>.
-mixin_type_parameters_mixin_extends_test: Crash # Instance of 'TypeOperator': type check unimplemented for M<int>.
-mixin_type_parameters_mixin_test: Crash # Instance of 'TypeOperator': type check unimplemented for M<int>.
-mixin_type_parameters_super_extends_test: Crash # Instance of 'TypeOperator': type check unimplemented for S<int>.
-mixin_type_parameters_super_test: Crash # Instance of 'TypeOperator': type check unimplemented for S<int>.
+mixin_type_parameter2_test: Crash # Please triage this failure.
+mixin_type_parameter3_test: Crash # Please triage this failure.
+mixin_type_parameters_mixin_extends_test: Crash # Please triage this failure.
+mixin_type_parameters_mixin_test: Crash # Please triage this failure.
+mixin_type_parameters_super_extends_test: Crash # Please triage this failure.
+mixin_type_parameters_super_test: Crash # Please triage this failure.
 mixin_typedef_constructor_test: Crash # Please triage this failure.
 mixin_with_two_implicit_constructors_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 modulo_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -919,18 +804,16 @@
 not_enough_positional_arguments_test/00: MissingRuntimeError # Please triage this failure.
 not_enough_positional_arguments_test/03: Crash # Please triage this failure.
 null_inline_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-null_is2_test: Crash # Instance of 'TypeOperator': type check unimplemented for T.
 null_no_such_method_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-null_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for dynamic.
-null_test/02: Crash # Instance of 'TypeOperator': type check unimplemented for dynamic.
-null_test/03: Crash # Instance of 'TypeOperator': type check unimplemented for dynamic.
-null_test/none: Crash # Instance of 'TypeOperator': type check unimplemented for dynamic.
+null_test/01: Crash # Instance of 'TypeOperator': type casts not implemented.
+null_test/02: Crash # Instance of 'TypeOperator': type casts not implemented.
+null_test/03: Crash # Instance of 'TypeOperator': type casts not implemented.
+null_test/none: Crash # Instance of 'TypeOperator': type casts not implemented.
 number_identifier_test/05: Crash # Instance of 'TypeOperator': type casts not implemented.
 number_identifier_test/08: Crash # Instance of 'TypeOperator': type casts not implemented.
 number_identifier_test/09: Crash # Instance of 'TypeOperator': type casts not implemented.
 number_identifier_test/none: Crash # Instance of 'TypeOperator': type casts not implemented.
 on_catch_malformed_type_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-operator4_test: RuntimeError # Please triage this failure.
 operator_equals_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 optimized_constant_array_string_access_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 optimized_string_charat_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -961,7 +844,7 @@
 reg_exp_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 regress_12561_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 regress_18435_test: Crash # Please triage this failure.
-regress_18535_test: Crash # Instance of 'TypeOperator': type check unimplemented for V.
+regress_18535_test: Crash # Please triage this failure.
 regress_21795_test: Crash # (try {foo(t);}finally {if(t==0){try {}catch (err,st){}}}): try/finally
 regress_22438_test: Crash #  cannot handle async/sync*/async* functions
 regress_22443_test: Crash # (D.loadLibrary()): handleStaticGetterInvoke: foreign: getter(loadLibrary)
@@ -974,6 +857,9 @@
 regress_22936_test/01: Crash # Please triage this failure.
 regress_22936_test/none: Crash # Please triage this failure.
 regress_23498_test: Crash #  cannot handle async/sync*/async* functions
+regress_23500_test/01: Crash #  cannot handle async/sync*/async* functions
+regress_23500_test/02: Crash #  cannot handle async/sync*/async* functions
+regress_23500_test/none: Crash #  cannot handle async/sync*/async* functions
 reify_typevar_static_test/01: Crash # Please triage this failure.
 return_type_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 side_effect_throw_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -987,7 +873,7 @@
 super_bound_closure_test/01: RuntimeError # Please triage this failure.
 super_bound_closure_test/none: RuntimeError # Please triage this failure.
 super_call4_test: RuntimeError # Please triage this failure.
-super_getter_setter_test: RuntimeError # Please triage this failure.
+super_getter_setter_test: Crash # Please triage this failure.
 super_implicit_closure_test: RuntimeError # Please triage this failure.
 super_inferrer_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 super_operator_index2_test: RuntimeError # Please triage this failure.
@@ -1051,23 +937,21 @@
 try_catch3_test: Crash #  try/finally
 try_catch4_test: Crash #  try/finally
 try_catch5_test: Crash # (try {try {a=8;return;}finally {b=8==a;entered=true;continue;}}finally {continue;}): try/finally
-try_catch_on_syntax_test/07: Crash # Instance of 'TypeOperator': type check unimplemented for UndefinedClass.
 try_catch_optimized2_test: Crash # (try {bar();}finally {}): try/finally
 try_catch_osr_test: Crash # (try {if(x==null)throw 42;return 99;}finally {}): try/finally
-try_catch_syntax_test/08: Crash # Instance of 'TypeOperator': type check unimplemented for MammaMia.
 try_catch_test/01: Crash # Please triage this failure.
 try_catch_test/none: Crash # Please triage this failure.
 type_argument_in_super_type_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 type_check_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 type_error_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 type_literal_prefix_call_test/00: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-type_parameter_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for Set<int>.
-type_parameter_test/02: Crash # Instance of 'TypeOperator': type check unimplemented for Set<int>.
-type_parameter_test/03: Crash # Instance of 'TypeOperator': type check unimplemented for Set<int>.
-type_parameter_test/04: Crash # Instance of 'TypeOperator': type check unimplemented for Set<int>.
-type_parameter_test/05: Crash # Instance of 'TypeOperator': type check unimplemented for Set<int>.
-type_parameter_test/06: Crash # Instance of 'TypeOperator': type check unimplemented for Set<int>.
-type_parameter_test/none: Crash # Instance of 'TypeOperator': type check unimplemented for Set<int>.
+type_parameter_test/01: Crash # Please triage this failure.
+type_parameter_test/02: Crash # Please triage this failure.
+type_parameter_test/03: Crash # Please triage this failure.
+type_parameter_test/04: Crash # Please triage this failure.
+type_parameter_test/05: Crash # Please triage this failure.
+type_parameter_test/06: Crash # Please triage this failure.
+type_parameter_test/none: Crash # Please triage this failure.
 type_promotion_functions_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for FuncDynToDyn.
 type_promotion_functions_test/02: Crash # Instance of 'TypeOperator': type check unimplemented for FuncDynToDyn.
 type_promotion_functions_test/03: Crash # Instance of 'TypeOperator': type check unimplemented for FuncDynToDyn.
@@ -1084,18 +968,15 @@
 type_promotion_functions_test/14: Crash # Instance of 'TypeOperator': type check unimplemented for FuncDynToDyn.
 type_promotion_functions_test/none: Crash # Instance of 'TypeOperator': type check unimplemented for FuncDynToDyn.
 type_propagation_in_for_update_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-type_variable_closure2_test: RuntimeError
+type_variable_closure2_test: RuntimeError # Please triage this failure.
 type_variable_closure_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 type_variable_conflict2_test/03: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 type_variable_conflict2_test/04: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 type_variable_conflict2_test/05: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 type_variable_conflict2_test/07: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 type_variable_conflict2_test/09: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-type_variable_field_initializer_closure_test: Crash # Instance of 'TypeOperator': type check unimplemented for List<int>.
-type_variable_field_initializer_test: Crash # Instance of 'TypeOperator': type check unimplemented for List<int>.
 type_variable_function_type_test: Crash # Instance of 'TypeOperator': type check unimplemented for Func<S>.
-type_variable_initializer_test: Crash # Instance of 'TypeOperator': type check unimplemented for Map<int, int>.
-type_variable_typedef_test: Crash # Please triage this failure.
+type_variable_typedef_test: Crash # type expression Foo<T> (typedef)
 typed_equality_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 typedef_is_test: Crash # Instance of 'TypeOperator': type check unimplemented for Func1.
 typevariable_substitution2_test/01: Crash # Please triage this failure.
diff --git a/tests/language/regress_21912_test.dart b/tests/language/regress_21912_test.dart
index a978882..8a7151b 100644
--- a/tests/language/regress_21912_test.dart
+++ b/tests/language/regress_21912_test.dart
@@ -16,7 +16,7 @@
     Function2<Function2<A, B>, Function2<B, A>> t1;
     Function2<AToB, BToA> t2;
     Function2<Function2<int, double>, Function2<int, double>> left;
-    left = t1; /// 01: ok
-    left = t2; /// 02: ok
+    left = t1; /// 01: static type warning
+    left = t2; /// 02: static type warning
   }
 }
diff --git a/tests/language/regress_23500_test.dart b/tests/language/regress_23500_test.dart
new file mode 100644
index 0000000..2a5a9fe
--- /dev/null
+++ b/tests/language/regress_23500_test.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "dart:async";
+import "package:expect/expect.dart";
+
+foo() async {
+  try {
+    try {
+      await for (var c in new Stream.fromIterable([])) {}  /// 01: ok
+      await 0;  /// 02: ok
+    } catch (error) {
+    }
+  } catch (error) {
+  }
+  throw "error";
+}
+
+main() async {
+  var error = "no error";
+  try {
+    await foo();
+  } catch (e) {
+    error = e;
+  }
+  Expect.equals("error", error);
+}
+
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index e68b833..b603b06 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -370,8 +370,9 @@
 convert/chunked_conversion_utf86_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 convert/chunked_conversion_utf87_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 convert/json_chunk_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-convert/json_lib_test: Crash # Instance of 'TypeOperator': type check unimplemented for T.
+convert/json_lib_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 convert/json_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+convert/json_toEncodable_reviver_test: RuntimeError # Please triage this failure.
 convert/json_utf8_chunk_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 convert/json_util_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 convert/latin1_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -404,7 +405,7 @@
 mirrors/constructor_private_name_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mirrors/constructors_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mirrors/dart2js_mirrors_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-mirrors/declarations_type_test: Crash # Instance of 'TypeOperator': type check unimplemented for Map<Symbol, DeclarationMirror>.
+mirrors/declarations_type_test: Crash # Instance of 'TypeOperator': type casts not implemented.
 mirrors/deferred_mirrors_metadata_test: Crash # (lib1.loadLibrary()): handleStaticGetterInvoke: foreign: getter(loadLibrary)
 mirrors/deferred_mirrors_metatarget_test: Crash # (lib.loadLibrary()): handleStaticGetterInvoke: foreign: getter(loadLibrary)
 mirrors/deferred_mirrors_update_test: Crash # (l.loadLibrary()): handleStaticGetterInvoke: foreign: getter(loadLibrary)
@@ -439,11 +440,11 @@
 mirrors/generic_type_mirror_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mirrors/generics_double_substitution_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mirrors/generics_double_substitution_test/none: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-mirrors/generics_dynamic_test: Crash # Please triage this failure.
+mirrors/generics_dynamic_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mirrors/generics_special_types_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mirrors/generics_substitution_test: Crash # Instance of 'TypeOperator': type casts not implemented.
-mirrors/generics_test/01: Crash # Please triage this failure.
-mirrors/generics_test/none: Crash # Please triage this failure.
+mirrors/generics_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+mirrors/generics_test/none: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mirrors/globalized_closures2_test/00: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mirrors/globalized_closures2_test/none: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mirrors/globalized_closures_test/00: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -579,9 +580,9 @@
 mirrors/proxy_type_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mirrors/raw_type_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mirrors/raw_type_test/none: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-mirrors/redirecting_factory_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for Class<String, int>.
-mirrors/redirecting_factory_test/02: Crash # Instance of 'TypeOperator': type check unimplemented for Class<String, int>.
-mirrors/redirecting_factory_test/none: Crash # Instance of 'TypeOperator': type check unimplemented for Class<String, int>.
+mirrors/redirecting_factory_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
+mirrors/redirecting_factory_test/02: Crash # Please triage this failure.
+mirrors/redirecting_factory_test/none: Crash # Please triage this failure.
 mirrors/reflect_class_test/01: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mirrors/reflect_class_test/02: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 mirrors/reflect_class_test/none: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
@@ -636,8 +637,5 @@
 typed_data/float32x4_shuffle_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 typed_data/float32x4_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 typed_data/int32x4_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-typed_data/typed_data_hierarchy_int64_test: Crash # Instance of 'TypeOperator': type check unimplemented for List<int>.
 typed_data/typed_data_list_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-typed_data/typed_data_sublist_type_test: Crash # Instance of 'TypeOperator': type check unimplemented for T.
 typed_data/typed_list_iterable_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
-convert/json_toEncodable_reviver_test : RuntimeError
diff --git a/tests/standalone/standalone.status b/tests/standalone/standalone.status
index ee2f9e0..35ada31 100644
--- a/tests/standalone/standalone.status
+++ b/tests/standalone/standalone.status
@@ -258,4 +258,3 @@
 io/windows_file_system_links_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 io/zlib_test: Crash # Instance of 'TypeOperator': type check unimplemented for _Nullary.
 priority_queue_stress_test: RuntimeError # Please triage this failure.
-status_expression_test: RuntimeError # Please triage this failure.
diff --git a/third_party/pkg_tested/pkg_tested.status b/third_party/pkg_tested/pkg_tested.status
index c18a94c..f5502f2 100644
--- a/third_party/pkg_tested/pkg_tested.status
+++ b/third_party/pkg_tested/pkg_tested.status
@@ -11,9 +11,18 @@
 */*/*/*/packages/*/*: Skip
 */*/*/*/*/packages/*/*: Skip
 
+pub/test/dart2js/compiles_generated_file_from_dependency_test: Pass, Slow
+pub/test/serve/web_socket/url_to_asset_id_test: Pass, Slow
+pub/test/transformer/loads_a_diamond_transformer_dependency_graph_test: Pass, Slow
+
 [ $browser ]
 analyzer_cli/*: SkipByDesign # Uses dart:io.
 dart_style/*: SkipByDesign
+pub/*: SkipByDesign
+
+[ $runtime == vm && $system == windows ]
+pub/test/run/app_can_read_from_stdin_test: Fail # Issue 19448
+pub/test/run/forwards_signal_posix_test: SkipByDesign
 
 [ $runtime == vm && ($mode == debug || $arch == mips || $arch == simmips || $arch == simarm || $arch == simarmv5te || $arch == simarm64 || $builder_tag == asan) ]
 dart_style/test/command_line_test: Skip # The test controller does not take into account that tests take much longer in debug mode or on simulators/mips.
@@ -26,3 +35,458 @@
 dart_style/test/formatter_test: Crash #  try/finally
 dart_style/test/io_test: Crash #  try/finally
 dart_style/test/source_code_test: Crash #  try/finally
+pub/test/ascii_tree_test: Crash # Instance of 'TypeOperator': type casts not implemented.
+pub/test/barback/all_includes_all_default_directories_test: Crash #  try/finally
+pub/test/barback/directory_args_test: Crash #  try/finally
+pub/test/barback/fails_if_args_with_all_test: Crash #  try/finally
+pub/test/barback/fails_if_dir_arg_does_not_exist_test: Crash #  try/finally
+pub/test/barback/fails_if_dir_outside_package_test: Crash #  try/finally
+pub/test/barback/fails_if_no_default_dirs_test: Crash #  try/finally
+pub/test/barback/fails_on_all_with_no_buildable_directories_test: Crash #  try/finally
+pub/test/barback/fails_on_disallowed_directories_test: Crash #  try/finally
+pub/test/barback/fails_on_overlapping_directories_test: Crash #  try/finally
+pub/test/barback/subdirectories_test: Crash #  try/finally
+pub/test/build/allows_arbitrary_modes_test: Crash #  try/finally
+pub/test/build/can_specify_output_directory_test: Crash #  try/finally
+pub/test/build/cleans_entire_build_directory_test: Crash #  try/finally
+pub/test/build/copies_browser_js_next_to_entrypoints_test: Crash #  try/finally
+pub/test/build/copies_browser_js_with_dependency_override_test: Crash #  try/finally
+pub/test/build/copies_browser_js_with_dev_dependency_test: Crash #  try/finally
+pub/test/build/copies_non_dart_files_to_build_test: Crash #  try/finally
+pub/test/build/defaults_to_release_mode_test: Crash #  try/finally
+pub/test/build/handles_long_paths_test: Crash #  try/finally
+pub/test/build/includes_assets_from_dependencies_test: Crash #  try/finally
+pub/test/build/includes_dart_files_from_dependencies_in_debug_test: Crash #  try/finally
+pub/test/build/includes_dart_files_in_debug_mode_test: Crash #  try/finally
+pub/test/build/outputs_error_to_json_test: Crash #  try/finally
+pub/test/build/outputs_results_to_json_test: Crash #  try/finally
+pub/test/build/preserves_htaccess_test: Crash #  try/finally
+pub/test/cache/add/adds_latest_matching_version_test: Crash #  try/finally
+pub/test/cache/add/adds_latest_version_test: Crash #  try/finally
+pub/test/cache/add/all_adds_all_matching_versions_test: Crash #  try/finally
+pub/test/cache/add/all_with_some_versions_present_test: Crash #  try/finally
+pub/test/cache/add/already_cached_test: Crash #  try/finally
+pub/test/cache/add/bad_version_test: Crash #  try/finally
+pub/test/cache/add/missing_package_arg_test: Crash #  try/finally
+pub/test/cache/add/no_matching_version_test: Crash #  try/finally
+pub/test/cache/add/package_not_found_test: Crash #  try/finally
+pub/test/cache/add/unexpected_arguments_test: Crash #  try/finally
+pub/test/cache/list_test: Crash #  try/finally
+pub/test/cache/repair/empty_cache_test: Crash #  try/finally
+pub/test/cache/repair/handles_corrupted_binstub_test: Crash #  try/finally
+pub/test/cache/repair/handles_corrupted_global_lockfile_test: Crash #  try/finally
+pub/test/cache/repair/handles_failure_test: Crash #  try/finally
+pub/test/cache/repair/handles_orphaned_binstub_test: Crash #  try/finally
+pub/test/cache/repair/recompiles_snapshots_test: Crash #  try/finally
+pub/test/cache/repair/reinstalls_git_packages_test: Crash #  try/finally
+pub/test/cache/repair/reinstalls_hosted_packages_test: Crash #  try/finally
+pub/test/cache/repair/updates_binstubs_test: Crash #  try/finally
+pub/test/dart2js/allows_import_in_dart_code_test: Crash #  try/finally
+pub/test/dart2js/compiles_entrypoints_in_root_package_test: Crash #  try/finally
+pub/test/dart2js/compiles_generated_dart_file_test: Crash #  try/finally
+pub/test/dart2js/compiles_generated_file_from_dependency_outside_web_test: Crash #  try/finally
+pub/test/dart2js/compiles_generated_file_from_dependency_test: Crash #  try/finally
+pub/test/dart2js/compiles_imported_generated_file_test: Crash #  try/finally
+pub/test/dart2js/converts_isolate_entrypoint_in_web_test: Crash #  try/finally
+pub/test/dart2js/does_not_compile_if_disabled_test: Crash #  try/finally
+pub/test/dart2js/does_not_compile_until_its_output_is_requested_test: Crash #  try/finally
+pub/test/dart2js/does_not_support_invalid_command_line_options_type_test: Crash #  try/finally
+pub/test/dart2js/does_not_support_invalid_environment_type_test: Crash #  try/finally
+pub/test/dart2js/does_not_support_invalid_option_test: Crash #  try/finally
+pub/test/dart2js/doesnt_support_invalid_type_for_boolean_option_test: Crash #  try/finally
+pub/test/dart2js/environment_constant_test: Crash #  try/finally
+pub/test/dart2js/ignores_entrypoint_in_dependency_test: Crash #  try/finally
+pub/test/dart2js/ignores_entrypoints_in_lib_test: Crash #  try/finally
+pub/test/dart2js/ignores_non_entrypoint_dart_files_test: Crash #  try/finally
+pub/test/dart2js/includes_source_maps_if_sourceMaps_true_test: Crash #  try/finally
+pub/test/dart2js/includes_source_maps_in_debug_test: Crash #  try/finally
+pub/test/dart2js/minifies_in_release_mode_test: Crash #  try/finally
+pub/test/dart2js/minify_configuration_overrides_mode_test: Crash #  try/finally
+pub/test/dart2js/omits_source_map_if_sourceMaps_false_test: Crash #  try/finally
+pub/test/dart2js/omits_source_map_in_release_test: Crash #  try/finally
+pub/test/dart2js/outputs_deferred_libraries_test: Crash #  try/finally
+pub/test/dart2js/passes_along_environment_constants_test: Crash #  try/finally
+pub/test/dart2js/reports_dart_parse_errors_test: Crash #  try/finally
+pub/test/dart2js/source_maps_include_core_libs_in_subdirectory_test: Crash #  try/finally
+pub/test/dart2js/source_maps_include_core_libs_test: Crash #  try/finally
+pub/test/dart2js/supports_configuration_with_build_test: Crash #  try/finally
+pub/test/dart2js/supports_valid_options_test: Crash #  try/finally
+pub/test/dart2js/unminified_in_nonrelease_mode_test: Crash #  try/finally
+pub/test/dependency_computer/conservative_dependencies_test: Crash #  try/finally
+pub/test/dependency_computer/cycle_test: Crash #  try/finally
+pub/test/dependency_computer/dev_transformers_test: Crash #  try/finally
+pub/test/dependency_computer/error_test: Crash #  try/finally
+pub/test/dependency_computer/import_dependencies_test: Crash #  try/finally
+pub/test/dependency_computer/no_dependencies_test: Crash #  try/finally
+pub/test/dependency_computer/transformers_needed_by_library_test: Crash #  try/finally
+pub/test/dependency_override_test: Crash #  try/finally
+pub/test/deps_test: Crash #  try/finally
+pub/test/dev_dependency_test: Crash #  try/finally
+pub/test/downgrade/does_not_show_other_versions_test: Crash #  try/finally
+pub/test/downgrade/doesnt_change_git_dependencies_test: Crash #  try/finally
+pub/test/downgrade/dry_run_does_not_apply_changes_test: Crash #  try/finally
+pub/test/downgrade/unlock_dependers_test: Crash #  try/finally
+pub/test/downgrade/unlock_if_necessary_test: Crash #  try/finally
+pub/test/error_group_test: Crash #  try/finally
+pub/test/get/broken_symlink_test: Crash #  try/finally
+pub/test/get/cache_transformed_dependency_test: Crash #  try/finally
+pub/test/get/dry_run_does_not_apply_changes_test: Crash #  try/finally
+pub/test/get/git/check_out_and_upgrade_test: Crash #  try/finally
+pub/test/get/git/check_out_branch_test: Crash #  try/finally
+pub/test/get/git/check_out_revision_test: Crash #  try/finally
+pub/test/get/git/check_out_test: Crash #  try/finally
+pub/test/get/git/check_out_transitive_test: Crash #  try/finally
+pub/test/get/git/check_out_twice_test: Crash #  try/finally
+pub/test/get/git/check_out_unfetched_revision_of_cached_repo_test: Crash #  try/finally
+pub/test/get/git/check_out_with_trailing_slash_test: Crash #  try/finally
+pub/test/get/git/dependency_name_match_pubspec_test: Crash #  try/finally
+pub/test/get/git/different_repo_name_test: Crash #  try/finally
+pub/test/get/git/doesnt_fetch_if_nothing_changes_test: Crash #  try/finally
+pub/test/get/git/lock_version_test: Crash #  try/finally
+pub/test/get/git/locked_revision_without_repo_test: Crash #  try/finally
+pub/test/get/git/require_pubspec_name_test: Crash #  try/finally
+pub/test/get/git/require_pubspec_test: Crash #  try/finally
+pub/test/get/git/stay_locked_if_compatible_test: Crash #  try/finally
+pub/test/get/git/unlock_if_incompatible_test: Crash #  try/finally
+pub/test/get/hosted/avoid_network_requests_test: Crash #  try/finally
+pub/test/get/hosted/cached_pubspec_test: Crash #  try/finally
+pub/test/get/hosted/do_not_upgrade_on_removed_constraints_test: Crash #  try/finally
+pub/test/get/hosted/does_no_network_requests_when_possible_test: Crash #  try/finally
+pub/test/get/hosted/get_test: Crash #  try/finally
+pub/test/get/hosted/get_transitive_test: Crash #  try/finally
+pub/test/get/hosted/gets_a_package_with_busted_dev_dependencies_test: Crash #  try/finally
+pub/test/get/hosted/resolve_constraints_test: Crash #  try/finally
+pub/test/get/hosted/stay_locked_if_compatible_test: Crash #  try/finally
+pub/test/get/hosted/stay_locked_if_new_is_satisfied_test: Crash #  try/finally
+pub/test/get/hosted/stay_locked_test: Crash #  try/finally
+pub/test/get/hosted/unlock_if_incompatible_test: Crash #  try/finally
+pub/test/get/hosted/unlock_if_new_is_unsatisfied_test: Crash #  try/finally
+pub/test/get/hosted/unlock_if_version_doesnt_exist_test: Crash #  try/finally
+pub/test/get/path/absolute_path_test: Crash #  try/finally
+pub/test/get/path/absolute_symlink_test: Crash #  try/finally
+pub/test/get/path/empty_pubspec_test: Crash #  try/finally
+pub/test/get/path/no_pubspec_test: Crash #  try/finally
+pub/test/get/path/nonexistent_dir_test: Crash #  try/finally
+pub/test/get/path/path_is_file_test: Crash #  try/finally
+pub/test/get/path/relative_path_test: Crash #  try/finally
+pub/test/get/path/relative_symlink_test: Crash #  try/finally
+pub/test/get/path/shared_dependency_symlink_test: Crash #  try/finally
+pub/test/get/path/shared_dependency_test: Crash #  try/finally
+pub/test/get/relative_symlink_test: Crash #  try/finally
+pub/test/get/switch_source_test: Crash #  try/finally
+pub/test/global/activate/activate_git_after_hosted_test: Crash #  try/finally
+pub/test/global/activate/activate_hosted_after_git_test: Crash #  try/finally
+pub/test/global/activate/activate_hosted_after_path_test: Crash #  try/finally
+pub/test/global/activate/activate_path_after_hosted_test: Crash #  try/finally
+pub/test/global/activate/bad_version_test: Crash #  try/finally
+pub/test/global/activate/cached_package_test: Crash #  try/finally
+pub/test/global/activate/constraint_test: Crash #  try/finally
+pub/test/global/activate/constraint_with_path_test: Crash #  try/finally
+pub/test/global/activate/different_version_test: Crash #  try/finally
+pub/test/global/activate/doesnt_snapshot_path_executables_test: Crash #  try/finally
+pub/test/global/activate/empty_constraint_test: Crash #  try/finally
+pub/test/global/activate/git_package_test: Crash #  try/finally
+pub/test/global/activate/ignores_active_version_test: Crash #  try/finally
+pub/test/global/activate/installs_dependencies_for_git_test: Crash #  try/finally
+pub/test/global/activate/installs_dependencies_for_path_test: Crash #  try/finally
+pub/test/global/activate/installs_dependencies_test: Crash #  try/finally
+pub/test/global/activate/missing_git_repo_test: Crash #  try/finally
+pub/test/global/activate/missing_package_arg_test: Crash #  try/finally
+pub/test/global/activate/outdated_binstub_test: Crash #  try/finally
+pub/test/global/activate/path_package_test: Crash #  try/finally
+pub/test/global/activate/reactivating_git_upgrades_test: Crash #  try/finally
+pub/test/global/activate/removes_old_lockfile_test: Crash #  try/finally
+pub/test/global/activate/snapshots_git_executables_test: Crash #  try/finally
+pub/test/global/activate/snapshots_hosted_executables_test: Crash #  try/finally
+pub/test/global/activate/supports_version_solver_backtracking_test: Crash #  try/finally
+pub/test/global/activate/uncached_package_test: Crash #  try/finally
+pub/test/global/activate/unexpected_arguments_test: Crash #  try/finally
+pub/test/global/activate/unknown_package_test: Crash #  try/finally
+pub/test/global/binstubs/binstub_runs_executable_test: Crash #  try/finally
+pub/test/global/binstubs/binstub_runs_global_run_if_no_snapshot_test: Crash #  try/finally
+pub/test/global/binstubs/binstub_runs_precompiled_snapshot_test: Crash #  try/finally
+pub/test/global/binstubs/creates_executables_in_pubspec_test: Crash #  try/finally
+pub/test/global/binstubs/does_not_warn_if_no_executables_test: Crash #  try/finally
+pub/test/global/binstubs/does_not_warn_if_on_path_test: Crash #  try/finally
+pub/test/global/binstubs/explicit_and_no_executables_options_test: Crash #  try/finally
+pub/test/global/binstubs/explicit_executables_test: Crash #  try/finally
+pub/test/global/binstubs/missing_script_test: Crash #  try/finally
+pub/test/global/binstubs/name_collision_test: Crash #  try/finally
+pub/test/global/binstubs/name_collision_with_overwrite_test: Crash #  try/finally
+pub/test/global/binstubs/no_executables_flag_test: Crash #  try/finally
+pub/test/global/binstubs/outdated_binstub_runs_pub_global_test: Crash #  try/finally
+pub/test/global/binstubs/outdated_snapshot_test: Crash #  try/finally
+pub/test/global/binstubs/path_package_test: Crash #  try/finally
+pub/test/global/binstubs/reactivate_removes_old_executables_test: Crash #  try/finally
+pub/test/global/binstubs/removes_even_if_not_in_pubspec_test: Crash #  try/finally
+pub/test/global/binstubs/removes_when_deactivated_test: Crash #  try/finally
+pub/test/global/binstubs/unknown_explicit_executable_test: Crash #  try/finally
+pub/test/global/binstubs/warns_if_not_on_path_test: Crash #  try/finally
+pub/test/global/deactivate/deactivate_and_reactivate_package_test: Crash #  try/finally
+pub/test/global/deactivate/git_package_test: Crash #  try/finally
+pub/test/global/deactivate/hosted_package_test: Crash #  try/finally
+pub/test/global/deactivate/missing_package_arg_test: Crash #  try/finally
+pub/test/global/deactivate/path_package_test: Crash #  try/finally
+pub/test/global/deactivate/removes_precompiled_snapshots_test: Crash #  try/finally
+pub/test/global/deactivate/unexpected_arguments_test: Crash #  try/finally
+pub/test/global/deactivate/unknown_package_test: Crash #  try/finally
+pub/test/global/list_test: Crash #  try/finally
+pub/test/global/run/errors_if_outside_bin_test: Crash #  try/finally
+pub/test/global/run/implicit_executable_name_test: Crash #  try/finally
+pub/test/global/run/missing_executable_arg_test: Crash #  try/finally
+pub/test/global/run/missing_path_package_test: Crash #  try/finally
+pub/test/global/run/mode_test: Crash #  try/finally
+pub/test/global/run/nonexistent_script_test: Crash #  try/finally
+pub/test/global/run/recompiles_if_sdk_is_out_of_date_test: Crash #  try/finally
+pub/test/global/run/reflects_changes_to_local_package_test: Crash #  try/finally
+pub/test/global/run/runs_git_script_test: Crash #  try/finally
+pub/test/global/run/runs_path_script_test: Crash #  try/finally
+pub/test/global/run/runs_script_test: Crash #  try/finally
+pub/test/global/run/runs_transformer_test: Crash #  try/finally
+pub/test/global/run/unknown_package_test: Crash #  try/finally
+pub/test/global/run/uses_old_lockfile_test: Crash #  try/finally
+pub/test/hosted/fail_gracefully_on_missing_package_test: Crash #  try/finally
+pub/test/hosted/fail_gracefully_on_url_resolve_test: Crash #  try/finally
+pub/test/hosted/offline_test: Crash #  try/finally
+pub/test/hosted/remove_removed_dependency_test: Crash #  try/finally
+pub/test/hosted/remove_removed_transitive_dependency_test: Crash #  try/finally
+pub/test/hosted/version_negotiation_test: Crash #  try/finally
+pub/test/implicit_barback_dependency_test: Crash #  try/finally
+pub/test/implicit_dependency_test: Crash #  try/finally
+pub/test/io_test: Crash #  try/finally
+pub/test/lish/archives_and_uploads_a_package_test: Crash #  try/finally
+pub/test/lish/cloud_storage_upload_doesnt_redirect_test: Crash #  try/finally
+pub/test/lish/cloud_storage_upload_provides_an_error_test: Crash #  try/finally
+pub/test/lish/does_not_publish_if_private_test: Crash #  try/finally
+pub/test/lish/does_not_publish_if_private_with_server_arg_test: Crash #  try/finally
+pub/test/lish/force_cannot_be_combined_with_dry_run_test: Crash #  try/finally
+pub/test/lish/force_does_not_publish_if_private_test: Crash #  try/finally
+pub/test/lish/force_does_not_publish_if_there_are_errors_test: Crash #  try/finally
+pub/test/lish/force_publishes_if_tests_are_no_warnings_or_errors_test: Crash #  try/finally
+pub/test/lish/force_publishes_if_there_are_warnings_test: Crash #  try/finally
+pub/test/lish/many_files_test: Crash #  try/finally
+pub/test/lish/package_creation_provides_a_malformed_error_test: Crash #  try/finally
+pub/test/lish/package_creation_provides_a_malformed_success_test: Crash #  try/finally
+pub/test/lish/package_creation_provides_an_error_test: Crash #  try/finally
+pub/test/lish/package_creation_provides_invalid_json_test: Crash #  try/finally
+pub/test/lish/package_validation_has_a_warning_and_continues_test: Crash #  try/finally
+pub/test/lish/package_validation_has_a_warning_and_is_canceled_test: Crash #  try/finally
+pub/test/lish/package_validation_has_an_error_test: Crash #  try/finally
+pub/test/lish/preview_errors_if_private_test: Crash #  try/finally
+pub/test/lish/preview_package_validation_has_a_warning_test: Crash #  try/finally
+pub/test/lish/preview_package_validation_has_no_warnings_test: Crash #  try/finally
+pub/test/lish/server_arg_does_not_override_private_test: Crash #  try/finally
+pub/test/lish/server_arg_overrides_publish_to_url_test: Crash #  try/finally
+pub/test/lish/upload_form_fields_has_a_non_string_value_test: Crash #  try/finally
+pub/test/lish/upload_form_fields_is_not_a_map_test: Crash #  try/finally
+pub/test/lish/upload_form_is_missing_fields_test: Crash #  try/finally
+pub/test/lish/upload_form_is_missing_url_test: Crash #  try/finally
+pub/test/lish/upload_form_provides_an_error_test: Crash #  try/finally
+pub/test/lish/upload_form_provides_invalid_json_test: Crash #  try/finally
+pub/test/lish/upload_form_url_is_not_a_string_test: Crash #  try/finally
+pub/test/lish/uses_publish_to_url_test: Crash #  try/finally
+pub/test/list_package_dirs/ignores_updated_pubspec_test: Crash #  try/finally
+pub/test/list_package_dirs/includes_dev_dependencies_test: Crash #  try/finally
+pub/test/list_package_dirs/lists_dependency_directories_test: Crash #  try/finally
+pub/test/list_package_dirs/lockfile_error_test: Crash #  try/finally
+pub/test/list_package_dirs/missing_pubspec_test: Crash #  try/finally
+pub/test/list_package_dirs/no_lockfile_test: Crash #  try/finally
+pub/test/list_package_dirs/pubspec_error_test: Crash #  try/finally
+pub/test/lock_file_test: Crash #  try/finally
+pub/test/no_package_symlinks_test: Crash #  try/finally
+pub/test/oauth2/with_a_malformed_credentials_authenticates_again_test: Crash #  try/finally
+pub/test/oauth2/with_a_pre_existing_credentials_does_not_authenticate_test: Crash #  try/finally
+pub/test/oauth2/with_a_server_rejected_refresh_token_authenticates_again_test: Crash #  try/finally
+pub/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test: Crash #  try/finally
+pub/test/oauth2/with_an_expired_credentials_without_a_refresh_token_authenticates_again_test: Crash #  try/finally
+pub/test/oauth2/with_no_credentials_authenticates_and_saves_credentials_test: Crash #  try/finally
+pub/test/oauth2/with_server_rejected_credentials_authenticates_again_test: Crash #  try/finally
+pub/test/package_list_files_test: Crash #  try/finally
+pub/test/preprocess_test: Crash #  try/finally
+pub/test/pub_get_and_upgrade_test: Crash #  try/finally
+pub/test/pub_test: Crash #  try/finally
+pub/test/pub_uploader_test: Crash #  try/finally
+pub/test/pubspec_test: Crash #  try/finally
+pub/test/real_version_test: Crash #  try/finally
+pub/test/run/allows_dart_extension_test: Crash #  try/finally
+pub/test/run/app_can_read_from_stdin_test: Crash #  try/finally
+pub/test/run/displays_transformer_logs_test: Crash #  try/finally
+pub/test/run/does_not_run_on_transformer_error_test: Crash #  try/finally
+pub/test/run/doesnt_load_an_unnecessary_transformer_test: Crash #  try/finally
+pub/test/run/errors_if_no_executable_is_given_test: Crash #  try/finally
+pub/test/run/errors_if_only_transitive_dependency_test: Crash #  try/finally
+pub/test/run/errors_if_path_in_dependency_test: Crash #  try/finally
+pub/test/run/forwards_signal_posix_test: Crash #  try/finally
+pub/test/run/ignores_explicit_dart2js_transformer_test: Crash #  try/finally
+pub/test/run/includes_parent_directories_of_entrypoint_test: Crash #  try/finally
+pub/test/run/mode_test: Crash #  try/finally
+pub/test/run/nonexistent_dependency_test: Crash #  try/finally
+pub/test/run/nonexistent_script_in_dependency_test: Crash #  try/finally
+pub/test/run/nonexistent_script_test: Crash #  try/finally
+pub/test/run/passes_along_arguments_test: Crash #  try/finally
+pub/test/run/runs_a_generated_script_test: Crash #  try/finally
+pub/test/run/runs_app_in_directory_in_entrypoint_test: Crash #  try/finally
+pub/test/run/runs_app_in_entrypoint_test: Crash #  try/finally
+pub/test/run/runs_app_in_entrypoint_with_warning_test: Crash #  try/finally
+pub/test/run/runs_from_a_dependency_override_after_dependency_test: Crash #  try/finally
+pub/test/run/runs_named_app_in_dependency_test: Crash #  try/finally
+pub/test/run/runs_named_app_in_dev_dependency_test: Crash #  try/finally
+pub/test/run/runs_shorthand_app_in_dependency_test: Crash #  try/finally
+pub/test/run/runs_the_script_in_checked_mode_test: Crash #  try/finally
+pub/test/run/runs_transformer_in_entrypoint_test: Crash #  try/finally
+pub/test/serve/404_page_test: Crash #  try/finally
+pub/test/serve/allows_arbitrary_modes_test: Crash #  try/finally
+pub/test/serve/defaults_to_debug_mode_test: Crash #  try/finally
+pub/test/serve/does_not_crash_if_an_unused_dart_file_has_a_syntax_error_test: Crash #  try/finally
+pub/test/serve/does_not_get_first_if_a_dependency_is_removed_test: Crash #  try/finally
+pub/test/serve/does_not_get_first_if_git_url_did_not_change_test: Crash #  try/finally
+pub/test/serve/does_not_get_first_if_locked_matches_override_test: Crash #  try/finally
+pub/test/serve/does_not_get_first_if_locked_version_matches_test: Crash #  try/finally
+pub/test/serve/does_not_serve_dart_in_release_test: Crash #  try/finally
+pub/test/serve/does_not_serve_hidden_assets_test: Crash #  try/finally
+pub/test/serve/does_not_watch_compiled_js_files_test: Crash #  try/finally
+pub/test/serve/gets_first_if_dependency_added_test: Crash #  try/finally
+pub/test/serve/gets_first_if_dependency_is_not_installed_test: Crash #  try/finally
+pub/test/serve/gets_first_if_dependency_version_changed_test: Crash #  try/finally
+pub/test/serve/gets_first_if_dev_dependency_changed_test: Crash #  try/finally
+pub/test/serve/gets_first_if_git_ref_changed_test: Crash #  try/finally
+pub/test/serve/gets_first_if_git_url_changed_test: Crash #  try/finally
+pub/test/serve/gets_first_if_no_lockfile_test: Crash #  try/finally
+pub/test/serve/gets_first_if_path_dependency_changed_test: Crash #  try/finally
+pub/test/serve/gets_first_if_source_changed_test: Crash #  try/finally
+pub/test/serve/gets_first_if_transitive_dependency_is_not_installed_test: Crash #  try/finally
+pub/test/serve/invalid_method_test: Crash #  try/finally
+pub/test/serve/invalid_urls_test: Crash #  try/finally
+pub/test/serve/missing_asset_test: Crash #  try/finally
+pub/test/serve/missing_dependency_file_test: Crash #  try/finally
+pub/test/serve/missing_file_test: Crash #  try/finally
+pub/test/serve/native_watch_added_file_test: Crash #  try/finally
+pub/test/serve/native_watch_modified_file_test: Crash #  try/finally
+pub/test/serve/native_watch_removed_file_test: Crash #  try/finally
+pub/test/serve/native_watch_replaced_file_test: Crash #  try/finally
+pub/test/serve/serve_from_app_lib_test: Crash #  try/finally
+pub/test/serve/serve_from_app_web_test: Crash #  try/finally
+pub/test/serve/serve_from_dependency_lib_test: Crash #  try/finally
+pub/test/serve/serves_file_with_space_test: Crash #  try/finally
+pub/test/serve/serves_index_html_for_directories_test: Crash #  try/finally
+pub/test/serve/serves_web_and_test_dirs_by_default_test: Crash #  try/finally
+pub/test/serve/supports_cross_origin_header_test: Crash #  try/finally
+pub/test/serve/supports_user_defined_declaring_transformers_test: Crash #  try/finally
+pub/test/serve/supports_user_defined_lazy_transformers_test: Crash #  try/finally
+pub/test/serve/unknown_dependency_test: Crash #  try/finally
+pub/test/serve/uses_appropriate_mime_types_test: Crash #  try/finally
+pub/test/serve/watch_added_file_test: Crash #  try/finally
+pub/test/serve/watch_modified_file_test: Crash #  try/finally
+pub/test/serve/watch_removed_file_test: Crash #  try/finally
+pub/test/serve/web_socket/exit_on_close_test: Crash #  try/finally
+pub/test/serve/web_socket/path_to_urls_errors_test: Crash #  try/finally
+pub/test/serve/web_socket/path_to_urls_test: Crash #  try/finally
+pub/test/serve/web_socket/path_to_urls_with_line_test: Crash #  try/finally
+pub/test/serve/web_socket/serve_directory_already_served_test: Crash #  try/finally
+pub/test/serve/web_socket/serve_directory_and_immediately_request_asset_test: Crash #  try/finally
+pub/test/serve/web_socket/serve_directory_and_immediately_serve_again_test: Crash #  try/finally
+pub/test/serve/web_socket/serve_directory_and_immediately_unserve_test: Crash #  try/finally
+pub/test/serve/web_socket/serve_directory_arg_errors_test: Crash #  try/finally
+pub/test/serve/web_socket/serve_directory_overlapping_test: Crash #  try/finally
+pub/test/serve/web_socket/serve_directory_test: Crash #  try/finally
+pub/test/serve/web_socket/unserve_directory_arg_errors_test: Crash #  try/finally
+pub/test/serve/web_socket/unserve_directory_not_served_test: Crash #  try/finally
+pub/test/serve/web_socket/unserve_directory_test: Crash #  try/finally
+pub/test/serve/web_socket/url_to_asset_id_errors_test: Crash #  try/finally
+pub/test/serve/web_socket/url_to_asset_id_test: Crash #  try/finally
+pub/test/serve/web_socket/url_to_asset_id_with_line_test: Crash #  try/finally
+pub/test/snapshot/creates_a_snapshot_for_immediate_and_transitive_dep_test: Crash #  try/finally
+pub/test/snapshot/creates_a_snapshot_test: Crash #  try/finally
+pub/test/snapshot/doesnt_load_irrelevant_transformers_test: Crash #  try/finally
+pub/test/snapshot/doesnt_resnapshot_when_a_dependency_is_unchanged_test: Crash #  try/finally
+pub/test/snapshot/doesnt_snapshot_an_entrypoint_dependency_test: Crash #  try/finally
+pub/test/snapshot/doesnt_snapshot_path_dependency_test: Crash #  try/finally
+pub/test/snapshot/doesnt_snapshot_transitive_dependencies_test: Crash #  try/finally
+pub/test/snapshot/prints_errors_for_broken_snapshots_test: Crash #  try/finally
+pub/test/snapshot/recompiles_if_the_sdk_is_out_of_date_test: Crash #  try/finally
+pub/test/snapshot/snapshots_transformed_code_test: Crash #  try/finally
+pub/test/snapshot/updates_snapshot_for_git_dependency_test: Crash #  try/finally
+pub/test/snapshot/upgrades_snapshot_for_dependency_test: Crash #  try/finally
+pub/test/snapshot/upgrades_snapshot_test: Crash #  try/finally
+pub/test/transcript_test: Crash # Instance of 'TypeOperator': type casts not implemented.
+pub/test/transformer/a_transformer_rejects_its_config_test: Crash #  try/finally
+pub/test/transformer/asset_not_found_exceptions_are_detectable_test: Crash #  try/finally
+pub/test/transformer/cache_test: Crash #  try/finally
+pub/test/transformer/can_log_messages_test: Crash #  try/finally
+pub/test/transformer/can_use_consume_primary_test: Crash #  try/finally
+pub/test/transformer/can_use_has_input_test: Crash #  try/finally
+pub/test/transformer/can_use_read_input_as_string_test: Crash #  try/finally
+pub/test/transformer/can_use_read_input_test: Crash #  try/finally
+pub/test/transformer/configuration/configuration_defaults_to_empty_map_test: Crash #  try/finally
+pub/test/transformer/configuration/passes_configuration_to_a_transformer_test: Crash #  try/finally
+pub/test/transformer/configuration/with_configuration_only_instantiates_configurable_transformers_test: Crash #  try/finally
+pub/test/transformer/dart2js_transformer_before_another_transformer_test: Crash #  try/finally
+pub/test/transformer/does_not_run_a_transform_on_an_input_in_another_package_test: Crash #  try/finally
+pub/test/transformer/exclusion/exclude_asset_glob_test: Crash #  try/finally
+pub/test/transformer/exclusion/exclude_asset_list_test: Crash #  try/finally
+pub/test/transformer/exclusion/exclude_asset_prefix_test: Crash #  try/finally
+pub/test/transformer/exclusion/exclude_asset_string_test: Crash #  try/finally
+pub/test/transformer/exclusion/include_asset_glob_test: Crash #  try/finally
+pub/test/transformer/exclusion/include_asset_list_test: Crash #  try/finally
+pub/test/transformer/exclusion/include_asset_prefix_test: Crash #  try/finally
+pub/test/transformer/exclusion/include_asset_string_test: Crash #  try/finally
+pub/test/transformer/exclusion/includes_before_excludes_test: Crash #  try/finally
+pub/test/transformer/exclusion/works_on_aggregate_transformer_test: Crash #  try/finally
+pub/test/transformer/exclusion/works_on_dart2js_test: Crash #  try/finally
+pub/test/transformer/exclusion/works_on_lazy_transformer_test: Crash #  try/finally
+pub/test/transformer/exclusion/works_on_transformer_group_test: Crash #  try/finally
+pub/test/transformer/fails_to_load_a_file_that_defines_no_transforms_test: Crash #  try/finally
+pub/test/transformer/fails_to_load_a_non_existent_transform_test: Crash #  try/finally
+pub/test/transformer/fails_to_load_a_pubspec_with_reserved_transformer_test: Crash #  try/finally
+pub/test/transformer/fails_to_load_a_transform_from_a_deps_dev_dependency_test: Crash #  try/finally
+pub/test/transformer/fails_to_load_a_transform_from_a_non_dependency_test: Crash #  try/finally
+pub/test/transformer/fails_to_load_a_transform_with_a_syntax_error_test: Crash #  try/finally
+pub/test/transformer/fails_to_load_a_transform_with_an_import_error_test: Crash #  try/finally
+pub/test/transformer/fails_to_load_an_unconfigurable_transformer_when_config_is_passed_test: Crash #  try/finally
+pub/test/transformer/ignores_a_transformer_on_test_files_in_a_dependency_test: Crash #  try/finally
+pub/test/transformer/loads_a_declaring_aggregate_transformer_test: Crash #  try/finally
+pub/test/transformer/loads_a_diamond_transformer_dependency_graph_test: Crash #  try/finally
+pub/test/transformer/loads_a_lazy_aggregate_transformer_test: Crash #  try/finally
+pub/test/transformer/loads_a_transformer_defined_in_an_exported_library_test: Crash #  try/finally
+pub/test/transformer/loads_an_aggregate_transformer_test: Crash #  try/finally
+pub/test/transformer/loads_different_configurations_from_the_same_isolate_test: Crash #  try/finally
+pub/test/transformer/multiple_transformers_reject_their_config_test: Crash #  try/finally
+pub/test/transformer/prefers_transformer_to_library_name_test: Crash #  try/finally
+pub/test/transformer/prints_a_transform_error_in_apply_test: Crash #  try/finally
+pub/test/transformer/prints_a_transform_interface_error_test: Crash #  try/finally
+pub/test/transformer/runs_a_local_transform_on_the_application_package_test: Crash #  try/finally
+pub/test/transformer/runs_a_third_party_transform_on_the_application_package_test: Crash #  try/finally
+pub/test/transformer/runs_a_third_party_transformer_on_a_local_transformer_test: Crash #  try/finally
+pub/test/transformer/runs_a_transformer_group_test: Crash #  try/finally
+pub/test/transformer/runs_a_transformer_on_a_dependency_test: Crash #  try/finally
+pub/test/transformer/runs_one_third_party_transformer_on_another_test: Crash #  try/finally
+pub/test/transformer/supports_a_transformer_that_doesnt_return_futures_test: Crash #  try/finally
+pub/test/unknown_source_test: Crash #  try/finally
+pub/test/upgrade/dry_run_does_not_apply_changes_test: Crash #  try/finally
+pub/test/upgrade/git/do_not_upgrade_if_unneeded_test: Crash #  try/finally
+pub/test/upgrade/git/upgrade_locked_test: Crash #  try/finally
+pub/test/upgrade/git/upgrade_one_locked_test: Crash #  try/finally
+pub/test/upgrade/git/upgrade_to_incompatible_pubspec_test: Crash #  try/finally
+pub/test/upgrade/git/upgrade_to_nonexistent_pubspec_test: Crash #  try/finally
+pub/test/upgrade/hosted/unlock_dependers_test: Crash #  try/finally
+pub/test/upgrade/hosted/unlock_if_necessary_test: Crash #  try/finally
+pub/test/upgrade/hosted/upgrade_removed_constraints_test: Crash #  try/finally
+pub/test/upgrade/report/describes_change_test: Crash #  try/finally
+pub/test/upgrade/report/does_not_show_newer_versions_for_locked_packages_test: Crash #  try/finally
+pub/test/upgrade/report/highlights_overrides_test: Crash #  try/finally
+pub/test/upgrade/report/leading_character_shows_change_test: Crash #  try/finally
+pub/test/upgrade/report/shows_newer_available_versions_test: Crash #  try/finally
+pub/test/upgrade/report/shows_number_of_changed_dependencies_test: Crash #  try/finally
+pub/test/utils_test: Crash #  try/finally
+pub/test/validator/compiled_dartdoc_test: Crash #  try/finally
+pub/test/validator/dependency_override_test: Crash #  try/finally
+pub/test/validator/dependency_test: Crash #  try/finally
+pub/test/validator/directory_test: Crash #  try/finally
+pub/test/validator/executable_test: Crash #  try/finally
+pub/test/validator/license_test: Crash #  try/finally
+pub/test/validator/name_test: Crash #  try/finally
+pub/test/validator/pubspec_field_test: Crash #  try/finally
+pub/test/validator/sdk_constraint_test: Crash #  try/finally
+pub/test/validator/size_test: Crash #  try/finally
+pub/test/validator/utf8_readme_test: Crash #  try/finally
+pub/test/version_solver_test: Crash #  try/finally
diff --git a/tools/VERSION b/tools/VERSION
index a79c18d..05c219c 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 1
 MINOR 11
 PATCH 0
-PRERELEASE 3
+PRERELEASE 4
 PRERELEASE_PATCH 0
diff --git a/tools/apps/update_homebrew/bin/update_homebrew.dart b/tools/apps/update_homebrew/bin/update_homebrew.dart
index 5e72f9c..dfdf41f 100644
--- a/tools/apps/update_homebrew/bin/update_homebrew.dart
+++ b/tools/apps/update_homebrew/bin/update_homebrew.dart
@@ -4,59 +4,74 @@
 
 library update_homebrew;
 
-import 'dart:io';
-import 'dart:convert';
 import 'dart:async';
-import 'package:http/http.dart' as http;
+import 'dart:convert';
+import 'dart:io';
+
 import 'package:args/args.dart';
-import 'package:googleapis/storage/v1.dart' as storage;
 import 'package:googleapis/common/common.dart' show DownloadOptions, Media;
+import 'package:googleapis/storage/v1.dart' as storage;
+import 'package:http/http.dart' as http;
+import 'package:stack_trace/stack_trace.dart';
 
-String repository;  // The path to the temporary git checkout of dart-homebrew.
-Map gitEnvironment;  // Pass a wrapper script for SSH to git in the environment.
+String repository; // The path to the temporary git checkout of dart-homebrew.
+Map gitEnvironment; // Pass a wrapper script for SSH to git in the environment.
 
-final CHANNELS = ['dev', 'stable'];
+const GITHUB_REPO = 'dart-lang/homebrew-dart';
 
-final SDK_FILES = ['sdk/dartsdk-macos-x64-release.zip',
-                   'sdk/dartsdk-macos-ia32-release.zip' ];
-final DARTIUM_FILES = ['dartium/dartium-macos-ia32-release.zip',
-                       'dartium/content_shell-macos-ia32-release.zip'];
+const CHANNELS = const ['dev', 'stable'];
+
+const SDK_FILES = const [
+  'sdk/dartsdk-macos-x64-release.zip',
+  'sdk/dartsdk-macos-ia32-release.zip'
+];
+
+const DARTIUM_FILES = const [
+  'dartium/dartium-macos-ia32-release.zip',
+  'dartium/content_shell-macos-ia32-release.zip'
+];
+
 final FILES = []..addAll(SDK_FILES)..addAll(DARTIUM_FILES);
 
-
-Future<String> getHash256(String channel, int revision, String download) {
+Future<String> getHash256(String channel, int revision, String download) async {
   var client = new http.Client();
-  var api = new storage.StorageApi(client);
-  return
-      api.objects.get('dart-archive',
-                      'channels/$channel/release/$revision/$download.sha256sum',
-                       downloadOptions: DownloadOptions.FullMedia)
-      .then((Media media) => ASCII.decodeStream(media.stream))
-      .then((hashLine) => new RegExp('[0-9a-fA-F]*').stringMatch(hashLine))
-      .whenComplete(client.close);
+  try {
+    var api = new storage.StorageApi(client);
+    var media = await api.objects.get('dart-archive',
+        'channels/$channel/release/$revision/$download.sha256sum',
+        downloadOptions: DownloadOptions.FullMedia);
+
+    var hashLine = await ASCII.decodeStream(media.stream);
+    return new RegExp('[0-9a-fA-F]*').stringMatch(hashLine);
+  } finally {
+    client.close();
+  }
 }
 
-Future<String> getVersion(String channel, int revision) {
+Future<String> getVersion(String channel, int revision) async {
   var client = new http.Client();
-  var api = new storage.StorageApi(client);
-  return api.objects.get('dart-archive',
-                         'channels/$channel/release/$revision/VERSION',
-                         downloadOptions: DownloadOptions.FullMedia)
-      .then((Media media) => JSON.fuse(ASCII).decoder.bind(media.stream).first)
-      .then((versionObject) => versionObject['version'])
-      .whenComplete(client.close);
+  try {
+    var api = new storage.StorageApi(client);
+
+    var media = await api.objects.get(
+        'dart-archive', 'channels/$channel/release/$revision/VERSION',
+        downloadOptions: DownloadOptions.FullMedia);
+
+    var versionObject = await JSON.fuse(ASCII).decoder.bind(media.stream).first;
+    return versionObject['version'];
+  } finally {
+    client.close();
+  }
 }
 
-Future setCurrentRevisions(Map revisions) {
-  return new File('$repository/dart.rb')
-    .readAsLines()
-    .then((lines) {
-      for (var channel in CHANNELS) {
-        final regExp = new RegExp('channels/$channel/release/(\\d*)/sdk');
-        revisions[channel] =
-	    regExp.firstMatch(lines.firstWhere(regExp.hasMatch)).group(1);
-      }
-    });
+Future setCurrentRevisions(Map revisions) async {
+  var lines = await (new File('$repository/dart.rb')).readAsLines();
+
+  for (var channel in CHANNELS) {
+    final regExp = new RegExp('channels/$channel/release/(\\d*)/sdk');
+    revisions[channel] =
+        regExp.firstMatch(lines.firstWhere(regExp.hasMatch)).group(1);
+  }
 }
 
 Future setHashes(Map revisions, Map hashes) {
@@ -72,39 +87,30 @@
   return Future.wait(waitOn);
 }
 
-Future writeHomebrewInfo(String channel, int revision) {
+Future writeHomebrewInfo(String channel, int revision) async {
   var revisions = {};
   var hashes = {};
-  var devVersion;
-  var stableVersion;
-  return setCurrentRevisions(revisions).then((_) {
-    if (revisions[channel] == revision) {
-      print("Channel $channel is already at revision $revision in homebrew.");
-      exit(0);
-    }
-    revisions[channel] = revision;
-    return setHashes(revisions, hashes);
-  }).then((_) {
-    return getVersion('dev', revisions['dev']);
-  }).then((version) {
-    devVersion = version;
-    return getVersion('stable', revisions['stable']);
-  }).then((version) {
-    stableVersion = version;
-    return (new File('$repository/dartium.rb').openWrite()
-      ..write(DartiumFile(revisions, hashes, devVersion, stableVersion)))
-      .close();
-  }).then((_) {
-    return (new File('$repository/dart.rb').openWrite()
-      ..write(DartFile(revisions, hashes, devVersion, stableVersion)))
-      .close();
-  });
+
+  await setCurrentRevisions(revisions);
+
+  if (revisions[channel] == revision) {
+    print("Channel $channel is already at revision $revision in homebrew.");
+    exit(0);
+  }
+  revisions[channel] = revision;
+  await setHashes(revisions, hashes);
+  var devVersion = await getVersion('dev', revisions['dev']);
+
+  var stableVersion = await getVersion('stable', revisions['stable']);
+
+  await (new File('$repository/dartium.rb').openWrite()
+    ..write(DartiumFile(revisions, hashes, devVersion, stableVersion))).close();
+  await (new File('$repository/dart.rb').openWrite()
+    ..write(DartFile(revisions, hashes, devVersion, stableVersion))).close();
 }
 
-String DartiumFile(Map revisions,
-                   Map hashes,
-                   String devVersion,
-                   String stableVersion) {
+String DartiumFile(
+    Map revisions, Map hashes, String devVersion, String stableVersion) {
   final urlBase = 'https://storage.googleapis.com/dart-archive/channels';
   final dartiumFile = 'dartium/dartium-macos-ia32-release.zip';
   final contentShellFile = 'dartium/content_shell-macos-ia32-release.zip';
@@ -167,10 +173,8 @@
 ''';
 }
 
-String DartFile(Map revisions,
-                Map hashes,
-                String devVersion,
-                String stableVersion) {
+String DartFile(
+    Map revisions, Map hashes, String devVersion, String stableVersion) {
   final urlBase = 'https://storage.googleapis.com/dart-archive/channels';
   final x64File = 'sdk/dartsdk-macos-x64-release.zip';
   final ia32File = 'sdk/dartsdk-macos-ia32-release.zip';
@@ -226,42 +230,54 @@
 ''';
 }
 
-Future runGit(List<String> args) {
+Future runGit(List<String> args) async {
   print("git ${args.join(' ')}");
-  return Process.run('git', args, workingDirectory: repository,
-                     environment: gitEnvironment)
-      .then((result) {
-        print(result.stdout);
-        print(result.stderr);
-      });
+
+  var result = await Process.run('git', args,
+      workingDirectory: repository, environment: gitEnvironment);
+
+  print(result.stdout);
+  print(result.stderr);
 }
 
-main(args) {
+main(args) async {
   final parser = new ArgParser()
-      ..addOption('revision', abbr: 'r')
-      ..addOption('channel', abbr: 'c', allowed: ['dev', 'stable'])
-      ..addOption('key', abbr: 'k');
+    ..addOption('revision', abbr: 'r')
+    ..addOption('channel', abbr: 'c', allowed: ['dev', 'stable'])
+    ..addOption('key', abbr: 'k');
   final options = parser.parse(args);
   final revision = options['revision'];
   final channel = options['channel'];
-  if ([revision, channel, options['key']].contains(null)) {
+  final key = options['key'];
+  if ([revision, channel, key].contains(null)) {
     print("Usage: update_homebrew.dart -r revision -c channel -k ssh_key\n"
-          "  ssh_key should allow pushes to dart-lang/homebrew-dart on github");
+        "  ssh_key should allow pushes to ${GITHUB_REPO} on github");
     return;
   }
   final sshWrapper = Platform.script.resolve('ssh_with_key').toFilePath();
-  gitEnvironment = {'GIT_SSH': sshWrapper,
-                    'SSH_KEY_PATH': options['key']};
+  gitEnvironment = {'GIT_SSH': sshWrapper, 'SSH_KEY_PATH': key};
 
-  Directory.systemTemp.createTemp('update_homebrew')
-      .then((tempDir) {
-        repository = tempDir.path;
-      })
-      .then((_) => runGit(
-          ['clone', 'git@github.com:dart-lang/homebrew-dart.git', '.']))
-      .then((_) => writeHomebrewInfo(channel, revision))
-      .then((_) => runGit(['commit', '-a', '-m',
-                           'Updated $channel branch to revision $revision']))
-      .then((_) => runGit(['push']))
-      .whenComplete(() => new Directory(repository).delete(recursive: true));
+  Chain.capture(() async {
+    var tempDir = await Directory.systemTemp.createTemp('update_homebrew');
+
+    try {
+      repository = tempDir.path;
+
+      await runGit(['clone', 'git@github.com:${GITHUB_REPO}.git', '.']);
+      await writeHomebrewInfo(channel, revision);
+      await runGit([
+        'commit',
+        '-a',
+        '-m',
+        'Updated $channel branch to revision $revision'
+      ]);
+
+      await runGit(['push']);
+    } finally {
+      await tempDir.delete(recursive: true);
+    }
+  }, onError: (error, chain) {
+    print(error);
+    print(chain.terse);
+  });
 }
diff --git a/tools/apps/update_homebrew/pubspec.yaml b/tools/apps/update_homebrew/pubspec.yaml
index e56d835..e0bed8b 100644
--- a/tools/apps/update_homebrew/pubspec.yaml
+++ b/tools/apps/update_homebrew/pubspec.yaml
@@ -1,6 +1,7 @@
 name: update_homebrew
 version: 0.1.0
 dependencies:
-  args: ">=0.12.0+2 <0.13.0"
-  googleapis: ">=0.2.1 <0.3.0"
-  http: ">=0.11.1+1 <0.12.0"
+  args: ^0.13.0
+  googleapis: ^0.2.1
+  http: ^0.11.1+1
+  stack_trace: ^1.3.2
diff --git a/tools/bots/cross-vm.py b/tools/bots/cross-vm.py
index f11777e..bf09cb1 100644
--- a/tools/bots/cross-vm.py
+++ b/tools/bots/cross-vm.py
@@ -70,7 +70,7 @@
   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']
+               '--exclude-suite=pkg,pkg_tested']
 
   revision = os.environ['BUILDBOT_GOT_REVISION']
   tarball = tarball_name(arch, mode, revision)
diff --git a/tools/bots/pub.py b/tools/bots/pub.py
index aeed588..98ae672 100755
--- a/tools/bots/pub.py
+++ b/tools/bots/pub.py
@@ -56,7 +56,7 @@
     common_args.append('-j1')
   if build_info.mode == 'release':
     bot.RunTest('pub and pkg ', build_info,
-                common_args + ['pub', 'pkg', 'docs'],
+                common_args + ['pub', 'pkg', 'docs', 'pkg_tested'],
                 swallow_error=True)
   else:
     # Pub tests currently have a lot of timeouts when run in debug mode.
diff --git a/tools/create_sdk.py b/tools/create_sdk.py
index ca5e772..9ec9371 100755
--- a/tools/create_sdk.py
+++ b/tools/create_sdk.py
@@ -229,7 +229,8 @@
 
   RESOURCE = join(SDK_tmp, 'lib', '_internal', 'pub', 'asset')
   os.makedirs(os.path.dirname(RESOURCE))
-  copytree(join(HOME, 'sdk', 'lib', '_internal', 'pub', 'asset'),
+  copytree(join(HOME, 'third_party', 'pkg_tested', 'pub', 'lib', 'src',
+                'asset'),
            join(RESOURCE),
            ignore=ignore_patterns('.svn'))
 
diff --git a/tools/deps/dartium.deps/DEPS b/tools/deps/dartium.deps/DEPS
index 5417092..4f4f47f 100644
--- a/tools/deps/dartium.deps/DEPS
+++ b/tools/deps/dartium.deps/DEPS
@@ -34,6 +34,7 @@
   "path_rev": "@b657c0854d1cf41c014986fa9d2321f1173df805",
   "plugin_tag": "@0.1.0",
   "pool_rev": "@22e12aeb16ad0b626900dbe79e4a25391ddfb28c",
+  "pub_rev": "@6f2a1b90b8210a85a38aab1af479c047681c29e6",
   "pub_semver_tag": "@1.2.0",
   "shelf_rev": "@1e87b79b21ac5e6fa2f93576d6c06eaa65285ef4",
   "shelf_web_socket_rev": "@ff170cec2c0e4e5722cdf47c557be63b5035a602",
@@ -108,6 +109,8 @@
       "https://github.com/dart-lang/plugin.git" + Var("plugin_tag"),
   "src/dart/third_party/pkg/pool":
       "https://github.com/dart-lang/pool.git" + Var("pool_rev"),
+  "src/dart/third_party/pkg_tested/pub":
+      "https://github.com/dart-lang/pub.git" + Var("pub_rev"),
   "src/dart/third_party/pkg/pub_semver":
       "https://github.com/dart-lang/pub_semver.git" + Var("pub_semver_tag"),
   "src/dart/third_party/pkg/shelf":
diff --git a/tools/make_links.py b/tools/make_links.py
index b99ef6e..5599e99 100644
--- a/tools/make_links.py
+++ b/tools/make_links.py
@@ -10,11 +10,15 @@
 SOURCE ends with .../lib, the lib suffix is ignored when determining
 the name of the target link.
 
+If a SOURCE contains ":", the left side is the path and the right side is the
+name of the package symlink.
+
 Before creating any links, the old entries of the TARGET directory will be
 removed.
 
 Usage:
   python tools/make_links.py OPTIONS TARGET SOURCES...
+
 """
 
 import optparse
@@ -84,11 +88,16 @@
     os.makedirs(target)
   for source in args[1:]:
     # Assume the source directory is named ".../NAME/lib".
-    (name, lib) = os.path.split(source)
+    split = source.split(':')
+    name = None
+    if len(split) == 2: (source, name) = split
+
+    (path, lib) = os.path.split(source)
     if lib != 'lib':
-      name = source
-    # Remove any addtional path components preceding NAME.
-    (path, name) = os.path.split(name)
+      path = source
+    # Remove any additional path components preceding NAME, if one wasn't
+    # specified explicitly.
+    if not name: (_, name) = os.path.split(path)
     orig_source = source
     if utils.GuessOS() == 'win32':
       source = os.path.relpath(source)
diff --git a/tools/promote.py b/tools/promote.py
index 5d3a3c4..ea420b4 100644
--- a/tools/promote.py
+++ b/tools/promote.py
@@ -103,7 +103,7 @@
 
   def promote(to_revision):
     def safety_check_on_gs_path(gs_path, revision, channel):
-      if not ((revision == 'latest' or int(revision) > 0)
+      if not (revision != None
               and len(channel) > 0
               and ('%s' % revision) in gs_path
               and channel in gs_path):
@@ -137,12 +137,6 @@
     remove_gs_directory(to_loc)
     Gsutil(['-m', 'cp', '-a', 'public-read', '-R', from_loc, to_loc])
 
-    # Copy eclipse update directory.
-    from_loc = raw_namer.editor_eclipse_update_directory(revision)
-    to_loc = release_namer.editor_eclipse_update_directory(to_revision)
-    remove_gs_directory(to_loc)
-    Gsutil(['-m', 'cp', '-a', 'public-read', '-R', from_loc, to_loc])
-
     # Copy api-docs zipfile.
     from_loc = raw_namer.apidocs_zipfilepath(revision)
     to_loc = release_namer.apidocs_zipfilepath(to_revision)
@@ -166,7 +160,6 @@
     to_loc = release_namer.version_filepath(to_revision)
     Gsutil(['cp', '-a', 'public-read', from_loc, to_loc])
 
-
   promote(revision)
   promote('latest')
 
diff --git a/tools/run_pub.py b/tools/run_pub.py
index c43b039..37b6772 100755
--- a/tools/run_pub.py
+++ b/tools/run_pub.py
@@ -12,7 +12,7 @@
 
 SCRIPT_DIR = os.path.dirname(sys.argv[0])
 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
-PUB_PATH = os.path.join(DART_ROOT, 'sdk/lib/_internal/pub/bin/pub.dart')
+PUB_PATH = os.path.join(DART_ROOT, 'third_party/pkg_tested/pub/bin/pub.dart')
 CANARY_PATH = os.path.join(DART_ROOT, 'tools', 'canary.dart')
 
 usage = """run_pub.py --package-root=<package root>"""
diff --git a/tools/status_clean.dart b/tools/status_clean.dart
index f406258..c5198b9 100644
--- a/tools/status_clean.dart
+++ b/tools/status_clean.dart
@@ -36,7 +36,6 @@
      "tests/compiler/dart2js_native/dart2js_native.status"],
     ["dart2js", "tests/compiler/dart2js",
      "tests/compiler/dart2js/dart2js.status"],
-    ["pub", "sdk/lib/_internal/pub", "sdk/lib/_internal/pub/pub.status"],
     ["benchmark_smoke", "tests/benchmark_smoke",
      "tests/benchmark_smoke/benchmark_smoke.status"],
     ["co19", "tests/co19/src", "tests/co19/co19-analyzer2.status"],
diff --git a/tools/testing/dart/test_configurations.dart b/tools/testing/dart/test_configurations.dart
index d56514e..c552282 100644
--- a/tools/testing/dart/test_configurations.dart
+++ b/tools/testing/dart/test_configurations.dart
@@ -196,14 +196,6 @@
           }
           testSuites.add(
               new PkgBuildTestSuite(conf, 'pkgbuild', 'pkg/pkgbuild.status'));
-        } else if (key == 'pub') {
-          // TODO(rnystrom): Move pub back into TEST_SUITE_DIRECTORIES once
-          // #104 is fixed.
-          testSuites.add(new StandardTestSuite(conf, 'pub',
-              new Path('sdk/lib/_internal/pub'),
-              ['sdk/lib/_internal/pub/pub.status'],
-              isTestFilePredicate: (file) => file.endsWith('_test.dart'),
-              recursive: true));
         }
       }
 
diff --git a/utils/pub/pub.gyp b/utils/pub/pub.gyp
index f15df32..252a255 100644
--- a/utils/pub/pub.gyp
+++ b/utils/pub/pub.gyp
@@ -11,8 +11,7 @@
         '../../runtime/dart-runtime.gyp:dart',
         '../../pkg/pkg.gyp:pkg_packages',
         '../../pkg/pkg_files.gyp:pkg_files_stamp',
-        '../../utils/compiler/compiler.gyp:dart2js_files_stamp',
-        'pub_files_stamp'
+        '../../utils/compiler/compiler.gyp:dart2js_files_stamp'
       ],
       'actions': [
         {
@@ -20,7 +19,6 @@
           'inputs': [
             '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
             '../../sdk/lib/_internal/libraries.dart',
-            '<(SHARED_INTERMEDIATE_DIR)/pub_files.stamp',
             '<(SHARED_INTERMEDIATE_DIR)/dart2js_files.stamp',
             '<(SHARED_INTERMEDIATE_DIR)/pkg_files.stamp',
             '<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
@@ -32,37 +30,10 @@
             '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
             '--package-root=<(PRODUCT_DIR)/packages/',
             '--snapshot=<(SHARED_INTERMEDIATE_DIR)/pub.dart.snapshot',
-            '../../sdk/lib/_internal/pub/bin/pub.dart',
+            '../../third_party/pkg_tested/pub/bin/pub.dart',
           ]
         },
       ],
     },
-    # Other targets depend on pub files, but have to many inputs, which causes
-    # issues on some platforms.
-    # This target lists all the files in sdk/lib/_internal/pub,
-    # and creates a single pub_files.stamp
-    {
-      'target_name': 'pub_files_stamp',
-      'type': 'none',
-      'actions': [
-        {
-          'action_name': 'make_pub_files_stamp',
-          'inputs': [
-            '../../tools/create_timestamp_file.py',
-            '<!@(["python", "../../tools/list_files.py", "\\.dart$",'
-                ' "../../sdk/lib/_internal/pub"])',
-          ],
-          'outputs': [
-            '<(SHARED_INTERMEDIATE_DIR)/pub_files.stamp',
-          ],
-          'action': [
-            'python', '../../tools/create_timestamp_file.py',
-            '<@(_outputs)',
-          ],
-        },
-      ],
-    }
-
-
   ],
 }