Chromium Code Reviews| 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); |
| + } |
| } |
| } |