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

Side by Side Diff: pkg/compiler/lib/src/elements/elements.dart

Issue 1383483006: Extract DiagnosticReporter implementation from Compiler. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fixes after rebase. Created 5 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
« no previous file with comments | « pkg/compiler/lib/src/dump_info.dart ('k') | pkg/compiler/lib/src/elements/modelx.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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; 5 library elements;
6 6
7 import '../common/resolution.dart' show 7 import '../common/resolution.dart' show
8 Resolution; 8 Resolution;
9 import '../compiler.dart' show 9 import '../compiler.dart' show
10 Compiler; 10 Compiler;
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 } 420 }
421 421
422 class Elements { 422 class Elements {
423 static bool isUnresolved(Element e) { 423 static bool isUnresolved(Element e) {
424 return e == null || e.isErroneous; 424 return e == null || e.isErroneous;
425 } 425 }
426 static bool isErroneous(Element e) => e != null && e.isErroneous; 426 static bool isErroneous(Element e) => e != null && e.isErroneous;
427 427
428 /// Unwraps [element] reporting any warnings attached to it, if any. 428 /// Unwraps [element] reporting any warnings attached to it, if any.
429 static Element unwrap(Element element, 429 static Element unwrap(Element element,
430 DiagnosticListener listener, 430 DiagnosticReporter listener,
431 Spannable spannable) { 431 Spannable spannable) {
432 if (element != null && element.isWarnOnUse) { 432 if (element != null && element.isWarnOnUse) {
433 WarnOnUseElement wrappedElement = element; 433 WarnOnUseElement wrappedElement = element;
434 element = wrappedElement.unwrap(listener, spannable); 434 element = wrappedElement.unwrap(listener, spannable);
435 } 435 }
436 return element; 436 return element;
437 } 437 }
438 438
439 static bool isClass(Element e) => e != null && e.kind == ElementKind.CLASS; 439 static bool isClass(Element e) => e != null && e.kind == ElementKind.CLASS;
440 static bool isTypedef(Element e) { 440 static bool isTypedef(Element e) {
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 } 799 }
800 800
801 /// An [Element] whose usage should cause one or more warnings. 801 /// An [Element] whose usage should cause one or more warnings.
802 abstract class WarnOnUseElement extends Element { 802 abstract class WarnOnUseElement extends Element {
803 /// The element whose usage cause a warning. 803 /// The element whose usage cause a warning.
804 Element get wrappedElement; 804 Element get wrappedElement;
805 805
806 /// Reports the attached warning and returns the wrapped element. 806 /// Reports the attached warning and returns the wrapped element.
807 /// [usageSpannable] is used to report messages on the reference of 807 /// [usageSpannable] is used to report messages on the reference of
808 /// [wrappedElement]. 808 /// [wrappedElement].
809 Element unwrap(DiagnosticListener listener, Spannable usageSpannable); 809 Element unwrap(DiagnosticReporter listener, Spannable usageSpannable);
810 } 810 }
811 811
812 /// An ambiguous element represents multiple elements accessible by the same 812 /// An ambiguous element represents multiple elements accessible by the same
813 /// name. 813 /// name.
814 /// 814 ///
815 /// Ambiguous elements are created during handling of import/export scopes. If 815 /// Ambiguous elements are created during handling of import/export scopes. If
816 /// an ambiguous element is encountered during resolution a warning/error is 816 /// an ambiguous element is encountered during resolution a warning/error is
817 /// reported. 817 /// reported.
818 abstract class AmbiguousElement extends Element { 818 abstract class AmbiguousElement extends Element {
819 MessageKind get messageKind; 819 MessageKind get messageKind;
820 Map get messageArguments; 820 Map get messageArguments;
821 Element get existingElement; 821 Element get existingElement;
822 Element get newElement; 822 Element get newElement;
823 823
824 /// Compute the info messages associated with an error/warning on [context]. 824 /// Compute the info messages associated with an error/warning on [context].
825 List<DiagnosticMessage> computeInfos( 825 List<DiagnosticMessage> computeInfos(
826 Element context, DiagnosticListener listener); 826 Element context, DiagnosticReporter listener);
827 } 827 }
828 828
829 // TODO(kasperl): This probably shouldn't be called an element. It's 829 // TODO(kasperl): This probably shouldn't be called an element. It's
830 // just an interface shared by classes and libraries. 830 // just an interface shared by classes and libraries.
831 abstract class ScopeContainerElement implements Element { 831 abstract class ScopeContainerElement implements Element {
832 Element localLookup(String elementName); 832 Element localLookup(String elementName);
833 833
834 void forEachLocalMember(f(Element element)); 834 void forEachLocalMember(f(Element element));
835 } 835 }
836 836
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 bool get isDeclaredByField; 1708 bool get isDeclaredByField;
1709 1709
1710 /// Returns `true` if this member is abstract. 1710 /// Returns `true` if this member is abstract.
1711 bool get isAbstract; 1711 bool get isAbstract;
1712 1712
1713 /// If abstract, [implementation] points to the overridden concrete member, 1713 /// If abstract, [implementation] points to the overridden concrete member,
1714 /// if any. Otherwise [implementation] points to the member itself. 1714 /// if any. Otherwise [implementation] points to the member itself.
1715 Member get implementation; 1715 Member get implementation;
1716 } 1716 }
1717 1717
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/dump_info.dart ('k') | pkg/compiler/lib/src/elements/modelx.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698