Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 667 * Adds [element] to the import scope of this library. | 667 * Adds [element] to the import scope of this library. |
| 668 * | 668 * |
| 669 * If an element by the same name is already in the imported scope, an | 669 * If an element by the same name is already in the imported scope, an |
| 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 Element existing = importScope[element.name]; | 677 SourceString name = element.name; |
| 678 if (existing != null) { | 678 Element existing = importScope.putIfAbsent(name, () => element); |
| 679 // TODO(johnniwinther): Provide access to the import tags from which | 679 if (existing != element) { |
| 680 // the elements came. | 680 if (existing.getLibrary().isPlatformLibrary && |
| 681 importScope[element.name] = new AmbiguousElementX( | 681 !element.getLibrary().isPlatformLibrary) { |
| 682 MessageKind.DUPLICATE_IMPORT, {'name': element.name}, | 682 // [existing] is implicitly hidden. |
| 683 this, existing, element); | 683 importScope[name] = element; |
| 684 } else { | 684 listener.reportMessage( |
|
ahe
2013/09/17 10:47:18
reportWarning.
Johnni Winther
2013/09/18 06:14:11
Done.
| |
| 685 importScope[element.name] = element; | 685 listener.spanFromSpannable(import), |
| 686 MessageKind.HIDDEN_IMPORT.error( | |
| 687 {'name': name, | |
| 688 'hiddenUri': existing.getLibrary().canonicalUri, | |
| 689 'hidingUri': element.getLibrary().canonicalUri}), | |
| 690 api.Diagnostic.WARNING); | |
| 691 } else if (!existing.getLibrary().isPlatformLibrary && | |
| 692 element.getLibrary().isPlatformLibrary) { | |
| 693 // [element] is implicitly hidden. | |
| 694 listener.reportMessage( | |
|
ahe
2013/09/17 10:47:18
reportWarning
Johnni Winther
2013/09/18 06:14:11
Done.
| |
| 695 listener.spanFromSpannable(import), | |
| 696 MessageKind.HIDDEN_IMPORT.error( | |
| 697 {'name': name, | |
| 698 'hiddenUri': element.getLibrary().canonicalUri, | |
| 699 'hidingUri': existing.getLibrary().canonicalUri}), | |
| 700 api.Diagnostic.WARNING); | |
| 701 } else { | |
| 702 // TODO(johnniwinther): Provide access to the import tags from which | |
| 703 // the elements came. | |
| 704 importScope[name] = new AmbiguousElementX( | |
| 705 MessageKind.DUPLICATE_IMPORT, {'name': name}, | |
| 706 this, existing, element); | |
| 707 } | |
| 686 } | 708 } |
| 687 } | 709 } |
| 688 | 710 |
| 689 void addMember(Element element, DiagnosticListener listener) { | 711 void addMember(Element element, DiagnosticListener listener) { |
| 690 localMembers = localMembers.prepend(element); | 712 localMembers = localMembers.prepend(element); |
| 691 addToScope(element, listener); | 713 addToScope(element, listener); |
| 692 } | 714 } |
| 693 | 715 |
| 694 void addToScope(Element element, DiagnosticListener listener) { | 716 void addToScope(Element element, DiagnosticListener listener) { |
| 695 localScope.add(element, listener); | 717 localScope.add(element, listener); |
| (...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2191 | 2213 |
| 2192 MetadataAnnotation ensureResolved(Compiler compiler) { | 2214 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 2193 if (resolutionState == STATE_NOT_STARTED) { | 2215 if (resolutionState == STATE_NOT_STARTED) { |
| 2194 compiler.resolver.resolveMetadataAnnotation(this); | 2216 compiler.resolver.resolveMetadataAnnotation(this); |
| 2195 } | 2217 } |
| 2196 return this; | 2218 return this; |
| 2197 } | 2219 } |
| 2198 | 2220 |
| 2199 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2221 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 2200 } | 2222 } |
| OLD | NEW |