Chromium Code Reviews| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 /// [MirrorUsageAnalyzerTask.hasMirrorUsage]). | 179 /// [MirrorUsageAnalyzerTask.hasMirrorUsage]). |
| 180 void run() { | 180 void run() { |
| 181 wildcard = compiler.libraries.values.toList(); | 181 wildcard = compiler.libraries.values.toList(); |
| 182 Map<LibraryElement, List<MirrorUsage>> usageMap = | 182 Map<LibraryElement, List<MirrorUsage>> usageMap = |
| 183 collectMirrorsUsedAnnotation(); | 183 collectMirrorsUsedAnnotation(); |
| 184 propagateOverrides(usageMap); | 184 propagateOverrides(usageMap); |
| 185 Set<LibraryElement> librariesWithoutUsage = new Set<LibraryElement>(); | 185 Set<LibraryElement> librariesWithoutUsage = new Set<LibraryElement>(); |
| 186 usageMap.forEach((LibraryElement library, List<MirrorUsage> usage) { | 186 usageMap.forEach((LibraryElement library, List<MirrorUsage> usage) { |
| 187 if (usage.isEmpty) librariesWithoutUsage.add(library); | 187 if (usage.isEmpty) librariesWithoutUsage.add(library); |
| 188 }); | 188 }); |
| 189 if (librariesWithoutUsage.isEmpty) { | 189 if (librariesWithoutUsage.isEmpty) { |
|
karlklose
2013/08/07 15:31:20
Could we warn if there is an import with and one w
ahe
2013/08/07 15:44:17
Yes. Filed http://dartbug.com/12297.
| |
| 190 mergedMirrorUsage = mergeUsages(usageMap); | 190 mergedMirrorUsage = mergeUsages(usageMap); |
| 191 } else { | 191 } else { |
| 192 mergedMirrorUsage = new MirrorUsage(null, wildcard, null, null); | 192 mergedMirrorUsage = new MirrorUsage(null, null, null, null); |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 | 195 |
| 196 /// Collect all @MirrorsUsed from all libraries and represent them as | 196 /// Collect all @MirrorsUsed from all libraries and represent them as |
| 197 /// [MirrorUsage]. | 197 /// [MirrorUsage]. |
| 198 Map<LibraryElement, List<MirrorUsage>> collectMirrorsUsedAnnotation() { | 198 Map<LibraryElement, List<MirrorUsage>> collectMirrorsUsedAnnotation() { |
| 199 Map<LibraryElement, List<MirrorUsage>> result = | 199 Map<LibraryElement, List<MirrorUsage>> result = |
| 200 new Map<LibraryElement, List<MirrorUsage>>(); | 200 new Map<LibraryElement, List<MirrorUsage>>(); |
| 201 for (LibraryElement library in compiler.libraries.values) { | 201 for (LibraryElement library in compiler.libraries.values) { |
| 202 if (library.isInternalLibrary) continue; | 202 if (library.isInternalLibrary) continue; |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 583 // @MirrorsUsed(targets: fisk) | 583 // @MirrorsUsed(targets: fisk) |
| 584 // ^^^^ | 584 // ^^^^ |
| 585 // | 585 // |
| 586 // Instead of saying 'fisk' should pretty print the problematic constant | 586 // Instead of saying 'fisk' should pretty print the problematic constant |
| 587 // value. | 587 // value. |
| 588 return spannable; | 588 return spannable; |
| 589 } | 589 } |
| 590 return node; | 590 return node; |
| 591 } | 591 } |
| 592 } | 592 } |
| OLD | NEW |