| 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 /// The elements are added with [_mapDependencies]. | 558 /// The elements are added with [_mapDependencies]. |
| 559 void _addMirrorElements() { | 559 void _addMirrorElements() { |
| 560 void mapDependenciesIfResolved( | 560 void mapDependenciesIfResolved( |
| 561 Element element, _DeferredImport deferredImport) { | 561 Element element, _DeferredImport deferredImport) { |
| 562 // If an element is the target of a MirrorsUsed annotation but never used | 562 // If an element is the target of a MirrorsUsed annotation but never used |
| 563 // It will not be resolved, and we should not call isNeededForReflection. | 563 // It will not be resolved, and we should not call isNeededForReflection. |
| 564 // TODO(sigurdm): Unresolved elements should just answer false when | 564 // TODO(sigurdm): Unresolved elements should just answer false when |
| 565 // asked isNeededForReflection. Instead an internal error is triggered. | 565 // asked isNeededForReflection. Instead an internal error is triggered. |
| 566 // So we have to filter them out here. | 566 // So we have to filter them out here. |
| 567 if (element is AnalyzableElementX && !element.hasTreeElements) return; | 567 if (element is AnalyzableElementX && !element.hasTreeElements) return; |
| 568 if (compiler.backend.isAccessibleByReflection(element)) { | 568 if (compiler.backend.mirrorsData.isAccessibleByReflection(element)) { |
| 569 _mapDependencies( | 569 _mapDependencies( |
| 570 element: element, import: deferredImport, isMirrorUsage: true); | 570 element: element, import: deferredImport, isMirrorUsage: true); |
| 571 } | 571 } |
| 572 } | 572 } |
| 573 | 573 |
| 574 // For each deferred import we analyze all elements reachable from the | 574 // For each deferred import we analyze all elements reachable from the |
| 575 // imported library through non-deferred imports. | 575 // imported library through non-deferred imports. |
| 576 void handleLibrary(LibraryElement library, _DeferredImport deferredImport) { | 576 void handleLibrary(LibraryElement library, _DeferredImport deferredImport) { |
| 577 library.implementation.forEachLocalMember((Element element) { | 577 library.implementation.forEachLocalMember((Element element) { |
| 578 mapDependenciesIfResolved(element, deferredImport); | 578 mapDependenciesIfResolved(element, deferredImport); |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 | 1051 |
| 1052 bool operator ==(other) { | 1052 bool operator ==(other) { |
| 1053 if (other is! _DeclaredDeferredImport) return false; | 1053 if (other is! _DeclaredDeferredImport) return false; |
| 1054 return declaration == other.declaration; | 1054 return declaration == other.declaration; |
| 1055 } | 1055 } |
| 1056 | 1056 |
| 1057 int get hashCode => declaration.hashCode * 17; | 1057 int get hashCode => declaration.hashCode * 17; |
| 1058 | 1058 |
| 1059 String toString() => '$declaration'; | 1059 String toString() => '$declaration'; |
| 1060 } | 1060 } |
| OLD | NEW |