| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 LibraryElement library, ImportElement import) { | 245 LibraryElement library, ImportElement import) { |
| 246 LibraryElement importedLibrary = import.importedLibrary; | 246 LibraryElement importedLibrary = import.importedLibrary; |
| 247 if (importedLibrary != compiler.commonElements.mirrorsLibrary) { | 247 if (importedLibrary != compiler.commonElements.mirrorsLibrary) { |
| 248 return null; | 248 return null; |
| 249 } | 249 } |
| 250 List<MirrorUsage> result = <MirrorUsage>[]; | 250 List<MirrorUsage> result = <MirrorUsage>[]; |
| 251 for (MetadataAnnotation metadata in import.metadata) { | 251 for (MetadataAnnotation metadata in import.metadata) { |
| 252 metadata.ensureResolved(compiler.resolution); | 252 metadata.ensureResolved(compiler.resolution); |
| 253 ConstantValue value = | 253 ConstantValue value = |
| 254 compiler.constants.getConstantValue(metadata.constant); | 254 compiler.constants.getConstantValue(metadata.constant); |
| 255 Element element = value.getType(compiler.commonElements).element; | 255 ResolutionDartType type = value.getType(compiler.commonElements); |
| 256 Element element = type.element; |
| 256 if (element == compiler.commonElements.mirrorsUsedClass) { | 257 if (element == compiler.commonElements.mirrorsUsedClass) { |
| 257 result.add(buildUsage(value)); | 258 result.add(buildUsage(value)); |
| 258 } | 259 } |
| 259 } | 260 } |
| 260 return result; | 261 return result; |
| 261 } | 262 } |
| 262 | 263 |
| 263 /// Merge all [MirrorUsage] instances accross all libraries. | 264 /// Merge all [MirrorUsage] instances accross all libraries. |
| 264 MirrorUsage mergeUsages(Map<LibraryElement, List<MirrorUsage>> usageMap) { | 265 MirrorUsage mergeUsages(Map<LibraryElement, List<MirrorUsage>> usageMap) { |
| 265 Set<MirrorUsage> usagesToMerge = new Set<MirrorUsage>(); | 266 Set<MirrorUsage> usagesToMerge = new Set<MirrorUsage>(); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 // @MirrorsUsed(targets: fisk) | 566 // @MirrorsUsed(targets: fisk) |
| 566 // ^^^^ | 567 // ^^^^ |
| 567 // | 568 // |
| 568 // Instead of saying 'fisk' should pretty print the problematic constant | 569 // Instead of saying 'fisk' should pretty print the problematic constant |
| 569 // value. | 570 // value. |
| 570 return spannable; | 571 return spannable; |
| 571 } | 572 } |
| 572 return node; | 573 return node; |
| 573 } | 574 } |
| 574 } | 575 } |
| OLD | NEW |