Chromium Code Reviews| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 Set<ConstantValue> constants, | 257 Set<ConstantValue> constants, |
| 258 isMirrorUsage) { | 258 isMirrorUsage) { |
| 259 | 259 |
| 260 if (element.isErroneous) { | 260 if (element.isErroneous) { |
| 261 // Erroneous elements are ignored. | 261 // Erroneous elements are ignored. |
| 262 return; | 262 return; |
| 263 } | 263 } |
| 264 | 264 |
| 265 /// Recursively collects all the dependencies of [type]. | 265 /// Recursively collects all the dependencies of [type]. |
| 266 void collectTypeDependencies(DartType type) { | 266 void collectTypeDependencies(DartType type) { |
| 267 // TODO(het): we would like to separate out types that are only needed for | |
| 268 // rti from types that are needed for their members. | |
|
sigurdm
2015/10/13 07:39:07
I think johnniwinther is working on this.
| |
| 267 if (type is GenericType) { | 269 if (type is GenericType) { |
| 268 type.typeArguments.forEach(collectTypeDependencies); | 270 type.typeArguments.forEach(collectTypeDependencies); |
| 269 } | 271 } |
| 270 if (type is FunctionType) { | 272 if (type is FunctionType) { |
| 271 for (DartType argumentType in type.parameterTypes) { | 273 for (DartType argumentType in type.parameterTypes) { |
| 272 collectTypeDependencies(argumentType); | 274 collectTypeDependencies(argumentType); |
| 273 } | 275 } |
| 274 for (DartType argumentType in type.optionalParameterTypes) { | 276 for (DartType argumentType in type.optionalParameterTypes) { |
| 275 collectTypeDependencies(argumentType); | 277 collectTypeDependencies(argumentType); |
| 276 } | 278 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 | 336 |
| 335 // TODO(sigurdm): How is metadata on a patch-class handled? | 337 // TODO(sigurdm): How is metadata on a patch-class handled? |
| 336 for (MetadataAnnotation metadata in element.metadata) { | 338 for (MetadataAnnotation metadata in element.metadata) { |
| 337 ConstantValue constant = | 339 ConstantValue constant = |
| 338 backend.constants.getConstantValueForMetadata(metadata); | 340 backend.constants.getConstantValueForMetadata(metadata); |
| 339 if (constant != null) { | 341 if (constant != null) { |
| 340 constants.add(constant); | 342 constants.add(constant); |
| 341 } | 343 } |
| 342 } | 344 } |
| 343 | 345 |
| 344 if (element is FunctionElement && | 346 if (element is FunctionElement) { |
| 345 compiler.resolverWorld.closurizedMembers.contains(element)) { | |
| 346 collectTypeDependencies(element.type); | 347 collectTypeDependencies(element.type); |
| 347 } | 348 } |
| 348 | 349 |
| 349 if (element.isClass) { | 350 if (element.isClass) { |
| 350 // If we see a class, add everything its live instance members refer | 351 // If we see a class, add everything its live instance members refer |
| 351 // to. Static members are not relevant, unless we are processing | 352 // to. Static members are not relevant, unless we are processing |
| 352 // extra dependencies due to mirrors. | 353 // extra dependencies due to mirrors. |
| 353 void addLiveInstanceMember(Element element) { | 354 void addLiveInstanceMember(Element element) { |
| 354 if (!compiler.enqueuer.resolution.hasBeenProcessed(element)) return; | 355 if (!compiler.enqueuer.resolution.hasBeenProcessed(element)) return; |
| 355 if (!isMirrorUsage && !element.isInstanceMember) return; | 356 if (!isMirrorUsage && !element.isInstanceMember) return; |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 935 return result; | 936 return result; |
| 936 } | 937 } |
| 937 | 938 |
| 938 bool operator ==(other) { | 939 bool operator ==(other) { |
| 939 if (other is! _DeclaredDeferredImport) return false; | 940 if (other is! _DeclaredDeferredImport) return false; |
| 940 return declaration == other.declaration; | 941 return declaration == other.declaration; |
| 941 } | 942 } |
| 942 | 943 |
| 943 int get hashCode => declaration.hashCode * 17; | 944 int get hashCode => declaration.hashCode * 17; |
| 944 } | 945 } |
| OLD | NEW |