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

Unified Diff: pkg/compiler/lib/src/parser/node_listener.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 | « pkg/analyzer/lib/src/fasta/ast_builder.dart ('k') | pkg/front_end/lib/src/fasta/fasta_codes_generated.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/parser/node_listener.dart
diff --git a/pkg/compiler/lib/src/parser/node_listener.dart b/pkg/compiler/lib/src/parser/node_listener.dart
index aef9278f8381c6195383ac38dec19870faf8b242..715059c1b7267ba181be654c5db9e88fbba3fcce 100644
--- a/pkg/compiler/lib/src/parser/node_listener.dart
+++ b/pkg/compiler/lib/src/parser/node_listener.dart
@@ -493,7 +493,7 @@ class NodeListener extends ElementListener {
}
@override
- void endFunction(Token getOrSet, Token endToken) {
+ void endNamedFunctionExpression(Token endToken) {
Statement body = popNode();
AsyncModifier asyncModifier = popNode();
NodeList initializers = popNode();
@@ -504,12 +504,22 @@ class NodeListener extends ElementListener {
TypeAnnotation type = popNode();
Modifiers modifiers = popNode();
pushNode(new FunctionExpression(name, typeVariables, formals, body, type,
- modifiers, initializers, getOrSet, asyncModifier));
+ modifiers, initializers, null, asyncModifier));
}
@override
void endFunctionDeclaration(Token endToken) {
- pushNode(new FunctionDeclaration(popNode()));
+ Statement body = popNode();
+ AsyncModifier asyncModifier = popNode();
+ NodeList initializers = popNode();
+ NodeList formals = popNode();
+ NodeList typeVariables = popNode();
+ // The name can be an identifier or a send in case of named constructors.
+ Expression name = popNode();
+ TypeAnnotation type = popNode();
+ Modifiers modifiers = popNode();
+ pushNode(new FunctionDeclaration(new FunctionExpression(name, typeVariables,
+ formals, body, type, modifiers, initializers, null, asyncModifier)));
}
@override
@@ -997,7 +1007,7 @@ class NodeListener extends ElementListener {
}
@override
- void endUnnamedFunction(Token beginToken, Token token) {
+ void endFunctionExpression(Token beginToken, Token token) {
Statement body = popNode();
AsyncModifier asyncModifier = popNode();
NodeList formals = popNode();
« no previous file with comments | « pkg/analyzer/lib/src/fasta/ast_builder.dart ('k') | pkg/front_end/lib/src/fasta/fasta_codes_generated.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698