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

Unified Diff: frog/leg/tree/nodes.dart

Issue 9502002: Add FunctionDeclaration node. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status files. Created 8 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
« no previous file with comments | « frog/leg/ssa/closure.dart ('k') | frog/leg/tree/unparser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/tree/nodes.dart
diff --git a/frog/leg/tree/nodes.dart b/frog/leg/tree/nodes.dart
index c96e1fb06e3ecd41f0124bbf4a2ad0f7cac3f745..62c0fca3e28cf574e558714497e193f8094bba74 100644
--- a/frog/leg/tree/nodes.dart
+++ b/frog/leg/tree/nodes.dart
@@ -14,6 +14,7 @@ interface Visitor<R> {
R visitExpressionStatement(ExpressionStatement node);
R visitFor(For node);
R visitForInStatement(ForInStatement node);
+ R visitFunctionDeclaration(FunctionDeclaration node);
R visitFunctionExpression(FunctionExpression node);
R visitIdentifier(Identifier node);
R visitIf(If node);
@@ -106,6 +107,7 @@ class Node implements Hashable {
ExpressionStatement asExpressionStatement() => null;
For asFor() => null;
ForInStatement asForInStatement() => null;
+ FunctionDeclaration asFunctionDeclaration() => null;
FunctionExpression asFunctionExpression() => null;
Identifier asIdentifier() => null;
If asIf() => null;
@@ -505,6 +507,21 @@ class For extends Loop {
}
}
+class FunctionDeclaration extends Statement {
+ final FunctionExpression function;
+
+ FunctionDeclaration(this.function);
+
+ FunctionDeclaration asFunctionDeclaration() => this;
+
+ accept(Visitor visitor) => visitor.visitFunctionDeclaration(this);
+
+ visitChildren(Visitor visitor) => function.accept(visitor);
+
+ Token getBeginToken() => function.getBeginToken();
+ Token getEndToken() => function.getEndToken();
+}
+
class FunctionExpression extends Expression {
final Node name;
« no previous file with comments | « frog/leg/ssa/closure.dart ('k') | frog/leg/tree/unparser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698