OLD | NEW |
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.src.generated.error; | 5 library analyzer.src.generated.error; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart' show AstNode; | 9 import 'package:analyzer/dart/ast/ast.dart' show AstNode; |
10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
11 import 'package:analyzer/dart/element/element.dart'; | 11 import 'package:analyzer/dart/element/element.dart'; |
12 import 'package:analyzer/dart/element/type.dart'; | 12 import 'package:analyzer/dart/element/type.dart'; |
13 import 'package:analyzer/source/error_processor.dart'; | 13 import 'package:analyzer/source/error_processor.dart'; |
| 14 import 'package:analyzer/src/dart/element/element.dart'; |
14 import 'package:analyzer/src/dart/element/type.dart'; | 15 import 'package:analyzer/src/dart/element/type.dart'; |
15 import 'package:analyzer/src/dart/scanner/scanner.dart' show ScannerErrorCode; | 16 import 'package:analyzer/src/dart/scanner/scanner.dart' show ScannerErrorCode; |
16 import 'package:analyzer/src/generated/generated/shared_messages.dart' | 17 import 'package:analyzer/src/generated/generated/shared_messages.dart' |
17 as shared_messages; | 18 as shared_messages; |
18 import 'package:analyzer/src/generated/java_core.dart'; | 19 import 'package:analyzer/src/generated/java_core.dart'; |
19 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; | 20 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; |
20 import 'package:analyzer/src/generated/source.dart'; | 21 import 'package:analyzer/src/generated/source.dart'; |
21 import 'package:analyzer/src/task/model.dart'; | 22 import 'package:analyzer/src/task/model.dart'; |
22 import 'package:analyzer/task/model.dart'; | 23 import 'package:analyzer/task/model.dart'; |
23 import 'package:source_span/source_span.dart'; | 24 import 'package:source_span/source_span.dart'; |
24 import 'package:analyzer/src/dart/element/element.dart'; | |
25 | 25 |
26 /** | 26 /** |
27 * The descriptor used to associate error processors with analysis contexts in | 27 * The descriptor used to associate error processors with analysis contexts in |
28 * configuration data. | 28 * configuration data. |
29 */ | 29 */ |
30 final ListResultDescriptor<ErrorProcessor> CONFIGURED_ERROR_PROCESSORS = | 30 final ListResultDescriptor<ErrorProcessor> CONFIGURED_ERROR_PROCESSORS = |
31 new ListResultDescriptorImpl('configured.errors', const <ErrorProcessor>[]); | 31 new ListResultDescriptorImpl('configured.errors', const <ErrorProcessor>[]); |
32 | 32 |
33 /** | 33 /** |
34 * An error discovered during the analysis of some Dart code. | 34 * An error discovered during the analysis of some Dart code. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 AnalysisError(this.source, this.offset, this.length, this.errorCode, | 116 AnalysisError(this.source, this.offset, this.length, this.errorCode, |
117 [List<Object> arguments]) { | 117 [List<Object> arguments]) { |
118 this._message = formatList(errorCode.message, arguments); | 118 this._message = formatList(errorCode.message, arguments); |
119 String correctionTemplate = errorCode.correction; | 119 String correctionTemplate = errorCode.correction; |
120 if (correctionTemplate != null) { | 120 if (correctionTemplate != null) { |
121 this._correction = formatList(correctionTemplate, arguments); | 121 this._correction = formatList(correctionTemplate, arguments); |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 /** | 125 /** |
| 126 * Initialize a newly created analysis error with given values. |
| 127 */ |
| 128 AnalysisError.forValues(this.source, this.offset, this.length, this.errorCode, |
| 129 this._message, this._correction); |
| 130 |
| 131 /** |
126 * Return the template used to create the correction to be displayed for this | 132 * Return the template used to create the correction to be displayed for this |
127 * error, or `null` if there is no correction information for this error. The | 133 * error, or `null` if there is no correction information for this error. The |
128 * correction should indicate how the user can fix the error. | 134 * correction should indicate how the user can fix the error. |
129 */ | 135 */ |
130 String get correction => _correction; | 136 String get correction => _correction; |
131 | 137 |
132 @override | 138 @override |
133 int get hashCode { | 139 int get hashCode { |
134 int hashCode = offset; | 140 int hashCode = offset; |
135 hashCode ^= (_message != null) ? _message.hashCode : 0; | 141 hashCode ^= (_message != null) ? _message.hashCode : 0; |
(...skipping 5675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5811 * Initialize a newly created error code to have the given [name]. | 5817 * Initialize a newly created error code to have the given [name]. |
5812 */ | 5818 */ |
5813 const TodoCode(String name) : super(name, "{0}"); | 5819 const TodoCode(String name) : super(name, "{0}"); |
5814 | 5820 |
5815 @override | 5821 @override |
5816 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 5822 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
5817 | 5823 |
5818 @override | 5824 @override |
5819 ErrorType get type => ErrorType.TODO; | 5825 ErrorType get type => ErrorType.TODO; |
5820 } | 5826 } |
OLD | NEW |