Fix more error code mappings

Change-Id: I01a340d9a6abac7c10c0a6431251694b04658e9d
Reviewed-on: https://dart-review.googlesource.com/65785
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Brian Wilkerson 2018-07-19 20:45:48 +00:00 committed by commit-bot@chromium.org
parent 6f5b0b5ddc
commit 75deedf3f4
6 changed files with 52 additions and 6 deletions

View file

@ -173,6 +173,7 @@ const List<ErrorCode> errorCodeValues = const [
CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME,
CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS,
CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC,
CompileTimeErrorCode.INVALID_INITIALIZER,
CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR,
CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER,
CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS,

View file

@ -1480,6 +1480,9 @@ class CompileTimeErrorCode extends ErrorCode {
correction: "Try using a different name, or "
"remove the modifier on the function body.");
static const CompileTimeErrorCode INVALID_INITIALIZER =
const CompileTimeErrorCode.fromFasta('INVALID_INITIALIZER');
/**
* 9. Functions: It is a compile-time error if an async, async* or sync*
* modifier is attached to the body of a setter or constructor.

View file

@ -812,6 +812,8 @@ const Template<Message Function(String name)>
const Code<Message Function(String name)> codeConflictsWithSetterWarning =
const Code<Message Function(String name)>(
"ConflictsWithSetterWarning", templateConflictsWithSetterWarning,
analyzerCode: "CONFLICTS_WITH_MEMBER",
dart2jsCode: "*fatal*",
severity: Severity.errorLegacyWarning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@ -3425,6 +3427,26 @@ const MessageCode messageInitializedVariableInForEach = const MessageCode(
tip:
r"""Try removing the initializer, or using a different kind of loop.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)>
templateInitializerForStaticField =
const Template<Message Function(String name)>(
messageTemplate: r"""'#name' isn't an instance field of this class.""",
withArguments: _withArgumentsInitializerForStaticField);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name)> codeInitializerForStaticField =
const Code<Message Function(String name)>(
"InitializerForStaticField", templateInitializerForStaticField,
analyzerCode: "INITIALIZER_FOR_STATIC_FIELD", dart2jsCode: "*fatal*");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsInitializerForStaticField(String name) {
return new Message(codeInitializerForStaticField,
message: """'${name}' isn't an instance field of this class.""",
arguments: {'name': name});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
@ -4285,6 +4307,9 @@ const Code<Null> codeInvalidInitializer = messageInvalidInitializer;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageInvalidInitializer = const MessageCode(
"InvalidInitializer",
analyzerCode: "INVALID_INITIALIZER",
dart2jsCode: "*fatal*",
severity: Severity.error,
message: r"""Not a valid initializer.""",
tip: r"""To initialize a field, use the syntax 'name = value'.""");
@ -5565,6 +5590,8 @@ const Code<Message Function(String name, String name2)>
codeOverrideTypeVariablesMismatch =
const Code<Message Function(String name, String name2)>(
"OverrideTypeVariablesMismatch", templateOverrideTypeVariablesMismatch,
analyzerCode: "INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS",
dart2jsCode: "*fatal*",
severity: Severity.errorLegacyWarning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@ -5652,6 +5679,8 @@ const Code<Null> codePartOfTwoLibraries = messagePartOfTwoLibraries;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messagePartOfTwoLibraries = const MessageCode(
"PartOfTwoLibraries",
analyzerCode: "PART_OF_DIFFERENT_LIBRARY",
dart2jsCode: "*fatal*",
severity: Severity.error,
message: r"""A file can't be part of more than one library.""",
tip:

View file

@ -4143,8 +4143,10 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
}
} else {
return buildInvalidInitializer(
deprecated_buildCompileTimeError(
"'$name' isn't an instance field of this class.", offset),
buildCompileTimeError(
fasta.templateInitializerForStaticField.withArguments(name),
offset,
name.length),
offset);
}
}

View file

@ -43,7 +43,6 @@ ConflictsWithFactory/example: Fail
ConflictsWithMember/example: Fail
ConflictsWithMemberWarning/example: Fail
ConflictsWithSetter/example: Fail
ConflictsWithSetterWarning/analyzerCode: Fail
ConflictsWithSetterWarning/example: Fail
ConflictsWithTypeVariable/example: Fail
ConstAfterFactory/script1: Fail
@ -191,6 +190,7 @@ ImplementsBeforeExtends/script: Fail
ImplementsBeforeWith/script: Fail
ImplicitCallOfNonMethod/example: Fail
ImportAfterPart/script1: Fail
InitializerForStaticField/example: Fail
InitializerOutsideConstructor/example: Fail
InputFileNotFound/analyzerCode: Fail
InputFileNotFound/example: Fail
@ -203,7 +203,6 @@ InvalidCastLocalFunction/example: Fail
InvalidCastNewExpr/example: Fail
InvalidCastStaticMethod/example: Fail
InvalidCastTopLevelFunction/example: Fail
InvalidInitializer/analyzerCode: Fail
InvalidInitializer/example: Fail
InvalidInlineFunctionType/analyzerCode: Fail
InvalidPackageUri/analyzerCode: Fail
@ -264,14 +263,12 @@ OverrideMismatchNamedParameter/example: Fail
OverrideMoreRequiredArguments/example: Fail
OverrideTypeMismatchParameter/example: Fail
OverrideTypeMismatchReturnType/example: Fail
OverrideTypeVariablesMismatch/analyzerCode: Fail
OverrideTypeVariablesMismatch/example: Fail
PackageNotFound/analyzerCode: Fail
PackageNotFound/example: Fail
PartOfLibraryNameMismatch/dart2jsCode: Fail
PartOfLibraryNameMismatch/example: Fail
PartOfSelf/dart2jsCode: Fail
PartOfTwoLibraries/analyzerCode: Fail # Issue 33227
PartOfUriMismatch/dart2jsCode: Fail
PartOfUriMismatch/example: Fail
PartOfUseUri/dart2jsCode: Fail

View file

@ -630,6 +630,11 @@ ExternalField:
script:
- "class C { external var f; }"
InitializerForStaticField:
template: "'#name' isn't an instance field of this class."
analyzerCode: INITIALIZER_FOR_STATIC_FIELD
dart2jsCode: "*fatal*"
InitializerOutsideConstructor:
template: "Only constructors can have initializers, and '#name' is not a constructor."
analyzerCode: INITIALIZER_OUTSIDE_CONSTRUCTOR
@ -808,6 +813,9 @@ InvalidVoid:
InvalidInitializer:
template: "Not a valid initializer."
tip: "To initialize a field, use the syntax 'name = value'."
severity: ERROR
analyzerCode: INVALID_INITIALIZER
dart2jsCode: "*fatal*"
MissingExponent:
template: "Numbers in exponential notation should always contain an exponent (an integer number with an optional sign)."
@ -1642,6 +1650,8 @@ ConflictsWithSetter:
ConflictsWithSetterWarning:
template: "Conflicts with setter '#name'."
severity: ERROR_LEGACY_WARNING
analyzerCode: CONFLICTS_WITH_MEMBER
dart2jsCode: "*fatal*"
ConflictsWithTypeVariable:
template: "Conflicts with type variable '#name'."
@ -1737,6 +1747,8 @@ IllegalMixin:
OverrideTypeVariablesMismatch:
template: "Declared type variables of '#name' doesn't match those on overridden method '#name2'."
severity: ERROR_LEGACY_WARNING
analyzerCode: INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS
dart2jsCode: "*fatal*"
OverriddenMethodCause:
template: "This is the overriden method ('#name')."
@ -1922,6 +1934,8 @@ PartOfTwoLibraries:
template: "A file can't be part of more than one library."
tip: "Try moving the shared declarations into the libraries, or into a new library."
severity: ERROR
analyzerCode: PART_OF_DIFFERENT_LIBRARY
dart2jsCode: "*fatal*"
script:
main.dart: "library lib; import 'lib.dart'; part 'part.dart';"
lib.dart: "library lib; part 'part.dart';"