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

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

Issue 1019923005: Dart2js deferred loading. Follow types of functions when calculating dependencies. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix indentation Created 5 years, 8 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/elements/modelx.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 00eaf84cfec2ddc8f0635e4c5f21f92f4970a60f..b56f3860f896b79d9ea618d07c3f41a021979935 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -38,6 +38,8 @@ import 'elements/elements.dart' show
TypedefElement,
VoidElement;
+import 'dart_types.dart';
+
import 'util/util.dart' show
Link, makeUnique;
import 'util/uri_extras.dart' as uri_extras;
@@ -301,6 +303,30 @@ class DeferredLoadTask extends CompilerTask {
addConstants(constant.value);
}
}
+
+ collectTypeDependencies(DartType type) {
+ if (type is FunctionType) {
+ for (DartType argumentType in type.parameterTypes) {
+ collectTypeDependencies(argumentType);
+ }
+ for (DartType argumentType in type.optionalParameterTypes) {
+ collectTypeDependencies(argumentType);
+ }
+ for (DartType argumentType in type.namedParameterTypes) {
+ collectTypeDependencies(argumentType);
+ }
+ collectTypeDependencies(type.returnType);
+ } else if (type is TypedefType) {
+ type.element.alias;
karlklose 2015/04/13 08:10:57 Add the type's element to elements? Shouldn't thi
sigurdm 2015/04/13 13:37:08 Done
+ } else if (type is InterfaceType) {
+ elements.add(type.element);
+ }
+ }
+
+ if (element is FunctionElement) {
+ collectTypeDependencies(element.type);
+ }
+
if (element.isClass) {
// If we see a class, add everything its live instance members refer
// to. Static members are not relevant, unless we are processing
« no previous file with comments | « no previous file | pkg/compiler/lib/src/elements/modelx.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698