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

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: 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 48fba41cb0e92afcb5ba78341f143e66c2cda972..c25132978ef7a264214767533b328ef690089603 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
@@ -674,15 +674,37 @@ 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.reportMessage(
ahe 2013/09/17 10:47:18 reportWarning.
Johnni Winther 2013/09/18 06:14:11 Done.
+ listener.spanFromSpannable(import),
+ MessageKind.HIDDEN_IMPORT.error(
+ {'name': name,
+ 'hiddenUri': existing.getLibrary().canonicalUri,
+ 'hidingUri': element.getLibrary().canonicalUri}),
+ api.Diagnostic.WARNING);
+ } else if (!existing.getLibrary().isPlatformLibrary &&
+ element.getLibrary().isPlatformLibrary) {
+ // [element] is implicitly hidden.
+ listener.reportMessage(
ahe 2013/09/17 10:47:18 reportWarning
Johnni Winther 2013/09/18 06:14:11 Done.
+ listener.spanFromSpannable(import),
+ MessageKind.HIDDEN_IMPORT.error(
+ {'name': name,
+ 'hiddenUri': element.getLibrary().canonicalUri,
+ 'hidingUri': existing.getLibrary().canonicalUri}),
+ api.Diagnostic.WARNING);
+ } 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