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

Side by Side Diff: pkg/fasta/lib/src/source/diet_parser.dart

Issue 2649923002: Update listener error handling. (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.diet_parser; 5 library fasta.diet_parser;
6 6
7 import 'package:dart_scanner/src/token.dart' show 7 import 'package:dart_scanner/src/token.dart' show
8 BeginGroupToken, 8 BeginGroupToken,
9 Token; 9 Token;
10 10
(...skipping 13 matching lines...) Expand all
24 class DietParser extends ClassMemberParser { 24 class DietParser extends ClassMemberParser {
25 DietParser(Listener listener, {bool asyncAwaitKeywordsEnabled: false}) 25 DietParser(Listener listener, {bool asyncAwaitKeywordsEnabled: false})
26 : super(listener, asyncAwaitKeywordsEnabled: asyncAwaitKeywordsEnabled); 26 : super(listener, asyncAwaitKeywordsEnabled: asyncAwaitKeywordsEnabled);
27 27
28 Token parseFormalParameters(Token token) => skipFormals(token); 28 Token parseFormalParameters(Token token) => skipFormals(token);
29 29
30 Token skipFormals(Token token) { 30 Token skipFormals(Token token) {
31 listener.beginOptionalFormalParameters(token); 31 listener.beginOptionalFormalParameters(token);
32 if (!optional('(', token)) { 32 if (!optional('(', token)) {
33 if (optional(';', token)) { 33 if (optional(';', token)) {
34 listener.reportError(token, ErrorKind.EXPECTED_OPEN_PARENS); 34 listener.reportError(token, ErrorKind.ExpectedOpenParens);
35 return token; 35 return token;
36 } 36 }
37 return listener.unexpected(token); 37 return listener.unexpected(token);
38 } 38 }
39 BeginGroupToken beginGroupToken = token; 39 BeginGroupToken beginGroupToken = token;
40 Token endToken = beginGroupToken.endGroup; 40 Token endToken = beginGroupToken.endGroup;
41 listener.endFormalParameters(0, token, endToken); 41 listener.endFormalParameters(0, token, endToken);
42 return endToken.next; 42 return endToken.next;
43 } 43 }
44 } 44 }
OLDNEW
« no previous file with comments | « pkg/fasta/lib/src/kernel/body_builder.dart ('k') | pkg/fasta/lib/src/source/stack_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698