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

Unified Diff: dart/frog/leg/scanner/listener.dart

Issue 8999015: Generate AST node for factory methods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix type errors Created 9 years 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 | dart/frog/leg/tree/nodes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/scanner/listener.dart
diff --git a/dart/frog/leg/scanner/listener.dart b/dart/frog/leg/scanner/listener.dart
index d4983b12041c096ca6011236bc49ebd7ff548503..2805327d7ec0b764bbf73a9caa7502675dc0e0e3 100644
--- a/dart/frog/leg/scanner/listener.dart
+++ b/dart/frog/leg/scanner/listener.dart
@@ -1100,17 +1100,19 @@ class NodeListener extends ElementListener {
}
void endFactoryMethod(Token factoryKeyword, Token periodBeforeName) {
- canceler.cancel('factory methods are not implemented',
- token: factoryKeyword);
Statement body = popNode();
- NodeList parameters = popNode();
+ NodeList formals = popNode();
Identifier name = null;
if (periodBeforeName !== null) {
name = popNode();
}
- Node typeName = popNode();
- pushNode(new UnimplementedStatement('factory',
- [typeName, name, parameters, body]));
+ Identifier typeName = popNode();
+ TypeAnnotation type = new TypeAnnotation(typeName, null);
+ handleModifier(factoryKeyword);
+ handleModifiers(1);
+ Modifiers modifiers = popNode();
+ pushNode(new FunctionExpression(name, formals, body, type,
+ modifiers, null));
}
void endForInStatement(Token beginToken, Token inKeyword, Token endToken) {
« no previous file with comments | « no previous file | dart/frog/leg/tree/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698