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 engine.error; | 5 library engine.error; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/src/generated/ast.dart' show AstNode; | 9 import 'package:analyzer/src/generated/ast.dart' show AstNode; |
10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 AnalysisError(this.source, this.offset, this.length, this.errorCode, | 117 AnalysisError(this.source, this.offset, this.length, this.errorCode, |
118 [List<Object> arguments]) { | 118 [List<Object> arguments]) { |
119 this._message = formatList(errorCode.message, arguments); | 119 this._message = formatList(errorCode.message, arguments); |
120 String correctionTemplate = errorCode.correction; | 120 String correctionTemplate = errorCode.correction; |
121 if (correctionTemplate != null) { | 121 if (correctionTemplate != null) { |
122 this._correction = formatList(correctionTemplate, arguments); | 122 this._correction = formatList(correctionTemplate, arguments); |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 /** | 126 /** |
127 * Initialize a newly created analysis error for the specified [source]. The | |
128 * error will have the given [errorCode] and the list of [arguments] will be | |
129 * used to complete the message. The error has no location information. | |
130 */ | |
131 @deprecated // Use new AnalysisError(source, 0, 0, errorCode, arguments) | |
132 AnalysisError.con1(Source source, ErrorCode errorCode, | |
133 [List<Object> arguments]) | |
134 : this(source, 0, 0, errorCode, arguments); | |
135 | |
136 /** | |
137 * Initialize a newly created analysis error for the specified [source] at the | |
138 * given [offset] with the given [length]. The error will have the given | |
139 * [errorCode] and the list of [arguments] will be used to complete the | |
140 * message. | |
141 */ | |
142 @deprecated // Use new AnalysisError(source, offset, length, errorCode, argume
nts) | |
143 AnalysisError.con2(Source source, int offset, int length, ErrorCode errorCode, | |
144 [List<Object> arguments]) | |
145 : this(source, offset, length, errorCode, arguments); | |
146 | |
147 /** | |
148 * Return the template used to create the correction to be displayed for this | 127 * Return the template used to create the correction to be displayed for this |
149 * error, or `null` if there is no correction information for this error. The | 128 * error, or `null` if there is no correction information for this error. The |
150 * correction should indicate how the user can fix the error. | 129 * correction should indicate how the user can fix the error. |
151 */ | 130 */ |
152 String get correction => _correction; | 131 String get correction => _correction; |
153 | 132 |
154 @override | 133 @override |
155 int get hashCode { | 134 int get hashCode { |
156 int hashCode = offset; | 135 int hashCode = offset; |
157 hashCode ^= (_message != null) ? _message.hashCode : 0; | 136 hashCode ^= (_message != null) ? _message.hashCode : 0; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 * Initialize a newly created analysis error. The error is associated with the | 250 * Initialize a newly created analysis error. The error is associated with the |
272 * given [source] and is located at the given [offset] with the given | 251 * given [source] and is located at the given [offset] with the given |
273 * [length]. The error will have the given [errorCode] and the list of | 252 * [length]. The error will have the given [errorCode] and the list of |
274 * [arguments] will be used to complete the message. | 253 * [arguments] will be used to complete the message. |
275 */ | 254 */ |
276 AnalysisErrorWithProperties( | 255 AnalysisErrorWithProperties( |
277 Source source, int offset, int length, ErrorCode errorCode, | 256 Source source, int offset, int length, ErrorCode errorCode, |
278 [List<Object> arguments]) | 257 [List<Object> arguments]) |
279 : super(source, offset, length, errorCode, arguments); | 258 : super(source, offset, length, errorCode, arguments); |
280 | 259 |
281 /** | |
282 * Initialize a newly created analysis error for the specified [source]. The | |
283 * error will have the given [errorCode] and the list of [arguments] will be | |
284 * used to complete the message. The error has no location information. | |
285 */ | |
286 @deprecated // Use new AnalysisErrorWithProperties(source, 0, 0, errorCode, ar
guments) | |
287 AnalysisErrorWithProperties.con1(Source source, ErrorCode errorCode, | |
288 [List<Object> arguments]) | |
289 : this(source, 0, 0, errorCode, arguments); | |
290 | |
291 /** | |
292 * Initialize a newly created analysis error for the specified [source] at the | |
293 * given [offset] with the given [length]. The error will have the given | |
294 * [errorCode] and the list of [arguments] will be used to complete the | |
295 * message. | |
296 */ | |
297 @deprecated // Use new AnalysisErrorWithProperties(source, offset, length, err
orCode, arguments) | |
298 AnalysisErrorWithProperties.con2( | |
299 Source source, int offset, int length, ErrorCode errorCode, | |
300 [List<Object> arguments]) | |
301 : this(source, offset, length, errorCode, arguments); | |
302 | |
303 @override | 260 @override |
304 Object getProperty(ErrorProperty property) => _propertyMap[property]; | 261 Object getProperty(ErrorProperty property) => _propertyMap[property]; |
305 | 262 |
306 /** | 263 /** |
307 * Set the value of the given [property] to the given [value]. Using a value | 264 * Set the value of the given [property] to the given [value]. Using a value |
308 * of `null` will effectively remove the property from this error. | 265 * of `null` will effectively remove the property from this error. |
309 */ | 266 */ |
310 void setProperty(ErrorProperty property, Object value) { | 267 void setProperty(ErrorProperty property, Object value) { |
311 _propertyMap[property] = value; | 268 _propertyMap[property] = value; |
312 } | 269 } |
(...skipping 5349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5662 * Initialize a newly created error code to have the given [name]. | 5619 * Initialize a newly created error code to have the given [name]. |
5663 */ | 5620 */ |
5664 const TodoCode(String name) : super(name, "{0}"); | 5621 const TodoCode(String name) : super(name, "{0}"); |
5665 | 5622 |
5666 @override | 5623 @override |
5667 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 5624 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
5668 | 5625 |
5669 @override | 5626 @override |
5670 ErrorType get type => ErrorType.TODO; | 5627 ErrorType get type => ErrorType.TODO; |
5671 } | 5628 } |
OLD | NEW |