| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 library engine.error; | 3 library engine.error; |
| 4 import 'java_core.dart'; | 4 import 'java_core.dart'; |
| 5 import 'source.dart'; | 5 import 'source.dart'; |
| 6 import 'ast.dart' show ASTNode; | 6 import 'ast.dart' show ASTNode; |
| 7 import 'scanner.dart' show Token; | 7 import 'scanner.dart' show Token; |
| 8 /** | 8 /** |
| 9 * Instances of the enumeration `ErrorSeverity` represent the severity of an [Er
rorCode] | 9 * Instances of the enumeration `ErrorSeverity` represent the severity of an [Er
rorCode] |
| 10 * . | 10 * . |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * The severity representing an error. | 35 * The severity representing an error. |
| 36 */ | 36 */ |
| 37 static final ErrorSeverity ERROR = new ErrorSeverity('ERROR', 3, "E", "error")
; | 37 static final ErrorSeverity ERROR = new ErrorSeverity('ERROR', 3, "E", "error")
; |
| 38 static final List<ErrorSeverity> values = [NONE, SUGGESTION, WARNING, ERROR]; | 38 static final List<ErrorSeverity> values = [NONE, SUGGESTION, WARNING, ERROR]; |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * The name of the severity used when producing machine output. | 41 * The name of the severity used when producing machine output. |
| 42 */ | 42 */ |
| 43 String _machineCode; | 43 String machineCode; |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * The name of the severity used when producing readable output. | 46 * The name of the severity used when producing readable output. |
| 47 */ | 47 */ |
| 48 String _displayName; | 48 String displayName; |
| 49 | 49 |
| 50 /** | 50 /** |
| 51 * Initialize a newly created severity with the given names. | 51 * Initialize a newly created severity with the given names. |
| 52 * | 52 * |
| 53 * @param machineCode the name of the severity used when producing machine out
put | 53 * @param machineCode the name of the severity used when producing machine out
put |
| 54 * @param displayName the name of the severity used when producing readable ou
tput | 54 * @param displayName the name of the severity used when producing readable ou
tput |
| 55 */ | 55 */ |
| 56 ErrorSeverity(String name, int ordinal, String machineCode, String displayName
) : super(name, ordinal) { | 56 ErrorSeverity(String name, int ordinal, String machineCode, String displayName
) : super(name, ordinal) { |
| 57 this._machineCode = machineCode; | 57 this.machineCode = machineCode; |
| 58 this._displayName = displayName; | 58 this.displayName = displayName; |
| 59 } | 59 } |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * Return the name of the severity used when producing readable output. | |
| 63 * | |
| 64 * @return the name of the severity used when producing readable output | |
| 65 */ | |
| 66 String get displayName => _displayName; | |
| 67 | |
| 68 /** | |
| 69 * Return the name of the severity used when producing machine output. | |
| 70 * | |
| 71 * @return the name of the severity used when producing machine output | |
| 72 */ | |
| 73 String get machineCode => _machineCode; | |
| 74 | |
| 75 /** | |
| 76 * Return the severity constant that represents the greatest severity. | 62 * Return the severity constant that represents the greatest severity. |
| 77 * | 63 * |
| 78 * @param severity the severity being compared against | 64 * @param severity the severity being compared against |
| 79 * @return the most sever of this or the given severity | 65 * @return the most sever of this or the given severity |
| 80 */ | 66 */ |
| 81 ErrorSeverity max(ErrorSeverity severity) => this.ordinal >= severity.ordinal
? this : severity; | 67 ErrorSeverity max(ErrorSeverity severity) => this.ordinal >= severity.ordinal
? this : severity; |
| 82 } | 68 } |
| 83 /** | 69 /** |
| 84 * Instances of the class `AnalysisErrorWithProperties` | 70 * Instances of the class `AnalysisErrorWithProperties` |
| 85 */ | 71 */ |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 if (errorSeverity1 == errorSeverity2) { | 245 if (errorSeverity1 == errorSeverity2) { |
| 260 return errorType1.compareTo(errorType2); | 246 return errorType1.compareTo(errorType2); |
| 261 } else { | 247 } else { |
| 262 return errorSeverity2.compareTo(errorSeverity1); | 248 return errorSeverity2.compareTo(errorSeverity1); |
| 263 } | 249 } |
| 264 }; | 250 }; |
| 265 | 251 |
| 266 /** | 252 /** |
| 267 * The error code associated with the error. | 253 * The error code associated with the error. |
| 268 */ | 254 */ |
| 269 ErrorCode _errorCode; | 255 ErrorCode errorCode; |
| 270 | 256 |
| 271 /** | 257 /** |
| 272 * The localized error message. | 258 * The localized error message. |
| 273 */ | 259 */ |
| 274 String _message; | 260 String message; |
| 275 | 261 |
| 276 /** | 262 /** |
| 277 * The correction to be displayed for this error, or `null` if there is no cor
rection | 263 * The correction to be displayed for this error, or `null` if there is no cor
rection |
| 278 * information for this error. | 264 * information for this error. |
| 279 */ | 265 */ |
| 280 String _correction; | 266 String correction; |
| 281 | 267 |
| 282 /** | 268 /** |
| 283 * The source in which the error occurred, or `null` if unknown. | 269 * The source in which the error occurred, or `null` if unknown. |
| 284 */ | 270 */ |
| 285 Source _source; | 271 Source source; |
| 286 | 272 |
| 287 /** | 273 /** |
| 288 * The character offset from the beginning of the source (zero based) where th
e error occurred. | 274 * The character offset from the beginning of the source (zero based) where th
e error occurred. |
| 289 */ | 275 */ |
| 290 int _offset = 0; | 276 int offset = 0; |
| 291 | 277 |
| 292 /** | 278 /** |
| 293 * The number of characters from the offset to the end of the source which enc
ompasses the | 279 * The number of characters from the offset to the end of the source which enc
ompasses the |
| 294 * compilation error. | 280 * compilation error. |
| 295 */ | 281 */ |
| 296 int _length = 0; | 282 int length = 0; |
| 297 | 283 |
| 298 /** | 284 /** |
| 299 * A flag indicating whether this error can be shown to be a non-issue because
of the result of | 285 * A flag indicating whether this error can be shown to be a non-issue because
of the result of |
| 300 * type propagation. | 286 * type propagation. |
| 301 */ | 287 */ |
| 302 bool _isStaticOnly2 = false; | 288 bool isStaticOnly = false; |
| 303 | 289 |
| 304 /** | 290 /** |
| 305 * Initialize a newly created analysis error for the specified source. The err
or has no location | 291 * Initialize a newly created analysis error for the specified source. The err
or has no location |
| 306 * information. | 292 * information. |
| 307 * | 293 * |
| 308 * @param source the source for which the exception occurred | 294 * @param source the source for which the exception occurred |
| 309 * @param errorCode the error code to be associated with this error | 295 * @param errorCode the error code to be associated with this error |
| 310 * @param arguments the arguments used to build the error message | 296 * @param arguments the arguments used to build the error message |
| 311 */ | 297 */ |
| 312 AnalysisError.con1(Source source, ErrorCode errorCode, List<Object> arguments)
{ | 298 AnalysisError.con1(Source source, ErrorCode errorCode, List<Object> arguments)
{ |
| 313 this._source = source; | 299 this.source = source; |
| 314 this._errorCode = errorCode; | 300 this.errorCode = errorCode; |
| 315 this._message = JavaString.format(errorCode.message, arguments); | 301 this.message = JavaString.format(errorCode.message, arguments); |
| 316 } | 302 } |
| 317 | 303 |
| 318 /** | 304 /** |
| 319 * Initialize a newly created analysis error for the specified source at the g
iven location. | 305 * Initialize a newly created analysis error for the specified source at the g
iven location. |
| 320 * | 306 * |
| 321 * @param source the source for which the exception occurred | 307 * @param source the source for which the exception occurred |
| 322 * @param offset the offset of the location of the error | 308 * @param offset the offset of the location of the error |
| 323 * @param length the length of the location of the error | 309 * @param length the length of the location of the error |
| 324 * @param errorCode the error code to be associated with this error | 310 * @param errorCode the error code to be associated with this error |
| 325 * @param arguments the arguments used to build the error message | 311 * @param arguments the arguments used to build the error message |
| 326 */ | 312 */ |
| 327 AnalysisError.con2(Source source, int offset, int length, ErrorCode errorCode,
List<Object> arguments) { | 313 AnalysisError.con2(Source source, int offset, int length, ErrorCode errorCode,
List<Object> arguments) { |
| 328 this._source = source; | 314 this.source = source; |
| 329 this._offset = offset; | 315 this.offset = offset; |
| 330 this._length = length; | 316 this.length = length; |
| 331 this._errorCode = errorCode; | 317 this.errorCode = errorCode; |
| 332 this._message = JavaString.format(errorCode.message, arguments); | 318 this.message = JavaString.format(errorCode.message, arguments); |
| 333 String correctionTemplate = errorCode.correction; | 319 String correctionTemplate = errorCode.correction; |
| 334 if (correctionTemplate != null) { | 320 if (correctionTemplate != null) { |
| 335 this._correction = JavaString.format(correctionTemplate, arguments); | 321 this.correction = JavaString.format(correctionTemplate, arguments); |
| 336 } | 322 } |
| 337 } | 323 } |
| 338 | 324 |
| 339 /** | 325 /** |
| 340 * Return the correction to be displayed for this error, or `null` if there is
no correction | |
| 341 * information for this error. The correction should indicate how the user can
fix the error. | |
| 342 * | |
| 343 * @return the template used to create the correction to be displayed for this
error | |
| 344 */ | |
| 345 String get correction => _correction; | |
| 346 | |
| 347 /** | |
| 348 * Return the error code associated with the error. | |
| 349 * | |
| 350 * @return the error code associated with the error | |
| 351 */ | |
| 352 ErrorCode get errorCode => _errorCode; | |
| 353 | |
| 354 /** | |
| 355 * Return the number of characters from the offset to the end of the source wh
ich encompasses the | |
| 356 * compilation error. | |
| 357 * | |
| 358 * @return the length of the error location | |
| 359 */ | |
| 360 int get length => _length; | |
| 361 | |
| 362 /** | |
| 363 * Return the message to be displayed for this error. The message should indic
ate what is wrong | |
| 364 * and why it is wrong. | |
| 365 * | |
| 366 * @return the message to be displayed for this error | |
| 367 */ | |
| 368 String get message => _message; | |
| 369 | |
| 370 /** | |
| 371 * Return the character offset from the beginning of the source (zero based) w
here the error | |
| 372 * occurred. | |
| 373 * | |
| 374 * @return the offset to the start of the error location | |
| 375 */ | |
| 376 int get offset => _offset; | |
| 377 | |
| 378 /** | |
| 379 * Return the value of the given property, or `null` if the given property is
not defined | 326 * Return the value of the given property, or `null` if the given property is
not defined |
| 380 * for this error. | 327 * for this error. |
| 381 * | 328 * |
| 382 * @param property the property whose value is to be returned | 329 * @param property the property whose value is to be returned |
| 383 * @return the value of the given property | 330 * @return the value of the given property |
| 384 */ | 331 */ |
| 385 Object getProperty(ErrorProperty property) => null; | 332 Object getProperty(ErrorProperty property) => null; |
| 386 | |
| 387 /** | |
| 388 * Return the source in which the error occurred, or `null` if unknown. | |
| 389 * | |
| 390 * @return the source in which the error occurred | |
| 391 */ | |
| 392 Source get source => _source; | |
| 393 int get hashCode { | 333 int get hashCode { |
| 394 int hashCode = _offset; | 334 int hashCode = offset; |
| 395 hashCode ^= (_message != null) ? _message.hashCode : 0; | 335 hashCode ^= (message != null) ? message.hashCode : 0; |
| 396 hashCode ^= (_source != null) ? _source.hashCode : 0; | 336 hashCode ^= (source != null) ? source.hashCode : 0; |
| 397 return hashCode; | 337 return hashCode; |
| 398 } | 338 } |
| 399 | |
| 400 /** | |
| 401 * Return `true` if this error can be shown to be a non-issue because of the r
esult of type | |
| 402 * propagation. | |
| 403 * | |
| 404 * @return `true` if this error can be shown to be a non-issue | |
| 405 */ | |
| 406 bool get isStaticOnly => _isStaticOnly2; | |
| 407 | |
| 408 /** | |
| 409 * Set whether this error can be shown to be a non-issue because of the result
of type propagation | |
| 410 * to the given value. | |
| 411 * | |
| 412 * @param isStaticOnly `true` if this error can be shown to be a non-issue | |
| 413 */ | |
| 414 void set isStaticOnly(bool isStaticOnly2) { | |
| 415 this._isStaticOnly2 = isStaticOnly2; | |
| 416 } | |
| 417 | |
| 418 /** | |
| 419 * Set the source in which the error occurred to the given source. | |
| 420 * | |
| 421 * @param source the source in which the error occurred | |
| 422 */ | |
| 423 void set source(Source source2) { | |
| 424 this._source = source2; | |
| 425 } | |
| 426 String toString() { | 339 String toString() { |
| 427 JavaStringBuilder builder = new JavaStringBuilder(); | 340 JavaStringBuilder builder = new JavaStringBuilder(); |
| 428 builder.append((_source != null) ? _source.fullName : "<unknown source>"); | 341 builder.append((source != null) ? source.fullName : "<unknown source>"); |
| 429 builder.append("("); | 342 builder.append("("); |
| 430 builder.append(_offset); | 343 builder.append(offset); |
| 431 builder.append(".."); | 344 builder.append(".."); |
| 432 builder.append(_offset + _length - 1); | 345 builder.append(offset + length - 1); |
| 433 builder.append("): "); | 346 builder.append("): "); |
| 434 builder.append(_message); | 347 builder.append(message); |
| 435 return builder.toString(); | 348 return builder.toString(); |
| 436 } | 349 } |
| 437 } | 350 } |
| 438 /** | 351 /** |
| 439 * The enumeration `ErrorProperty` defines the properties that can be associated
with an | 352 * The enumeration `ErrorProperty` defines the properties that can be associated
with an |
| 440 * [AnalysisError]. | 353 * [AnalysisError]. |
| 441 */ | 354 */ |
| 442 class ErrorProperty extends Enum<ErrorProperty> { | 355 class ErrorProperty extends Enum<ErrorProperty> { |
| 443 | 356 |
| 444 /** | 357 /** |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 HINT, | 522 HINT, |
| 610 COMPILE_TIME_ERROR, | 523 COMPILE_TIME_ERROR, |
| 611 PUB_SUGGESTION, | 524 PUB_SUGGESTION, |
| 612 STATIC_WARNING, | 525 STATIC_WARNING, |
| 613 STATIC_TYPE_WARNING, | 526 STATIC_TYPE_WARNING, |
| 614 SYNTACTIC_ERROR]; | 527 SYNTACTIC_ERROR]; |
| 615 | 528 |
| 616 /** | 529 /** |
| 617 * The severity of this type of error. | 530 * The severity of this type of error. |
| 618 */ | 531 */ |
| 619 ErrorSeverity _severity; | 532 ErrorSeverity severity; |
| 620 | 533 |
| 621 /** | 534 /** |
| 622 * Initialize a newly created error type to have the given severity. | 535 * Initialize a newly created error type to have the given severity. |
| 623 * | 536 * |
| 624 * @param severity the severity of this type of error | 537 * @param severity the severity of this type of error |
| 625 */ | 538 */ |
| 626 ErrorType(String name, int ordinal, ErrorSeverity severity) : super(name, ordi
nal) { | 539 ErrorType(String name, int ordinal, ErrorSeverity severity) : super(name, ordi
nal) { |
| 627 this._severity = severity; | 540 this.severity = severity; |
| 628 } | 541 } |
| 629 | |
| 630 /** | |
| 631 * Return the severity of this type of error. | |
| 632 * | |
| 633 * @return the severity of this type of error | |
| 634 */ | |
| 635 ErrorSeverity get severity => _severity; | |
| 636 } | 542 } |
| 637 /** | 543 /** |
| 638 * The enumeration `CompileTimeErrorCode` defines the error codes used for compi
le time | 544 * The enumeration `CompileTimeErrorCode` defines the error codes used for compi
le time |
| 639 * errors. The convention for this class is for the name of the error code to in
dicate the problem | 545 * errors. The convention for this class is for the name of the error code to in
dicate the problem |
| 640 * that caused the error to be generated and for the error message to explain wh
at is wrong and, | 546 * that caused the error to be generated and for the error message to explain wh
at is wrong and, |
| 641 * when appropriate, how the problem can be corrected. | 547 * when appropriate, how the problem can be corrected. |
| 642 * | 548 * |
| 643 * @coverage dart.engine.error | 549 * @coverage dart.engine.error |
| 644 */ | 550 */ |
| 645 class CompileTimeErrorCode extends Enum<CompileTimeErrorCode> implements ErrorCo
de { | 551 class CompileTimeErrorCode extends Enum<CompileTimeErrorCode> implements ErrorCo
de { |
| (...skipping 2627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3273 */ | 3179 */ |
| 3274 StaticTypeWarningCode.con2(String name, int ordinal, String message, String co
rrection) : super(name, ordinal) { | 3180 StaticTypeWarningCode.con2(String name, int ordinal, String message, String co
rrection) : super(name, ordinal) { |
| 3275 this._message = message; | 3181 this._message = message; |
| 3276 this.correction6 = correction; | 3182 this.correction6 = correction; |
| 3277 } | 3183 } |
| 3278 String get correction => correction6; | 3184 String get correction => correction6; |
| 3279 ErrorSeverity get errorSeverity => ErrorType.STATIC_TYPE_WARNING.severity; | 3185 ErrorSeverity get errorSeverity => ErrorType.STATIC_TYPE_WARNING.severity; |
| 3280 String get message => _message; | 3186 String get message => _message; |
| 3281 ErrorType get type => ErrorType.STATIC_TYPE_WARNING; | 3187 ErrorType get type => ErrorType.STATIC_TYPE_WARNING; |
| 3282 } | 3188 } |
| OLD | NEW |