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

Unified Diff: sdk/lib/_internal/compiler/implementation/elements/modelx.dart

Issue 23684057: Support new import rules. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 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
Index: sdk/lib/_internal/compiler/implementation/elements/modelx.dart
diff --git a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
index bacfc870e48d7f783d8d02bf309efa96ca01d1d6..fda82a7406b554fd4bb58c354a211b9125d355f5 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
@@ -674,15 +674,31 @@ class LibraryElementX extends ElementX implements LibraryElement {
importers[element] =
importers.putIfAbsent(element, () => const Link<Import>())
.prepend(import);
- Element existing = importScope[element.name];
- if (existing != null) {
- // TODO(johnniwinther): Provide access to the import tags from which
- // the elements came.
- importScope[element.name] = new AmbiguousElementX(
- MessageKind.DUPLICATE_IMPORT, {'name': element.name},
- this, existing, element);
- } else {
- importScope[element.name] = element;
+ SourceString name = element.name;
+ Element existing = importScope.putIfAbsent(name, () => element);
+ if (existing != element) {
+ if (existing.getLibrary().isPlatformLibrary &&
+ !element.getLibrary().isPlatformLibrary) {
+ // [existing] is implicitly hidden.
+ importScope[name] = element;
+ listener.reportWarningCode(import, MessageKind.HIDDEN_IMPORT,
+ {'name': name,
+ 'hiddenUri': existing.getLibrary().canonicalUri,
+ 'hidingUri': element.getLibrary().canonicalUri});
+ } else if (!existing.getLibrary().isPlatformLibrary &&
+ element.getLibrary().isPlatformLibrary) {
+ // [element] is implicitly hidden.
+ listener.reportWarningCode(import, MessageKind.HIDDEN_IMPORT,
+ {'name': name,
+ 'hiddenUri': element.getLibrary().canonicalUri,
+ 'hidingUri': existing.getLibrary().canonicalUri});
+ } else {
+ // TODO(johnniwinther): Provide access to the import tags from which
+ // the elements came.
+ importScope[name] = new AmbiguousElementX(
+ MessageKind.DUPLICATE_IMPORT, {'name': name},
+ this, existing, element);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698