Index: pkg/compiler/lib/src/deferred_load.dart |
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart |
index 3213f9f52dfbaad0b5fd6e5ee88e0e7c20b1916d..e261ff6d8f6fe51df293d7fbe5f2f41524584439 100644 |
--- a/pkg/compiler/lib/src/deferred_load.dart |
+++ b/pkg/compiler/lib/src/deferred_load.dart |
@@ -280,6 +280,23 @@ class DeferredLoadTask extends CompilerTask { |
elements.add(dependency); |
} |
+ |
+ void registerTypeArgumentsAsDependencies(DartType type) { |
+ Element dependency = type.element; |
+ if (dependency == null || dependency.isErroneous || |
+ dependency.isTypeVariable) { |
+ return; |
+ } |
+ elements.add(dependency); |
+ if (type is GenericType) { |
+ type.typeArguments.forEach(registerTypeArgumentsAsDependencies); |
+ } |
+ } |
+ |
+ treeElements.forEachType((Node node, DartType type) { |
+ if (node is NewExpression) registerTypeArgumentsAsDependencies(type); |
+ }); |
+ |
treeElements.forEachConstantNode((Node node, _) { |
// Explicitly depend on the backend constants. |
ConstantValue value = |