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

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

Issue 2770033002: Parse FunctionDeclarationStatement(s) with Fasta. (Closed)
Patch Set: Created 3 years, 9 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/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/fasta/ast_builder.dart
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 25297814b065902d141ceab9d734ea28c94368f3..63d3b1e9d28c38efc5e9ee4deb2dcbb6d4cb478b 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -1417,6 +1417,33 @@ class AstBuilder extends ScopeListener {
name, toAnalyzerToken(assignment), initializer));
}
+ @override
+ void endFunction(Token getOrSet, Token endToken) {
+ debugEvent("Function");
+ FunctionBody body = pop();
+ pop(); // constructor initializers
+ FormalParameterList parameters = pop();
+ TypeParameterList typeParameters = pop();
+ // TODO(scheglov) It is an error if "getOrSet" is not null.
+ push(ast.functionExpression(typeParameters, parameters, body));
+ }
+
+ @override
+ void endFunctionDeclaration(Token token) {
+ debugEvent("FunctionDeclaration");
+ FunctionExpression functionExpression = pop();
+ SimpleIdentifier name = pop();
+ TypeAnnotation returnType = pop();
+ pop(); // modifiers
+ push(ast.functionDeclarationStatement(ast.functionDeclaration(
+ null, null, null, returnType, null, name, functionExpression)));
+ }
+
+ @override
+ void endFunctionName(Token beginToken, Token token) {
+ debugEvent("FunctionName");
+ }
+
void endTopLevelFields(int count, Token beginToken, Token endToken) {
debugEvent("TopLevelFields");
List<VariableDeclaration> variables = popList(count);
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698