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

Side by Side Diff: pkg/front_end/lib/src/fasta/parser/parser.dart

Issue 2738903002: Change the calling conventions for handleUnrecoverableError. (Closed)
Patch Set: Fix a code path I missed in element_listener.dart 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 unified diff | Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/listener.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta.parser.parser; 5 library fasta.parser.parser;
6 6
7 import '../scanner.dart' show ErrorToken; 7 import '../scanner.dart' show ErrorToken;
8 8
9 import '../scanner/recover.dart' show closeBraceFor, skipToEof; 9 import '../scanner/recover.dart' show closeBraceFor, skipToEof;
10 10
(...skipping 3507 matching lines...) Expand 10 before | Expand all | Expand 10 after
3518 3518
3519 /// Don't call this method. Should only be used as a last resort when there 3519 /// Don't call this method. Should only be used as a last resort when there
3520 /// is no feasible way to recover from a parser error. 3520 /// is no feasible way to recover from a parser error.
3521 Token reportUnrecoverableError(Token token, ErrorKind kind, [Map arguments]) { 3521 Token reportUnrecoverableError(Token token, ErrorKind kind, [Map arguments]) {
3522 Token next; 3522 Token next;
3523 if (token is ErrorToken) { 3523 if (token is ErrorToken) {
3524 next = reportErrorToken(token, false); 3524 next = reportErrorToken(token, false);
3525 } else { 3525 } else {
3526 arguments ??= {}; 3526 arguments ??= {};
3527 arguments.putIfAbsent("actual", () => token.value); 3527 arguments.putIfAbsent("actual", () => token.value);
3528 next = listener.handleUnrecoverableError(token, kind, arguments); 3528 next = listener.handleUnrecoverableError(token, kind, arguments)?.next;
3529 } 3529 }
3530 return next ?? skipToEof(token); 3530 return next ?? skipToEof(token);
3531 } 3531 }
3532 3532
3533 void reportRecoverableError(Token token, ErrorKind kind, [Map arguments]) { 3533 void reportRecoverableError(Token token, ErrorKind kind, [Map arguments]) {
3534 if (token is ErrorToken) { 3534 if (token is ErrorToken) {
3535 reportErrorToken(token, true); 3535 reportErrorToken(token, true);
3536 } else { 3536 } else {
3537 arguments ??= {}; 3537 arguments ??= {};
3538 listener.handleRecoverableError(token, kind, arguments); 3538 listener.handleRecoverableError(token, kind, arguments);
(...skipping 30 matching lines...) Expand all
3569 arguments = {"text": token.assertionMessage}; 3569 arguments = {"text": token.assertionMessage};
3570 break; 3570 break;
3571 3571
3572 default: 3572 default:
3573 break; 3573 break;
3574 } 3574 }
3575 if (isRecoverable) { 3575 if (isRecoverable) {
3576 listener.handleRecoverableError(token, kind, arguments); 3576 listener.handleRecoverableError(token, kind, arguments);
3577 return null; 3577 return null;
3578 } else { 3578 } else {
3579 return listener.handleUnrecoverableError(token, kind, arguments); 3579 return listener.handleUnrecoverableError(token, kind, arguments)?.next;
3580 } 3580 }
3581 } 3581 }
3582 } 3582 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/listener.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698