OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library deferred_load; | 5 library deferred_load; |
6 | 6 |
7 import 'common.dart'; | 7 import 'common.dart'; |
8 import 'common/backend_api.dart' show | 8 import 'common/backend_api.dart' show |
9 Backend; | 9 Backend; |
10 import 'common/tasks.dart' show | 10 import 'common/tasks.dart' show |
(...skipping 29 matching lines...) Expand all Loading... |
40 TreeElements; | 40 TreeElements; |
41 import 'tree/tree.dart' as ast; | 41 import 'tree/tree.dart' as ast; |
42 import 'tree/tree.dart' show | 42 import 'tree/tree.dart' show |
43 Import, | 43 Import, |
44 LibraryTag, | 44 LibraryTag, |
45 LibraryDependency, | 45 LibraryDependency, |
46 LiteralDartString, | 46 LiteralDartString, |
47 LiteralString, | 47 LiteralString, |
48 NewExpression, | 48 NewExpression, |
49 Node; | 49 Node; |
| 50 import 'universe/use.dart' show |
| 51 StaticUse; |
50 import 'universe/world_impact.dart' show | 52 import 'universe/world_impact.dart' show |
51 WorldImpact; | 53 WorldImpact; |
52 import 'util/setlet.dart' show | 54 import 'util/setlet.dart' show |
53 Setlet; | 55 Setlet; |
54 import 'util/uri_extras.dart' as uri_extras; | 56 import 'util/uri_extras.dart' as uri_extras; |
55 import 'util/util.dart' show | 57 import 'util/util.dart' show |
56 Link, makeUnique; | 58 Link, makeUnique; |
57 | 59 |
58 /// A "hunk" of the program that will be loaded whenever one of its [imports] | 60 /// A "hunk" of the program that will be loaded whenever one of its [imports] |
59 /// are loaded. | 61 /// are loaded. |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 } else { | 307 } else { |
306 // TODO(sigurdm): We want to be more specific about this - need a better | 308 // TODO(sigurdm): We want to be more specific about this - need a better |
307 // way to query "liveness". | 309 // way to query "liveness". |
308 AstElement analyzableElement = element.analyzableElement.declaration; | 310 AstElement analyzableElement = element.analyzableElement.declaration; |
309 if (!compiler.enqueuer.resolution.hasBeenProcessed(analyzableElement)) { | 311 if (!compiler.enqueuer.resolution.hasBeenProcessed(analyzableElement)) { |
310 return; | 312 return; |
311 } | 313 } |
312 | 314 |
313 WorldImpact worldImpact = | 315 WorldImpact worldImpact = |
314 compiler.resolution.getWorldImpact(analyzableElement); | 316 compiler.resolution.getWorldImpact(analyzableElement); |
315 elements.addAll(worldImpact.staticUses); | 317 worldImpact.staticUses.forEach((StaticUse staticUse) { |
| 318 elements.add(staticUse.element); |
| 319 }); |
316 elements.addAll(worldImpact.closures); | 320 elements.addAll(worldImpact.closures); |
317 for (DartType type in worldImpact.typeLiterals) { | 321 for (DartType type in worldImpact.typeLiterals) { |
318 if (type.isTypedef || type.isInterfaceType) { | 322 if (type.isTypedef || type.isInterfaceType) { |
319 elements.add(type.element); | 323 elements.add(type.element); |
320 } | 324 } |
321 } | 325 } |
322 worldImpact.instantiatedTypes.forEach(collectTypeDependencies); | 326 worldImpact.instantiatedTypes.forEach(collectTypeDependencies); |
323 worldImpact.isChecks.forEach(collectTypeDependencies); | 327 worldImpact.isChecks.forEach(collectTypeDependencies); |
324 worldImpact.asCasts.forEach(collectTypeDependencies); | 328 worldImpact.asCasts.forEach(collectTypeDependencies); |
325 worldImpact.onCatchTypes.forEach(collectTypeDependencies); | 329 worldImpact.onCatchTypes.forEach(collectTypeDependencies); |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 return result; | 986 return result; |
983 } | 987 } |
984 | 988 |
985 bool operator ==(other) { | 989 bool operator ==(other) { |
986 if (other is! _DeclaredDeferredImport) return false; | 990 if (other is! _DeclaredDeferredImport) return false; |
987 return declaration == other.declaration; | 991 return declaration == other.declaration; |
988 } | 992 } |
989 | 993 |
990 int get hashCode => declaration.hashCode * 17; | 994 int get hashCode => declaration.hashCode * 17; |
991 } | 995 } |
OLD | NEW |