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/tasks.dart' show CompilerTask; | 7 import 'common/tasks.dart' show CompilerTask; |
8 import 'common.dart'; | 8 import 'common.dart'; |
9 import 'compiler.dart' show Compiler; | 9 import 'compiler.dart' show Compiler; |
10 import 'constants/expressions.dart' show ConstantExpression; | 10 import 'constants/expressions.dart' show ConstantExpression; |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 } | 437 } |
438 | 438 |
439 if (element is FunctionElement) { | 439 if (element is FunctionElement) { |
440 collectTypeDependencies(element.type); | 440 collectTypeDependencies(element.type); |
441 } | 441 } |
442 | 442 |
443 if (element.isClass) { | 443 if (element.isClass) { |
444 // If we see a class, add everything its live instance members refer | 444 // If we see a class, add everything its live instance members refer |
445 // to. Static members are not relevant, unless we are processing | 445 // to. Static members are not relevant, unless we are processing |
446 // extra dependencies due to mirrors. | 446 // extra dependencies due to mirrors. |
447 void addLiveInstanceMember(_, MemberElement element) { | 447 void addLiveInstanceMember(_, _element) { |
| 448 MemberElement element = _element; |
448 if (!compiler.resolutionWorldBuilder.isMemberUsed(element)) return; | 449 if (!compiler.resolutionWorldBuilder.isMemberUsed(element)) return; |
449 if (!isMirrorUsage && !element.isInstanceMember) return; | 450 if (!isMirrorUsage && !element.isInstanceMember) return; |
450 elements.add(element); | 451 elements.add(element); |
451 collectDependencies(element); | 452 collectDependencies(element); |
452 } | 453 } |
453 | 454 |
454 ClassElement cls = element.declaration; | 455 ClassElement cls = element.declaration; |
455 cls.implementation.forEachMember(addLiveInstanceMember); | 456 cls.implementation.forEachMember(addLiveInstanceMember); |
456 for (ResolutionInterfaceType type in cls.implementation.allSupertypes) { | 457 for (ResolutionInterfaceType type in cls.implementation.allSupertypes) { |
457 elements.add(type.element.implementation); | 458 elements.add(type.element.implementation); |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 | 1101 |
1101 bool operator ==(other) { | 1102 bool operator ==(other) { |
1102 if (other is! _DeclaredDeferredImport) return false; | 1103 if (other is! _DeclaredDeferredImport) return false; |
1103 return declaration == other.declaration; | 1104 return declaration == other.declaration; |
1104 } | 1105 } |
1105 | 1106 |
1106 int get hashCode => declaration.hashCode * 17; | 1107 int get hashCode => declaration.hashCode * 17; |
1107 | 1108 |
1108 String toString() => '$declaration'; | 1109 String toString() => '$declaration'; |
1109 } | 1110 } |
OLD | NEW |