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

Side by Side 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, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/pkg.status ('k') | sdk/lib/_internal/compiler/implementation/warnings.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library elements.modelx; 5 library elements.modelx;
6 6
7 import 'dart:collection' show LinkedHashMap; 7 import 'dart:collection' show LinkedHashMap;
8 8
9 import 'elements.dart'; 9 import 'elements.dart';
10 import '../../compiler.dart' as api; 10 import '../../compiler.dart' as api;
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 * [ErroneousElement] will be put in the imported scope, allowing for the 670 * [ErroneousElement] will be put in the imported scope, allowing for the
671 * detection of ambiguous uses of imported names. 671 * detection of ambiguous uses of imported names.
672 */ 672 */
673 void addImport(Element element, Import import, DiagnosticListener listener) { 673 void addImport(Element element, Import import, DiagnosticListener listener) {
674 importers[element] = 674 importers[element] =
675 importers.putIfAbsent(element, () => const Link<Import>()) 675 importers.putIfAbsent(element, () => const Link<Import>())
676 .prepend(import); 676 .prepend(import);
677 SourceString name = element.name; 677 SourceString name = element.name;
678 Element existing = importScope.putIfAbsent(name, () => element); 678 Element existing = importScope.putIfAbsent(name, () => element);
679 if (existing != element) { 679 if (existing != element) {
680 // TODO(johnniwinther): Only emit these warnings if [element] is used.
680 if (existing.getLibrary().isPlatformLibrary && 681 if (existing.getLibrary().isPlatformLibrary &&
681 !element.getLibrary().isPlatformLibrary) { 682 !element.getLibrary().isPlatformLibrary) {
682 // [existing] is implicitly hidden. 683 // [existing] is implicitly hidden.
683 importScope[name] = element; 684 importScope[name] = element;
684 listener.reportWarningCode(import, MessageKind.HIDDEN_IMPORT, 685 listener.reportWarningCode(import, MessageKind.HIDDEN_IMPORT,
685 {'name': name, 686 {'name': name,
686 'hiddenUri': existing.getLibrary().canonicalUri, 687 'hiddenUri': existing.getLibrary().canonicalUri,
687 'hidingUri': element.getLibrary().canonicalUri}); 688 'hidingUri': element.getLibrary().canonicalUri});
688 } else if (!existing.getLibrary().isPlatformLibrary && 689 } else if (!existing.getLibrary().isPlatformLibrary &&
689 element.getLibrary().isPlatformLibrary) { 690 element.getLibrary().isPlatformLibrary) {
690 // [element] is implicitly hidden. 691 // [element] is implicitly hidden.
691 listener.reportWarningCode(import, MessageKind.HIDDEN_IMPORT, 692 if (import == null) {
692 {'name': name, 693 // [element] is imported implicitly (probably through dart:core).
693 'hiddenUri': element.getLibrary().canonicalUri, 694 listener.reportWarningCode(importers[existing].head,
694 'hidingUri': existing.getLibrary().canonicalUri}); 695 MessageKind.HIDDEN_IMPLICIT_IMPORT,
696 {'name': name,
697 'hiddenUri': element.getLibrary().canonicalUri,
698 'hidingUri': existing.getLibrary().canonicalUri});
699 } else {
700 listener.reportWarningCode(import, MessageKind.HIDDEN_IMPORT,
701 {'name': name,
702 'hiddenUri': element.getLibrary().canonicalUri,
703 'hidingUri': existing.getLibrary().canonicalUri});
704 }
695 } else { 705 } else {
696 // TODO(johnniwinther): Provide access to the import tags from which 706 // TODO(johnniwinther): Provide access to the import tags from which
697 // the elements came. 707 // the elements came.
698 importScope[name] = new AmbiguousElementX( 708 importScope[name] = new AmbiguousElementX(
699 MessageKind.DUPLICATE_IMPORT, {'name': name}, 709 MessageKind.DUPLICATE_IMPORT, {'name': name},
700 this, existing, element); 710 this, existing, element);
701 } 711 }
702 } 712 }
703 } 713 }
704 714
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after
2222 2232
2223 MetadataAnnotation ensureResolved(Compiler compiler) { 2233 MetadataAnnotation ensureResolved(Compiler compiler) {
2224 if (resolutionState == STATE_NOT_STARTED) { 2234 if (resolutionState == STATE_NOT_STARTED) {
2225 compiler.resolver.resolveMetadataAnnotation(this); 2235 compiler.resolver.resolveMetadataAnnotation(this);
2226 } 2236 }
2227 return this; 2237 return this;
2228 } 2238 }
2229 2239
2230 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 2240 String toString() => 'MetadataAnnotation($value, $resolutionState)';
2231 } 2241 }
OLDNEW
« 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