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 'ast.dart' show AstNode; | 9 import 'ast.dart' show AstNode; |
10 import 'element.dart'; | 10 import 'element.dart'; |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 /** | 287 /** |
288 * Set the value of the given [property] to the given [value]. Using a value | 288 * Set the value of the given [property] to the given [value]. Using a value |
289 * of `null` will effectively remove the property from this error. | 289 * of `null` will effectively remove the property from this error. |
290 */ | 290 */ |
291 void setProperty(ErrorProperty property, Object value) { | 291 void setProperty(ErrorProperty property, Object value) { |
292 _propertyMap[property] = value; | 292 _propertyMap[property] = value; |
293 } | 293 } |
294 } | 294 } |
295 | 295 |
296 /** | 296 /** |
| 297 * The error codes used for errors in analysis options files. The convention for |
| 298 * this class is for the name of the error code to indicate the problem that |
| 299 * caused the error to be generated and for the error message to explain what is |
| 300 * wrong and, when appropriate, how the problem can be corrected. |
| 301 */ |
| 302 class AnalysisOptionsErrorCode extends ErrorCode { |
| 303 /** |
| 304 * An error code indicating that there is a syntactic error in the file. |
| 305 * |
| 306 * Parameters: |
| 307 * 0: the error message from the parse error |
| 308 */ |
| 309 static const AnalysisOptionsErrorCode PARSE_ERROR = |
| 310 const AnalysisOptionsErrorCode('PARSE_ERROR', '{0}'); |
| 311 |
| 312 /** |
| 313 * Initialize a newly created error code to have the given [name]. The message |
| 314 * associated with the error will be created from the given [message] |
| 315 * template. The correction associated with the error will be created from the |
| 316 * given [correction] template. |
| 317 */ |
| 318 const AnalysisOptionsErrorCode(String name, String message, |
| 319 [String correction]) |
| 320 : super(name, message, correction); |
| 321 |
| 322 @override |
| 323 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; |
| 324 |
| 325 @override |
| 326 ErrorType get type => ErrorType.COMPILE_TIME_ERROR; |
| 327 } |
| 328 |
| 329 /** |
297 * An [AnalysisErrorListener] that keeps track of whether any error has been | 330 * An [AnalysisErrorListener] that keeps track of whether any error has been |
298 * reported to it. | 331 * reported to it. |
299 */ | 332 */ |
300 class BooleanErrorListener implements AnalysisErrorListener { | 333 class BooleanErrorListener implements AnalysisErrorListener { |
301 /** | 334 /** |
302 * A flag indicating whether an error has been reported to this listener. | 335 * A flag indicating whether an error has been reported to this listener. |
303 */ | 336 */ |
304 bool _errorReported = false; | 337 bool _errorReported = false; |
305 | 338 |
306 /** | 339 /** |
(...skipping 4691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4998 * Initialize a newly created error code to have the given [name]. | 5031 * Initialize a newly created error code to have the given [name]. |
4999 */ | 5032 */ |
5000 const TodoCode(String name) : super(name, "{0}"); | 5033 const TodoCode(String name) : super(name, "{0}"); |
5001 | 5034 |
5002 @override | 5035 @override |
5003 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 5036 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
5004 | 5037 |
5005 @override | 5038 @override |
5006 ErrorType get type => ErrorType.TODO; | 5039 ErrorType get type => ErrorType.TODO; |
5007 } | 5040 } |
OLD | NEW |