Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Unified Diff: pkg/compiler/lib/src/mirrors_used.dart

Issue 1335983004: Add ImportElement and ExportElement (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/mirrors/dart2js_mirrors.dart ('k') | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/mirrors_used.dart
diff --git a/pkg/compiler/lib/src/mirrors_used.dart b/pkg/compiler/lib/src/mirrors_used.dart
index fac02346e9b381c2939054abc5deacef1fd154bc..553f9ccae6bfb8c38c2beb3b56ebd0c1041621cd 100644
--- a/pkg/compiler/lib/src/mirrors_used.dart
+++ b/pkg/compiler/lib/src/mirrors_used.dart
@@ -28,6 +28,7 @@ import 'diagnostics/spannable.dart' show
import 'elements/elements.dart' show
ClassElement,
Element,
+ ImportElement,
LibraryElement,
MetadataAnnotation,
ScopeContainerElement,
@@ -199,12 +200,10 @@ class MirrorUsageAnalyzer {
new Map<LibraryElement, List<MirrorUsage>>();
for (LibraryElement library in compiler.libraryLoader.libraries) {
if (library.isInternalLibrary) continue;
- for (LibraryTag tag in library.tags) {
- Import importTag = tag.asImport();
- if (importTag == null) continue;
+ for (ImportElement import in library.imports) {
compiler.withCurrentElement(library, () {
List<MirrorUsage> usages =
- mirrorsUsedOnLibraryTag(library, importTag);
+ mirrorsUsedOnLibraryTag(library, import);
if (usages != null) {
List<MirrorUsage> existing = result[library];
if (existing != null) {
@@ -255,13 +254,13 @@ class MirrorUsageAnalyzer {
/// Find @MirrorsUsed annotations on the given import [tag] in [library]. The
/// annotations are represented as [MirrorUsage].
List<MirrorUsage> mirrorsUsedOnLibraryTag(LibraryElement library,
- Import tag) {
- LibraryElement importedLibrary = library.getLibraryFromTag(tag);
+ ImportElement import) {
+ LibraryElement importedLibrary = import.importedLibrary;
if (importedLibrary != compiler.mirrorsLibrary) {
return null;
}
List<MirrorUsage> result = <MirrorUsage>[];
- for (MetadataAnnotation metadata in tag.metadata) {
+ for (MetadataAnnotation metadata in import.metadata) {
metadata.ensureResolved(compiler);
ConstantValue value =
compiler.constants.getConstantValue(metadata.constant);
@@ -476,8 +475,8 @@ class MirrorUsageBuilder {
LibraryElement libraryCandiate;
String libraryNameCandiate;
for (LibraryElement l in compiler.libraryLoader.libraries) {
- if (l.hasLibraryName()) {
- String libraryName = l.getLibraryOrScriptName();
+ if (l.hasLibraryName) {
+ String libraryName = l.libraryOrScriptName;
if (string == libraryName) {
// Found an exact match.
libraryCandiate = l;
@@ -535,7 +534,7 @@ class MirrorUsageBuilder {
compiler.reportHint(
spannable, MessageKind.MIRRORS_CANNOT_RESOLVE_IN_LIBRARY,
{'name': identifiers[0],
- 'library': library.getLibraryOrScriptName()});
+ 'library': library.libraryOrScriptName});
} else {
compiler.reportHint(
spannable, MessageKind.MIRRORS_CANNOT_FIND_IN_ELEMENT,
« no previous file with comments | « pkg/compiler/lib/src/mirrors/dart2js_mirrors.dart ('k') | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698