Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(773)

Unified Diff: pkg/compiler/lib/src/deferred_load.dart

Issue 1244513003: dart2js: fix dependency tracking for deferred loading when types are only used (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/resolution/tree_elements.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 =
« no previous file with comments | « no previous file | pkg/compiler/lib/src/resolution/tree_elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698