| 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 'dart2jslib.dart' show | 7 import 'dart2jslib.dart' show |
| 8 Compiler, | 8 Compiler, |
| 9 CompilerTask, | 9 CompilerTask, |
| 10 Constant, | 10 Constant, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 MirrorUsageAnalyzer analyzer; | 94 MirrorUsageAnalyzer analyzer; |
| 95 | 95 |
| 96 MirrorUsageAnalyzerTask(Compiler compiler) | 96 MirrorUsageAnalyzerTask(Compiler compiler) |
| 97 : super(compiler) { | 97 : super(compiler) { |
| 98 analyzer = new MirrorUsageAnalyzer(compiler, this); | 98 analyzer = new MirrorUsageAnalyzer(compiler, this); |
| 99 } | 99 } |
| 100 | 100 |
| 101 /// Collect @MirrorsUsed annotations in all libraries. Called by the | 101 /// Collect @MirrorsUsed annotations in all libraries. Called by the |
| 102 /// compiler after all libraries are loaded, but before resolution. | 102 /// compiler after all libraries are loaded, but before resolution. |
| 103 void analyzeUsage(LibraryElement mainApp) { | 103 void analyzeUsage(LibraryElement mainApp) { |
| 104 if (compiler.mirrorsLibrary == null) return; | 104 if (mainApp == null || compiler.mirrorsLibrary == null) return; |
| 105 measure(analyzer.run); | 105 measure(analyzer.run); |
| 106 List<String> symbols = analyzer.mergedMirrorUsage.symbols; | 106 List<String> symbols = analyzer.mergedMirrorUsage.symbols; |
| 107 List<Element> targets = analyzer.mergedMirrorUsage.targets; | 107 List<Element> targets = analyzer.mergedMirrorUsage.targets; |
| 108 List<Element> metaTargets = analyzer.mergedMirrorUsage.metaTargets; | 108 List<Element> metaTargets = analyzer.mergedMirrorUsage.metaTargets; |
| 109 compiler.backend.registerMirrorUsage( | 109 compiler.backend.registerMirrorUsage( |
| 110 symbols == null ? null : new Set<String>.from(symbols), | 110 symbols == null ? null : new Set<String>.from(symbols), |
| 111 targets == null ? null : new Set<Element>.from(targets), | 111 targets == null ? null : new Set<Element>.from(targets), |
| 112 metaTargets == null ? null : new Set<Element>.from(metaTargets)); | 112 metaTargets == null ? null : new Set<Element>.from(metaTargets)); |
| 113 librariesWithUsage = analyzer.librariesWithUsage; | 113 librariesWithUsage = analyzer.librariesWithUsage; |
| 114 } | 114 } |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 // @MirrorsUsed(targets: fisk) | 582 // @MirrorsUsed(targets: fisk) |
| 583 // ^^^^ | 583 // ^^^^ |
| 584 // | 584 // |
| 585 // Instead of saying 'fisk' should pretty print the problematic constant | 585 // Instead of saying 'fisk' should pretty print the problematic constant |
| 586 // value. | 586 // value. |
| 587 return spannable; | 587 return spannable; |
| 588 } | 588 } |
| 589 return node; | 589 return node; |
| 590 } | 590 } |
| 591 } | 591 } |
| OLD | NEW |