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

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

Issue 2985703002: new handleInvalidTopLevelDeclaration event in fasta parser (Closed)
Patch Set: rebase and address comment Created 3 years, 4 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 c2b8fc7e204337cca87f4e47f67fc40b4ec0a374..f7e2e1f90c1ca2e2ecc07d131512ef7aaa3a7661 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -261,8 +261,12 @@ class Parser {
return parseExport(token);
} else if (identical(value, 'part')) {
return parsePartOrPartOf(token);
- } else {
+ } else if (token.type == TokenType.IDENTIFIER || token.keyword != null) {
return parseTopLevelMember(token);
+ } else {
+ reportRecoverableErrorWithToken(token, fasta.templateExpectedDeclaration);
+ listener.handleInvalidTopLevelDeclaration(token);
+ return token.next;
}
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/listener.dart ('k') | pkg/front_end/lib/src/fasta/source/diet_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698