Chromium Code Reviews| 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) { |
|
Paul Berry
2017/03/14 19:57:57
Rather than put a switch statement here (which can
ahe
2017/03/16 09:10:51
Done.
|
| + 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)) { |
|
Siggi Cherem (dart-lang)
2017/03/14 16:04:45
+floitsch
just a heads up: this will need to be c
ahe
2017/03/16 09:10:51
Acknowledged.
|
| + reportRecoverableError(token, ErrorKind.BuiltInIdentifierAsType); |
| + } |
| + break; |
| + |
| + default: |
| + break; |
| + } |
| } |
| listener.handleIdentifier(token, context); |
| return token.next; |