OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library analyzer.error.error; |
| 6 |
| 7 import 'dart:collection'; |
| 8 |
| 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/error/listener.dart'; |
| 11 import 'package:analyzer/src/dart/scanner/scanner.dart' show ScannerErrorCode; |
| 12 import 'package:analyzer/src/error/codes.dart'; |
| 13 import 'package:analyzer/src/generated/java_core.dart'; |
| 14 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; |
| 15 import 'package:analyzer/src/generated/source.dart'; |
| 16 |
| 17 /** |
| 18 * An error discovered during the analysis of some Dart code. |
| 19 * |
| 20 * See [AnalysisErrorListener]. |
| 21 */ |
| 22 class AnalysisError { |
| 23 /** |
| 24 * An empty array of errors used when no errors are expected. |
| 25 */ |
| 26 static const List<AnalysisError> NO_ERRORS = const <AnalysisError>[]; |
| 27 |
| 28 /** |
| 29 * A [Comparator] that sorts by the name of the file that the [AnalysisError] |
| 30 * was found. |
| 31 */ |
| 32 static Comparator<AnalysisError> FILE_COMPARATOR = |
| 33 (AnalysisError o1, AnalysisError o2) => |
| 34 o1.source.shortName.compareTo(o2.source.shortName); |
| 35 |
| 36 /** |
| 37 * A [Comparator] that sorts error codes first by their severity (errors |
| 38 * first, warnings second), and then by the error code type. |
| 39 */ |
| 40 static Comparator<AnalysisError> ERROR_CODE_COMPARATOR = |
| 41 (AnalysisError o1, AnalysisError o2) { |
| 42 ErrorCode errorCode1 = o1.errorCode; |
| 43 ErrorCode errorCode2 = o2.errorCode; |
| 44 ErrorSeverity errorSeverity1 = errorCode1.errorSeverity; |
| 45 ErrorSeverity errorSeverity2 = errorCode2.errorSeverity; |
| 46 if (errorSeverity1 == errorSeverity2) { |
| 47 ErrorType errorType1 = errorCode1.type; |
| 48 ErrorType errorType2 = errorCode2.type; |
| 49 return errorType1.compareTo(errorType2); |
| 50 } else { |
| 51 return errorSeverity2.compareTo(errorSeverity1); |
| 52 } |
| 53 }; |
| 54 |
| 55 /** |
| 56 * The error code associated with the error. |
| 57 */ |
| 58 final ErrorCode errorCode; |
| 59 |
| 60 /** |
| 61 * The localized error message. |
| 62 */ |
| 63 String _message; |
| 64 |
| 65 /** |
| 66 * The correction to be displayed for this error, or `null` if there is no |
| 67 * correction information for this error. |
| 68 */ |
| 69 String _correction; |
| 70 |
| 71 /** |
| 72 * The source in which the error occurred, or `null` if unknown. |
| 73 */ |
| 74 final Source source; |
| 75 |
| 76 /** |
| 77 * The character offset from the beginning of the source (zero based) where |
| 78 * the error occurred. |
| 79 */ |
| 80 int offset = 0; |
| 81 |
| 82 /** |
| 83 * The number of characters from the offset to the end of the source which |
| 84 * encompasses the compilation error. |
| 85 */ |
| 86 int length = 0; |
| 87 |
| 88 /** |
| 89 * A flag indicating whether this error can be shown to be a non-issue because |
| 90 * of the result of type propagation. |
| 91 */ |
| 92 bool isStaticOnly = false; |
| 93 |
| 94 /** |
| 95 * Initialize a newly created analysis error. The error is associated with the |
| 96 * given [source] and is located at the given [offset] with the given |
| 97 * [length]. The error will have the given [errorCode] and the list of |
| 98 * [arguments] will be used to complete the message. |
| 99 */ |
| 100 AnalysisError(this.source, this.offset, this.length, this.errorCode, |
| 101 [List<Object> arguments]) { |
| 102 this._message = formatList(errorCode.message, arguments); |
| 103 String correctionTemplate = errorCode.correction; |
| 104 if (correctionTemplate != null) { |
| 105 this._correction = formatList(correctionTemplate, arguments); |
| 106 } |
| 107 } |
| 108 |
| 109 /** |
| 110 * Initialize a newly created analysis error with given values. |
| 111 */ |
| 112 AnalysisError.forValues(this.source, this.offset, this.length, this.errorCode, |
| 113 this._message, this._correction); |
| 114 |
| 115 /** |
| 116 * Return the template used to create the correction to be displayed for this |
| 117 * error, or `null` if there is no correction information for this error. The |
| 118 * correction should indicate how the user can fix the error. |
| 119 */ |
| 120 String get correction => _correction; |
| 121 |
| 122 @override |
| 123 int get hashCode { |
| 124 int hashCode = offset; |
| 125 hashCode ^= (_message != null) ? _message.hashCode : 0; |
| 126 hashCode ^= (source != null) ? source.hashCode : 0; |
| 127 return hashCode; |
| 128 } |
| 129 |
| 130 /** |
| 131 * Return the message to be displayed for this error. The message should |
| 132 * indicate what is wrong and why it is wrong. |
| 133 */ |
| 134 String get message => _message; |
| 135 |
| 136 @override |
| 137 bool operator ==(Object other) { |
| 138 if (identical(other, this)) { |
| 139 return true; |
| 140 } |
| 141 // prepare other AnalysisError |
| 142 if (other is AnalysisError) { |
| 143 // Quick checks. |
| 144 if (!identical(errorCode, other.errorCode)) { |
| 145 return false; |
| 146 } |
| 147 if (offset != other.offset || length != other.length) { |
| 148 return false; |
| 149 } |
| 150 if (isStaticOnly != other.isStaticOnly) { |
| 151 return false; |
| 152 } |
| 153 // Deep checks. |
| 154 if (_message != other._message) { |
| 155 return false; |
| 156 } |
| 157 if (source != other.source) { |
| 158 return false; |
| 159 } |
| 160 // OK |
| 161 return true; |
| 162 } |
| 163 return false; |
| 164 } |
| 165 |
| 166 /** |
| 167 * Return the value of the given [property], or `null` if the given property |
| 168 * is not defined for this error. |
| 169 */ |
| 170 Object/*=V*/ getProperty/*<V>*/(ErrorProperty/*<V>*/ property) => null; |
| 171 |
| 172 @override |
| 173 String toString() { |
| 174 StringBuffer buffer = new StringBuffer(); |
| 175 buffer.write((source != null) ? source.fullName : "<unknown source>"); |
| 176 buffer.write("("); |
| 177 buffer.write(offset); |
| 178 buffer.write(".."); |
| 179 buffer.write(offset + length - 1); |
| 180 buffer.write("): "); |
| 181 //buffer.write("(" + lineNumber + ":" + columnNumber + "): "); |
| 182 buffer.write(_message); |
| 183 return buffer.toString(); |
| 184 } |
| 185 |
| 186 /** |
| 187 * Merge all of the errors in the lists in the given list of [errorLists] into |
| 188 * a single list of errors. |
| 189 */ |
| 190 static List<AnalysisError> mergeLists(List<List<AnalysisError>> errorLists) { |
| 191 Set<AnalysisError> errors = new HashSet<AnalysisError>(); |
| 192 for (List<AnalysisError> errorList in errorLists) { |
| 193 errors.addAll(errorList); |
| 194 } |
| 195 return errors.toList(); |
| 196 } |
| 197 } |
| 198 |
| 199 /** |
| 200 * An [AnalysisError] that can have arbitrary properties associated with it. |
| 201 */ |
| 202 class AnalysisErrorWithProperties extends AnalysisError { |
| 203 /** |
| 204 * The properties associated with this error. |
| 205 */ |
| 206 HashMap<ErrorProperty, Object> _propertyMap = |
| 207 new HashMap<ErrorProperty, Object>(); |
| 208 |
| 209 /** |
| 210 * Initialize a newly created analysis error. The error is associated with the |
| 211 * given [source] and is located at the given [offset] with the given |
| 212 * [length]. The error will have the given [errorCode] and the list of |
| 213 * [arguments] will be used to complete the message. |
| 214 */ |
| 215 AnalysisErrorWithProperties( |
| 216 Source source, int offset, int length, ErrorCode errorCode, |
| 217 [List<Object> arguments]) |
| 218 : super(source, offset, length, errorCode, arguments); |
| 219 |
| 220 @override |
| 221 Object/*=V*/ getProperty/*<V>*/(ErrorProperty/*<V>*/ property) => |
| 222 _propertyMap[property] as Object/*=V*/; |
| 223 |
| 224 /** |
| 225 * Set the value of the given [property] to the given [value]. Using a value |
| 226 * of `null` will effectively remove the property from this error. |
| 227 */ |
| 228 void setProperty/*<V>*/(ErrorProperty/*<V>*/ property, Object/*=V*/ value) { |
| 229 _propertyMap[property] = value; |
| 230 } |
| 231 } |
| 232 |
| 233 /** |
| 234 * An error code associated with an [AnalysisError]. |
| 235 * |
| 236 * Generally, we want to provide messages that consist of three sentences. From |
| 237 * the user's perspective these sentences should explain: |
| 238 * 1. what is wrong, |
| 239 * 2. why is it wrong, and |
| 240 * 3. how do I fix it. |
| 241 * However, we combine the first two in the [message] and the last in the |
| 242 * [correction]. |
| 243 */ |
| 244 abstract class ErrorCode { |
| 245 /** |
| 246 * Engine error code values. |
| 247 */ |
| 248 static const List<ErrorCode> values = const [ |
| 249 // |
| 250 // Manually generated. FWIW, this get's you most of the way there: |
| 251 // |
| 252 // > grep 'static const .*Code' (error.dart|parser|scanner.dart) |
| 253 // | awk '{print $3"."$4","}' |
| 254 // |
| 255 // error.dart: |
| 256 // |
| 257 AnalysisOptionsErrorCode.PARSE_ERROR, |
| 258 AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUES, |
| 259 AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUE, |
| 260 AnalysisOptionsWarningCode.UNSUPPORTED_VALUE, |
| 261 AnalysisOptionsWarningCode.UNRECOGNIZED_ERROR_CODE, |
| 262 CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH, |
| 263 CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, |
| 264 CheckedModeCompileTimeErrorCode.CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE, |
| 265 CheckedModeCompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE, |
| 266 CheckedModeCompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE, |
| 267 CheckedModeCompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE, |
| 268 CheckedModeCompileTimeErrorCode.VARIABLE_TYPE_MISMATCH, |
| 269 CompileTimeErrorCode.ACCESS_PRIVATE_ENUM_FIELD, |
| 270 CompileTimeErrorCode.AMBIGUOUS_EXPORT, |
| 271 CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS, |
| 272 CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_NON_PARAMETER, |
| 273 CompileTimeErrorCode.ASYNC_FOR_IN_WRONG_CONTEXT, |
| 274 CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT, |
| 275 CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, |
| 276 CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME, |
| 277 CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME, |
| 278 CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME, |
| 279 CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, |
| 280 CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCEPTION, |
| 281 CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD, |
| 282 CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER, |
| 283 CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD, |
| 284 CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD, |
| 285 CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS, |
| 286 CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, |
| 287 CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION, |
| 288 CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST, |
| 289 CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN, |
| 290 CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER, |
| 291 CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, |
| 292 CompileTimeErrorCode.CONST_DEFERRED_CLASS, |
| 293 CompileTimeErrorCode.CONST_FORMAL_PARAMETER, |
| 294 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, |
| 295 CompileTimeErrorCode |
| 296 .CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY, |
| 297 CompileTimeErrorCode.CONST_INSTANCE_FIELD, |
| 298 CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, |
| 299 CompileTimeErrorCode.CONST_NOT_INITIALIZED, |
| 300 CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL, |
| 301 CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING, |
| 302 CompileTimeErrorCode.CONST_EVAL_TYPE_INT, |
| 303 CompileTimeErrorCode.CONST_EVAL_TYPE_NUM, |
| 304 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, |
| 305 CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE, |
| 306 CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS, |
| 307 CompileTimeErrorCode.CONST_WITH_NON_CONST, |
| 308 CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT, |
| 309 CompileTimeErrorCode.CONST_WITH_NON_TYPE, |
| 310 CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS, |
| 311 CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR, |
| 312 CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT, |
| 313 CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS, |
| 314 CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER, |
| 315 CompileTimeErrorCode.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR, |
| 316 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT, |
| 317 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME, |
| 318 CompileTimeErrorCode.DUPLICATE_DEFINITION, |
| 319 CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE, |
| 320 CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT, |
| 321 CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY, |
| 322 CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY, |
| 323 CompileTimeErrorCode.EXTENDS_ENUM, |
| 324 CompileTimeErrorCode.EXTENDS_NON_CLASS, |
| 325 CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, |
| 326 CompileTimeErrorCode.EXTENDS_DEFERRED_CLASS, |
| 327 CompileTimeErrorCode.EXTRA_ARGUMENT_TO_ASSERT, |
| 328 CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, |
| 329 CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS, |
| 330 CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER, |
| 331 CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES, |
| 332 CompileTimeErrorCode.FIELD_INITIALIZER_FACTORY_CONSTRUCTOR, |
| 333 CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, |
| 334 CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR, |
| 335 CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME, |
| 336 CompileTimeErrorCode.IMPLEMENTS_DEFERRED_CLASS, |
| 337 CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, |
| 338 CompileTimeErrorCode.IMPLEMENTS_DYNAMIC, |
| 339 CompileTimeErrorCode.IMPLEMENTS_ENUM, |
| 340 CompileTimeErrorCode.IMPLEMENTS_NON_CLASS, |
| 341 CompileTimeErrorCode.IMPLEMENTS_REPEATED, |
| 342 CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS, |
| 343 CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, |
| 344 CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY, |
| 345 CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY, |
| 346 CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES, |
| 347 CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTENT_FIELD, |
| 348 CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD, |
| 349 CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD, |
| 350 CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD, |
| 351 CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_FACTORY, |
| 352 CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC, |
| 353 CompileTimeErrorCode.INSTANTIATE_ENUM, |
| 354 CompileTimeErrorCode.INVALID_ANNOTATION, |
| 355 CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY, |
| 356 CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC, |
| 357 CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR, |
| 358 CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER, |
| 359 CompileTimeErrorCode.INVALID_CONSTANT, |
| 360 CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME, |
| 361 CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS, |
| 362 CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS, |
| 363 CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST, |
| 364 CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP, |
| 365 CompileTimeErrorCode.INVALID_URI, |
| 366 CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE, |
| 367 CompileTimeErrorCode.LABEL_UNDEFINED, |
| 368 CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME, |
| 369 CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME, |
| 370 CompileTimeErrorCode.MISSING_CONST_IN_LIST_LITERAL, |
| 371 CompileTimeErrorCode.MISSING_CONST_IN_MAP_LITERAL, |
| 372 CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR, |
| 373 CompileTimeErrorCode.MIXIN_DEFERRED_CLASS, |
| 374 CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS, |
| 375 CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, |
| 376 CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, |
| 377 CompileTimeErrorCode.MIXIN_OF_ENUM, |
| 378 CompileTimeErrorCode.MIXIN_OF_NON_CLASS, |
| 379 CompileTimeErrorCode.MIXIN_REFERENCES_SUPER, |
| 380 CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS, |
| 381 CompileTimeErrorCode.MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS, |
| 382 CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS, |
| 383 CompileTimeErrorCode.NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS, |
| 384 CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT, |
| 385 CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT, |
| 386 CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT, |
| 387 CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION, |
| 388 CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY, |
| 389 CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE, |
| 390 CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY, |
| 391 CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT, |
| 392 CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY, |
| 393 CompileTimeErrorCode.NON_CONSTANT_MAP_KEY, |
| 394 CompileTimeErrorCode.NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY, |
| 395 CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE, |
| 396 CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY, |
| 397 CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR, |
| 398 CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER, |
| 399 CompileTimeErrorCode |
| 400 .NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY, |
| 401 CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS, |
| 402 CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR, |
| 403 CompileTimeErrorCode.OBJECT_CANNOT_EXTEND_ANOTHER_CLASS, |
| 404 CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR, |
| 405 CompileTimeErrorCode.PART_OF_NON_PART, |
| 406 CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER, |
| 407 CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT, |
| 408 CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER, |
| 409 CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT, |
| 410 CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT, |
| 411 CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| 412 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| 413 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS, |
| 414 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS, |
| 415 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH, |
| 416 CompileTimeErrorCode.REDIRECT_TO_MISSING_CONSTRUCTOR, |
| 417 CompileTimeErrorCode.REDIRECT_TO_NON_CLASS, |
| 418 CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR, |
| 419 CompileTimeErrorCode.REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR, |
| 420 CompileTimeErrorCode.REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR, |
| 421 CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION, |
| 422 CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH, |
| 423 CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR, |
| 424 CompileTimeErrorCode.RETURN_IN_GENERATOR, |
| 425 CompileTimeErrorCode.SHARED_DEFERRED_PREFIX, |
| 426 CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, |
| 427 CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR, |
| 428 CompileTimeErrorCode.SUPER_INITIALIZER_IN_OBJECT, |
| 429 CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, |
| 430 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, |
| 431 CompileTimeErrorCode.UNDEFINED_CLASS, |
| 432 CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER, |
| 433 CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT, |
| 434 CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER, |
| 435 CompileTimeErrorCode.URI_DOES_NOT_EXIST, |
| 436 CompileTimeErrorCode.URI_WITH_INTERPOLATION, |
| 437 CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR, |
| 438 CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS, |
| 439 CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER, |
| 440 CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR, |
| 441 CompileTimeErrorCode.YIELD_IN_NON_GENERATOR, |
| 442 HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, |
| 443 HintCode.CAN_BE_NULL_AFTER_NULL_AWARE, |
| 444 HintCode.DEAD_CODE, |
| 445 HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH, |
| 446 HintCode.DEAD_CODE_ON_CATCH_SUBTYPE, |
| 447 HintCode.DEPRECATED_MEMBER_USE, |
| 448 HintCode.DUPLICATE_IMPORT, |
| 449 HintCode.DIVISION_OPTIMIZATION, |
| 450 HintCode.INVALID_FACTORY_ANNOTATION, |
| 451 HintCode.INVALID_FACTORY_METHOD_DECL, |
| 452 HintCode.INVALID_FACTORY_METHOD_IMPL, |
| 453 HintCode.IS_DOUBLE, |
| 454 HintCode.IS_INT, |
| 455 HintCode.IS_NOT_DOUBLE, |
| 456 HintCode.IS_NOT_INT, |
| 457 HintCode.IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION, |
| 458 HintCode.INVALID_ASSIGNMENT, |
| 459 HintCode.INVALID_USE_OF_PROTECTED_MEMBER, |
| 460 HintCode.MISSING_JS_LIB_ANNOTATION, |
| 461 HintCode.MISSING_REQUIRED_PARAM, |
| 462 HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS, |
| 463 HintCode.MISSING_RETURN, |
| 464 HintCode.NULL_AWARE_IN_CONDITION, |
| 465 HintCode.OVERRIDE_ON_NON_OVERRIDING_GETTER, |
| 466 HintCode.OVERRIDE_ON_NON_OVERRIDING_FIELD, |
| 467 HintCode.OVERRIDE_ON_NON_OVERRIDING_METHOD, |
| 468 HintCode.OVERRIDE_ON_NON_OVERRIDING_SETTER, |
| 469 HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE, |
| 470 HintCode.TYPE_CHECK_IS_NOT_NULL, |
| 471 HintCode.TYPE_CHECK_IS_NULL, |
| 472 HintCode.UNDEFINED_GETTER, |
| 473 HintCode.UNDEFINED_HIDDEN_NAME, |
| 474 HintCode.UNDEFINED_METHOD, |
| 475 HintCode.UNDEFINED_OPERATOR, |
| 476 HintCode.UNDEFINED_SETTER, |
| 477 HintCode.UNDEFINED_SHOWN_NAME, |
| 478 HintCode.UNNECESSARY_CAST, |
| 479 HintCode.UNNECESSARY_NO_SUCH_METHOD, |
| 480 HintCode.UNNECESSARY_TYPE_CHECK_FALSE, |
| 481 HintCode.UNNECESSARY_TYPE_CHECK_TRUE, |
| 482 HintCode.UNUSED_ELEMENT, |
| 483 HintCode.UNUSED_FIELD, |
| 484 HintCode.UNUSED_IMPORT, |
| 485 HintCode.UNUSED_CATCH_CLAUSE, |
| 486 HintCode.UNUSED_CATCH_STACK, |
| 487 HintCode.UNUSED_LOCAL_VARIABLE, |
| 488 HintCode.UNUSED_SHOWN_NAME, |
| 489 HintCode.USE_OF_VOID_RESULT, |
| 490 HintCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE, |
| 491 HintCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE, |
| 492 HintCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT, |
| 493 HtmlErrorCode.PARSE_ERROR, |
| 494 HtmlWarningCode.INVALID_URI, |
| 495 HtmlWarningCode.URI_DOES_NOT_EXIST, |
| 496 StaticTypeWarningCode.EXPECTED_ONE_LIST_TYPE_ARGUMENTS, |
| 497 StaticTypeWarningCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS, |
| 498 StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE, |
| 499 StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE, |
| 500 StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE, |
| 501 StaticTypeWarningCode.INACCESSIBLE_SETTER, |
| 502 StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE, |
| 503 StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, |
| 504 StaticTypeWarningCode.INVALID_ASSIGNMENT, |
| 505 StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, |
| 506 StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, |
| 507 StaticTypeWarningCode.NON_BOOL_CONDITION, |
| 508 StaticTypeWarningCode.NON_BOOL_EXPRESSION, |
| 509 StaticTypeWarningCode.NON_BOOL_NEGATION_EXPRESSION, |
| 510 StaticTypeWarningCode.NON_BOOL_OPERAND, |
| 511 StaticTypeWarningCode.NON_NULLABLE_FIELD_NOT_INITIALIZED, |
| 512 StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, |
| 513 StaticTypeWarningCode.RETURN_OF_INVALID_TYPE, |
| 514 StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, |
| 515 StaticTypeWarningCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND, |
| 516 StaticTypeWarningCode.UNDEFINED_ENUM_CONSTANT, |
| 517 StaticTypeWarningCode.UNDEFINED_FUNCTION, |
| 518 StaticTypeWarningCode.UNDEFINED_GETTER, |
| 519 StaticTypeWarningCode.UNDEFINED_METHOD, |
| 520 StaticTypeWarningCode.UNDEFINED_METHOD_WITH_CONSTRUCTOR, |
| 521 StaticTypeWarningCode.UNDEFINED_OPERATOR, |
| 522 StaticTypeWarningCode.UNDEFINED_SETTER, |
| 523 StaticTypeWarningCode.UNDEFINED_SUPER_GETTER, |
| 524 StaticTypeWarningCode.UNDEFINED_SUPER_METHOD, |
| 525 StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR, |
| 526 StaticTypeWarningCode.UNDEFINED_SUPER_SETTER, |
| 527 StaticTypeWarningCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER, |
| 528 StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, |
| 529 StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, |
| 530 StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE, |
| 531 StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, |
| 532 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 533 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, |
| 534 StaticWarningCode.ASSIGNMENT_TO_CONST, |
| 535 StaticWarningCode.ASSIGNMENT_TO_FINAL, |
| 536 StaticWarningCode.ASSIGNMENT_TO_FINAL_NO_SETTER, |
| 537 StaticWarningCode.ASSIGNMENT_TO_FUNCTION, |
| 538 StaticWarningCode.ASSIGNMENT_TO_METHOD, |
| 539 StaticWarningCode.ASSIGNMENT_TO_TYPE, |
| 540 StaticWarningCode.CASE_BLOCK_NOT_TERMINATED, |
| 541 StaticWarningCode.CAST_TO_NON_TYPE, |
| 542 StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER, |
| 543 StaticWarningCode.CONFLICTING_DART_IMPORT, |
| 544 StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER, |
| 545 StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER, |
| 546 StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER2, |
| 547 StaticWarningCode.CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER, |
| 548 StaticWarningCode.CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER, |
| 549 StaticWarningCode.CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER, |
| 550 StaticWarningCode.CONST_WITH_ABSTRACT_CLASS, |
| 551 StaticWarningCode.EQUAL_KEYS_IN_MAP, |
| 552 StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAMED, |
| 553 StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS, |
| 554 StaticWarningCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION, |
| 555 StaticWarningCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, |
| 556 StaticWarningCode.FIELD_INITIALIZER_NOT_ASSIGNABLE, |
| 557 StaticWarningCode.FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE, |
| 558 StaticWarningCode.FINAL_NOT_INITIALIZED, |
| 559 StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_1, |
| 560 StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_2, |
| 561 StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS, |
| 562 StaticWarningCode.FUNCTION_WITHOUT_CALL, |
| 563 StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAMED, |
| 564 StaticWarningCode.IMPORT_OF_NON_LIBRARY, |
| 565 StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD, |
| 566 StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC, |
| 567 StaticWarningCode.INVALID_GETTER_OVERRIDE_RETURN_TYPE, |
| 568 StaticWarningCode.INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE, |
| 569 StaticWarningCode.INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS, |
| 570 StaticWarningCode.INVALID_METHOD_OVERRIDE_TYPE_PARAMETER_BOUND, |
| 571 StaticWarningCode.INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE, |
| 572 StaticWarningCode.INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE, |
| 573 StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE, |
| 574 StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED, |
| 575 StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL, |
| 576 StaticWarningCode.INVALID_OVERRIDE_NAMED, |
| 577 StaticWarningCode.INVALID_OVERRIDE_POSITIONAL, |
| 578 StaticWarningCode.INVALID_OVERRIDE_REQUIRED, |
| 579 StaticWarningCode.INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE, |
| 580 StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE, |
| 581 StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE, |
| 582 StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE, |
| 583 StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES, |
| 584 StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE, |
| 585 StaticWarningCode.MIXED_RETURN_TYPES, |
| 586 StaticWarningCode.NEW_WITH_ABSTRACT_CLASS, |
| 587 StaticWarningCode.NEW_WITH_INVALID_TYPE_PARAMETERS, |
| 588 StaticWarningCode.NEW_WITH_NON_TYPE, |
| 589 StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR, |
| 590 StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT, |
| 591 StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS, |
| 592 StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR, |
| 593 StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE, |
| 594 StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE, |
| 595 StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO, |
| 596 StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE, |
| 597 StaticWarningCode.NON_VOID_RETURN_FOR_OPERATOR, |
| 598 StaticWarningCode.NON_VOID_RETURN_FOR_SETTER, |
| 599 StaticWarningCode.NOT_A_TYPE, |
| 600 StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS, |
| 601 StaticWarningCode.PART_OF_DIFFERENT_LIBRARY, |
| 602 StaticWarningCode.REDIRECT_TO_INVALID_FUNCTION_TYPE, |
| 603 StaticWarningCode.REDIRECT_TO_INVALID_RETURN_TYPE, |
| 604 StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUCTOR, |
| 605 StaticWarningCode.REDIRECT_TO_NON_CLASS, |
| 606 StaticWarningCode.RETURN_WITHOUT_VALUE, |
| 607 StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER, |
| 608 StaticWarningCode.SWITCH_EXPRESSION_NOT_ASSIGNABLE, |
| 609 StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS, |
| 610 StaticWarningCode.TYPE_TEST_WITH_NON_TYPE, |
| 611 StaticWarningCode.TYPE_TEST_WITH_UNDEFINED_NAME, |
| 612 StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC, |
| 613 StaticWarningCode.UNDEFINED_CLASS, |
| 614 StaticWarningCode.UNDEFINED_CLASS_BOOLEAN, |
| 615 StaticWarningCode.UNDEFINED_GETTER, |
| 616 StaticWarningCode.UNDEFINED_IDENTIFIER, |
| 617 StaticWarningCode.UNDEFINED_NAMED_PARAMETER, |
| 618 StaticWarningCode.UNDEFINED_SETTER, |
| 619 StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER, |
| 620 StaticWarningCode.UNDEFINED_SUPER_GETTER, |
| 621 StaticWarningCode.UNDEFINED_SUPER_SETTER, |
| 622 StaticWarningCode.VOID_RETURN_FOR_GETTER, |
| 623 StaticWarningCode.MISSING_ENUM_CONSTANT_IN_SWITCH, |
| 624 StrongModeCode.ASSIGNMENT_CAST, |
| 625 StrongModeCode.DOWN_CAST_COMPOSITE, |
| 626 StrongModeCode.DOWN_CAST_IMPLICIT, |
| 627 StrongModeCode.DYNAMIC_CAST, |
| 628 StrongModeCode.DYNAMIC_INVOKE, |
| 629 StrongModeCode.IMPLICIT_DYNAMIC_FIELD, |
| 630 StrongModeCode.IMPLICIT_DYNAMIC_FUNCTION, |
| 631 StrongModeCode.IMPLICIT_DYNAMIC_INVOKE, |
| 632 StrongModeCode.IMPLICIT_DYNAMIC_LIST_LITERAL, |
| 633 StrongModeCode.IMPLICIT_DYNAMIC_MAP_LITERAL, |
| 634 StrongModeCode.IMPLICIT_DYNAMIC_METHOD, |
| 635 StrongModeCode.IMPLICIT_DYNAMIC_PARAMETER, |
| 636 StrongModeCode.IMPLICIT_DYNAMIC_RETURN, |
| 637 StrongModeCode.IMPLICIT_DYNAMIC_TYPE, |
| 638 StrongModeCode.IMPLICIT_DYNAMIC_VARIABLE, |
| 639 StrongModeCode.INFERRED_TYPE, |
| 640 StrongModeCode.INFERRED_TYPE_ALLOCATION, |
| 641 StrongModeCode.INFERRED_TYPE_CLOSURE, |
| 642 StrongModeCode.INFERRED_TYPE_LITERAL, |
| 643 StrongModeCode.INVALID_FIELD_OVERRIDE, |
| 644 StrongModeCode.INVALID_METHOD_OVERRIDE, |
| 645 StrongModeCode.INVALID_METHOD_OVERRIDE_FROM_BASE, |
| 646 StrongModeCode.INVALID_METHOD_OVERRIDE_FROM_MIXIN, |
| 647 StrongModeCode.INVALID_PARAMETER_DECLARATION, |
| 648 StrongModeCode.INVALID_SUPER_INVOCATION, |
| 649 StrongModeCode.NON_GROUND_TYPE_CHECK_INFO, |
| 650 StrongModeCode.STATIC_TYPE_ERROR, |
| 651 StrongModeCode.UNSAFE_BLOCK_CLOSURE_INFERENCE, |
| 652 TodoCode.TODO, |
| 653 // |
| 654 // parser.dart: |
| 655 // |
| 656 ParserErrorCode.ABSTRACT_CLASS_MEMBER, |
| 657 ParserErrorCode.ABSTRACT_ENUM, |
| 658 ParserErrorCode.ABSTRACT_STATIC_METHOD, |
| 659 ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION, |
| 660 ParserErrorCode.ABSTRACT_TOP_LEVEL_VARIABLE, |
| 661 ParserErrorCode.ABSTRACT_TYPEDEF, |
| 662 ParserErrorCode.ANNOTATION_ON_ENUM_CONSTANT, |
| 663 ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER, |
| 664 ParserErrorCode.ASYNC_NOT_SUPPORTED, |
| 665 ParserErrorCode.BREAK_OUTSIDE_OF_LOOP, |
| 666 ParserErrorCode.CLASS_IN_CLASS, |
| 667 ParserErrorCode.COLON_IN_PLACE_OF_IN, |
| 668 ParserErrorCode.CONST_AND_FINAL, |
| 669 ParserErrorCode.CONST_AND_VAR, |
| 670 ParserErrorCode.CONST_CLASS, |
| 671 ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, |
| 672 ParserErrorCode.CONST_ENUM, |
| 673 ParserErrorCode.CONST_FACTORY, |
| 674 ParserErrorCode.CONST_METHOD, |
| 675 ParserErrorCode.CONST_TYPEDEF, |
| 676 ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, |
| 677 ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP, |
| 678 ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE, |
| 679 ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS, |
| 680 ParserErrorCode.DIRECTIVE_AFTER_DECLARATION, |
| 681 ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT, |
| 682 ParserErrorCode.DUPLICATED_MODIFIER, |
| 683 ParserErrorCode.EMPTY_ENUM_BODY, |
| 684 ParserErrorCode.ENUM_IN_CLASS, |
| 685 ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND, |
| 686 ParserErrorCode.EXPECTED_CASE_OR_DEFAULT, |
| 687 ParserErrorCode.EXPECTED_CLASS_MEMBER, |
| 688 ParserErrorCode.EXPECTED_EXECUTABLE, |
| 689 ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL, |
| 690 ParserErrorCode.EXPECTED_STRING_LITERAL, |
| 691 ParserErrorCode.EXPECTED_TOKEN, |
| 692 ParserErrorCode.EXPECTED_TYPE_NAME, |
| 693 ParserErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, |
| 694 ParserErrorCode.EXTERNAL_AFTER_CONST, |
| 695 ParserErrorCode.EXTERNAL_AFTER_FACTORY, |
| 696 ParserErrorCode.EXTERNAL_AFTER_STATIC, |
| 697 ParserErrorCode.EXTERNAL_CLASS, |
| 698 ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY, |
| 699 ParserErrorCode.EXTERNAL_ENUM, |
| 700 ParserErrorCode.EXTERNAL_FIELD, |
| 701 ParserErrorCode.EXTERNAL_GETTER_WITH_BODY, |
| 702 ParserErrorCode.EXTERNAL_METHOD_WITH_BODY, |
| 703 ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY, |
| 704 ParserErrorCode.EXTERNAL_SETTER_WITH_BODY, |
| 705 ParserErrorCode.EXTERNAL_TYPEDEF, |
| 706 ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION, |
| 707 ParserErrorCode.FACTORY_WITH_INITIALIZERS, |
| 708 ParserErrorCode.FACTORY_WITHOUT_BODY, |
| 709 ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, |
| 710 ParserErrorCode.FINAL_AND_VAR, |
| 711 ParserErrorCode.FINAL_CLASS, |
| 712 ParserErrorCode.FINAL_CONSTRUCTOR, |
| 713 ParserErrorCode.FINAL_ENUM, |
| 714 ParserErrorCode.FINAL_METHOD, |
| 715 ParserErrorCode.FINAL_TYPEDEF, |
| 716 ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR, |
| 717 ParserErrorCode.GETTER_IN_FUNCTION, |
| 718 ParserErrorCode.GETTER_WITH_PARAMETERS, |
| 719 ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, |
| 720 ParserErrorCode.IMPLEMENTS_BEFORE_EXTENDS, |
| 721 ParserErrorCode.IMPLEMENTS_BEFORE_WITH, |
| 722 ParserErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, |
| 723 ParserErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH, |
| 724 ParserErrorCode.INVALID_AWAIT_IN_FOR, |
| 725 ParserErrorCode.INVALID_CODE_POINT, |
| 726 ParserErrorCode.INVALID_COMMENT_REFERENCE, |
| 727 ParserErrorCode.INVALID_HEX_ESCAPE, |
| 728 ParserErrorCode.INVALID_LITERAL_IN_CONFIGURATION, |
| 729 ParserErrorCode.INVALID_OPERATOR, |
| 730 ParserErrorCode.INVALID_OPERATOR_FOR_SUPER, |
| 731 ParserErrorCode.INVALID_STAR_AFTER_ASYNC, |
| 732 ParserErrorCode.INVALID_SYNC, |
| 733 ParserErrorCode.INVALID_UNICODE_ESCAPE, |
| 734 ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST, |
| 735 ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER, |
| 736 ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, |
| 737 ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER, |
| 738 ParserErrorCode.MISSING_CATCH_OR_FINALLY, |
| 739 ParserErrorCode.MISSING_CLASS_BODY, |
| 740 ParserErrorCode.MISSING_CLOSING_PARENTHESIS, |
| 741 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, |
| 742 ParserErrorCode.MISSING_ENUM_BODY, |
| 743 ParserErrorCode.MISSING_EXPRESSION_IN_INITIALIZER, |
| 744 ParserErrorCode.MISSING_EXPRESSION_IN_THROW, |
| 745 ParserErrorCode.MISSING_FUNCTION_BODY, |
| 746 ParserErrorCode.MISSING_FUNCTION_PARAMETERS, |
| 747 ParserErrorCode.MISSING_METHOD_PARAMETERS, |
| 748 ParserErrorCode.MISSING_GET, |
| 749 ParserErrorCode.MISSING_IDENTIFIER, |
| 750 ParserErrorCode.MISSING_INITIALIZER, |
| 751 ParserErrorCode.MISSING_KEYWORD_OPERATOR, |
| 752 ParserErrorCode.MISSING_NAME_IN_LIBRARY_DIRECTIVE, |
| 753 ParserErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE, |
| 754 ParserErrorCode.MISSING_PREFIX_IN_DEFERRED_IMPORT, |
| 755 ParserErrorCode.MISSING_STAR_AFTER_SYNC, |
| 756 ParserErrorCode.MISSING_STATEMENT, |
| 757 ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP, |
| 758 ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, |
| 759 ParserErrorCode.MISSING_VARIABLE_IN_FOR_EACH, |
| 760 ParserErrorCode.MIXED_PARAMETER_GROUPS, |
| 761 ParserErrorCode.MULTIPLE_EXTENDS_CLAUSES, |
| 762 ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES, |
| 763 ParserErrorCode.MULTIPLE_LIBRARY_DIRECTIVES, |
| 764 ParserErrorCode.MULTIPLE_NAMED_PARAMETER_GROUPS, |
| 765 ParserErrorCode.MULTIPLE_PART_OF_DIRECTIVES, |
| 766 ParserErrorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS, |
| 767 ParserErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH, |
| 768 ParserErrorCode.MULTIPLE_WITH_CLAUSES, |
| 769 ParserErrorCode.NAMED_FUNCTION_EXPRESSION, |
| 770 ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP, |
| 771 ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE, |
| 772 ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE, |
| 773 ParserErrorCode.NON_CONSTRUCTOR_FACTORY, |
| 774 ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME, |
| 775 ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART, |
| 776 ParserErrorCode.NON_STRING_LITERAL_AS_URI, |
| 777 ParserErrorCode.NON_USER_DEFINABLE_OPERATOR, |
| 778 ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS, |
| 779 ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT, |
| 780 ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP, |
| 781 ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY, |
| 782 ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR, |
| 783 ParserErrorCode.SETTER_IN_FUNCTION, |
| 784 ParserErrorCode.STATIC_AFTER_CONST, |
| 785 ParserErrorCode.STATIC_AFTER_FINAL, |
| 786 ParserErrorCode.STATIC_AFTER_VAR, |
| 787 ParserErrorCode.STATIC_CONSTRUCTOR, |
| 788 ParserErrorCode.STATIC_GETTER_WITHOUT_BODY, |
| 789 ParserErrorCode.STATIC_OPERATOR, |
| 790 ParserErrorCode.STATIC_SETTER_WITHOUT_BODY, |
| 791 ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION, |
| 792 ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE, |
| 793 ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES, |
| 794 ParserErrorCode.TOP_LEVEL_OPERATOR, |
| 795 ParserErrorCode.TYPEDEF_IN_CLASS, |
| 796 ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, |
| 797 ParserErrorCode.UNEXPECTED_TOKEN, |
| 798 ParserErrorCode.WITH_BEFORE_EXTENDS, |
| 799 ParserErrorCode.WITH_WITHOUT_EXTENDS, |
| 800 ParserErrorCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER, |
| 801 ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER, |
| 802 ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP, |
| 803 ParserErrorCode.VAR_AND_TYPE, |
| 804 ParserErrorCode.VAR_AS_TYPE_NAME, |
| 805 ParserErrorCode.VAR_CLASS, |
| 806 ParserErrorCode.VAR_ENUM, |
| 807 ParserErrorCode.VAR_RETURN_TYPE, |
| 808 ParserErrorCode.VAR_TYPEDEF, |
| 809 ParserErrorCode.VOID_PARAMETER, |
| 810 ParserErrorCode.VOID_VARIABLE, |
| 811 // |
| 812 // scanner.dart: |
| 813 // |
| 814 ScannerErrorCode.ILLEGAL_CHARACTER, |
| 815 ScannerErrorCode.MISSING_DIGIT, |
| 816 ScannerErrorCode.MISSING_HEX_DIGIT, |
| 817 ScannerErrorCode.MISSING_QUOTE, |
| 818 ScannerErrorCode.UNABLE_GET_CONTENT, |
| 819 ScannerErrorCode.UNTERMINATED_MULTI_LINE_COMMENT, |
| 820 ScannerErrorCode.UNTERMINATED_STRING_LITERAL, |
| 821 ]; |
| 822 |
| 823 /** |
| 824 * The lazy initialized map from [uniqueName] to the [ErrorCode] instance. |
| 825 */ |
| 826 static HashMap<String, ErrorCode> _uniqueNameToCodeMap; |
| 827 |
| 828 /** |
| 829 * An empty list of error codes. |
| 830 */ |
| 831 static const List<ErrorCode> EMPTY_LIST = const <ErrorCode>[]; |
| 832 |
| 833 /** |
| 834 * The name of the error code. |
| 835 */ |
| 836 final String name; |
| 837 |
| 838 /** |
| 839 * The template used to create the message to be displayed for this error. The |
| 840 * message should indicate what is wrong and why it is wrong. |
| 841 */ |
| 842 final String message; |
| 843 |
| 844 /** |
| 845 * The template used to create the correction to be displayed for this error, |
| 846 * or `null` if there is no correction information for this error. The |
| 847 * correction should indicate how the user can fix the error. |
| 848 */ |
| 849 final String correction; |
| 850 |
| 851 /** |
| 852 * Initialize a newly created error code to have the given [name]. The message |
| 853 * associated with the error will be created from the given [message] |
| 854 * template. The correction associated with the error will be created from the |
| 855 * given [correction] template. |
| 856 */ |
| 857 const ErrorCode(this.name, this.message, [this.correction]); |
| 858 |
| 859 /** |
| 860 * The severity of the error. |
| 861 */ |
| 862 ErrorSeverity get errorSeverity; |
| 863 |
| 864 /** |
| 865 * The type of the error. |
| 866 */ |
| 867 ErrorType get type; |
| 868 |
| 869 /** |
| 870 * The unique name of this error code. |
| 871 */ |
| 872 String get uniqueName => "$runtimeType.$name"; |
| 873 |
| 874 @override |
| 875 String toString() => uniqueName; |
| 876 |
| 877 /** |
| 878 * Return the [ErrorCode] with the given [uniqueName], or `null` if not |
| 879 * found. |
| 880 */ |
| 881 static ErrorCode byUniqueName(String uniqueName) { |
| 882 if (_uniqueNameToCodeMap == null) { |
| 883 _uniqueNameToCodeMap = new HashMap<String, ErrorCode>(); |
| 884 for (ErrorCode errorCode in values) { |
| 885 _uniqueNameToCodeMap[errorCode.uniqueName] = errorCode; |
| 886 } |
| 887 } |
| 888 return _uniqueNameToCodeMap[uniqueName]; |
| 889 } |
| 890 } |
| 891 |
| 892 /** |
| 893 * The properties that can be associated with an [AnalysisError]. |
| 894 */ |
| 895 class ErrorProperty<V> extends Enum<ErrorProperty> { |
| 896 /** |
| 897 * A property whose value is a list of [FieldElement]s that are final, but |
| 898 * not initialized by a constructor. |
| 899 */ |
| 900 static const ErrorProperty<List<FieldElement>> NOT_INITIALIZED_FIELDS = |
| 901 const ErrorProperty<List<FieldElement>>('NOT_INITIALIZED_FIELDS', 0); |
| 902 |
| 903 /** |
| 904 * A property whose value is the name of the library that is used by all |
| 905 * of the "part of" directives, so should be used in the "library" directive. |
| 906 * Is `null` if there is no a single name used by all of the parts. |
| 907 */ |
| 908 static const ErrorProperty<String> PARTS_LIBRARY_NAME = |
| 909 const ErrorProperty<String>('PARTS_LIBRARY_NAME', 1); |
| 910 |
| 911 /** |
| 912 * A property whose value is a list of [ExecutableElement] that should |
| 913 * be but are not implemented by a concrete class. |
| 914 */ |
| 915 static const ErrorProperty<List<ExecutableElement>> UNIMPLEMENTED_METHODS = |
| 916 const ErrorProperty<List<ExecutableElement>>('UNIMPLEMENTED_METHODS', 2); |
| 917 |
| 918 static const List<ErrorProperty> values = const [ |
| 919 NOT_INITIALIZED_FIELDS, |
| 920 PARTS_LIBRARY_NAME, |
| 921 UNIMPLEMENTED_METHODS |
| 922 ]; |
| 923 |
| 924 const ErrorProperty(String name, int ordinal) : super(name, ordinal); |
| 925 } |
| 926 |
| 927 /** |
| 928 * The severity of an [ErrorCode]. |
| 929 */ |
| 930 class ErrorSeverity extends Enum<ErrorSeverity> { |
| 931 /** |
| 932 * The severity representing a non-error. This is never used for any error |
| 933 * code, but is useful for clients. |
| 934 */ |
| 935 static const ErrorSeverity NONE = const ErrorSeverity('NONE', 0, " ", "none"); |
| 936 |
| 937 /** |
| 938 * The severity representing an informational level analysis issue. |
| 939 */ |
| 940 static const ErrorSeverity INFO = const ErrorSeverity('INFO', 1, "I", "info"); |
| 941 |
| 942 /** |
| 943 * The severity representing a warning. Warnings can become errors if the `-We
rror` command |
| 944 * line flag is specified. |
| 945 */ |
| 946 static const ErrorSeverity WARNING = |
| 947 const ErrorSeverity('WARNING', 2, "W", "warning"); |
| 948 |
| 949 /** |
| 950 * The severity representing an error. |
| 951 */ |
| 952 static const ErrorSeverity ERROR = |
| 953 const ErrorSeverity('ERROR', 3, "E", "error"); |
| 954 |
| 955 static const List<ErrorSeverity> values = const [NONE, INFO, WARNING, ERROR]; |
| 956 |
| 957 /** |
| 958 * The name of the severity used when producing machine output. |
| 959 */ |
| 960 final String machineCode; |
| 961 |
| 962 /** |
| 963 * The name of the severity used when producing readable output. |
| 964 */ |
| 965 final String displayName; |
| 966 |
| 967 /** |
| 968 * Initialize a newly created severity with the given names. |
| 969 * |
| 970 * Parameters: |
| 971 * 0: the name of the severity used when producing machine output |
| 972 * 1: the name of the severity used when producing readable output |
| 973 */ |
| 974 const ErrorSeverity( |
| 975 String name, int ordinal, this.machineCode, this.displayName) |
| 976 : super(name, ordinal); |
| 977 |
| 978 /** |
| 979 * Return the severity constant that represents the greatest severity. |
| 980 */ |
| 981 ErrorSeverity max(ErrorSeverity severity) => |
| 982 this.ordinal >= severity.ordinal ? this : severity; |
| 983 } |
| 984 |
| 985 /** |
| 986 * The type of an [ErrorCode]. |
| 987 */ |
| 988 class ErrorType extends Enum<ErrorType> { |
| 989 /** |
| 990 * Task (todo) comments in user code. |
| 991 */ |
| 992 static const ErrorType TODO = const ErrorType('TODO', 0, ErrorSeverity.INFO); |
| 993 |
| 994 /** |
| 995 * Extra analysis run over the code to follow best practices, which are not in |
| 996 * the Dart Language Specification. |
| 997 */ |
| 998 static const ErrorType HINT = const ErrorType('HINT', 1, ErrorSeverity.INFO); |
| 999 |
| 1000 /** |
| 1001 * Compile-time errors are errors that preclude execution. A compile time |
| 1002 * error must be reported by a Dart compiler before the erroneous code is |
| 1003 * executed. |
| 1004 */ |
| 1005 static const ErrorType COMPILE_TIME_ERROR = |
| 1006 const ErrorType('COMPILE_TIME_ERROR', 2, ErrorSeverity.ERROR); |
| 1007 |
| 1008 /** |
| 1009 * Checked mode compile-time errors are errors that preclude execution in |
| 1010 * checked mode. |
| 1011 */ |
| 1012 static const ErrorType CHECKED_MODE_COMPILE_TIME_ERROR = const ErrorType( |
| 1013 'CHECKED_MODE_COMPILE_TIME_ERROR', 3, ErrorSeverity.ERROR); |
| 1014 |
| 1015 /** |
| 1016 * Static warnings are those warnings reported by the static checker. They |
| 1017 * have no effect on execution. Static warnings must be provided by Dart |
| 1018 * compilers used during development. |
| 1019 */ |
| 1020 static const ErrorType STATIC_WARNING = |
| 1021 const ErrorType('STATIC_WARNING', 4, ErrorSeverity.WARNING); |
| 1022 |
| 1023 /** |
| 1024 * Many, but not all, static warnings relate to types, in which case they are |
| 1025 * known as static type warnings. |
| 1026 */ |
| 1027 static const ErrorType STATIC_TYPE_WARNING = |
| 1028 const ErrorType('STATIC_TYPE_WARNING', 5, ErrorSeverity.WARNING); |
| 1029 |
| 1030 /** |
| 1031 * Syntactic errors are errors produced as a result of input that does not |
| 1032 * conform to the grammar. |
| 1033 */ |
| 1034 static const ErrorType SYNTACTIC_ERROR = |
| 1035 const ErrorType('SYNTACTIC_ERROR', 6, ErrorSeverity.ERROR); |
| 1036 |
| 1037 /** |
| 1038 * Lint warnings describe style and best practice recommendations that can be |
| 1039 * used to formalize a project's style guidelines. |
| 1040 */ |
| 1041 static const ErrorType LINT = const ErrorType('LINT', 7, ErrorSeverity.INFO); |
| 1042 |
| 1043 static const List<ErrorType> values = const [ |
| 1044 TODO, |
| 1045 HINT, |
| 1046 COMPILE_TIME_ERROR, |
| 1047 CHECKED_MODE_COMPILE_TIME_ERROR, |
| 1048 STATIC_WARNING, |
| 1049 STATIC_TYPE_WARNING, |
| 1050 SYNTACTIC_ERROR, |
| 1051 LINT |
| 1052 ]; |
| 1053 |
| 1054 /** |
| 1055 * The severity of this type of error. |
| 1056 */ |
| 1057 final ErrorSeverity severity; |
| 1058 |
| 1059 /** |
| 1060 * Initialize a newly created error type to have the given [name] and |
| 1061 * [severity]. |
| 1062 */ |
| 1063 const ErrorType(String name, int ordinal, this.severity) |
| 1064 : super(name, ordinal); |
| 1065 |
| 1066 String get displayName => name.toLowerCase().replaceAll('_', ' '); |
| 1067 } |
OLD | NEW |