Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1376)

Unified Diff: pkg/analyzer/lib/src/error/codes.dart

Issue 2346803005: Remove use of shared messages (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/generated/shared_messages.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/error/codes.dart
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 9ca769e2f63859d2fc6c1b22c25901a19af1e604..d87b593ce4f10c9467aa5edc44be8f18f8a0a109 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -6,8 +6,6 @@ library analyzer.src.error.codes;
import 'package:analyzer/error/error.dart';
import 'package:analyzer/src/dart/element/element.dart';
-import 'package:analyzer/src/generated/generated/shared_messages.dart'
- as shared_messages;
/**
* The error codes used for errors in analysis options files. The convention for
@@ -1944,21 +1942,29 @@ class CompileTimeErrorCode extends ErrorCode {
* <i>rethrow;</i> is not enclosed within a on-catch clause.
*/
static const CompileTimeErrorCode RETHROW_OUTSIDE_CATCH =
- shared_messages.RETHROW_OUTSIDE_CATCH;
+ const CompileTimeErrorCode(
+ 'RETHROW_OUTSIDE_CATCH',
+ "Rethrow must be inside of catch clause.",
+ "Try moving the expression into a catch clause, or using a 'throw' expression.");
/**
* 13.12 Return: It is a compile-time error if a return statement of the form
* <i>return e;</i> appears in a generative constructor.
*/
static const CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR =
- shared_messages.RETURN_IN_GENERATIVE_CONSTRUCTOR;
+ const CompileTimeErrorCode(
+ 'RETURN_IN_GENERATIVE_CONSTRUCTOR',
+ "Constructors can't return values.",
+ "Try removing the return statement or using a factory constructor.");
/**
* 13.12 Return: It is a compile-time error if a return statement of the form
* <i>return e;</i> appears in a generator function.
*/
- static const CompileTimeErrorCode RETURN_IN_GENERATOR =
- shared_messages.RETURN_IN_GENERATOR;
+ static const CompileTimeErrorCode RETURN_IN_GENERATOR = const CompileTimeErrorCode(
+ 'RETURN_IN_GENERATOR',
+ "Can't return a value from a generator function (using the '{0}' modifier).",
+ "Try removing the value, replacing 'return' with 'yield' or changing the method body modifier.");
/**
* 14.1 Imports: It is a compile-time error if a prefix used in a deferred
@@ -2206,8 +2212,10 @@ class HintCode extends ErrorCode {
* 0: the name of the actual argument type
* 1: the name of the expected type
*/
- static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE =
- shared_messages.ARGUMENT_TYPE_NOT_ASSIGNABLE_HINT;
+ static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE = const HintCode(
+ 'ARGUMENT_TYPE_NOT_ASSIGNABLE',
+ "The argument type '{0}' cannot be assigned to the parameter type '{1}'.",
+ null);
/**
* When the target expression uses '?.' operator, it can be `null`, so all the
@@ -2477,8 +2485,8 @@ class HintCode extends ErrorCode {
* 0: the name of the getter
* 1: the name of the enclosing type where the getter is being looked for
*/
- static const HintCode UNDEFINED_GETTER =
- shared_messages.UNDEFINED_GETTER_HINT;
+ static const HintCode UNDEFINED_GETTER = const HintCode('UNDEFINED_GETTER',
+ "The getter '{0}' is not defined for the class '{1}'.", null);
/**
* An undefined name hidden in an import or export directive.
@@ -2496,8 +2504,8 @@ class HintCode extends ErrorCode {
* 0: the name of the method that is undefined
* 1: the resolved type name that the method lookup is happening on
*/
- static const HintCode UNDEFINED_METHOD =
- shared_messages.UNDEFINED_METHOD_HINT;
+ static const HintCode UNDEFINED_METHOD = const HintCode('UNDEFINED_METHOD',
+ "The method '{0}' is not defined for the class '{1}'.", null);
/**
* This hint is generated anywhere where the
@@ -2508,8 +2516,10 @@ class HintCode extends ErrorCode {
* 0: the name of the operator
* 1: the name of the enclosing type where the operator is being looked for
*/
- static const HintCode UNDEFINED_OPERATOR =
- shared_messages.UNDEFINED_OPERATOR_HINT;
+ static const HintCode UNDEFINED_OPERATOR = const HintCode(
+ 'UNDEFINED_OPERATOR',
+ "The operator '{0}' is not defined for the class '{1}'.",
+ null);
/**
* This hint is generated anywhere where the
@@ -2521,8 +2531,8 @@ class HintCode extends ErrorCode {
* 0: the name of the setter
* 1: the name of the enclosing type where the setter is being looked for
*/
- static const HintCode UNDEFINED_SETTER =
- shared_messages.UNDEFINED_SETTER_HINT;
+ static const HintCode UNDEFINED_SETTER = const HintCode('UNDEFINED_SETTER',
+ "The setter '{0}' is not defined for the class '{1}'.", null);
/**
* An undefined name shown in an import or export directive.
@@ -2995,7 +3005,10 @@ class StaticTypeWarningCode extends ErrorCode {
* 2: the name of the method
*/
static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE =
- shared_messages.RETURN_OF_INVALID_TYPE;
+ const StaticTypeWarningCode(
+ 'RETURN_OF_INVALID_TYPE',
+ "The return type '{0}' is not a '{1}', as defined by the method '{2}'.",
+ null);
/**
* 12.11 Instance Creation: It is a static type warning if any of the type
@@ -3052,7 +3065,8 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the name of the enumeration used to access the constant
*/
static const StaticTypeWarningCode UNDEFINED_ENUM_CONSTANT =
- shared_messages.UNDEFINED_ENUM_CONSTANT;
+ const StaticTypeWarningCode('UNDEFINED_ENUM_CONSTANT',
+ "There is no constant named '{0}' in '{1}'.", null);
/**
* 12.15.3 Unqualified Invocation: If there exists a lexically visible
@@ -3067,7 +3081,8 @@ class StaticTypeWarningCode extends ErrorCode {
* 0: the name of the method that is undefined
*/
static const StaticTypeWarningCode UNDEFINED_FUNCTION =
- shared_messages.UNDEFINED_FUNCTION;
+ const StaticTypeWarningCode(
+ 'UNDEFINED_FUNCTION', "The function '{0}' is not defined.", null);
/**
* 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is
@@ -3078,7 +3093,8 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the name of the enclosing type where the getter is being looked for
*/
static const StaticTypeWarningCode UNDEFINED_GETTER =
- shared_messages.UNDEFINED_GETTER_STATIC_TYPE_WARNING;
+ const StaticTypeWarningCode('UNDEFINED_GETTER',
+ "The getter '{0}' is not defined for the class '{1}'.", null);
/**
* 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>.
@@ -3090,7 +3106,8 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the resolved type name that the method lookup is happening on
*/
static const StaticTypeWarningCode UNDEFINED_METHOD =
- shared_messages.UNDEFINED_METHOD_STATIC_TYPE_WARNING;
+ const StaticTypeWarningCode('UNDEFINED_METHOD',
+ "The method '{0}' is not defined for the class '{1}'.", null);
/**
* 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>.
@@ -3102,7 +3119,10 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the resolved type name that the method lookup is happening on
*/
static const StaticTypeWarningCode UNDEFINED_METHOD_WITH_CONSTRUCTOR =
- shared_messages.UNDEFINED_METHOD_WITH_CONSTRUCTOR;
+ const StaticTypeWarningCode(
+ 'UNDEFINED_METHOD_WITH_CONSTRUCTOR',
+ "The method '{0}' is not defined for the class '{1}', but a constructor with that name is defined.",
+ "Try adding 'new' or 'const' to invoke the constuctor, or change the method name.");
/**
* 12.18 Assignment: Evaluation of an assignment of the form
@@ -3125,7 +3145,8 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the name of the enclosing type where the operator is being looked for
*/
static const StaticTypeWarningCode UNDEFINED_OPERATOR =
- shared_messages.UNDEFINED_OPERATOR_STATIC_TYPE_WARNING;
+ const StaticTypeWarningCode('UNDEFINED_OPERATOR',
+ "The operator '{0}' is not defined for the class '{1}'.", null);
/**
* 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>.
@@ -3139,7 +3160,8 @@ class StaticTypeWarningCode extends ErrorCode {
* See [INACCESSIBLE_SETTER].
*/
static const StaticTypeWarningCode UNDEFINED_SETTER =
- shared_messages.UNDEFINED_SETTER_STATIC_TYPE_WARNING;
+ const StaticTypeWarningCode('UNDEFINED_SETTER',
+ "The setter '{0}' is not defined for the class '{1}'.", null);
/**
* 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is
@@ -3150,7 +3172,8 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the name of the enclosing type where the getter is being looked for
*/
static const StaticTypeWarningCode UNDEFINED_SUPER_GETTER =
- shared_messages.UNDEFINED_SUPER_GETTER_STATIC_TYPE_WARNING;
+ const StaticTypeWarningCode('UNDEFINED_SUPER_GETTER',
+ "The getter '{0}' is not defined in a superclass of '{1}'.", null);
/**
* 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
@@ -3164,7 +3187,8 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the resolved type name that the method lookup is happening on
*/
static const StaticTypeWarningCode UNDEFINED_SUPER_METHOD =
- shared_messages.UNDEFINED_SUPER_METHOD;
+ const StaticTypeWarningCode('UNDEFINED_SUPER_METHOD',
+ "The method '{0}' is not defined in a superclass of '{1}'.", null);
/**
* 12.18 Assignment: Evaluation of an assignment of the form
@@ -3187,7 +3211,8 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the name of the enclosing type where the operator is being looked for
*/
static const StaticTypeWarningCode UNDEFINED_SUPER_OPERATOR =
- shared_messages.UNDEFINED_SUPER_OPERATOR;
+ const StaticTypeWarningCode('UNDEFINED_SUPER_OPERATOR',
+ "The operator '{0}' is not defined in a superclass of '{1}'.", null);
/**
* 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>.
@@ -3201,7 +3226,8 @@ class StaticTypeWarningCode extends ErrorCode {
* See [INACCESSIBLE_SETTER].
*/
static const StaticTypeWarningCode UNDEFINED_SUPER_SETTER =
- shared_messages.UNDEFINED_SUPER_SETTER_STATIC_TYPE_WARNING;
+ const StaticTypeWarningCode('UNDEFINED_SUPER_SETTER',
+ "The setter '{0}' is not defined in a superclass of '{1}'.", null);
/**
* 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does
@@ -3354,7 +3380,10 @@ class StaticWarningCode extends ErrorCode {
* 1: the name of the expected type
*/
static const StaticWarningCode ARGUMENT_TYPE_NOT_ASSIGNABLE =
- shared_messages.ARGUMENT_TYPE_NOT_ASSIGNABLE_STATIC_WARNING;
+ const StaticWarningCode(
+ 'ARGUMENT_TYPE_NOT_ASSIGNABLE',
+ "The argument type '{0}' cannot be assigned to the parameter type '{1}'.",
+ null);
/**
* 5 Variables: Attempting to assign to a final variable elsewhere will cause
@@ -4464,8 +4493,10 @@ class StaticWarningCode extends ErrorCode {
* 0: the name of the getter
* 1: the name of the enclosing type where the getter is being looked for
*/
- static const StaticWarningCode UNDEFINED_GETTER =
- shared_messages.UNDEFINED_GETTER_STATIC_WARNING;
+ static const StaticWarningCode UNDEFINED_GETTER = const StaticWarningCode(
+ 'UNDEFINED_GETTER',
+ "The getter '{0}' is not defined for the class '{1}'.",
+ null);
/**
* 12.30 Identifier Reference: It is as static warning if an identifier
@@ -4515,8 +4546,10 @@ class StaticWarningCode extends ErrorCode {
* 0: the name of the getter
* 1: the name of the enclosing type where the setter is being looked for
*/
- static const StaticWarningCode UNDEFINED_SETTER =
- shared_messages.UNDEFINED_SETTER_STATIC_WARNING;
+ static const StaticWarningCode UNDEFINED_SETTER = const StaticWarningCode(
+ 'UNDEFINED_SETTER',
+ "The setter '{0}' is not defined for the class '{1}'.",
+ null);
/**
* 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not
@@ -4540,7 +4573,8 @@ class StaticWarningCode extends ErrorCode {
* 1: the name of the enclosing type where the getter is being looked for
*/
static const StaticWarningCode UNDEFINED_SUPER_GETTER =
- shared_messages.UNDEFINED_SUPER_GETTER_STATIC_WARNING;
+ const StaticWarningCode('UNDEFINED_SUPER_GETTER',
+ "The getter '{0}' is not defined in a superclass of '{1}'.", null);
/**
* 12.18 Assignment: It is as static warning if an assignment of the form
@@ -4558,7 +4592,8 @@ class StaticWarningCode extends ErrorCode {
* 1: the name of the enclosing type where the setter is being looked for
*/
static const StaticWarningCode UNDEFINED_SUPER_SETTER =
- shared_messages.UNDEFINED_SUPER_SETTER_STATIC_WARNING;
+ const StaticWarningCode('UNDEFINED_SUPER_SETTER',
+ "The setter '{0}' is not defined in a superclass of '{1}'.", null);
/**
* 7.2 Getters: It is a static warning if the return type of a getter is void.
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/generated/shared_messages.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698