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

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

Issue 2710973002: Revert "Add support for the new function-type syntax." (Closed)
Patch Set: Created 3 years, 10 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:front_end/src/fasta/scanner/token.dart' show 7 import 'package:front_end/src/fasta/scanner/token.dart' show
8 BeginGroupToken, 8 BeginGroupToken,
9 Token; 9 Token;
10 10
11 import 'package:front_end/src/fasta/parser/class_member_parser.dart' show 11 import 'package:front_end/src/fasta/parser/class_member_parser.dart' show
12 ClassMemberParser; 12 ClassMemberParser;
13 13
14 import 'package:front_end/src/fasta/parser/error_kind.dart' show 14 import 'package:front_end/src/fasta/parser/error_kind.dart' show
15 ErrorKind; 15 ErrorKind;
16 16
17 import 'package:front_end/src/fasta/parser/listener.dart' show 17 import 'package:front_end/src/fasta/parser/listener.dart' show
18 Listener; 18 Listener;
19 19
20 import 'package:front_end/src/fasta/parser/parser.dart' show 20 import 'package:front_end/src/fasta/parser/parser.dart' show
21 optional; 21 optional;
22 22
23 // TODO(ahe): Move this to parser package. 23 // TODO(ahe): Move this to parser package.
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, {bool inFunctionType: false}) { 28 Token parseFormalParameters(Token token) => skipFormals(token);
29 return skipFormals(token);
30 }
31 29
32 Token skipFormals(Token token) { 30 Token skipFormals(Token token) {
33 listener.beginOptionalFormalParameters(token); 31 listener.beginOptionalFormalParameters(token);
34 if (!optional('(', token)) { 32 if (!optional('(', token)) {
35 if (optional(';', token)) { 33 if (optional(';', token)) {
36 reportRecoverableError(token, ErrorKind.ExpectedOpenParens, {}); 34 reportRecoverableError(token, ErrorKind.ExpectedOpenParens, {});
37 return token; 35 return token;
38 } 36 }
39 return reportUnrecoverableError(token, ErrorKind.UnexpectedToken); 37 return reportUnrecoverableError(token, ErrorKind.UnexpectedToken);
40 } 38 }
41 BeginGroupToken beginGroupToken = token; 39 BeginGroupToken beginGroupToken = token;
42 Token endToken = beginGroupToken.endGroup; 40 Token endToken = beginGroupToken.endGroup;
43 listener.endFormalParameters(0, token, endToken); 41 listener.endFormalParameters(0, token, endToken);
44 return endToken.next; 42 return endToken.next;
45 } 43 }
46 } 44 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/diet_listener.dart ('k') | pkg/front_end/lib/src/fasta/source/outline_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698