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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 413 } |
414 | 414 |
415 if (element is FunctionElement) { | 415 if (element is FunctionElement) { |
416 collectTypeDependencies(element.type); | 416 collectTypeDependencies(element.type); |
417 } | 417 } |
418 | 418 |
419 if (element.isClass) { | 419 if (element.isClass) { |
420 // If we see a class, add everything its live instance members refer | 420 // If we see a class, add everything its live instance members refer |
421 // to. Static members are not relevant, unless we are processing | 421 // to. Static members are not relevant, unless we are processing |
422 // extra dependencies due to mirrors. | 422 // extra dependencies due to mirrors. |
423 void addLiveInstanceMember(Element element) { | 423 void addLiveInstanceMember(_, Element element) { |
424 if (!compiler.enqueuer.resolution.hasBeenProcessed(element)) return; | 424 if (!compiler.enqueuer.resolution.hasBeenProcessed(element)) return; |
425 if (!isMirrorUsage && !element.isInstanceMember) return; | 425 if (!isMirrorUsage && !element.isInstanceMember) return; |
426 elements.add(element); | 426 elements.add(element); |
427 collectDependencies(element); | 427 collectDependencies(element); |
428 } | 428 } |
429 | 429 |
430 ClassElement cls = element.declaration; | 430 ClassElement cls = element.declaration; |
431 cls.forEachLocalMember(addLiveInstanceMember); | 431 cls.implementation.forEachMember(addLiveInstanceMember); |
432 if (cls.implementation != cls) { | |
433 // TODO(ahe): Why doesn't ClassElement.forEachLocalMember do this? | |
434 cls.implementation.forEachLocalMember(addLiveInstanceMember); | |
435 } | |
436 for (var type in cls.implementation.allSupertypes) { | 432 for (var type in cls.implementation.allSupertypes) { |
437 elements.add(type.element.implementation); | 433 elements.add(type.element.implementation); |
438 } | 434 } |
439 elements.add(cls.implementation); | 435 elements.add(cls.implementation); |
440 } else if (Elements.isStaticOrTopLevel(element) || element.isConstructor) { | 436 } else if (Elements.isStaticOrTopLevel(element) || element.isConstructor) { |
441 elements.add(element); | 437 elements.add(element); |
442 collectDependencies(element); | 438 collectDependencies(element); |
443 } | 439 } |
444 if (element.isGenerativeConstructor) { | 440 if (element.isGenerativeConstructor) { |
445 // When instantiating a class, we record a reference to the | 441 // When instantiating a class, we record a reference to the |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 | 1048 |
1053 bool operator ==(other) { | 1049 bool operator ==(other) { |
1054 if (other is! _DeclaredDeferredImport) return false; | 1050 if (other is! _DeclaredDeferredImport) return false; |
1055 return declaration == other.declaration; | 1051 return declaration == other.declaration; |
1056 } | 1052 } |
1057 | 1053 |
1058 int get hashCode => declaration.hashCode * 17; | 1054 int get hashCode => declaration.hashCode * 17; |
1059 | 1055 |
1060 String toString() => '$declaration'; | 1056 String toString() => '$declaration'; |
1061 } | 1057 } |
OLD | NEW |