mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Make correction parameter optional named in ErrorCode and subclasses.
This is a preparatory step before adding a flag that signals that the error code represents an unresolved identifier situation. R=brianwilkerson@google.com Change-Id: Ic3b30e2efae7ee0c12a40d1cc2bd48c14185d926 Reviewed-on: https://dart-review.googlesource.com/48763 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
98f627f989
commit
14806df576
|
@ -40,8 +40,8 @@ class AnalysisOptionsErrorCode extends ErrorCode {
|
|||
* Initialize a newly created error code to have the given [name].
|
||||
*/
|
||||
const AnalysisOptionsErrorCode(String name, String message,
|
||||
[String correction])
|
||||
: super(name, message, correction);
|
||||
{String correction})
|
||||
: super(name, message, correction: correction);
|
||||
|
||||
@override
|
||||
ErrorSeverity get errorSeverity => ErrorSeverity.ERROR;
|
||||
|
@ -117,10 +117,9 @@ class AnalysisOptionsWarningCode extends ErrorCode {
|
|||
* 2: legal values
|
||||
*/
|
||||
static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUES =
|
||||
const AnalysisOptionsWarningCode(
|
||||
'UNSUPPORTED_OPTION_WITH_LEGAL_VALUES',
|
||||
const AnalysisOptionsWarningCode('UNSUPPORTED_OPTION_WITH_LEGAL_VALUES',
|
||||
"The option '{1}' isn't supported by '{0}'.",
|
||||
"Try using one of the supported options: {2}.");
|
||||
correction: "Try using one of the supported options: {2}.");
|
||||
|
||||
/**
|
||||
* An error code indicating that an option entry is being configured with an
|
||||
|
@ -133,16 +132,15 @@ class AnalysisOptionsWarningCode extends ErrorCode {
|
|||
*/
|
||||
static const AnalysisOptionsWarningCode UNSUPPORTED_VALUE =
|
||||
const AnalysisOptionsWarningCode(
|
||||
'UNSUPPORTED_VALUE',
|
||||
"The value '{1}' isn't supported by '{0}'.",
|
||||
"Try using one of the supported options: {2}.");
|
||||
'UNSUPPORTED_VALUE', "The value '{1}' isn't supported by '{0}'.",
|
||||
correction: "Try using one of the supported options: {2}.");
|
||||
|
||||
/**
|
||||
* Initialize a newly created warning code to have the given [name].
|
||||
*/
|
||||
const AnalysisOptionsWarningCode(String name, String message,
|
||||
[String correction])
|
||||
: super(name, message, correction);
|
||||
{String correction})
|
||||
: super(name, message, correction: correction);
|
||||
|
||||
@override
|
||||
ErrorSeverity get errorSeverity => ErrorSeverity.WARNING;
|
||||
|
@ -169,18 +167,18 @@ class AnalysisOptionsHintCode extends ErrorCode {
|
|||
* An error code indicating that strong-mode: false is being deprecated.
|
||||
*/
|
||||
static const AnalysisOptionsHintCode SPEC_MODE_DEPRECATED =
|
||||
const AnalysisOptionsHintCode(
|
||||
'SPEC_MODE_DEPRECATED',
|
||||
const AnalysisOptionsHintCode('SPEC_MODE_DEPRECATED',
|
||||
"The option 'strong-mode: false' is being deprecated.",
|
||||
"It's recommended to use 'strong-mode: true' and make your code "
|
||||
"strong mode clean.");
|
||||
correction:
|
||||
"It's recommended to use 'strong-mode: true' and make your code "
|
||||
"strong mode clean.");
|
||||
|
||||
/**
|
||||
* Initialize a newly created hint code to have the given [name].
|
||||
*/
|
||||
const AnalysisOptionsHintCode(String name, String message,
|
||||
[String correction])
|
||||
: super(name, message, correction);
|
||||
{String correction})
|
||||
: super(name, message, correction: correction);
|
||||
|
||||
@override
|
||||
ErrorSeverity get errorSeverity => ErrorSeverity.INFO;
|
||||
|
|
|
@ -44,17 +44,15 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode CAN_BE_NULL_AFTER_NULL_AWARE = const HintCode(
|
||||
'CAN_BE_NULL_AFTER_NULL_AWARE',
|
||||
"The target expression uses '?.', so its value can be null.",
|
||||
"Replace the '.' with a '?.' in the invocation.");
|
||||
correction: "Replace the '.' with a '?.' in the invocation.");
|
||||
|
||||
/**
|
||||
* Dead code is code that is never reached, this can happen for instance if a
|
||||
* statement follows a return statement.
|
||||
*/
|
||||
static const HintCode DEAD_CODE = const HintCode(
|
||||
'DEAD_CODE',
|
||||
"Dead code.",
|
||||
"Try removing the code, or "
|
||||
"fixing the code before it so that it can be reached.");
|
||||
static const HintCode DEAD_CODE = const HintCode('DEAD_CODE', "Dead code.",
|
||||
correction: "Try removing the code, or "
|
||||
"fixing the code before it so that it can be reached.");
|
||||
|
||||
/**
|
||||
* Dead code is code that is never reached. This case covers cases where the
|
||||
|
@ -64,8 +62,9 @@ class HintCode extends ErrorCode {
|
|||
'DEAD_CODE_CATCH_FOLLOWING_CATCH',
|
||||
"Dead code: catch clauses after a 'catch (e)' or "
|
||||
"an 'on Object catch (e)' are never reached.",
|
||||
"Try reordering the catch clauses so that they can be reached, or "
|
||||
"removing the unreachable catch clauses.");
|
||||
correction:
|
||||
"Try reordering the catch clauses so that they can be reached, or "
|
||||
"removing the unreachable catch clauses.");
|
||||
|
||||
/**
|
||||
* Dead code is code that is never reached. This case covers cases where the
|
||||
|
@ -80,8 +79,9 @@ class HintCode extends ErrorCode {
|
|||
'DEAD_CODE_ON_CATCH_SUBTYPE',
|
||||
"Dead code: this on-catch block will never be executed because '{0}' is "
|
||||
"a subtype of '{1}' and hence will have been caught above.",
|
||||
"Try reordering the catch clauses so that this block can be reached, or "
|
||||
"removing the unreachable catch clause.");
|
||||
correction:
|
||||
"Try reordering the catch clauses so that this block can be reached, or "
|
||||
"removing the unreachable catch clause.");
|
||||
|
||||
/**
|
||||
* Deprecated members should not be invoked or used.
|
||||
|
@ -90,9 +90,9 @@ class HintCode extends ErrorCode {
|
|||
* 0: the name of the member
|
||||
*/
|
||||
static const HintCode DEPRECATED_MEMBER_USE = const HintCode(
|
||||
'DEPRECATED_MEMBER_USE',
|
||||
"'{0}' is deprecated and shouldn't be used.",
|
||||
"Try replacing the use of the deprecated member with the replacement.");
|
||||
'DEPRECATED_MEMBER_USE', "'{0}' is deprecated and shouldn't be used.",
|
||||
correction:
|
||||
"Try replacing the use of the deprecated member with the replacement.");
|
||||
|
||||
/**
|
||||
* Users should not create a class named `Function` anymore.
|
||||
|
@ -100,23 +100,21 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode DEPRECATED_FUNCTION_CLASS_DECLARATION = const HintCode(
|
||||
'DEPRECATED_FUNCTION_CLASS_DECLARATION',
|
||||
"Declaring a class named 'Function' is deprecated.",
|
||||
"Try renaming the class.");
|
||||
correction: "Try renaming the class.");
|
||||
|
||||
/**
|
||||
* `Function` should not be extended anymore.
|
||||
*/
|
||||
static const HintCode DEPRECATED_EXTENDS_FUNCTION = const HintCode(
|
||||
'DEPRECATED_EXTENDS_FUNCTION',
|
||||
"Extending 'Function' is deprecated.",
|
||||
"Try removing 'Function' from the 'extends' clause.");
|
||||
'DEPRECATED_EXTENDS_FUNCTION', "Extending 'Function' is deprecated.",
|
||||
correction: "Try removing 'Function' from the 'extends' clause.");
|
||||
|
||||
/**
|
||||
* `Function` should not be mixed in anymore.
|
||||
*/
|
||||
static const HintCode DEPRECATED_MIXIN_FUNCTION = const HintCode(
|
||||
'DEPRECATED_MIXIN_FUNCTION',
|
||||
"Mixing in 'Function' is deprecated.",
|
||||
"Try removing 'Function' from the 'with' clause.");
|
||||
'DEPRECATED_MIXIN_FUNCTION', "Mixing in 'Function' is deprecated.",
|
||||
correction: "Try removing 'Function' from the 'with' clause.");
|
||||
|
||||
/**
|
||||
* Hint to use the ~/ operator.
|
||||
|
@ -124,13 +122,14 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode DIVISION_OPTIMIZATION = const HintCode(
|
||||
'DIVISION_OPTIMIZATION',
|
||||
"The operator x ~/ y is more efficient than (x / y).toInt().",
|
||||
"Try re-writing the expression to use the '~/' operator.");
|
||||
correction: "Try re-writing the expression to use the '~/' operator.");
|
||||
|
||||
/**
|
||||
* Duplicate imports.
|
||||
*/
|
||||
static const HintCode DUPLICATE_IMPORT = const HintCode('DUPLICATE_IMPORT',
|
||||
"Duplicate import.", "Try removing all but one import of the library.");
|
||||
static const HintCode DUPLICATE_IMPORT = const HintCode(
|
||||
'DUPLICATE_IMPORT', "Duplicate import.",
|
||||
correction: "Try removing all but one import of the library.");
|
||||
|
||||
/**
|
||||
* It is a bad practice for a source file in a package "lib" directory
|
||||
|
@ -144,8 +143,8 @@ class HintCode extends ErrorCode {
|
|||
'FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE',
|
||||
"A file in the 'lib' directory shouldn't import a file outside the "
|
||||
"'lib' directory.",
|
||||
"Try removing the import, or "
|
||||
"moving the imported file inside the 'lib' directory.");
|
||||
correction: "Try removing the import, or "
|
||||
"moving the imported file inside the 'lib' directory.");
|
||||
|
||||
/**
|
||||
* It is a bad practice for a source file ouside a package "lib" directory
|
||||
|
@ -159,7 +158,7 @@ class HintCode extends ErrorCode {
|
|||
'FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE',
|
||||
"A file outside the 'lib' directory shouldn't reference a file "
|
||||
"inside the 'lib' directory using a relative path.",
|
||||
"Try using a package: URI instead.");
|
||||
correction: "Try using a package: URI instead.");
|
||||
|
||||
/**
|
||||
* Generic type comments (`/*<T>*/` and `/*=T*/`) are no longer necessary and
|
||||
|
@ -168,7 +167,7 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode GENERIC_METHOD_COMMENT = const HintCode(
|
||||
'GENERIC_METHOD_COMMENT',
|
||||
"The generic type comment is being deprecated in favor of the real syntax.",
|
||||
"Try replacing the comment with the actual type annotation.");
|
||||
correction: "Try replacing the comment with the actual type annotation.");
|
||||
|
||||
/**
|
||||
* Deferred libraries shouldn't define a top level function 'loadLibrary'.
|
||||
|
@ -178,8 +177,8 @@ class HintCode extends ErrorCode {
|
|||
'IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION',
|
||||
"The library '{0}' defines a top-level function named 'loadLibrary' "
|
||||
"which is hidden by deferring this library.",
|
||||
"Try changing the import to not be deferred, or "
|
||||
"rename the function in the imported library.");
|
||||
correction: "Try changing the import to not be deferred, or "
|
||||
"rename the function in the imported library.");
|
||||
|
||||
/**
|
||||
* This hint is generated anywhere where the
|
||||
|
@ -193,8 +192,8 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode INVALID_ASSIGNMENT = const HintCode(
|
||||
'INVALID_ASSIGNMENT',
|
||||
"A value of type '{0}' can't be assigned to a variable of type '{1}'.",
|
||||
"Try changing the type of the variable, or "
|
||||
"casting the right-hand type to '{1}'.");
|
||||
correction: "Try changing the type of the variable, or "
|
||||
"casting the right-hand type to '{1}'.");
|
||||
|
||||
/**
|
||||
* This hint is generated anywhere a @factory annotation is associated with
|
||||
|
@ -241,11 +240,13 @@ class HintCode extends ErrorCode {
|
|||
* 1: the number of type parameters in the overridden method
|
||||
* 2: the name of the class where the overridden method is declared
|
||||
*/
|
||||
static const HintCode INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS = const HintCode(
|
||||
'INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS',
|
||||
"The method has {0} type parameters, but it is overriding a method "
|
||||
"with {1} type parameters from '{2}'.",
|
||||
"Try changing the number of type parameters so that they are the same.");
|
||||
static const HintCode INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS =
|
||||
const HintCode(
|
||||
'INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS',
|
||||
"The method has {0} type parameters, but it is overriding a method "
|
||||
"with {1} type parameters from '{2}'.",
|
||||
correction:
|
||||
"Try changing the number of type parameters so that they are the same.");
|
||||
|
||||
/**
|
||||
* Generic Method DEP: bounds of type parameters must be compatible.
|
||||
|
@ -263,7 +264,8 @@ class HintCode extends ErrorCode {
|
|||
'INVALID_METHOD_OVERRIDE_TYPE_PARAMETER_BOUND',
|
||||
"The type parameter '{0}' extends '{1}', but that is stricter than "
|
||||
"'{2}' extends '{3}' in the overridden method from '{4}'.",
|
||||
"Try changing the bounds on the type parameters so that they are compatible.");
|
||||
correction:
|
||||
"Try changing the bounds on the type parameters so that they are compatible.");
|
||||
|
||||
/**
|
||||
* This hint is generated anywhere where `@required` annotates a non named
|
||||
|
@ -276,7 +278,7 @@ class HintCode extends ErrorCode {
|
|||
'INVALID_REQUIRED_PARAM',
|
||||
"The type parameter '{0}' is annotated with @required but only named "
|
||||
"parameters without default value can be annotated with it.",
|
||||
"Remove @required.");
|
||||
correction: "Remove @required.");
|
||||
|
||||
/**
|
||||
* This hint is generated anywhere where a member annotated with `@protected`
|
||||
|
@ -308,7 +310,7 @@ class HintCode extends ErrorCode {
|
|||
'IS_DOUBLE',
|
||||
"When compiled to JS, this test might return true when the left hand "
|
||||
"side is an int.",
|
||||
"Try testing for 'num' instead.");
|
||||
correction: "Try testing for 'num' instead.");
|
||||
|
||||
/**
|
||||
* Hint for the `x is int` type checks.
|
||||
|
@ -317,7 +319,7 @@ class HintCode extends ErrorCode {
|
|||
'IS_INT',
|
||||
"When compiled to JS, this test might return true when the left hand "
|
||||
"side is a double.",
|
||||
"Try testing for 'num' instead.");
|
||||
correction: "Try testing for 'num' instead.");
|
||||
|
||||
/**
|
||||
* Hint for the `x is! double` type checks.
|
||||
|
@ -326,7 +328,7 @@ class HintCode extends ErrorCode {
|
|||
'IS_NOT_DOUBLE',
|
||||
"When compiled to JS, this test might return false when the left hand "
|
||||
"side is an int.",
|
||||
"Try testing for 'num' instead.");
|
||||
correction: "Try testing for 'num' instead.");
|
||||
|
||||
/**
|
||||
* Hint for the `x is! int` type checks.
|
||||
|
@ -335,7 +337,7 @@ class HintCode extends ErrorCode {
|
|||
'IS_NOT_INT',
|
||||
"When compiled to JS, this test might return false when the left hand "
|
||||
"side is a double.",
|
||||
"Try testing for 'num' instead.");
|
||||
correction: "Try testing for 'num' instead.");
|
||||
|
||||
/**
|
||||
* Generate a hint for an element that is annotated with `@JS(...)` whose
|
||||
|
@ -345,7 +347,7 @@ class HintCode extends ErrorCode {
|
|||
'MISSING_JS_LIB_ANNOTATION',
|
||||
"The @JS() annotation can only be used if it is also declared on the "
|
||||
"library directive.",
|
||||
"Try adding the annotation to the library directive.");
|
||||
correction: "Try adding the annotation to the library directive.");
|
||||
|
||||
/**
|
||||
* Generate a hint for a constructor, function or method invocation where a
|
||||
|
@ -382,7 +384,8 @@ class HintCode extends ErrorCode {
|
|||
'MISSING_RETURN',
|
||||
"This function declares a return type of '{0}', but doesn't end with a "
|
||||
"return statement.",
|
||||
"Try adding a return statement, or changing the return type to 'void'.");
|
||||
correction:
|
||||
"Try adding a return statement, or changing the return type to 'void'.");
|
||||
|
||||
/**
|
||||
* Generate a hint for classes that inherit from classes annotated with
|
||||
|
@ -421,8 +424,9 @@ class HintCode extends ErrorCode {
|
|||
'NULL_AWARE_IN_CONDITION',
|
||||
"The value of the '?.' operator can be 'null', which isn't appropriate "
|
||||
"in a condition.",
|
||||
"Try replacing the '?.' with a '.', testing the left-hand side for null if "
|
||||
"necessary.");
|
||||
correction:
|
||||
"Try replacing the '?.' with a '.', testing the left-hand side for null if "
|
||||
"necessary.");
|
||||
|
||||
/**
|
||||
* A condition in operands of a logical operator could evaluate to `null`
|
||||
|
@ -442,7 +446,7 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode OVERRIDE_EQUALS_BUT_NOT_HASH_CODE = const HintCode(
|
||||
'OVERRIDE_EQUALS_BUT_NOT_HASH_CODE',
|
||||
"The class '{0}' overrides 'operator==', but not 'get hashCode'.",
|
||||
"Try implementing 'hashCode'.");
|
||||
correction: "Try implementing 'hashCode'.");
|
||||
|
||||
/**
|
||||
* A getter with the override annotation does not override an existing getter.
|
||||
|
@ -450,8 +454,8 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode OVERRIDE_ON_NON_OVERRIDING_GETTER = const HintCode(
|
||||
'OVERRIDE_ON_NON_OVERRIDING_GETTER',
|
||||
"Getter doesn't override an inherited getter.",
|
||||
"Try updating this class to match the superclass, or "
|
||||
"removing the override annotation.");
|
||||
correction: "Try updating this class to match the superclass, or "
|
||||
"removing the override annotation.");
|
||||
|
||||
/**
|
||||
* A field with the override annotation does not override a getter or setter.
|
||||
|
@ -459,8 +463,8 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode OVERRIDE_ON_NON_OVERRIDING_FIELD = const HintCode(
|
||||
'OVERRIDE_ON_NON_OVERRIDING_FIELD',
|
||||
"Field doesn't override an inherited getter or setter.",
|
||||
"Try updating this class to match the superclass, or "
|
||||
"removing the override annotation.");
|
||||
correction: "Try updating this class to match the superclass, or "
|
||||
"removing the override annotation.");
|
||||
|
||||
/**
|
||||
* A method with the override annotation does not override an existing method.
|
||||
|
@ -468,8 +472,8 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode OVERRIDE_ON_NON_OVERRIDING_METHOD = const HintCode(
|
||||
'OVERRIDE_ON_NON_OVERRIDING_METHOD',
|
||||
"Method doesn't override an inherited method.",
|
||||
"Try updating this class to match the superclass, or "
|
||||
"removing the override annotation.");
|
||||
correction: "Try updating this class to match the superclass, or "
|
||||
"removing the override annotation.");
|
||||
|
||||
/**
|
||||
* A setter with the override annotation does not override an existing setter.
|
||||
|
@ -477,8 +481,8 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode OVERRIDE_ON_NON_OVERRIDING_SETTER = const HintCode(
|
||||
'OVERRIDE_ON_NON_OVERRIDING_SETTER',
|
||||
"Setter doesn't override an inherited setter.",
|
||||
"Try updating this class to match the superclass, or "
|
||||
"removing the override annotation.");
|
||||
correction: "Try updating this class to match the superclass, or "
|
||||
"removing the override annotation.");
|
||||
|
||||
/**
|
||||
* It is a bad practice for a package import to reference anything outside the
|
||||
|
@ -496,15 +500,14 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode TYPE_CHECK_IS_NOT_NULL = const HintCode(
|
||||
'TYPE_CHECK_IS_NOT_NULL',
|
||||
"Tests for non-null should be done with '!= null'.",
|
||||
"Try replacing the 'is! Null' check with '!= null'.");
|
||||
correction: "Try replacing the 'is! Null' check with '!= null'.");
|
||||
|
||||
/**
|
||||
* Type checks of the type `x is Null` should be done with `x == null`.
|
||||
*/
|
||||
static const HintCode TYPE_CHECK_IS_NULL = const HintCode(
|
||||
'TYPE_CHECK_IS_NULL',
|
||||
"Tests for null should be done with '== null'.",
|
||||
"Try replacing the 'is Null' check with '== null'.");
|
||||
'TYPE_CHECK_IS_NULL', "Tests for null should be done with '== null'.",
|
||||
correction: "Try replacing the 'is Null' check with '== null'.");
|
||||
|
||||
/**
|
||||
* This hint is generated anywhere where the
|
||||
|
@ -517,9 +520,9 @@ class HintCode extends ErrorCode {
|
|||
* 1: the name of the enclosing type where the getter is being looked for
|
||||
*/
|
||||
static const HintCode UNDEFINED_GETTER = const HintCode(
|
||||
'UNDEFINED_GETTER',
|
||||
"The getter '{0}' isn't defined for the class '{1}'.",
|
||||
"Try defining a getter or field named '{0}', or invoke a different getter.");
|
||||
'UNDEFINED_GETTER', "The getter '{0}' isn't defined for the class '{1}'.",
|
||||
correction:
|
||||
"Try defining a getter or field named '{0}', or invoke a different getter.");
|
||||
|
||||
/**
|
||||
* An undefined name hidden in an import or export directive.
|
||||
|
@ -527,7 +530,7 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode UNDEFINED_HIDDEN_NAME = const HintCode(
|
||||
'UNDEFINED_HIDDEN_NAME',
|
||||
"The library '{0}' doesn't export a member with the hidden name '{1}'.",
|
||||
"Try removing the name from the list of hidden members.");
|
||||
correction: "Try removing the name from the list of hidden members.");
|
||||
|
||||
/**
|
||||
* This hint is generated anywhere where the
|
||||
|
@ -539,10 +542,10 @@ class HintCode extends ErrorCode {
|
|||
* 1: the resolved type name that the method lookup is happening on
|
||||
*/
|
||||
static const HintCode UNDEFINED_METHOD = const HintCode(
|
||||
'UNDEFINED_METHOD',
|
||||
"The method '{0}' isn't defined for the class '{1}'.",
|
||||
"Try correcting the name to the name of an existing method, or "
|
||||
"defining a method named '{0}'.");
|
||||
'UNDEFINED_METHOD', "The method '{0}' isn't defined for the class '{1}'.",
|
||||
correction:
|
||||
"Try correcting the name to the name of an existing method, or "
|
||||
"defining a method named '{0}'.");
|
||||
|
||||
/**
|
||||
* This hint is generated anywhere where the
|
||||
|
@ -556,7 +559,7 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode UNDEFINED_OPERATOR = const HintCode(
|
||||
'UNDEFINED_OPERATOR',
|
||||
"The operator '{0}' isn't defined for the class '{1}'.",
|
||||
"Try defining the operator '{0}'.");
|
||||
correction: "Try defining the operator '{0}'.");
|
||||
|
||||
/**
|
||||
* This hint is generated anywhere where the
|
||||
|
@ -569,9 +572,9 @@ class HintCode extends ErrorCode {
|
|||
* 1: the name of the enclosing type where the setter is being looked for
|
||||
*/
|
||||
static const HintCode UNDEFINED_SETTER = const HintCode(
|
||||
'UNDEFINED_SETTER',
|
||||
"The setter '{0}' isn't defined for the class '{1}'.",
|
||||
"Try defining a setter or field named '{0}', or invoke a different setter.");
|
||||
'UNDEFINED_SETTER', "The setter '{0}' isn't defined for the class '{1}'.",
|
||||
correction:
|
||||
"Try defining a setter or field named '{0}', or invoke a different setter.");
|
||||
|
||||
/**
|
||||
* An undefined name shown in an import or export directive.
|
||||
|
@ -579,21 +582,21 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode UNDEFINED_SHOWN_NAME = const HintCode(
|
||||
'UNDEFINED_SHOWN_NAME',
|
||||
"The library '{0}' doesn't export a member with the shown name '{1}'.",
|
||||
"Try removing the name from the list of shown members.");
|
||||
correction: "Try removing the name from the list of shown members.");
|
||||
|
||||
/**
|
||||
* Unnecessary cast.
|
||||
*/
|
||||
static const HintCode UNNECESSARY_CAST = const HintCode(
|
||||
'UNNECESSARY_CAST', "Unnecessary cast.", "Try removing the cast.");
|
||||
'UNNECESSARY_CAST', "Unnecessary cast.",
|
||||
correction: "Try removing the cast.");
|
||||
|
||||
/**
|
||||
* Unnecessary `noSuchMethod` declaration.
|
||||
*/
|
||||
static const HintCode UNNECESSARY_NO_SUCH_METHOD = const HintCode(
|
||||
'UNNECESSARY_NO_SUCH_METHOD',
|
||||
"Unnecessary 'noSuchMethod' declaration.",
|
||||
"Try removing the declaration of 'noSuchMethod'.");
|
||||
'UNNECESSARY_NO_SUCH_METHOD', "Unnecessary 'noSuchMethod' declaration.",
|
||||
correction: "Try removing the declaration of 'noSuchMethod'.");
|
||||
|
||||
/**
|
||||
* Unnecessary type checks, the result is always false.
|
||||
|
@ -601,7 +604,7 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode UNNECESSARY_TYPE_CHECK_FALSE = const HintCode(
|
||||
'UNNECESSARY_TYPE_CHECK_FALSE',
|
||||
"Unnecessary type check, the result is always false.",
|
||||
"Try correcting the type check, or removing the type check.");
|
||||
correction: "Try correcting the type check, or removing the type check.");
|
||||
|
||||
/**
|
||||
* Unnecessary type checks, the result is always true.
|
||||
|
@ -609,7 +612,7 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode UNNECESSARY_TYPE_CHECK_TRUE = const HintCode(
|
||||
'UNNECESSARY_TYPE_CHECK_TRUE',
|
||||
"Unnecessary type check, the result is always true.",
|
||||
"Try correcting the type check, or removing the type check.");
|
||||
correction: "Try correcting the type check, or removing the type check.");
|
||||
|
||||
/**
|
||||
* Unused catch exception variables.
|
||||
|
@ -620,7 +623,7 @@ class HintCode extends ErrorCode {
|
|||
// TODO(brianwilkerson) Split this error code so that we can differentiate
|
||||
// between removing the catch clause and replacing the catch clause with
|
||||
// an on clause.
|
||||
"Try removing the catch clause.");
|
||||
correction: "Try removing the catch clause.");
|
||||
|
||||
/**
|
||||
* Unused catch stack trace variables.
|
||||
|
@ -628,21 +631,21 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode UNUSED_CATCH_STACK = const HintCode(
|
||||
'UNUSED_CATCH_STACK',
|
||||
"The stack trace variable '{0}' isn't used and can be removed.",
|
||||
"Try removing the stack trace variable, or using it.");
|
||||
correction: "Try removing the stack trace variable, or using it.");
|
||||
|
||||
/**
|
||||
* See [Modifier.IS_USED_IN_LIBRARY].
|
||||
*/
|
||||
static const HintCode UNUSED_ELEMENT = const HintCode('UNUSED_ELEMENT',
|
||||
"The {0} '{1}' isn't used.", "Try removing the declaration of '{1}'.");
|
||||
static const HintCode UNUSED_ELEMENT = const HintCode(
|
||||
'UNUSED_ELEMENT', "The {0} '{1}' isn't used.",
|
||||
correction: "Try removing the declaration of '{1}'.");
|
||||
|
||||
/**
|
||||
* Unused fields are fields which are never read.
|
||||
*/
|
||||
static const HintCode UNUSED_FIELD = const HintCode(
|
||||
'UNUSED_FIELD',
|
||||
"The value of the field '{0}' isn't used.",
|
||||
"Try removing the field, or using it.");
|
||||
'UNUSED_FIELD', "The value of the field '{0}' isn't used.",
|
||||
correction: "Try removing the field, or using it.");
|
||||
|
||||
/**
|
||||
* Unused imports are imports which are never used.
|
||||
|
@ -650,18 +653,18 @@ class HintCode extends ErrorCode {
|
|||
* Parameters:
|
||||
* 0: The content of the unused import's uri
|
||||
*/
|
||||
static const HintCode UNUSED_IMPORT = const HintCode('UNUSED_IMPORT',
|
||||
"Unused import: '{0}'.", "Try removing the import directive.");
|
||||
static const HintCode UNUSED_IMPORT = const HintCode(
|
||||
'UNUSED_IMPORT', "Unused import: '{0}'.",
|
||||
correction: "Try removing the import directive.");
|
||||
|
||||
/**
|
||||
* Unused labels are labels that are never referenced in either a 'break' or
|
||||
* 'continue' statement.
|
||||
*/
|
||||
static const HintCode UNUSED_LABEL = const HintCode(
|
||||
'UNUSED_LABEL',
|
||||
"The label '{0}' isn't used.",
|
||||
"Try removing the label, or "
|
||||
"using it in either a 'break' or 'continue' statement.");
|
||||
static const HintCode UNUSED_LABEL =
|
||||
const HintCode('UNUSED_LABEL', "The label '{0}' isn't used.",
|
||||
correction: "Try removing the label, or "
|
||||
"using it in either a 'break' or 'continue' statement.");
|
||||
|
||||
/**
|
||||
* Unused local variables are local variables that are never read.
|
||||
|
@ -669,15 +672,14 @@ class HintCode extends ErrorCode {
|
|||
static const HintCode UNUSED_LOCAL_VARIABLE = const HintCode(
|
||||
'UNUSED_LOCAL_VARIABLE',
|
||||
"The value of the local variable '{0}' isn't used.",
|
||||
"Try removing the variable, or using it.");
|
||||
correction: "Try removing the variable, or using it.");
|
||||
|
||||
/**
|
||||
* Unused shown names are names shown on imports which are never used.
|
||||
*/
|
||||
static const HintCode UNUSED_SHOWN_NAME = const HintCode(
|
||||
'UNUSED_SHOWN_NAME',
|
||||
"The name {0} is shown, but not used.",
|
||||
"Try removing the name from the list of shown members.");
|
||||
'UNUSED_SHOWN_NAME', "The name {0} is shown, but not used.",
|
||||
correction: "Try removing the name from the list of shown members.");
|
||||
|
||||
/**
|
||||
* It will be a static type warning if <i>m</i> is not a generic method with
|
||||
|
@ -692,7 +694,7 @@ class HintCode extends ErrorCode {
|
|||
'WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD',
|
||||
"The method '{0}' is declared with {1} type parameters, "
|
||||
"but {2} type arguments were given.",
|
||||
"Try adjusting the number of type arguments.");
|
||||
correction: "Try adjusting the number of type arguments.");
|
||||
|
||||
/**
|
||||
* Initialize a newly created error code to have the given [name]. The message
|
||||
|
@ -700,8 +702,8 @@ class HintCode extends ErrorCode {
|
|||
* template. The correction associated with the error will be created from the
|
||||
* given [correction] template.
|
||||
*/
|
||||
const HintCode(String name, String message, [String correction])
|
||||
: super(name, message, correction);
|
||||
const HintCode(String name, String message, {String correction})
|
||||
: super(name, message, correction: correction);
|
||||
|
||||
@override
|
||||
ErrorSeverity get errorSeverity => ErrorType.HINT.severity;
|
||||
|
|
|
@ -14,8 +14,8 @@ import 'package:analyzer/error/error.dart';
|
|||
* might aggregated to define a project's style guide.
|
||||
*/
|
||||
class LintCode extends ErrorCode {
|
||||
const LintCode(String name, String message, [String correction])
|
||||
: super(name, message, correction);
|
||||
const LintCode(String name, String message, {String correction})
|
||||
: super(name, message, correction: correction);
|
||||
|
||||
@override
|
||||
ErrorSeverity get errorSeverity => ErrorSeverity.INFO;
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -4869,8 +4869,9 @@ class ResolverErrorCode extends ErrorCode {
|
|||
'PART_OF_UNNAMED_LIBRARY',
|
||||
"Library is unnamed. Expected a URI not a library name '{0}' in the "
|
||||
"part-of directive.",
|
||||
"Try changing the part-of directive to a URI, or try including a"
|
||||
" different part.");
|
||||
correction:
|
||||
"Try changing the part-of directive to a URI, or try including a"
|
||||
" different part.");
|
||||
|
||||
/**
|
||||
* Initialize a newly created error code to have the given [name]. The message
|
||||
|
@ -4878,8 +4879,8 @@ class ResolverErrorCode extends ErrorCode {
|
|||
* template. The correction associated with the error will be created from the
|
||||
* given [correction] template.
|
||||
*/
|
||||
const ResolverErrorCode(String name, String message, [String correction])
|
||||
: super(name, message, correction);
|
||||
const ResolverErrorCode(String name, String message, {String correction})
|
||||
: super(name, message, correction: correction);
|
||||
|
||||
@override
|
||||
ErrorSeverity get errorSeverity => type.severity;
|
||||
|
|
|
@ -28,8 +28,8 @@ class HtmlErrorCode extends ErrorCode {
|
|||
* template. The correction associated with the error will be created from the
|
||||
* given [correction] template.
|
||||
*/
|
||||
const HtmlErrorCode(String name, String message, [String correction])
|
||||
: super(name, message, correction);
|
||||
const HtmlErrorCode(String name, String message, {String correction})
|
||||
: super(name, message, correction: correction);
|
||||
|
||||
@override
|
||||
ErrorSeverity get errorSeverity => ErrorSeverity.ERROR;
|
||||
|
@ -71,8 +71,8 @@ class HtmlWarningCode extends ErrorCode {
|
|||
* template. The correction associated with the error will be created from the
|
||||
* given [correction] template.
|
||||
*/
|
||||
const HtmlWarningCode(String name, String message, [String correction])
|
||||
: super(name, message, correction);
|
||||
const HtmlWarningCode(String name, String message, {String correction})
|
||||
: super(name, message, correction: correction);
|
||||
|
||||
@override
|
||||
ErrorSeverity get errorSeverity => ErrorSeverity.WARNING;
|
||||
|
|
|
@ -19,9 +19,8 @@ class PubspecWarningCode extends ErrorCode {
|
|||
*/
|
||||
static const PubspecWarningCode ASSET_DOES_NOT_EXIST =
|
||||
const PubspecWarningCode(
|
||||
'ASSET_DOES_NOT_EXIST',
|
||||
"The asset {0} does not exist.",
|
||||
"Try creating the file or fixing the path to the file.");
|
||||
'ASSET_DOES_NOT_EXIST', "The asset {0} does not exist.",
|
||||
correction: "Try creating the file or fixing the path to the file.");
|
||||
|
||||
/**
|
||||
* A code indicating that the value of the asset field is not a list.
|
||||
|
@ -29,41 +28,38 @@ class PubspecWarningCode extends ErrorCode {
|
|||
static const PubspecWarningCode ASSET_FIELD_NOT_LIST = const PubspecWarningCode(
|
||||
'ASSET_FIELD_NOT_LIST',
|
||||
"The value of the 'asset' field is expected to be a list of relative file paths.",
|
||||
"Try converting the value to be a list of relative file paths.");
|
||||
correction:
|
||||
"Try converting the value to be a list of relative file paths.");
|
||||
|
||||
/**
|
||||
* A code indicating that an element in the asset list is not a string.
|
||||
*/
|
||||
static const PubspecWarningCode ASSET_NOT_STRING = const PubspecWarningCode(
|
||||
'ASSET_NOT_STRING',
|
||||
"Assets are expected to be a file paths (strings).",
|
||||
"Try converting the value to be a string.");
|
||||
'ASSET_NOT_STRING', "Assets are expected to be a file paths (strings).",
|
||||
correction: "Try converting the value to be a string.");
|
||||
|
||||
/**
|
||||
* A code indicating that the value of a dependencies field is not a map.
|
||||
*/
|
||||
static const PubspecWarningCode DEPENDENCIES_FIELD_NOT_MAP =
|
||||
const PubspecWarningCode(
|
||||
'DEPENDENCIES_FIELD_NOT_MAP',
|
||||
const PubspecWarningCode('DEPENDENCIES_FIELD_NOT_MAP',
|
||||
"The value of the '{0}' field is expected to be a map.",
|
||||
"Try converting the value to be a map.");
|
||||
correction: "Try converting the value to be a map.");
|
||||
|
||||
/**
|
||||
* A code indicating that the value of the flutter field is not a map.
|
||||
*/
|
||||
static const PubspecWarningCode FLUTTER_FIELD_NOT_MAP =
|
||||
const PubspecWarningCode(
|
||||
'FLUTTER_FIELD_NOT_MAP',
|
||||
const PubspecWarningCode('FLUTTER_FIELD_NOT_MAP',
|
||||
"The value of the 'flutter' field is expected to be a map.",
|
||||
"Try converting the value to be a map.");
|
||||
correction: "Try converting the value to be a map.");
|
||||
|
||||
/**
|
||||
* A code indicating that the name field is missing.
|
||||
*/
|
||||
static const PubspecWarningCode MISSING_NAME = const PubspecWarningCode(
|
||||
'MISSING_NAME',
|
||||
"The name field is required but missing.",
|
||||
"Try adding a field named 'name'.");
|
||||
'MISSING_NAME', "The name field is required but missing.",
|
||||
correction: "Try adding a field named 'name'.");
|
||||
|
||||
/**
|
||||
* A code indicating that the name field is not a string.
|
||||
|
@ -71,7 +67,7 @@ class PubspecWarningCode extends ErrorCode {
|
|||
static const PubspecWarningCode NAME_NOT_STRING = const PubspecWarningCode(
|
||||
'NAME_NOT_STRING',
|
||||
"The value of the name field is expected to be a string.",
|
||||
"Try converting the value to be a string.");
|
||||
correction: "Try converting the value to be a string.");
|
||||
|
||||
/**
|
||||
* A code indicating that a package listed as a dev dependency is also listed
|
||||
|
@ -85,14 +81,14 @@ class PubspecWarningCode extends ErrorCode {
|
|||
'UNNECESSARY_DEV_DEPENDENCY',
|
||||
"The dev dependency on {0} is unnecessary because there is also a "
|
||||
"normal dependency on that package.",
|
||||
"Try removing the dev dependency.");
|
||||
correction: "Try removing the dev dependency.");
|
||||
|
||||
/**
|
||||
* Initialize a newly created warning code to have the given [name], [message]
|
||||
* and [correction].
|
||||
*/
|
||||
const PubspecWarningCode(String name, String message, [String correction])
|
||||
: super(name, message, correction);
|
||||
const PubspecWarningCode(String name, String message, {String correction})
|
||||
: super(name, message, correction: correction);
|
||||
|
||||
@override
|
||||
ErrorSeverity get errorSeverity => ErrorSeverity.WARNING;
|
||||
|
|
|
@ -144,8 +144,8 @@ class YamlErrorCode extends ErrorCode {
|
|||
* template. The correction associated with the error will be created from the
|
||||
* given [correction] template.
|
||||
*/
|
||||
const YamlErrorCode(String name, String message, [String correction])
|
||||
: super(name, message, correction);
|
||||
const YamlErrorCode(String name, String message, {String correction})
|
||||
: super(name, message, correction: correction);
|
||||
|
||||
@override
|
||||
ErrorSeverity get errorSeverity => ErrorSeverity.ERROR;
|
||||
|
|
|
@ -31,7 +31,7 @@ abstract class ErrorCode {
|
|||
* template. The correction associated with the error will be created from the
|
||||
* given [correction] template.
|
||||
*/
|
||||
const ErrorCode(this.name, this.message, [this.correction]);
|
||||
const ErrorCode(this.name, this.message, {this.correction});
|
||||
|
||||
/**
|
||||
* The severity of the error.
|
||||
|
|
|
@ -47,10 +47,9 @@ class ScannerErrorCode extends ErrorCode {
|
|||
|
||||
static const ScannerErrorCode UNTERMINATED_MULTI_LINE_COMMENT =
|
||||
const ScannerErrorCode(
|
||||
'UNTERMINATED_MULTI_LINE_COMMENT',
|
||||
"Unterminated multi-line comment.",
|
||||
"Try terminating the comment with '*/', or "
|
||||
"removing any unbalanced occurances of '/*' (because comments nest in Dart).");
|
||||
'UNTERMINATED_MULTI_LINE_COMMENT', "Unterminated multi-line comment.",
|
||||
correction: "Try terminating the comment with '*/', or "
|
||||
"removing any unbalanced occurances of '/*' (because comments nest in Dart).");
|
||||
|
||||
static const ScannerErrorCode UNTERMINATED_STRING_LITERAL =
|
||||
const ScannerErrorCode(
|
||||
|
@ -62,8 +61,8 @@ class ScannerErrorCode extends ErrorCode {
|
|||
* template. The correction associated with the error will be created from the
|
||||
* given [correction] template.
|
||||
*/
|
||||
const ScannerErrorCode(String name, String message, [String correction])
|
||||
: super(name, message, correction);
|
||||
const ScannerErrorCode(String name, String message, {String correction})
|
||||
: super(name, message, correction: correction);
|
||||
|
||||
@override
|
||||
ErrorSeverity get errorSeverity => ErrorSeverity.ERROR;
|
||||
|
|
Loading…
Reference in a new issue