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

Unified Diff: pkg/front_end/lib/src/fasta/parser/parser.dart

Issue 2750863002: Complain about built-in identifiers. (Closed)
Patch Set: Address comments. Created 3 years, 9 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
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 e2083093cd49b0be62fa52fe6a554097d106a296..6f5aea713804530b6f381faae1e712561b70550d 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -887,6 +887,13 @@ class Parser {
if (!token.isIdentifier()) {
token =
reportUnrecoverableError(token, ErrorKind.ExpectedIdentifier)?.next;
+ } else if (token.isBuiltInIdentifier &&
+ !context.isBuiltInIdentifierAllowed) {
+ if (context.inDeclaration) {
+ reportRecoverableError(token, ErrorKind.BuiltInIdentifierInDeclaration);
+ } else if (!optional("dynamic", token)) {
+ reportRecoverableError(token, ErrorKind.BuiltInIdentifierAsType);
+ }
}
listener.handleIdentifier(token, context);
return token.next;
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/identifier_context.dart ('k') | pkg/front_end/lib/src/fasta/scanner/token.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698