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

Side by Side Diff: pkg/analyzer/lib/error/error.dart

Issue 2498133002: Connect analyzer's AnalysisError object to front_end's CompilationError. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 analyzer.error.error; 5 library analyzer.error.error;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/error/listener.dart'; 10 import 'package:analyzer/error/listener.dart';
11 import 'package:analyzer/src/dart/scanner/scanner.dart' show ScannerErrorCode; 11 import 'package:analyzer/src/dart/scanner/scanner.dart' show ScannerErrorCode;
12 import 'package:analyzer/src/error/codes.dart'; 12 import 'package:analyzer/src/error/codes.dart';
13 import 'package:analyzer/src/generated/java_core.dart'; 13 import 'package:analyzer/src/generated/java_core.dart';
14 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; 14 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
15 import 'package:analyzer/src/generated/source.dart'; 15 import 'package:analyzer/src/generated/source.dart';
16 import 'package:front_end/compilation_error.dart';
16 import 'package:front_end/src/base/errors.dart'; 17 import 'package:front_end/src/base/errors.dart';
17 import 'package:front_end/src/scanner/errors.dart'; 18 import 'package:front_end/src/scanner/errors.dart';
19 import 'package:source_span/src/span.dart';
18 20
19 export 'package:front_end/src/base/errors.dart' 21 export 'package:front_end/src/base/errors.dart'
20 show ErrorCode, ErrorSeverity, ErrorType; 22 show ErrorCode, ErrorSeverity, ErrorType;
21 23
22 const List<ErrorCode> errorCodeValues = const [ 24 const List<ErrorCode> errorCodeValues = const [
23 // 25 //
24 // Manually generated. You can mostly reproduce this list by running the 26 // Manually generated. You can mostly reproduce this list by running the
25 // following command from the root of the analyzer package: 27 // following command from the root of the analyzer package:
26 // 28 //
27 // > cat 29 // > cat
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 } 637 }
636 } 638 }
637 return _uniqueNameToCodeMap[uniqueName]; 639 return _uniqueNameToCodeMap[uniqueName];
638 } 640 }
639 641
640 /** 642 /**
641 * An error discovered during the analysis of some Dart code. 643 * An error discovered during the analysis of some Dart code.
642 * 644 *
643 * See [AnalysisErrorListener]. 645 * See [AnalysisErrorListener].
644 */ 646 */
645 class AnalysisError { 647 class AnalysisError extends CompilationError {
646 /** 648 /**
647 * An empty array of errors used when no errors are expected. 649 * An empty array of errors used when no errors are expected.
648 */ 650 */
649 static const List<AnalysisError> NO_ERRORS = const <AnalysisError>[]; 651 static const List<AnalysisError> NO_ERRORS = const <AnalysisError>[];
650 652
651 /** 653 /**
652 * A [Comparator] that sorts by the name of the file that the [AnalysisError] 654 * A [Comparator] that sorts by the name of the file that the [AnalysisError]
653 * was found. 655 * was found.
654 */ 656 */
655 static Comparator<AnalysisError> FILE_COMPARATOR = 657 static Comparator<AnalysisError> FILE_COMPARATOR =
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 String get correction => _correction; 745 String get correction => _correction;
744 746
745 @override 747 @override
746 int get hashCode { 748 int get hashCode {
747 int hashCode = offset; 749 int hashCode = offset;
748 hashCode ^= (_message != null) ? _message.hashCode : 0; 750 hashCode ^= (_message != null) ? _message.hashCode : 0;
749 hashCode ^= (source != null) ? source.hashCode : 0; 751 hashCode ^= (source != null) ? source.hashCode : 0;
750 return hashCode; 752 return hashCode;
751 } 753 }
752 754
755 @override
756 SourceSpan get span => source.sourceFile.span(offset, offset + length);
757
753 /** 758 /**
754 * Return the message to be displayed for this error. The message should 759 * Return the message to be displayed for this error. The message should
755 * indicate what is wrong and why it is wrong. 760 * indicate what is wrong and why it is wrong.
756 */ 761 */
757 String get message => _message; 762 String get message => _message;
758 763
759 @override 764 @override
760 bool operator ==(Object other) { 765 bool operator ==(Object other) {
761 if (identical(other, this)) { 766 if (identical(other, this)) {
762 return true; 767 return true;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 904
900 @override 905 @override
901 int get hashCode => ordinal; 906 int get hashCode => ordinal;
902 907
903 @override 908 @override
904 int compareTo(ErrorProperty other) => ordinal - other.ordinal; 909 int compareTo(ErrorProperty other) => ordinal - other.ordinal;
905 910
906 @override 911 @override
907 String toString() => name; 912 String toString() => name;
908 } 913 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/source.dart » ('j') | pkg/analyzer/lib/src/generated/source_io.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698