| 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 collectTypeDependencies(element.type); | 356 collectTypeDependencies(element.type); |
| 357 } | 357 } |
| 358 | 358 |
| 359 if (element.isClass) { | 359 if (element.isClass) { |
| 360 // If we see a class, add everything its live instance members refer | 360 // If we see a class, add everything its live instance members refer |
| 361 // to. Static members are not relevant, unless we are processing | 361 // to. Static members are not relevant, unless we are processing |
| 362 // extra dependencies due to mirrors. | 362 // extra dependencies due to mirrors. |
| 363 void addLiveInstanceMember(Element element) { | 363 void addLiveInstanceMember(Element element) { |
| 364 if (!compiler.enqueuer.resolution.hasBeenProcessed(element)) return; | 364 if (!compiler.enqueuer.resolution.hasBeenProcessed(element)) return; |
| 365 if (!isMirrorUsage && !element.isInstanceMember) return; | 365 if (!isMirrorUsage && !element.isInstanceMember) return; |
| 366 collectDependencies(element.implementation); | 366 elements.add(element); |
| 367 collectDependencies(element); |
| 367 } | 368 } |
| 368 ClassElement cls = element.declaration; | 369 ClassElement cls = element.declaration; |
| 369 cls.forEachLocalMember(addLiveInstanceMember); | 370 cls.forEachLocalMember(addLiveInstanceMember); |
| 370 if (cls.implementation != cls) { | 371 if (cls.implementation != cls) { |
| 371 // TODO(ahe): Why doesn't ClassElement.forEachLocalMember do this? | 372 // TODO(ahe): Why doesn't ClassElement.forEachLocalMember do this? |
| 372 cls.implementation.forEachLocalMember(addLiveInstanceMember); | 373 cls.implementation.forEachLocalMember(addLiveInstanceMember); |
| 373 } | 374 } |
| 374 for (var type in cls.implementation.allSupertypes) { | 375 for (var type in cls.implementation.allSupertypes) { |
| 375 elements.add(type.element.implementation); | 376 elements.add(type.element.implementation); |
| 376 } | 377 } |
| 377 elements.add(cls.implementation); | 378 elements.add(cls.implementation); |
| 378 } else if (Elements.isStaticOrTopLevel(element) || | 379 } else if (Elements.isStaticOrTopLevel(element) || |
| 379 element.isConstructor) { | 380 element.isConstructor) { |
| 381 elements.add(element); |
| 380 collectDependencies(element); | 382 collectDependencies(element); |
| 381 } | 383 } |
| 382 if (element.isGenerativeConstructor) { | 384 if (element.isGenerativeConstructor) { |
| 383 // When instantiating a class, we record a reference to the | 385 // When instantiating a class, we record a reference to the |
| 384 // constructor, not the class itself. We must add all the | 386 // constructor, not the class itself. We must add all the |
| 385 // instance members of the constructor's class. | 387 // instance members of the constructor's class. |
| 386 ClassElement implementation = | 388 ClassElement implementation = |
| 387 element.enclosingClass.implementation; | 389 element.enclosingClass.implementation; |
| 388 _collectAllElementsAndConstantsResolvedFrom( | 390 _collectAllElementsAndConstantsResolvedFrom( |
| 389 implementation, elements, constants, isMirrorUsage); | 391 implementation, elements, constants, isMirrorUsage); |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 return result; | 982 return result; |
| 981 } | 983 } |
| 982 | 984 |
| 983 bool operator ==(other) { | 985 bool operator ==(other) { |
| 984 if (other is! _DeclaredDeferredImport) return false; | 986 if (other is! _DeclaredDeferredImport) return false; |
| 985 return declaration == other.declaration; | 987 return declaration == other.declaration; |
| 986 } | 988 } |
| 987 | 989 |
| 988 int get hashCode => declaration.hashCode * 17; | 990 int get hashCode => declaration.hashCode * 17; |
| 989 } | 991 } |
| OLD | NEW |