| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 dart2js.mirrors_handler; | 5 library dart2js.mirrors_handler; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/resolution.dart'; | 8 import '../common/resolution.dart'; |
| 9 import '../compiler.dart'; | 9 import '../compiler.dart'; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // necessary, but the backend relies on them being resolved. | 119 // necessary, but the backend relies on them being resolved. |
| 120 enqueuer.applyImpact( | 120 enqueuer.applyImpact( |
| 121 _computeImpactForReflectiveStaticFields(_findStaticFieldTargets())); | 121 _computeImpactForReflectiveStaticFields(_findStaticFieldTargets())); |
| 122 } | 122 } |
| 123 | 123 |
| 124 if (_mirrorsData.mustPreserveNames) _reporter.log('Preserving names.'); | 124 if (_mirrorsData.mustPreserveNames) _reporter.log('Preserving names.'); |
| 125 | 125 |
| 126 if (_mirrorsData.mustRetainMetadata) { | 126 if (_mirrorsData.mustRetainMetadata) { |
| 127 _reporter.log('Retaining metadata.'); | 127 _reporter.log('Retaining metadata.'); |
| 128 | 128 |
| 129 (_compiler.libraryLoader.libraries as Iterable<LibraryElement>) | 129 for (LibraryEntity library in _compiler.libraryLoader.libraries) { |
| 130 .forEach(_mirrorsData.retainMetadataOfLibrary); | 130 _mirrorsData.retainMetadataOfLibrary(library, |
| 131 addForEmission: !enqueuer.isResolutionQueue); |
| 132 } |
| 131 | 133 |
| 132 if (!enqueuer.queueIsClosed) { | 134 if (!enqueuer.queueIsClosed) { |
| 133 /// Register the constant value of [metadata] as live in resolution. | 135 /// Register the constant value of [metadata] as live in resolution. |
| 134 void registerMetadataConstant(MetadataAnnotation metadata) { | 136 void registerMetadataConstant(MetadataAnnotation metadata) { |
| 135 ConstantValue constant = | 137 ConstantValue constant = |
| 136 _constants.getConstantValueForMetadata(metadata); | 138 _constants.getConstantValueForMetadata(metadata); |
| 137 Dependency dependency = | 139 Dependency dependency = |
| 138 new Dependency(constant, metadata.annotatedElement); | 140 new Dependency(constant, metadata.annotatedElement); |
| 139 _metadataConstants.add(dependency); | 141 _metadataConstants.add(dependency); |
| 140 _impactBuilder.registerConstantUse(new ConstantUse.mirrors(constant)); | 142 _impactBuilder.registerConstantUse(new ConstantUse.mirrors(constant)); |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 479 |
| 478 /// Records that [constant] is used by the element behind [registry]. | 480 /// Records that [constant] is used by the element behind [registry]. |
| 479 class Dependency { | 481 class Dependency { |
| 480 final ConstantValue constant; | 482 final ConstantValue constant; |
| 481 final Element annotatedElement; | 483 final Element annotatedElement; |
| 482 | 484 |
| 483 const Dependency(this.constant, this.annotatedElement); | 485 const Dependency(this.constant, this.annotatedElement); |
| 484 | 486 |
| 485 String toString() => '$annotatedElement:${constant.toStructuredText()}'; | 487 String toString() => '$annotatedElement:${constant.toStructuredText()}'; |
| 486 } | 488 } |
| OLD | NEW |