| Index: pkg/front_end/lib/src/fasta/parser/parser.dart
|
| diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
|
| index d86c385bb685670587f37f5ba9e566127d014155..23f9e3a15a66443b6c418cdf549c8b96b9fbd05e 100644
|
| --- a/pkg/front_end/lib/src/fasta/parser/parser.dart
|
| +++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
|
| @@ -887,6 +887,32 @@ class Parser {
|
| if (!token.isIdentifier()) {
|
| token =
|
| reportUnrecoverableError(token, ErrorKind.ExpectedIdentifier)?.next;
|
| + } else if (token.isBuiltInIdentifier) {
|
| + // It is a compile-time error if a built-in identifier is used as the
|
| + // declared name of a prefix, class, type parameter or type alias.
|
| + // It is a compile-time error to use a built-in identifier other than
|
| + // dynamic as a type annotation or type parameter.
|
| + switch (context) {
|
| + case IdentifierContext.importPrefixDeclaration:
|
| + case IdentifierContext.typedefDeclaration:
|
| + case IdentifierContext.enumDeclaration:
|
| + case IdentifierContext.namedMixinDeclaration:
|
| + case IdentifierContext.classDeclaration:
|
| + case IdentifierContext.typeVariableDeclaration:
|
| + reportRecoverableError(
|
| + token, ErrorKind.BuiltInIdentifierInDeclaration);
|
| + break;
|
| +
|
| + case IdentifierContext.typeReference:
|
| + case IdentifierContext.typeReferenceContinuation:
|
| + if (!optional("dynamic", token)) {
|
| + reportRecoverableError(token, ErrorKind.BuiltInIdentifierAsType);
|
| + }
|
| + break;
|
| +
|
| + default:
|
| + break;
|
| + }
|
| }
|
| listener.handleIdentifier(token, context);
|
| return token.next;
|
|
|