OLD | NEW |
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 Loading... |
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.ExpectedOpenParens); | 34 reportRecoverableError(token, ErrorKind.ExpectedOpenParens, {}); |
35 return token; | 35 return token; |
36 } | 36 } |
37 return listener.unexpected(token); | 37 return reportUnrecoverableError(token, ErrorKind.UnexpectedToken); |
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 } |
OLD | NEW |