| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 Map<ErrorProperty, Object> _propertyMap = new Map<ErrorProperty, Object>(); | 100 Map<ErrorProperty, Object> _propertyMap = new Map<ErrorProperty, Object>(); |
| 101 | 101 |
| 102 /** | 102 /** |
| 103 * Initialize a newly created analysis error for the specified source. The err
or has no location | 103 * Initialize a newly created analysis error for the specified source. The err
or has no location |
| 104 * information. | 104 * information. |
| 105 * | 105 * |
| 106 * @param source the source for which the exception occurred | 106 * @param source the source for which the exception occurred |
| 107 * @param errorCode the error code to be associated with this error | 107 * @param errorCode the error code to be associated with this error |
| 108 * @param arguments the arguments used to build the error message | 108 * @param arguments the arguments used to build the error message |
| 109 */ | 109 */ |
| 110 AnalysisErrorWithProperties.con1(Source source, ErrorCode errorCode, List<Obje
ct> arguments) : super.con1(source, errorCode, arguments) { | 110 AnalysisErrorWithProperties.con1(Source source, ErrorCode errorCode, List<Obje
ct> arguments) : super.con1(source, errorCode, arguments); |
| 111 _jtd_constructor_134_impl(source, errorCode, arguments); | |
| 112 } | |
| 113 _jtd_constructor_134_impl(Source source, ErrorCode errorCode, List<Object> arg
uments) { | |
| 114 } | |
| 115 | 111 |
| 116 /** | 112 /** |
| 117 * Initialize a newly created analysis error for the specified source at the g
iven location. | 113 * Initialize a newly created analysis error for the specified source at the g
iven location. |
| 118 * | 114 * |
| 119 * @param source the source for which the exception occurred | 115 * @param source the source for which the exception occurred |
| 120 * @param offset the offset of the location of the error | 116 * @param offset the offset of the location of the error |
| 121 * @param length the length of the location of the error | 117 * @param length the length of the location of the error |
| 122 * @param errorCode the error code to be associated with this error | 118 * @param errorCode the error code to be associated with this error |
| 123 * @param arguments the arguments used to build the error message | 119 * @param arguments the arguments used to build the error message |
| 124 */ | 120 */ |
| 125 AnalysisErrorWithProperties.con2(Source source, int offset, int length, ErrorC
ode errorCode, List<Object> arguments) : super.con2(source, offset, length, erro
rCode, arguments) { | 121 AnalysisErrorWithProperties.con2(Source source, int offset, int length, ErrorC
ode errorCode, List<Object> arguments) : super.con2(source, offset, length, erro
rCode, arguments); |
| 126 _jtd_constructor_135_impl(source, offset, length, errorCode, arguments); | |
| 127 } | |
| 128 _jtd_constructor_135_impl(Source source, int offset, int length, ErrorCode err
orCode, List<Object> arguments) { | |
| 129 } | |
| 130 Object getProperty(ErrorProperty property) => _propertyMap[property]; | 122 Object getProperty(ErrorProperty property) => _propertyMap[property]; |
| 131 | 123 |
| 132 /** | 124 /** |
| 133 * Set the value of the given property to the given value. Using a value of `n
ull` will | 125 * Set the value of the given property to the given value. Using a value of `n
ull` will |
| 134 * effectively remove the property from this error. | 126 * effectively remove the property from this error. |
| 135 * | 127 * |
| 136 * @param property the property whose value is to be returned | 128 * @param property the property whose value is to be returned |
| 137 * @param value the new value of the given property | 129 * @param value the new value of the given property |
| 138 */ | 130 */ |
| 139 void setProperty(ErrorProperty property, Object value) { | 131 void setProperty(ErrorProperty property, Object value) { |
| 140 _propertyMap[property] = value; | 132 _propertyMap[property] = value; |
| 141 } | 133 } |
| 142 } | 134 } |
| 143 /** | 135 /** |
| 144 * The enumeration `AuditCode` defines the audits and coding recommendations for
best | |
| 145 * practices which are not mentioned in the Dart Language Specification. | |
| 146 */ | |
| 147 class AuditCode implements Comparable<AuditCode>, ErrorCode { | |
| 148 | |
| 149 /** | |
| 150 * Dead code is code that is never reached, this can happen for instance if a
statement follows a | |
| 151 * return statement. | |
| 152 */ | |
| 153 static final AuditCode DEAD_CODE = new AuditCode('DEAD_CODE', 0, "Dead code"); | |
| 154 static final List<AuditCode> values = [DEAD_CODE]; | |
| 155 | |
| 156 /// The name of this enum constant, as declared in the enum declaration. | |
| 157 final String name; | |
| 158 | |
| 159 /// The position in the enum declaration. | |
| 160 final int ordinal; | |
| 161 | |
| 162 /** | |
| 163 * The message template used to create the message to be displayed for this er
ror. | |
| 164 */ | |
| 165 String _message; | |
| 166 | |
| 167 /** | |
| 168 * Initialize a newly created error code to have the given message. | |
| 169 * | |
| 170 * @param message the message template used to create the message to be displa
yed for the error | |
| 171 */ | |
| 172 AuditCode(this.name, this.ordinal, String message) { | |
| 173 this._message = message; | |
| 174 } | |
| 175 ErrorSeverity get errorSeverity => ErrorType.AUDIT.severity; | |
| 176 String get message => _message; | |
| 177 ErrorType get type => ErrorType.AUDIT; | |
| 178 int compareTo(AuditCode other) => ordinal - other.ordinal; | |
| 179 int get hashCode => ordinal; | |
| 180 String toString() => name; | |
| 181 } | |
| 182 /** | |
| 183 * Instances of the class `ErrorReporter` wrap an error listener with utility me
thods used to | 136 * Instances of the class `ErrorReporter` wrap an error listener with utility me
thods used to |
| 184 * create the errors being reported. | 137 * create the errors being reported. |
| 185 * | 138 * |
| 186 * @coverage dart.engine.error | 139 * @coverage dart.engine.error |
| 187 */ | 140 */ |
| 188 class ErrorReporter { | 141 class ErrorReporter { |
| 189 | 142 |
| 190 /** | 143 /** |
| 191 * The error listener to which errors will be reported. | 144 * The error listener to which errors will be reported. |
| 192 */ | 145 */ |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 int _length = 0; | 299 int _length = 0; |
| 347 | 300 |
| 348 /** | 301 /** |
| 349 * Initialize a newly created analysis error for the specified source. The err
or has no location | 302 * Initialize a newly created analysis error for the specified source. The err
or has no location |
| 350 * information. | 303 * information. |
| 351 * | 304 * |
| 352 * @param source the source for which the exception occurred | 305 * @param source the source for which the exception occurred |
| 353 * @param errorCode the error code to be associated with this error | 306 * @param errorCode the error code to be associated with this error |
| 354 * @param arguments the arguments used to build the error message | 307 * @param arguments the arguments used to build the error message |
| 355 */ | 308 */ |
| 356 AnalysisError.con1(Source source2, ErrorCode errorCode2, List<Object> argument
s) { | 309 AnalysisError.con1(Source source, ErrorCode errorCode, List<Object> arguments)
{ |
| 357 _jtd_constructor_132_impl(source2, errorCode2, arguments); | 310 this._source = source; |
| 358 } | 311 this._errorCode = errorCode; |
| 359 _jtd_constructor_132_impl(Source source2, ErrorCode errorCode2, List<Object> a
rguments) { | 312 this._message = JavaString.format(errorCode.message, arguments); |
| 360 this._source = source2; | |
| 361 this._errorCode = errorCode2; | |
| 362 this._message = JavaString.format(errorCode2.message, arguments); | |
| 363 } | 313 } |
| 364 | 314 |
| 365 /** | 315 /** |
| 366 * Initialize a newly created analysis error for the specified source at the g
iven location. | 316 * Initialize a newly created analysis error for the specified source at the g
iven location. |
| 367 * | 317 * |
| 368 * @param source the source for which the exception occurred | 318 * @param source the source for which the exception occurred |
| 369 * @param offset the offset of the location of the error | 319 * @param offset the offset of the location of the error |
| 370 * @param length the length of the location of the error | 320 * @param length the length of the location of the error |
| 371 * @param errorCode the error code to be associated with this error | 321 * @param errorCode the error code to be associated with this error |
| 372 * @param arguments the arguments used to build the error message | 322 * @param arguments the arguments used to build the error message |
| 373 */ | 323 */ |
| 374 AnalysisError.con2(Source source2, int offset2, int length2, ErrorCode errorCo
de2, List<Object> arguments) { | 324 AnalysisError.con2(Source source, int offset, int length, ErrorCode errorCode,
List<Object> arguments) { |
| 375 _jtd_constructor_133_impl(source2, offset2, length2, errorCode2, arguments); | 325 this._source = source; |
| 376 } | 326 this._offset = offset; |
| 377 _jtd_constructor_133_impl(Source source2, int offset2, int length2, ErrorCode
errorCode2, List<Object> arguments) { | 327 this._length = length; |
| 378 this._source = source2; | 328 this._errorCode = errorCode; |
| 379 this._offset = offset2; | 329 this._message = JavaString.format(errorCode.message, arguments); |
| 380 this._length = length2; | |
| 381 this._errorCode = errorCode2; | |
| 382 this._message = JavaString.format(errorCode2.message, arguments); | |
| 383 } | 330 } |
| 384 | 331 |
| 385 /** | 332 /** |
| 386 * Return the error code associated with the error. | 333 * Return the error code associated with the error. |
| 387 * | 334 * |
| 388 * @return the error code associated with the error | 335 * @return the error code associated with the error |
| 389 */ | 336 */ |
| 390 ErrorCode get errorCode => _errorCode; | 337 ErrorCode get errorCode => _errorCode; |
| 391 | 338 |
| 392 /** | 339 /** |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 * be but are not implemented by a concrete class. | 412 * be but are not implemented by a concrete class. |
| 466 */ | 413 */ |
| 467 static final ErrorProperty UNIMPLEMENTED_METHODS = new ErrorProperty('UNIMPLEM
ENTED_METHODS', 0); | 414 static final ErrorProperty UNIMPLEMENTED_METHODS = new ErrorProperty('UNIMPLEM
ENTED_METHODS', 0); |
| 468 static final List<ErrorProperty> values = [UNIMPLEMENTED_METHODS]; | 415 static final List<ErrorProperty> values = [UNIMPLEMENTED_METHODS]; |
| 469 | 416 |
| 470 /// The name of this enum constant, as declared in the enum declaration. | 417 /// The name of this enum constant, as declared in the enum declaration. |
| 471 final String name; | 418 final String name; |
| 472 | 419 |
| 473 /// The position in the enum declaration. | 420 /// The position in the enum declaration. |
| 474 final int ordinal; | 421 final int ordinal; |
| 475 ErrorProperty(this.name, this.ordinal) { | 422 ErrorProperty(this.name, this.ordinal); |
| 423 int compareTo(ErrorProperty other) => ordinal - other.ordinal; |
| 424 int get hashCode => ordinal; |
| 425 String toString() => name; |
| 426 } |
| 427 /** |
| 428 * The enumeration `HintCode` defines the hints and coding recommendations for b
est practices |
| 429 * which are not mentioned in the Dart Language Specification. |
| 430 */ |
| 431 class HintCode implements Comparable<HintCode>, ErrorCode { |
| 432 |
| 433 /** |
| 434 * Dead code is code that is never reached, this can happen for instance if a
statement follows a |
| 435 * return statement. |
| 436 */ |
| 437 static final HintCode DEAD_CODE = new HintCode('DEAD_CODE', 0, "Dead code"); |
| 438 |
| 439 /** |
| 440 * Dead code is code that is never reached. This case covers cases where the u
ser has catch |
| 441 * clauses after `catch (e)` or `on Object catch (e)`. |
| 442 */ |
| 443 static final HintCode DEAD_CODE_CATCH_FOLLOWING_CATCH = new HintCode('DEAD_COD
E_CATCH_FOLLOWING_CATCH', 1, "Dead code, catch clauses after a 'catch (e)' or an
'on Object catch (e)' are never reached"); |
| 444 |
| 445 /** |
| 446 * Dead code is code that is never reached. This case covers cases where the u
ser has an on-catch |
| 447 * clause such as `on A catch (e)`, where a supertype of `A` was already caugh
t. |
| 448 * |
| 449 * @param subtypeName name of the subtype |
| 450 * @param supertypeName name of the supertype |
| 451 */ |
| 452 static final HintCode DEAD_CODE_ON_CATCH_SUBTYPE = new HintCode('DEAD_CODE_ON_
CATCH_SUBTYPE', 2, "Dead code, this on-catch block will never be executed since
'%s' is a subtype of '%s'"); |
| 453 static final List<HintCode> values = [DEAD_CODE, DEAD_CODE_CATCH_FOLLOWING_CAT
CH, DEAD_CODE_ON_CATCH_SUBTYPE]; |
| 454 |
| 455 /// The name of this enum constant, as declared in the enum declaration. |
| 456 final String name; |
| 457 |
| 458 /// The position in the enum declaration. |
| 459 final int ordinal; |
| 460 |
| 461 /** |
| 462 * The message template used to create the message to be displayed for this er
ror. |
| 463 */ |
| 464 String _message; |
| 465 |
| 466 /** |
| 467 * Initialize a newly created error code to have the given message. |
| 468 * |
| 469 * @param message the message template used to create the message to be displa
yed for the error |
| 470 */ |
| 471 HintCode(this.name, this.ordinal, String message) { |
| 472 this._message = message; |
| 476 } | 473 } |
| 477 int compareTo(ErrorProperty other) => ordinal - other.ordinal; | 474 ErrorSeverity get errorSeverity => ErrorType.HINT.severity; |
| 475 String get message => _message; |
| 476 ErrorType get type => ErrorType.HINT; |
| 477 int compareTo(HintCode other) => ordinal - other.ordinal; |
| 478 int get hashCode => ordinal; | 478 int get hashCode => ordinal; |
| 479 String toString() => name; | 479 String toString() => name; |
| 480 } | 480 } |
| 481 /** | 481 /** |
| 482 * The interface `ErrorCode` defines the behavior common to objects representing
error codes | 482 * The interface `ErrorCode` defines the behavior common to objects representing
error codes |
| 483 * associated with [AnalysisError]. | 483 * associated with [AnalysisError]. |
| 484 * | 484 * |
| 485 * @coverage dart.engine.error | 485 * @coverage dart.engine.error |
| 486 */ | 486 */ |
| 487 abstract class ErrorCode { | 487 abstract class ErrorCode { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 508 ErrorType get type; | 508 ErrorType get type; |
| 509 } | 509 } |
| 510 /** | 510 /** |
| 511 * Instances of the enumeration `ErrorType` represent the type of an [ErrorCode]
. | 511 * Instances of the enumeration `ErrorType` represent the type of an [ErrorCode]
. |
| 512 * | 512 * |
| 513 * @coverage dart.engine.error | 513 * @coverage dart.engine.error |
| 514 */ | 514 */ |
| 515 class ErrorType implements Comparable<ErrorType> { | 515 class ErrorType implements Comparable<ErrorType> { |
| 516 | 516 |
| 517 /** | 517 /** |
| 518 * Extra audits run over the code to follow best practices, which are not in t
he Dart Language | 518 * Extra analysis run over the code to follow best practices, which are not in
the Dart Language |
| 519 * Specification. | 519 * Specification. |
| 520 */ | 520 */ |
| 521 static final ErrorType AUDIT = new ErrorType('AUDIT', 0, ErrorSeverity.SUGGEST
ION); | 521 static final ErrorType HINT = new ErrorType('HINT', 0, ErrorSeverity.SUGGESTIO
N); |
| 522 | 522 |
| 523 /** | 523 /** |
| 524 * Compile-time errors are errors that preclude execution. A compile time erro
r must be reported | 524 * Compile-time errors are errors that preclude execution. A compile time erro
r must be reported |
| 525 * by a Dart compiler before the erroneous code is executed. | 525 * by a Dart compiler before the erroneous code is executed. |
| 526 */ | 526 */ |
| 527 static final ErrorType COMPILE_TIME_ERROR = new ErrorType('COMPILE_TIME_ERROR'
, 1, ErrorSeverity.ERROR); | 527 static final ErrorType COMPILE_TIME_ERROR = new ErrorType('COMPILE_TIME_ERROR'
, 1, ErrorSeverity.ERROR); |
| 528 | 528 |
| 529 /** | 529 /** |
| 530 * Suggestions made in situations where the user has deviated from recommended
pub programming | 530 * Suggestions made in situations where the user has deviated from recommended
pub programming |
| 531 * practices. | 531 * practices. |
| 532 */ | 532 */ |
| 533 static final ErrorType PUB_SUGGESTION = new ErrorType('PUB_SUGGESTION', 2, Err
orSeverity.SUGGESTION); | 533 static final ErrorType PUB_SUGGESTION = new ErrorType('PUB_SUGGESTION', 2, Err
orSeverity.SUGGESTION); |
| 534 | 534 |
| 535 /** | 535 /** |
| 536 * Static warnings are those warnings reported by the static checker. They hav
e no effect on | 536 * Static warnings are those warnings reported by the static checker. They hav
e no effect on |
| 537 * execution. Static warnings must be provided by Dart compilers used during d
evelopment. | 537 * execution. Static warnings must be provided by Dart compilers used during d
evelopment. |
| 538 */ | 538 */ |
| 539 static final ErrorType STATIC_WARNING = new ErrorType('STATIC_WARNING', 3, Err
orSeverity.WARNING); | 539 static final ErrorType STATIC_WARNING = new ErrorType('STATIC_WARNING', 3, Err
orSeverity.WARNING); |
| 540 | 540 |
| 541 /** | 541 /** |
| 542 * Many, but not all, static warnings relate to types, in which case they are
known as static type | 542 * Many, but not all, static warnings relate to types, in which case they are
known as static type |
| 543 * warnings. | 543 * warnings. |
| 544 */ | 544 */ |
| 545 static final ErrorType STATIC_TYPE_WARNING = new ErrorType('STATIC_TYPE_WARNIN
G', 4, ErrorSeverity.WARNING); | 545 static final ErrorType STATIC_TYPE_WARNING = new ErrorType('STATIC_TYPE_WARNIN
G', 4, ErrorSeverity.WARNING); |
| 546 | 546 |
| 547 /** | 547 /** |
| 548 * Syntactic errors are errors produced as a result of input that does not con
form to the grammar. | 548 * Syntactic errors are errors produced as a result of input that does not con
form to the grammar. |
| 549 */ | 549 */ |
| 550 static final ErrorType SYNTACTIC_ERROR = new ErrorType('SYNTACTIC_ERROR', 5, E
rrorSeverity.ERROR); | 550 static final ErrorType SYNTACTIC_ERROR = new ErrorType('SYNTACTIC_ERROR', 5, E
rrorSeverity.ERROR); |
| 551 static final List<ErrorType> values = [AUDIT, COMPILE_TIME_ERROR, PUB_SUGGESTI
ON, STATIC_WARNING, STATIC_TYPE_WARNING, SYNTACTIC_ERROR]; | 551 static final List<ErrorType> values = [HINT, COMPILE_TIME_ERROR, PUB_SUGGESTIO
N, STATIC_WARNING, STATIC_TYPE_WARNING, SYNTACTIC_ERROR]; |
| 552 | 552 |
| 553 /// The name of this enum constant, as declared in the enum declaration. | 553 /// The name of this enum constant, as declared in the enum declaration. |
| 554 final String name; | 554 final String name; |
| 555 | 555 |
| 556 /// The position in the enum declaration. | 556 /// The position in the enum declaration. |
| 557 final int ordinal; | 557 final int ordinal; |
| 558 | 558 |
| 559 /** | 559 /** |
| 560 * The severity of this type of error. | 560 * The severity of this type of error. |
| 561 */ | 561 */ |
| (...skipping 2238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2800 StaticTypeWarningCode(this.name, this.ordinal, String message) { | 2800 StaticTypeWarningCode(this.name, this.ordinal, String message) { |
| 2801 this._message = message; | 2801 this._message = message; |
| 2802 } | 2802 } |
| 2803 ErrorSeverity get errorSeverity => ErrorType.STATIC_TYPE_WARNING.severity; | 2803 ErrorSeverity get errorSeverity => ErrorType.STATIC_TYPE_WARNING.severity; |
| 2804 String get message => _message; | 2804 String get message => _message; |
| 2805 ErrorType get type => ErrorType.STATIC_TYPE_WARNING; | 2805 ErrorType get type => ErrorType.STATIC_TYPE_WARNING; |
| 2806 int compareTo(StaticTypeWarningCode other) => ordinal - other.ordinal; | 2806 int compareTo(StaticTypeWarningCode other) => ordinal - other.ordinal; |
| 2807 int get hashCode => ordinal; | 2807 int get hashCode => ordinal; |
| 2808 String toString() => name; | 2808 String toString() => name; |
| 2809 } | 2809 } |
| OLD | NEW |