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

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

Issue 2968093003: Improve parsing of function expressions. (Closed)
Patch Set: Update to new message API. Created 3 years, 5 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/compiler/lib/src/parser/node_listener.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 7d7c7061e0c6431a170b2eb839c0323a7a33ab79..765b02a64a8241af5dad2ce22fbc8c3af9cf0587 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -1478,12 +1478,13 @@ class AstBuilder extends ScopeListener {
comment, metadata, partKeyword, ofKeyword, uri, name, semicolon));
}
- void endUnnamedFunction(Token beginToken, Token token) {
+ @override
+ void endFunctionExpression(Token beginToken, Token token) {
// 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("UnnamedFunction");
+ debugEvent("FunctionExpression");
FunctionBody body = pop();
FormalParameterList parameters = pop();
TypeParameterList typeParameters = pop();
@@ -1562,21 +1563,20 @@ class AstBuilder extends ScopeListener {
}
@override
- void endFunction(Token getOrSet, Token endToken) {
- debugEvent("Function");
+ void endNamedFunctionExpression(Token endToken) {
+ logEvent("NamedFunctionExpression");
+ }
+
+ @override
+ void endFunctionDeclaration(Token endToken) {
+ debugEvent("FunctionDeclaration");
FunctionBody body = pop();
pop(); // constructor initializers
pop(); // separator before 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();
+ FunctionExpression functionExpression =
+ ast.functionExpression(typeParameters, parameters, body);
SimpleIdentifier name = pop();
TypeAnnotation returnType = pop();
pop(); // modifiers
« no previous file with comments | « no previous file | pkg/compiler/lib/src/parser/node_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698