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 | 7 import 'common/backend_api.dart' show |
8 Backend; | 8 Backend; |
9 import 'common/resolution.dart' show | 9 import 'common/resolution.dart' show |
10 Resolution; | 10 Resolution; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 /// [elements] and [constants] respectively. | 297 /// [elements] and [constants] respectively. |
298 void collectDependencies(Element element) { | 298 void collectDependencies(Element element) { |
299 // TODO(johnniwinther): Remove this when [AbstractFieldElement] has been | 299 // TODO(johnniwinther): Remove this when [AbstractFieldElement] has been |
300 // removed. | 300 // removed. |
301 if (element is! AstElement) return; | 301 if (element is! AstElement) return; |
302 AstElement astElement = element; | 302 AstElement astElement = element; |
303 | 303 |
304 // TODO(sigurdm): We want to be more specific about this - need a better | 304 // TODO(sigurdm): We want to be more specific about this - need a better |
305 // way to query "liveness". | 305 // way to query "liveness". |
306 if (astElement is! TypedefElement && | 306 if (astElement is! TypedefElement && |
307 !compiler.enqueuer.resolution.hasBeenResolved(astElement)) { | 307 !compiler.enqueuer.resolution.hasBeenProcessed(astElement)) { |
308 return; | 308 return; |
309 } | 309 } |
310 | 310 |
311 TreeElements treeElements = astElement.resolvedAst.elements; | 311 TreeElements treeElements = astElement.resolvedAst.elements; |
312 | 312 |
313 assert(treeElements != null); | 313 assert(treeElements != null); |
314 | 314 |
315 for (Element dependency in treeElements.allElements) { | 315 for (Element dependency in treeElements.allElements) { |
316 if (dependency.isLocal && !dependency.isFunction) continue; | 316 if (dependency.isLocal && !dependency.isFunction) continue; |
317 if (dependency.isErroneous) continue; | 317 if (dependency.isErroneous) continue; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 if (element is FunctionElement && | 349 if (element is FunctionElement && |
350 compiler.resolverWorld.closurizedMembers.contains(element)) { | 350 compiler.resolverWorld.closurizedMembers.contains(element)) { |
351 collectTypeDependencies(element.type); | 351 collectTypeDependencies(element.type); |
352 } | 352 } |
353 | 353 |
354 if (element.isClass) { | 354 if (element.isClass) { |
355 // If we see a class, add everything its live instance members refer | 355 // If we see a class, add everything its live instance members refer |
356 // to. Static members are not relevant, unless we are processing | 356 // to. Static members are not relevant, unless we are processing |
357 // extra dependencies due to mirrors. | 357 // extra dependencies due to mirrors. |
358 void addLiveInstanceMember(Element element) { | 358 void addLiveInstanceMember(Element element) { |
359 if (!compiler.enqueuer.resolution.hasBeenResolved(element)) return; | 359 if (!compiler.enqueuer.resolution.hasBeenProcessed(element)) return; |
360 if (!isMirrorUsage && !element.isInstanceMember) return; | 360 if (!isMirrorUsage && !element.isInstanceMember) return; |
361 collectDependencies(element.implementation); | 361 collectDependencies(element.implementation); |
362 } | 362 } |
363 ClassElement cls = element.declaration; | 363 ClassElement cls = element.declaration; |
364 cls.forEachLocalMember(addLiveInstanceMember); | 364 cls.forEachLocalMember(addLiveInstanceMember); |
365 if (cls.implementation != cls) { | 365 if (cls.implementation != cls) { |
366 // TODO(ahe): Why doesn't ClassElement.forEachLocalMember do this? | 366 // TODO(ahe): Why doesn't ClassElement.forEachLocalMember do this? |
367 cls.implementation.forEachLocalMember(addLiveInstanceMember); | 367 cls.implementation.forEachLocalMember(addLiveInstanceMember); |
368 } | 368 } |
369 for (var type in cls.implementation.allSupertypes) { | 369 for (var type in cls.implementation.allSupertypes) { |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 return result; | 940 return result; |
941 } | 941 } |
942 | 942 |
943 bool operator ==(other) { | 943 bool operator ==(other) { |
944 if (other is! _DeclaredDeferredImport) return false; | 944 if (other is! _DeclaredDeferredImport) return false; |
945 return declaration == other.declaration; | 945 return declaration == other.declaration; |
946 } | 946 } |
947 | 947 |
948 int get hashCode => declaration.hashCode * 17; | 948 int get hashCode => declaration.hashCode * 17; |
949 } | 949 } |
OLD | NEW |