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

Unified Diff: pkg/front_end/lib/src/fasta/parser/parser.dart

Issue 2716433002: Add support for FieldFormalParameter. (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 side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/parser/parser.dart
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index 19512820017d87d353339ceba1ae7bad30986160..0ea4a4a49bbe8622e6dc6300b4a00576f262c777 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -478,11 +478,13 @@ class Parser {
// TODO(ahe): Validate that there are formal parameters if void.
token = parseReturnTypeOpt(token);
Token thisKeyword = null;
+ Token period = null;
if (optional('this', token)) {
thisKeyword = token;
+ period = token.next;
Paul Berry 2017/02/22 20:41:09 This seems problematic for error recovery. If the
scheglov 2017/02/23 06:43:50 This is the pattern that is used everywhere else i
ahe 2017/02/23 16:27:11 I agree that it is a problem for error recovery.
// TODO(ahe): Validate field initializers are only used in
// constructors, and not for function-typed arguments.
- token = expect('.', token.next);
+ token = expect('.', period);
}
token = parseIdentifier(token);
if (optional('(', token)) {
@@ -510,7 +512,7 @@ class Parser {
equal, ErrorKind.PositionalParameterWithEquals);
}
}
- listener.endFormalParameter(thisKeyword);
+ listener.endFormalParameter(thisKeyword, period);
ahe 2017/02/23 16:27:11 This isn't necessary. The period can be found with
return token;
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/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