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

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

Issue 2693453004: Include class names in parser events. (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 8df334b42d206a606e830c13fb04299339a6eab6..a98d45a5f639bcd3f06c22dafc366623a5d9cded 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -712,45 +712,44 @@ class Parser {
abstractKeyword = token;
token = token.next;
}
- Token classKeyword = token;
- var isMixinApplication = optional('=', peekAfterType(token.next));
- if (isMixinApplication) {
- listener.beginNamedMixinApplication(begin);
- } else {
- listener.beginClassDeclaration(begin);
- }
-
int modifierCount = 0;
if (abstractKeyword != null) {
parseModifier(abstractKeyword);
modifierCount++;
}
listener.handleModifiers(modifierCount);
+ bool isMixinApplication = optional('=', peekAfterType(token));
+ Token name = token.next;
+ token = parseIdentifier(name);
if (isMixinApplication) {
- token = parseIdentifier(token.next);
- token = parseTypeVariablesOpt(token);
+ listener.beginNamedMixinApplication(begin, name);
+ } else {
+ listener.beginClassDeclaration(begin, name);
+ }
+
+ token = parseTypeVariablesOpt(token);
+
+ if (optional('=', token)) {
token = expect('=', token);
- return parseNamedMixinApplication(token, classKeyword);
+ return parseNamedMixinApplication(token, begin, name);
} else {
- return parseClass(begin, classKeyword);
+ return parseClass(token, begin, name);
}
}
- Token parseNamedMixinApplication(Token token, Token classKeyword) {
+ Token parseNamedMixinApplication(Token token, Token begin, Token name) {
token = parseMixinApplication(token);
Token implementsKeyword = null;
if (optional('implements', token)) {
implementsKeyword = token;
token = parseTypeList(token.next);
}
- listener.endNamedMixinApplication(classKeyword, implementsKeyword, token);
+ listener.endNamedMixinApplication(begin, implementsKeyword, token);
return expect(';', token);
}
- Token parseClass(Token begin, Token classKeyword) {
- Token token = parseIdentifier(classKeyword.next);
- token = parseTypeVariablesOpt(token);
+ Token parseClass(Token token, Token begin, Token name) {
Token extendsKeyword;
if (optional('extends', token)) {
extendsKeyword = 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