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

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

Issue 24736002: Handle hiding dart:core imports specially. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove unused variables. 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
« no previous file with comments | « pkg/pkg.status ('k') | sdk/lib/_internal/compiler/implementation/warnings.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 82f5e73de83c54c28a278eef9dbde43cc7aa3b4b..51e0f2177fe0ab0a0f370c80bcb8f3d3d88f33e6 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
@@ -677,6 +677,7 @@ class LibraryElementX extends ElementX implements LibraryElement {
SourceString name = element.name;
Element existing = importScope.putIfAbsent(name, () => element);
if (existing != element) {
+ // TODO(johnniwinther): Only emit these warnings if [element] is used.
if (existing.getLibrary().isPlatformLibrary &&
!element.getLibrary().isPlatformLibrary) {
// [existing] is implicitly hidden.
@@ -688,10 +689,19 @@ class LibraryElementX extends ElementX implements LibraryElement {
} 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});
+ if (import == null) {
+ // [element] is imported implicitly (probably through dart:core).
+ listener.reportWarningCode(importers[existing].head,
+ MessageKind.HIDDEN_IMPLICIT_IMPORT,
+ {'name': name,
+ 'hiddenUri': element.getLibrary().canonicalUri,
+ 'hidingUri': existing.getLibrary().canonicalUri});
+ } else {
+ 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.
« no previous file with comments | « pkg/pkg.status ('k') | sdk/lib/_internal/compiler/implementation/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698