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

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

Issue 2723883002: Add AstBuilder support for fields. (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 c517e22bcac260aa776657a12b64d5bba3bfc589..fd1f9457a15f449f87d2b99e3565c40667bd9a87 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -1165,8 +1165,13 @@ class Parser {
Token getOrSet, Token name, bool isTopLevel) {
bool hasType = type != null;
+ Token covariantKeyword;
if (getOrSet == null && !isTopLevel) {
- modifiers = removeOptCovariantTokenIfNotStatic(modifiers);
+ Link<Token> newModifiers = removeOptCovariantTokenIfNotStatic(modifiers);
ahe 2017/03/01 15:20:31 This is horrible. But that's not your fault. Would
Paul Berry 2017/03/01 21:08:22 Done.
+ if (!identical(newModifiers, modifiers)) {
+ covariantKeyword = modifiers.first;
+ modifiers = newModifiers;
+ }
}
Token varFinalOrConst =
@@ -1219,7 +1224,7 @@ class Parser {
if (isTopLevel) {
listener.endTopLevelFields(fieldCount, start, semicolon);
} else {
- listener.endFields(fieldCount, start, semicolon);
+ listener.endFields(fieldCount, covariantKeyword, start, semicolon);
}
return token;
}
@@ -1716,7 +1721,7 @@ class Parser {
token = reportUnrecoverableError(token, ErrorKind.UnexpectedToken);
if (identical(token.kind, EOF_TOKEN)) {
// TODO(ahe): This is a hack, see parseTopLevelMember.
- listener.endFields(1, start, token);
+ listener.endFields(1, null, start, token);
listener.endMember();
return token;
}

Powered by Google App Engine
This is Rietveld 408576698