| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_used; | 5 library dart2js.mirrors_used; |
| 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 'compile_time_constants.dart' show ConstantCompiler; | 9 import 'compile_time_constants.dart' show ConstantCompiler; |
| 10 import 'compiler.dart' show Compiler; | 10 import 'compiler.dart' show Compiler; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 /// Collect @MirrorsUsed annotations in all libraries. Called by the | 92 /// Collect @MirrorsUsed annotations in all libraries. Called by the |
| 93 /// compiler after all libraries are loaded, but before resolution. | 93 /// compiler after all libraries are loaded, but before resolution. |
| 94 void analyzeUsage(LibraryElement mainApp) { | 94 void analyzeUsage(LibraryElement mainApp) { |
| 95 if (mainApp == null || compiler.commonElements.mirrorsLibrary == null) { | 95 if (mainApp == null || compiler.commonElements.mirrorsLibrary == null) { |
| 96 return; | 96 return; |
| 97 } | 97 } |
| 98 measure(analyzer.run); | 98 measure(analyzer.run); |
| 99 List<String> symbols = analyzer.mergedMirrorUsage.symbols; | 99 List<String> symbols = analyzer.mergedMirrorUsage.symbols; |
| 100 List<Element> targets = analyzer.mergedMirrorUsage.targets; | 100 List<Element> targets = analyzer.mergedMirrorUsage.targets; |
| 101 List<Element> metaTargets = analyzer.mergedMirrorUsage.metaTargets; | 101 List<Element> metaTargets = analyzer.mergedMirrorUsage.metaTargets; |
| 102 compiler.backend.registerMirrorUsage( | 102 compiler.backend.mirrorsData.registerMirrorUsage( |
| 103 symbols == null ? null : new Set<String>.from(symbols), | 103 symbols == null ? null : new Set<String>.from(symbols), |
| 104 targets == null ? null : new Set<Element>.from(targets), | 104 targets == null ? null : new Set<Element>.from(targets), |
| 105 metaTargets == null ? null : new Set<Element>.from(metaTargets)); | 105 metaTargets == null ? null : new Set<Element>.from(metaTargets)); |
| 106 librariesWithUsage = analyzer.librariesWithUsage; | 106 librariesWithUsage = analyzer.librariesWithUsage; |
| 107 } | 107 } |
| 108 | 108 |
| 109 /// Is there a @MirrorsUsed annotation in the library of [element]? Used by | 109 /// Is there a @MirrorsUsed annotation in the library of [element]? Used by |
| 110 /// the resolver to suppress hints about using new Symbol or | 110 /// the resolver to suppress hints about using new Symbol or |
| 111 /// MirrorSystem.getName. | 111 /// MirrorSystem.getName. |
| 112 bool hasMirrorUsage(Element element) { | 112 bool hasMirrorUsage(Element element) { |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 // @MirrorsUsed(targets: fisk) | 566 // @MirrorsUsed(targets: fisk) |
| 567 // ^^^^ | 567 // ^^^^ |
| 568 // | 568 // |
| 569 // Instead of saying 'fisk' should pretty print the problematic constant | 569 // Instead of saying 'fisk' should pretty print the problematic constant |
| 570 // value. | 570 // value. |
| 571 return spannable; | 571 return spannable; |
| 572 } | 572 } |
| 573 return node; | 573 return node; |
| 574 } | 574 } |
| 575 } | 575 } |
| OLD | NEW |