| 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 'constants/expressions.dart'; | 7 import 'constants/expressions.dart'; |
| 8 import 'constants/values.dart' show | 8 import 'constants/values.dart' show |
| 9 ConstantValue, | 9 ConstantValue, |
| 10 ConstructedConstantValue, | 10 ConstructedConstantValue, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 ElementKind, | 31 ElementKind, |
| 32 Elements, | 32 Elements, |
| 33 FunctionElement, | 33 FunctionElement, |
| 34 LibraryElement, | 34 LibraryElement, |
| 35 MetadataAnnotation, | 35 MetadataAnnotation, |
| 36 PrefixElement, | 36 PrefixElement, |
| 37 ScopeContainerElement, | 37 ScopeContainerElement, |
| 38 TypedefElement, | 38 TypedefElement, |
| 39 VoidElement; | 39 VoidElement; |
| 40 | 40 |
| 41 import 'dart_types.dart'; | |
| 42 | |
| 43 import 'util/util.dart' show | 41 import 'util/util.dart' show |
| 44 Link, makeUnique; | 42 Link, makeUnique; |
| 45 import 'util/uri_extras.dart' as uri_extras; | 43 import 'util/uri_extras.dart' as uri_extras; |
| 46 | 44 |
| 47 import 'util/setlet.dart' show | 45 import 'util/setlet.dart' show |
| 48 Setlet; | 46 Setlet; |
| 49 | 47 |
| 50 import 'tree/tree.dart' show | 48 import 'tree/tree.dart' show |
| 51 Import, | 49 Import, |
| 52 LibraryTag, | 50 LibraryTag, |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 } | 294 } |
| 297 | 295 |
| 298 // TODO(sigurdm): How is metadata on a patch-class handled? | 296 // TODO(sigurdm): How is metadata on a patch-class handled? |
| 299 for (MetadataAnnotation metadata in element.metadata) { | 297 for (MetadataAnnotation metadata in element.metadata) { |
| 300 ConstantExpression constant = | 298 ConstantExpression constant = |
| 301 backend.constants.getConstantForMetadata(metadata); | 299 backend.constants.getConstantForMetadata(metadata); |
| 302 if (constant != null) { | 300 if (constant != null) { |
| 303 addConstants(constant.value); | 301 addConstants(constant.value); |
| 304 } | 302 } |
| 305 } | 303 } |
| 306 | |
| 307 collectTypeDependencies(DartType type) { | |
| 308 if (type is FunctionType) { | |
| 309 for (DartType argumentType in type.parameterTypes) { | |
| 310 collectTypeDependencies(argumentType); | |
| 311 } | |
| 312 for (DartType argumentType in type.optionalParameterTypes) { | |
| 313 collectTypeDependencies(argumentType); | |
| 314 } | |
| 315 for (DartType argumentType in type.namedParameterTypes) { | |
| 316 collectTypeDependencies(argumentType); | |
| 317 } | |
| 318 collectTypeDependencies(type.returnType); | |
| 319 } else if (type is TypedefType) { | |
| 320 elements.add(type.element); | |
| 321 collectTypeDependencies(type.unalias(compiler)); | |
| 322 } else if (type is InterfaceType) { | |
| 323 elements.add(type.element); | |
| 324 } | |
| 325 } | |
| 326 | |
| 327 if (element is FunctionElement) { | |
| 328 collectTypeDependencies(element.type); | |
| 329 } | |
| 330 | |
| 331 if (element.isClass) { | 304 if (element.isClass) { |
| 332 // If we see a class, add everything its live instance members refer | 305 // If we see a class, add everything its live instance members refer |
| 333 // to. Static members are not relevant, unless we are processing | 306 // to. Static members are not relevant, unless we are processing |
| 334 // extra dependencies due to mirrors. | 307 // extra dependencies due to mirrors. |
| 335 void addLiveInstanceMember(Element element) { | 308 void addLiveInstanceMember(Element element) { |
| 336 if (!compiler.enqueuer.resolution.hasBeenResolved(element)) return; | 309 if (!compiler.enqueuer.resolution.hasBeenResolved(element)) return; |
| 337 if (!isMirrorUsage && !element.isInstanceMember) return; | 310 if (!isMirrorUsage && !element.isInstanceMember) return; |
| 338 collectDependencies(element.implementation); | 311 collectDependencies(element.implementation); |
| 339 } | 312 } |
| 340 ClassElement cls = element.declaration; | 313 ClassElement cls = element.declaration; |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 _importingLibrary = importingLibrary; | 829 _importingLibrary = importingLibrary; |
| 857 | 830 |
| 858 String get importingLibraryName { | 831 String get importingLibraryName { |
| 859 String libraryName = _importingLibrary.getLibraryName(); | 832 String libraryName = _importingLibrary.getLibraryName(); |
| 860 return libraryName == "" | 833 return libraryName == "" |
| 861 ? "<unnamed>" | 834 ? "<unnamed>" |
| 862 : libraryName; | 835 : libraryName; |
| 863 } | 836 } |
| 864 | 837 |
| 865 } | 838 } |
| OLD | NEW |