Skip to content

Commit a2f32eb

Browse files
danrubelcommit-bot@chromium.org
authored andcommitted
finish cleanup ErrorToken parsing
Change-Id: I876c4805561d29b289184ce696fe4db2038bc362 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106005 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Dan Rubel <danrubel@google.com>
1 parent 6bd64ff commit a2f32eb

File tree

1 file changed

+5
-30
lines changed

1 file changed

+5
-30
lines changed

pkg/front_end/lib/src/fasta/parser/parser.dart

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4292,20 +4292,7 @@ class Parser {
42924292
//
42934293
// Recovery code.
42944294
//
4295-
if (token.next is ErrorToken) {
4296-
token = token.next;
4297-
Token previous;
4298-
do {
4299-
// Report the error in the error token, skip the error token, and try
4300-
// again.
4301-
previous = token;
4302-
reportErrorToken(token);
4303-
token = token.next;
4304-
} while (token is ErrorToken);
4305-
return parsePrimary(previous, context);
4306-
} else {
4307-
return parseSend(token, context);
4308-
}
4295+
return parseSend(token, context);
43094296
}
43104297

43114298
Token parseParenthesizedExpressionOrFunctionLiteral(Token token) {
@@ -6361,32 +6348,20 @@ class Parser {
63616348
void reportRecoverableError(Token token, Message message) {
63626349
// Find a non-synthetic token on which to report the error.
63636350
token = findNonZeroLengthToken(token);
6364-
if (token is ErrorToken) {
6365-
reportErrorToken(token);
6366-
} else {
6367-
listener.handleRecoverableError(message, token, token);
6368-
}
6351+
listener.handleRecoverableError(message, token, token);
63696352
}
63706353

63716354
void reportRecoverableErrorWithToken(
63726355
Token token, Template<_MessageWithArgument<Token>> template) {
63736356
// Find a non-synthetic token on which to report the error.
63746357
token = findNonZeroLengthToken(token);
6375-
if (token is ErrorToken) {
6376-
reportErrorToken(token);
6377-
} else {
6378-
listener.handleRecoverableError(
6379-
template.withArguments(token), token, token);
6380-
}
6381-
}
6382-
6383-
void reportErrorToken(ErrorToken token) {
6384-
listener.handleErrorToken(token);
6358+
listener.handleRecoverableError(
6359+
template.withArguments(token), token, token);
63856360
}
63866361

63876362
Token reportAllErrorTokens(Token token) {
63886363
while (token is ErrorToken) {
6389-
reportErrorToken(token);
6364+
listener.handleErrorToken(token);
63906365
token = token.next;
63916366
}
63926367
return token;

0 commit comments

Comments
 (0)