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

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

Issue 2703863003: Add AstBuilder support for class declarations and named mixin applications. (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/listener.dart
diff --git a/pkg/front_end/lib/src/fasta/parser/listener.dart b/pkg/front_end/lib/src/fasta/parser/listener.dart
index 738620faadd27cb6c3a4669e4a1188884f816640..1acd2b8d135ac40211a0621a7a4f07805dd65b45 100644
--- a/pkg/front_end/lib/src/fasta/parser/listener.dart
+++ b/pkg/front_end/lib/src/fasta/parser/listener.dart
@@ -59,12 +59,22 @@ class Listener {
void beginClassBody(Token token) {}
+ /// Handle the end of the body of a class declaration. The only substructures
+ /// are the class members.
void endClassBody(int memberCount, Token beginToken, Token endToken) {
logEvent("ClassBody");
}
void beginClassDeclaration(Token beginToken, Token name) {}
+ /// Handle the end of a class declaration. Substructures:
+ /// - metadata
+ /// - modifiers
+ /// - class name
+ /// - type variables
+ /// - supertype (may be a mixin application)
+ /// - implemented types
+ /// - class body
void endClassDeclaration(int interfacesCount, Token beginToken,
Token extendsKeyword, Token implementsKeyword, Token endToken) {
logEvent("ClassDeclaration");
@@ -228,12 +238,28 @@ class Listener {
void beginMixinApplication(Token token) {}
+ /// Handle the end of a mixin application construct (e.g. "A with B, C").
+ /// Substructures:
+ /// - supertype
+ /// - mixin types (TypeList)
void endMixinApplication() {
logEvent("MixinApplication");
}
void beginNamedMixinApplication(Token beginToken, Token name) {}
+ /// Handle the end of a named mixin declaration. Substructures:
+ /// - metadata
+ /// - modifiers
+ /// - class name
+ /// - type variables
+ /// - mixin application
+ /// - implemented types (TypeList)
+ ///
+ /// TODO(paulberry,ahe): it seems incosistent that for a named mixin
+ /// application, the implemented types are a TypeList, whereas for a class
+ /// declaration, each implemented type is listed separately on the stack, and
+ /// the number of implemented types is passed as a parameter.
ahe 2017/02/20 13:04:39 I agree. I would favor passing in a count here.
Paul Berry 2017/02/20 14:25:10 SGTM. I don't think I have a preference.
void endNamedMixinApplication(
Token begin, Token implementsKeyword, Token endToken) {
logEvent("NamedMixinApplication");

Powered by Google App Engine
This is Rietveld 408576698