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

Unified Diff: pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart

Issue 2705153004: Handle TypeVariable and TypeVariables in AstBuilder. (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/analyzer/ast_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
index b75cb180b3dd0acf1d9e30a0ea62442686a76683..3c4ecbedd5802ebb41740f97371ce08f3a71618d 100644
--- a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
+++ b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
@@ -995,6 +995,28 @@ class AstBuilder extends ScopeListener {
push(ast.topLevelVariableDeclaration(
comment, metadata, variableList, toAnalyzerToken(endToken)));
}
+
+ @override
+ void endTypeVariable(Token token, Token extendsOrSuper) {
scheglov 2017/02/21 19:19:26 What means "OrSuper" here? Did I miss something fr
Paul Berry 2017/02/21 20:00:25 I copied it from the base class. I think it's a s
ahe 2017/02/22 10:35:45 Yes. This is a bug.
+ // TODO(paulberry): set up scopes properly to resolve parameters and type
+ // variables. Note that this is tricky due to the handling of initializers
+ // in constructors, so the logic should be shared with BodyBuilder as much
+ // as possible.
+ debugEvent("TypeVariable");
+ TypeAnnotation bound = pop();
+ SimpleIdentifier name = pop();
+ List<Annotation> metadata = null; // TODO(paulberry)
+ Comment comment = null; // TODO(paulberry)
+ push(ast.typeParameter(
+ comment, metadata, name, toAnalyzerToken(extendsOrSuper), bound));
+ }
+
+ void endTypeVariables(int count, Token beginToken, Token endToken) {
scheglov 2017/02/21 19:19:26 @override?
Paul Berry 2017/02/21 20:00:24 Done.
+ debugEvent("TypeVariables");
+ List<TypeParameter> typeParameters = popList(count);
+ push(ast.typeParameterList(toAnalyzerToken(beginToken), typeParameters,
+ toAnalyzerToken(endToken)));
+ }
}
/// Data structure placed on the stack to represent a class body.
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | pkg/front_end/lib/src/fasta/parser/listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698