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

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

Issue 2876813002: Implement generalized function types. (Closed)
Patch Set: Address comments. Created 3 years, 7 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 '../fasta_codes.dart' show codeExpectedOpenParens; 7 import '../fasta_codes.dart' show codeExpectedOpenParens;
8 8
9 import '../parser/class_member_parser.dart' show ClassMemberParser; 9 import '../parser/class_member_parser.dart' show ClassMemberParser;
10 10
11 import '../parser/listener.dart' show Listener; 11 import '../parser/listener.dart' show Listener;
12 12
13 import '../parser/parser.dart' show optional; 13 import '../parser/parser.dart' show MemberKind, optional;
14 14
15 import '../scanner/token.dart' show BeginGroupToken; 15 import '../scanner/token.dart' show BeginGroupToken;
16 16
17 import '../../scanner/token.dart' show Token; 17 import '../../scanner/token.dart' show Token;
18 18
19 // TODO(ahe): Move this to parser package. 19 // TODO(ahe): Move this to parser package.
20 class DietParser extends ClassMemberParser { 20 class DietParser extends ClassMemberParser {
21 DietParser(Listener listener) : super(listener); 21 DietParser(Listener listener) : super(listener);
22 22
23 Token parseFormalParameters(Token token, {bool inFunctionType: false}) { 23 Token parseFormalParameters(Token token, MemberKind kind) {
24 return skipFormals(token); 24 return skipFormals(token, kind);
25 } 25 }
26 26
27 Token skipFormals(Token token) { 27 Token skipFormals(Token token, MemberKind kind) {
28 listener.beginOptionalFormalParameters(token); 28 listener.beginOptionalFormalParameters(token);
29 if (!optional('(', token)) { 29 if (!optional('(', token)) {
30 if (optional(';', token)) { 30 if (optional(';', token)) {
31 reportRecoverableErrorCode(token, codeExpectedOpenParens); 31 reportRecoverableErrorCode(token, codeExpectedOpenParens);
32 return token; 32 return token;
33 } 33 }
34 return reportUnexpectedToken(token).next; 34 return reportUnexpectedToken(token).next;
35 } 35 }
36 BeginGroupToken beginGroupToken = token; 36 BeginGroupToken beginGroupToken = token;
37 Token endToken = beginGroupToken.endGroup; 37 Token endToken = beginGroupToken.endGroup;
38 listener.endFormalParameters(0, token, endToken); 38 listener.endFormalParameters(0, token, endToken, kind);
39 return endToken.next; 39 return endToken.next;
40 } 40 }
41 } 41 }
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