| 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/backend_api.dart' show Backend; | 7 import 'common/backend_api.dart' show Backend; |
| 8 import 'common/tasks.dart' show CompilerTask; | 8 import 'common/tasks.dart' show CompilerTask; |
| 9 import 'common.dart'; | 9 import 'common.dart'; |
| 10 import 'compiler.dart' show Compiler; | 10 import 'compiler.dart' show Compiler; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 ImportElement, | 28 ImportElement, |
| 29 LibraryElement, | 29 LibraryElement, |
| 30 MetadataAnnotation, | 30 MetadataAnnotation, |
| 31 PrefixElement, | 31 PrefixElement, |
| 32 ResolvedAstKind, | 32 ResolvedAstKind, |
| 33 TypedefElement; | 33 TypedefElement; |
| 34 import 'js_backend/js_backend.dart' show JavaScriptBackend; | 34 import 'js_backend/js_backend.dart' show JavaScriptBackend; |
| 35 import 'resolution/resolution.dart' show AnalyzableElementX; | 35 import 'resolution/resolution.dart' show AnalyzableElementX; |
| 36 import 'resolution/tree_elements.dart' show TreeElements; | 36 import 'resolution/tree_elements.dart' show TreeElements; |
| 37 import 'tree/tree.dart' as ast; | 37 import 'tree/tree.dart' as ast; |
| 38 import 'universe/use.dart' show StaticUse, TypeUse, TypeUseKind; | 38 import 'universe/use.dart' show StaticUse, StaticUseKind, TypeUse, TypeUseKind; |
| 39 import 'universe/world_impact.dart' | 39 import 'universe/world_impact.dart' |
| 40 show ImpactUseCase, WorldImpact, WorldImpactVisitorImpl; | 40 show ImpactUseCase, WorldImpact, WorldImpactVisitorImpl; |
| 41 import 'util/setlet.dart' show Setlet; | 41 import 'util/setlet.dart' show Setlet; |
| 42 import 'util/uri_extras.dart' as uri_extras; | 42 import 'util/uri_extras.dart' as uri_extras; |
| 43 import 'util/util.dart' show Link, makeUnique; | 43 import 'util/util.dart' show Link, makeUnique; |
| 44 | 44 |
| 45 /// A "hunk" of the program that will be loaded whenever one of its [imports] | 45 /// A "hunk" of the program that will be loaded whenever one of its [imports] |
| 46 /// are loaded. | 46 /// are loaded. |
| 47 /// | 47 /// |
| 48 /// Elements that are only used in one deferred import, is in an OutputUnit with | 48 /// Elements that are only used in one deferred import, is in an OutputUnit with |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 return; | 323 return; |
| 324 } | 324 } |
| 325 | 325 |
| 326 WorldImpact worldImpact = | 326 WorldImpact worldImpact = |
| 327 compiler.resolution.getWorldImpact(analyzableElement); | 327 compiler.resolution.getWorldImpact(analyzableElement); |
| 328 compiler.impactStrategy.visitImpact( | 328 compiler.impactStrategy.visitImpact( |
| 329 analyzableElement, | 329 analyzableElement, |
| 330 worldImpact, | 330 worldImpact, |
| 331 new WorldImpactVisitorImpl(visitStaticUse: (StaticUse staticUse) { | 331 new WorldImpactVisitorImpl(visitStaticUse: (StaticUse staticUse) { |
| 332 elements.add(staticUse.element); | 332 elements.add(staticUse.element); |
| 333 switch (staticUse.kind) { |
| 334 case StaticUseKind.CONSTRUCTOR_INVOKE: |
| 335 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE: |
| 336 collectTypeDependencies(staticUse.type); |
| 337 break; |
| 338 default: |
| 339 } |
| 333 }, visitTypeUse: (TypeUse typeUse) { | 340 }, visitTypeUse: (TypeUse typeUse) { |
| 334 DartType type = typeUse.type; | 341 DartType type = typeUse.type; |
| 335 switch (typeUse.kind) { | 342 switch (typeUse.kind) { |
| 336 case TypeUseKind.TYPE_LITERAL: | 343 case TypeUseKind.TYPE_LITERAL: |
| 337 if (type.isTypedef || type.isInterfaceType) { | 344 if (type.isTypedef || type.isInterfaceType) { |
| 338 elements.add(type.element); | 345 elements.add(type.element); |
| 339 } | 346 } |
| 340 break; | 347 break; |
| 341 case TypeUseKind.INSTANTIATION: | 348 case TypeUseKind.INSTANTIATION: |
| 342 case TypeUseKind.IS_CHECK: | 349 case TypeUseKind.IS_CHECK: |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 | 1050 |
| 1044 bool operator ==(other) { | 1051 bool operator ==(other) { |
| 1045 if (other is! _DeclaredDeferredImport) return false; | 1052 if (other is! _DeclaredDeferredImport) return false; |
| 1046 return declaration == other.declaration; | 1053 return declaration == other.declaration; |
| 1047 } | 1054 } |
| 1048 | 1055 |
| 1049 int get hashCode => declaration.hashCode * 17; | 1056 int get hashCode => declaration.hashCode * 17; |
| 1050 | 1057 |
| 1051 String toString() => '$declaration'; | 1058 String toString() => '$declaration'; |
| 1052 } | 1059 } |
| OLD | NEW |