Chromium Code Reviews| 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 | 297 * The error codes used for errors in analysis options files. |
| 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 */ | 298 */ |
| 302 class AnalysisOptionsErrorCode extends ErrorCode { | 299 class AnalysisOptionsErrorCode extends ErrorCode { |
| 303 /** | 300 /** |
| 304 * An error code indicating that there is a syntactic error in the file. | 301 * An error code indicating that there is a syntactic error in the file. |
| 305 * | 302 * |
| 306 * Parameters: | 303 * Parameters: |
| 307 * 0: the error message from the parse error | 304 * 0: the error message from the parse error |
| 308 */ | 305 */ |
| 309 static const AnalysisOptionsErrorCode PARSE_ERROR = | 306 static const AnalysisOptionsErrorCode PARSE_ERROR = |
| 310 const AnalysisOptionsErrorCode('PARSE_ERROR', '{0}'); | 307 const AnalysisOptionsErrorCode('PARSE_ERROR', '{0}'); |
| 311 | 308 |
| 312 /** | 309 /** |
| 313 * Initialize a newly created error code to have the given [name]. The message | 310 * Initialize a newly created error code to have the given [name]. |
|
Brian Wilkerson
2015/10/21 21:13:58
Not sure why you'd want to drop the documentation.
| |
| 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 */ | 311 */ |
| 318 const AnalysisOptionsErrorCode(String name, String message, | 312 const AnalysisOptionsErrorCode(String name, String message, |
| 319 [String correction]) | 313 [String correction]) |
| 320 : super(name, message, correction); | 314 : super(name, message, correction); |
| 321 | 315 |
| 322 @override | 316 @override |
| 323 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; | 317 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; |
| 324 | 318 |
| 325 @override | 319 @override |
| 326 ErrorType get type => ErrorType.COMPILE_TIME_ERROR; | 320 ErrorType get type => ErrorType.COMPILE_TIME_ERROR; |
| 327 } | 321 } |
| 328 | 322 |
| 329 /** | 323 /** |
| 324 * The error codes used for warnings in analysis options files. | |
| 325 */ | |
| 326 class AnalysisOptionsWarningCode extends ErrorCode { | |
| 327 /** | |
| 328 * An error code indicating that a plugin is being configured with an | |
| 329 * unsupported option. | |
| 330 * | |
| 331 * Parameters: | |
| 332 * 0: the plugin name | |
| 333 * 1: the unsupported option key | |
| 334 */ | |
| 335 static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION = | |
| 336 const AnalysisOptionsWarningCode('UNSUPPORTED_OPTION_ERROR', | |
| 337 "The option '{1}' is not supported by {0}"); | |
| 338 | |
| 339 /** | |
| 340 * Initialize a newly created warning code to have the given [name]. | |
| 341 */ | |
| 342 const AnalysisOptionsWarningCode(String name, String message, | |
| 343 [String correction]) | |
| 344 : super(name, message, correction); | |
| 345 | |
| 346 @override | |
| 347 ErrorSeverity get errorSeverity => ErrorSeverity.WARNING; | |
| 348 | |
| 349 @override | |
| 350 ErrorType get type => ErrorType.COMPILE_TIME_ERROR; | |
|
scheglov
2015/10/21 21:01:24
STATIC_WARNING?
pquitslund
2015/10/21 21:04:51
Done.
| |
| 351 } | |
| 352 | |
| 353 /** | |
| 330 * An [AnalysisErrorListener] that keeps track of whether any error has been | 354 * An [AnalysisErrorListener] that keeps track of whether any error has been |
| 331 * reported to it. | 355 * reported to it. |
| 332 */ | 356 */ |
| 333 class BooleanErrorListener implements AnalysisErrorListener { | 357 class BooleanErrorListener implements AnalysisErrorListener { |
| 334 /** | 358 /** |
| 335 * A flag indicating whether an error has been reported to this listener. | 359 * A flag indicating whether an error has been reported to this listener. |
| 336 */ | 360 */ |
| 337 bool _errorReported = false; | 361 bool _errorReported = false; |
| 338 | 362 |
| 339 /** | 363 /** |
| (...skipping 4691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5031 * Initialize a newly created error code to have the given [name]. | 5055 * Initialize a newly created error code to have the given [name]. |
| 5032 */ | 5056 */ |
| 5033 const TodoCode(String name) : super(name, "{0}"); | 5057 const TodoCode(String name) : super(name, "{0}"); |
| 5034 | 5058 |
| 5035 @override | 5059 @override |
| 5036 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 5060 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
| 5037 | 5061 |
| 5038 @override | 5062 @override |
| 5039 ErrorType get type => ErrorType.TODO; | 5063 ErrorType get type => ErrorType.TODO; |
| 5040 } | 5064 } |
| OLD | NEW |