Improve analyzer/fasta error code matching
This addresses a comment in https://dart-review.googlesource.com/c/sdk/+/74600,
updates the "run fasta generate first" exception message,
and converts more Analyzer errors to be auto generated.
Change-Id: I9c98184d1b9fe642dab4d66fbcd961dc27dfa6f9
Reviewed-on: https://dart-review.googlesource.com/74900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
diff --git a/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart b/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
index c418f97..83be441 100644
--- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
+++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
@@ -602,17 +602,14 @@
correction: "Try adding a library name after the 'of'.");
static const ParserErrorCode MISSING_PREFIX_IN_DEFERRED_IMPORT =
- const ParserErrorCode('MISSING_PREFIX_IN_DEFERRED_IMPORT',
- "Deferred imports should have a prefix.",
- correction: "Try adding a prefix to the import.");
+ _MISSING_PREFIX_IN_DEFERRED_IMPORT;
static const ParserErrorCode MISSING_STAR_AFTER_SYNC = const ParserErrorCode(
'MISSING_STAR_AFTER_SYNC',
"The modifier 'sync' must be followed by a star ('*').",
correction: "Try removing the modifier, or add a star.");
- static const ParserErrorCode MISSING_STATEMENT =
- const ParserErrorCode('MISSING_STATEMENT', "Expected a statement.");
+ static const ParserErrorCode MISSING_STATEMENT = _MISSING_STATEMENT;
/**
* Parameters:
@@ -638,11 +635,8 @@
"Can't have both positional and named parameters in a single parameter list.",
correction: "Try choosing a single style of optional parameters.");
- static const ParserErrorCode MULTIPLE_EXTENDS_CLAUSES = const ParserErrorCode(
- 'MULTIPLE_EXTENDS_CLAUSES',
- "Each class definition can have at most one extends clause.",
- correction:
- "Try choosing one superclass and define your class to implement (or mix in) the others.");
+ static const ParserErrorCode MULTIPLE_EXTENDS_CLAUSES =
+ _MULTIPLE_EXTENDS_CLAUSES;
static const ParserErrorCode MULTIPLE_IMPLEMENTS_CLAUSES = const ParserErrorCode(
'MULTIPLE_IMPLEMENTS_CLAUSES',
@@ -651,24 +645,17 @@
"Try combining all of the implements clauses into a single clause.");
static const ParserErrorCode MULTIPLE_LIBRARY_DIRECTIVES =
- const ParserErrorCode('MULTIPLE_LIBRARY_DIRECTIVES',
- "Only one library directive may be declared in a file.",
- correction: "Try removing all but one of the library directives.");
+ _MULTIPLE_LIBRARY_DIRECTIVES;
static const ParserErrorCode MULTIPLE_NAMED_PARAMETER_GROUPS =
const ParserErrorCode('MULTIPLE_NAMED_PARAMETER_GROUPS',
"Can't have multiple groups of named parameters in a single parameter list.",
correction: "Try combining all of the groups into a single group.");
- static const ParserErrorCode MULTIPLE_ON_CLAUSES = const ParserErrorCode(
- 'MULTIPLE_ON_CLAUSES',
- "Each mixin definition can have at most one on clause.",
- correction: "Try combining all of the on clauses into a single clause.");
+ static const ParserErrorCode MULTIPLE_ON_CLAUSES = _MULTIPLE_ON_CLAUSES;
static const ParserErrorCode MULTIPLE_PART_OF_DIRECTIVES =
- const ParserErrorCode('MULTIPLE_PART_OF_DIRECTIVES',
- "Only one part-of directive may be declared in a file.",
- correction: "Try removing all but one of the part-of directives.");
+ _MULTIPLE_PART_OF_DIRECTIVES;
static const ParserErrorCode MULTIPLE_POSITIONAL_PARAMETER_GROUPS =
const ParserErrorCode('MULTIPLE_POSITIONAL_PARAMETER_GROUPS',
@@ -687,11 +674,7 @@
correction:
"Try moving all but one of the declarations inside the loop body.");
- static const ParserErrorCode MULTIPLE_WITH_CLAUSES = const ParserErrorCode(
- 'MULTIPLE_WITH_CLAUSES',
- "Each class definition can have at most one with clause.",
- correction:
- "Try combining all of the with clauses into a single clause.");
+ static const ParserErrorCode MULTIPLE_WITH_CLAUSES = _MULTIPLE_WITH_CLAUSES;
static const ParserErrorCode NAMED_FUNCTION_EXPRESSION = const ParserErrorCode(
'NAMED_FUNCTION_EXPRESSION', "Function expressions can't be named.",
@@ -722,10 +705,7 @@
correction: "Try removing the word 'native'.");
static const ParserErrorCode NATIVE_CLAUSE_SHOULD_BE_ANNOTATION =
- const ParserErrorCode('NATIVE_CLAUSE_SHOULD_BE_ANNOTATION',
- "Native clause in this form is deprecated.",
- correction: "Try removing this native clause and adding @native()"
- " or @native('native-name') before the declaration.");
+ _NATIVE_CLAUSE_SHOULD_BE_ANNOTATION;
static const ParserErrorCode NON_CONSTRUCTOR_FACTORY = const ParserErrorCode(
'NON_CONSTRUCTOR_FACTORY',
@@ -798,16 +778,10 @@
_PREFIX_AFTER_COMBINATOR;
static const ParserErrorCode REDIRECTING_CONSTRUCTOR_WITH_BODY =
- const ParserErrorCode('REDIRECTING_CONSTRUCTOR_WITH_BODY',
- "Redirecting constructors can't have a body.",
- correction: "Try removing the body, or "
- "not making this a redirecting constructor.");
+ _REDIRECTING_CONSTRUCTOR_WITH_BODY;
static const ParserErrorCode REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR =
- const ParserErrorCode('REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR',
- "Only factory constructor can specify '=' redirection.",
- correction: "Try making this a factory constructor, or "
- "not making this a redirecting constructor.");
+ _REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR;
static const ParserErrorCode SETTER_IN_FUNCTION = const ParserErrorCode(
'SETTER_IN_FUNCTION',
diff --git a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
index c77bf08..4c26c3a 100644
--- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
@@ -28,6 +28,16 @@
_STATIC_AFTER_VAR,
_STATIC_AFTER_FINAL,
_STATIC_AFTER_CONST,
+ _REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR,
+ _REDIRECTING_CONSTRUCTOR_WITH_BODY,
+ _NATIVE_CLAUSE_SHOULD_BE_ANNOTATION,
+ _MULTIPLE_WITH_CLAUSES,
+ _MULTIPLE_PART_OF_DIRECTIVES,
+ _MULTIPLE_ON_CLAUSES,
+ _MULTIPLE_LIBRARY_DIRECTIVES,
+ _MULTIPLE_EXTENDS_CLAUSES,
+ _MISSING_STATEMENT,
+ _MISSING_PREFIX_IN_DEFERRED_IMPORT,
];
const ParserErrorCode _CONTINUE_OUTSIDE_OF_LOOP = const ParserErrorCode(
@@ -64,11 +74,63 @@
"The keyword 'await' isn't allowed for a normal 'for' statement.",
correction: "Try removing the keyword, or use a for-each statement.");
+const ParserErrorCode _MISSING_PREFIX_IN_DEFERRED_IMPORT =
+ const ParserErrorCode('MISSING_PREFIX_IN_DEFERRED_IMPORT',
+ "Deferred imports should have a prefix.",
+ correction: "Try adding a prefix to the import.");
+
+const ParserErrorCode _MISSING_STATEMENT =
+ const ParserErrorCode('MISSING_STATEMENT', "Expected a statement.");
+
+const ParserErrorCode _MULTIPLE_EXTENDS_CLAUSES = const ParserErrorCode(
+ 'MULTIPLE_EXTENDS_CLAUSES',
+ "Each class definition can have at most one extends clause.",
+ correction:
+ "Try choosing one superclass and define your class to implement (or mix in) the others.");
+
+const ParserErrorCode _MULTIPLE_LIBRARY_DIRECTIVES = const ParserErrorCode(
+ 'MULTIPLE_LIBRARY_DIRECTIVES',
+ "Only one library directive may be declared in a file.",
+ correction: "Try removing all but one of the library directives.");
+
+const ParserErrorCode _MULTIPLE_ON_CLAUSES = const ParserErrorCode(
+ 'MULTIPLE_ON_CLAUSES',
+ "Each mixin definition can have at most one on clause.",
+ correction: "Try combining all of the on clauses into a single clause.");
+
+const ParserErrorCode _MULTIPLE_PART_OF_DIRECTIVES = const ParserErrorCode(
+ 'MULTIPLE_PART_OF_DIRECTIVES',
+ "Only one part-of directive may be declared in a file.",
+ correction: "Try removing all but one of the part-of directives.");
+
+const ParserErrorCode _MULTIPLE_WITH_CLAUSES = const ParserErrorCode(
+ 'MULTIPLE_WITH_CLAUSES',
+ "Each class definition can have at most one with clause.",
+ correction: "Try combining all of the with clauses into a single clause.");
+
+const ParserErrorCode _NATIVE_CLAUSE_SHOULD_BE_ANNOTATION = const ParserErrorCode(
+ 'NATIVE_CLAUSE_SHOULD_BE_ANNOTATION',
+ "Native clause in this form is deprecated.",
+ correction:
+ "Try removing this native clause and adding @native() or @native('native-name') before the declaration.");
+
const ParserErrorCode _PREFIX_AFTER_COMBINATOR = const ParserErrorCode(
'PREFIX_AFTER_COMBINATOR',
"The prefix ('as' clause) should come before any show/hide combinators.",
correction: "Try moving the prefix before the combinators.");
+const ParserErrorCode _REDIRECTING_CONSTRUCTOR_WITH_BODY = const ParserErrorCode(
+ 'REDIRECTING_CONSTRUCTOR_WITH_BODY',
+ "Redirecting constructors can't have a body.",
+ correction:
+ "Try removing the body, or not making this a redirecting constructor.");
+
+const ParserErrorCode _REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR =
+ const ParserErrorCode('REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR',
+ "Only factory constructor can specify '=' redirection.",
+ correction:
+ "Try making this a factory constructor, or remove the redirection.");
+
const ParserErrorCode _STATIC_AFTER_CONST = const ParserErrorCode(
'STATIC_AFTER_CONST',
"The modifier 'static' should be before the modifier 'const'.",
diff --git a/pkg/analyzer/lib/src/fasta/error_converter.dart b/pkg/analyzer/lib/src/fasta/error_converter.dart
index 378d1cc..d11fb57 100644
--- a/pkg/analyzer/lib/src/fasta/error_converter.dart
+++ b/pkg/analyzer/lib/src/fasta/error_converter.dart
@@ -454,46 +454,18 @@
errorReporter?.reportErrorForOffset(
ParserErrorCode.MISSING_METHOD_PARAMETERS, offset, length);
return;
- case "MISSING_PREFIX_IN_DEFERRED_IMPORT":
- errorReporter?.reportErrorForOffset(
- ParserErrorCode.MISSING_PREFIX_IN_DEFERRED_IMPORT, offset, length);
- return;
case "MISSING_STAR_AFTER_SYNC":
errorReporter?.reportErrorForOffset(
ParserErrorCode.MISSING_STAR_AFTER_SYNC, offset, length);
return;
- case "MISSING_STATEMENT":
- errorReporter?.reportErrorForOffset(
- ParserErrorCode.MISSING_STATEMENT, offset, length);
- return;
case "MISSING_TYPEDEF_PARAMETERS":
errorReporter?.reportErrorForOffset(
ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, offset, length);
return;
- case "MULTIPLE_EXTENDS_CLAUSES":
- errorReporter?.reportErrorForOffset(
- ParserErrorCode.MULTIPLE_EXTENDS_CLAUSES, offset, length);
- return;
case "MULTIPLE_IMPLEMENTS_CLAUSES":
errorReporter?.reportErrorForOffset(
ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES, offset, length);
return;
- case "MULTIPLE_LIBRARY_DIRECTIVES":
- errorReporter?.reportErrorForOffset(
- ParserErrorCode.MULTIPLE_LIBRARY_DIRECTIVES, offset, length);
- return;
- case "MULTIPLE_ON_CLAUSES":
- errorReporter?.reportErrorForOffset(
- ParserErrorCode.MULTIPLE_ON_CLAUSES, offset, length);
- return;
- case "MULTIPLE_WITH_CLAUSES":
- errorReporter?.reportErrorForOffset(
- ParserErrorCode.MULTIPLE_WITH_CLAUSES, offset, length);
- return;
- case "MULTIPLE_PART_OF_DIRECTIVES":
- errorReporter?.reportErrorForOffset(
- ParserErrorCode.MULTIPLE_PART_OF_DIRECTIVES, offset, length);
- return;
case "NAMED_FUNCTION_EXPRESSION":
errorReporter?.reportErrorForOffset(
ParserErrorCode.NAMED_FUNCTION_EXPRESSION, offset, length);
@@ -502,10 +474,6 @@
errorReporter?.reportErrorForOffset(
ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP, offset, length);
return;
- case "NATIVE_CLAUSE_SHOULD_BE_ANNOTATION":
- errorReporter?.reportErrorForOffset(
- ParserErrorCode.NATIVE_CLAUSE_SHOULD_BE_ANNOTATION, offset, length);
- return;
case "NON_PART_OF_DIRECTIVE_IN_PART":
errorReporter?.reportErrorForOffset(
ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART, offset, length);
@@ -524,16 +492,6 @@
offset,
length);
return;
- case "REDIRECTING_CONSTRUCTOR_WITH_BODY":
- errorReporter?.reportErrorForOffset(
- ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY, offset, length);
- return;
- case "REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR":
- errorReporter?.reportErrorForOffset(
- ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR,
- offset,
- length);
- return;
case "RETURN_IN_GENERATOR":
errorReporter?.reportErrorForOffset(
CompileTimeErrorCode.RETURN_IN_GENERATOR, offset, length,
diff --git a/pkg/analyzer/tool/messages/generate.dart b/pkg/analyzer/tool/messages/generate.dart
index 828545a..61e3f65 100644
--- a/pkg/analyzer/tool/messages/generate.dart
+++ b/pkg/analyzer/tool/messages/generate.dart
@@ -184,7 +184,7 @@
for (ErrorCode errorCode in errorCodeValues) {
if (errorCode is ParserErrorCode) {
String message =
- errorCode.message.replaceAll('{0}', '').replaceAll('{1}', '');
+ errorCode.message.replaceAll(new RegExp(r'\{\d+\}'), '');
messageToName[message] = errorCode.name;
}
}
@@ -262,6 +262,6 @@
""";
const shouldRunFastaGenerateMessagesFirst = """
-Error: Encountered an error that would be caught
- by first running 'pkg/front_end/tool/fasta generate-messages'.
+Error: After modifying message.yaml, run this first:
+ pkg/front_end/tool/fasta generate-messages
""";
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
index e373365..b1a841f 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -2608,7 +2608,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageExpectedStatement = const MessageCode(
"ExpectedStatement",
- analyzerCode: "MISSING_STATEMENT",
+ index: 29,
message: r"""Expected a statement.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -5160,7 +5160,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageMissingPrefixInDeferredImport = const MessageCode(
"MissingPrefixInDeferredImport",
- analyzerCode: "MISSING_PREFIX_IN_DEFERRED_IMPORT",
+ index: 30,
message: r"""Deferred imports should have a prefix.""",
tip: r"""Try adding a prefix to the import.""");
@@ -5223,7 +5223,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageMultipleExtends = const MessageCode("MultipleExtends",
- analyzerCode: "MULTIPLE_EXTENDS_CLAUSES",
+ index: 28,
message: r"""Each class definition can have at most one extends clause.""",
tip:
r"""Try choosing one superclass and define your class to implement (or mix in) the others.""");
@@ -5247,7 +5247,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageMultipleLibraryDirectives = const MessageCode(
"MultipleLibraryDirectives",
- analyzerCode: "MULTIPLE_LIBRARY_DIRECTIVES",
+ index: 27,
message: r"""Only one library directive may be declared in a file.""",
tip: r"""Try removing all but one of the library directives.""");
@@ -5257,7 +5257,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageMultipleOnClauses = const MessageCode(
"MultipleOnClauses",
- analyzerCode: "MULTIPLE_ON_CLAUSES",
+ index: 26,
message: r"""Each mixin definition can have at most one on clause.""",
tip: r"""Try combining all of the on clauses into a single clause.""");
@@ -5266,7 +5266,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageMultipleWith = const MessageCode("MultipleWith",
- analyzerCode: "MULTIPLE_WITH_CLAUSES",
+ index: 24,
message: r"""Each class definition can have at most one with clause.""",
tip: r"""Try combining all of the with clauses into a single clause.""");
@@ -5286,7 +5286,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageNativeClauseShouldBeAnnotation = const MessageCode(
"NativeClauseShouldBeAnnotation",
- analyzerCode: "NATIVE_CLAUSE_SHOULD_BE_ANNOTATION",
+ index: 23,
message: r"""Native clause in this form is deprecated.""",
tip:
r"""Try removing this native clause and adding @native() or @native('native-name') before the declaration.""");
@@ -6075,7 +6075,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messagePartOfTwice = const MessageCode("PartOfTwice",
- analyzerCode: "MULTIPLE_PART_OF_DIRECTIVES",
+ index: 25,
message: r"""Only one part-of directive may be declared in a file.""",
tip: r"""Try removing all but one of the part-of directives.""");
@@ -6322,7 +6322,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageRedirectingConstructorWithBody = const MessageCode(
"RedirectingConstructorWithBody",
- analyzerCode: "REDIRECTING_CONSTRUCTOR_WITH_BODY",
+ index: 22,
message: r"""Redirecting constructors can't have a body.""",
tip:
r"""Try removing the body, or not making this a redirecting constructor.""");
@@ -6333,7 +6333,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageRedirectionInNonFactory = const MessageCode(
"RedirectionInNonFactory",
- analyzerCode: "REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR",
+ index: 21,
message: r"""Only factory constructor can specify '=' redirection.""",
tip:
r"""Try making this a factory constructor, or remove the redirection.""");
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 2823171..19f0706 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -203,8 +203,9 @@
script: "main();"
ExpectedStatement:
+ index: 29
template: "Expected a statement."
- analyzerCode: MISSING_STATEMENT
+ analyzerCode: ParserErrorCode.MISSING_STATEMENT
statement: "void;"
ExpectedButGot:
@@ -244,20 +245,23 @@
- "main() { return true }"
MultipleLibraryDirectives:
+ index: 27
template: "Only one library directive may be declared in a file."
tip: "Try removing all but one of the library directives."
- analyzerCode: MULTIPLE_LIBRARY_DIRECTIVES
+ analyzerCode: ParserErrorCode.MULTIPLE_LIBRARY_DIRECTIVES
MultipleExtends:
+ index: 28
template: "Each class definition can have at most one extends clause."
tip: "Try choosing one superclass and define your class to implement (or mix in) the others."
- analyzerCode: MULTIPLE_EXTENDS_CLAUSES
+ analyzerCode: ParserErrorCode.MULTIPLE_EXTENDS_CLAUSES
script: "class A extends B extends C {}"
MultipleWith:
+ index: 24
template: "Each class definition can have at most one with clause."
tip: "Try combining all of the with clauses into a single clause."
- analyzerCode: MULTIPLE_WITH_CLAUSES
+ analyzerCode: ParserErrorCode.MULTIPLE_WITH_CLAUSES
script: "class A extends B with C, D with E {}"
WithBeforeExtends:
@@ -311,9 +315,10 @@
script: "class A implements B implements C, D {}"
MultipleOnClauses:
+ index: 26
template: "Each mixin definition can have at most one on clause."
tip: "Try combining all of the on clauses into a single clause."
- analyzerCode: MULTIPLE_ON_CLAUSES
+ analyzerCode: ParserErrorCode.MULTIPLE_ON_CLAUSES
script: "mixin A on B on C, D {}"
ImplementsFutureOr:
@@ -1425,9 +1430,10 @@
analyzerCode: NAMED_FUNCTION_EXPRESSION
NativeClauseShouldBeAnnotation:
+ index: 23
template: "Native clause in this form is deprecated."
tip: "Try removing this native clause and adding @native() or @native('native-name') before the declaration."
- analyzerCode: NATIVE_CLAUSE_SHOULD_BE_ANNOTATION
+ analyzerCode: ParserErrorCode.NATIVE_CLAUSE_SHOULD_BE_ANNOTATION
ReturnTypeFunctionExpression:
template: "A function expression can't have a return type."
@@ -1533,9 +1539,10 @@
severity: IGNORED
MissingPrefixInDeferredImport:
+ index: 30
template: "Deferred imports should have a prefix."
tip: "Try adding a prefix to the import."
- analyzerCode: MISSING_PREFIX_IN_DEFERRED_IMPORT
+ analyzerCode: ParserErrorCode.MISSING_PREFIX_IN_DEFERRED_IMPORT
DeferredAfterPrefix:
template: "The deferred keyword should come immediately before the prefix ('as' clause)."
@@ -1916,9 +1923,10 @@
- "part of l; part 'f.dart';"
PartOfTwice:
+ index: 25
template: "Only one part-of directive may be declared in a file."
tip: "Try removing all but one of the part-of directives."
- analyzerCode: MULTIPLE_PART_OF_DIRECTIVES
+ analyzerCode: ParserErrorCode.MULTIPLE_PART_OF_DIRECTIVES
script:
main.dart: |
part "part.dart";
@@ -1956,9 +1964,10 @@
- "factory class C {}"
RedirectionInNonFactory:
+ index: 21
template: "Only factory constructor can specify '=' redirection."
tip: "Try making this a factory constructor, or remove the redirection."
- analyzerCode: REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR
+ analyzerCode: ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR
script:
- "class C { C() = D; }"
@@ -2384,9 +2393,10 @@
- "class C { C() : x(3) {} }"
RedirectingConstructorWithBody:
+ index: 22
template: "Redirecting constructors can't have a body."
tip: "Try removing the body, or not making this a redirecting constructor."
- analyzerCode: REDIRECTING_CONSTRUCTOR_WITH_BODY
+ analyzerCode: ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY
script:
- "class C { C() : this.x() {} }"