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

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

Issue 2957503003: Don't peek when parsing mixin applications. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/parser/parser.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 270320dd9a68f9005ec81b678990a2908138881d..7c16ef901b70b5162afb89d8704bb0fd48065530 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -637,9 +637,10 @@ class Parser {
return expect(';', token);
}
- Token parseMixinApplication(Token token) {
+ /// Parse a mixin application starting from `with`. Assumes that the first
+ /// type has already been parsed.
+ Token parseMixinApplicationRest(Token token) {
listener.beginMixinApplication(token);
- token = parseType(token);
Token withKeyword = token;
token = expect('with', token);
token = parseTypeList(token);
@@ -1002,7 +1003,8 @@ class Parser {
Token parseNamedMixinApplication(
Token token, Token begin, Token classKeyword, Token name, Token equals) {
- token = parseMixinApplication(token);
+ token = parseType(token);
+ token = parseMixinApplicationRest(token);
Token implementsKeyword = null;
if (optional('implements', token)) {
implementsKeyword = token;
@@ -1017,10 +1019,9 @@ class Parser {
Token extendsKeyword;
if (optional('extends', token)) {
extendsKeyword = token;
- if (optional('with', peekAfterNominalType(token.next))) {
- token = parseMixinApplication(token.next);
- } else {
- token = parseType(token.next);
+ token = parseType(token.next);
+ if (optional('with', token)) {
+ token = parseMixinApplicationRest(token);
}
} else {
extendsKeyword = null;
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/parser/parser.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698