mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
Create a recovery method in ClassMethodModifierContext
Change-Id: I3e721995efd71f9905fd9dc001b05148fd48973b Reviewed-on: https://dart-review.googlesource.com/30883 Reviewed-by: Dan Rubel <danrubel@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
36057d82fa
commit
294e8a1ac1
|
@ -478,11 +478,7 @@ class ClassMethodModifierContext {
|
|||
} else if (identical(value, 'static')) {
|
||||
token = parseStaticRecovery(token);
|
||||
} else if (identical(value, 'typedef')) {
|
||||
// TODO(brianwilkerson): Move this into a `parseTypedefRecovery` method
|
||||
// that can be more sophisticated about skipping the rest of the typedef
|
||||
// declaration.
|
||||
parser.reportRecoverableError(token.next, fasta.messageTypedefInClass);
|
||||
token = token.next;
|
||||
token = parseTypedefRecovery(token);
|
||||
} else if (identical(value, 'var')) {
|
||||
token = parseVarRecovery(token);
|
||||
} else if (token.next.isModifier) {
|
||||
|
@ -637,6 +633,16 @@ class ClassMethodModifierContext {
|
|||
return next;
|
||||
}
|
||||
|
||||
Token parseTypedefRecovery(Token token) {
|
||||
token = token.next;
|
||||
assert(optional('typedef', token));
|
||||
parser.reportRecoverableError(token, fasta.messageTypedefInClass);
|
||||
// TODO(brianwilkerson) If the declaration appears to be a valid typedef
|
||||
// then skip the entire declaration so that we generate a single error
|
||||
// (above) rather than many unhelpful errors.
|
||||
return token;
|
||||
}
|
||||
|
||||
Token parseVarRecovery(Token token) {
|
||||
token = token.next;
|
||||
if (token.next.isIdentifier && optional('(', token.next.next)) {
|
||||
|
|
Loading…
Reference in a new issue