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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/leg/ssa/closure.dart ('k') | frog/leg/tree/unparser.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 interface Visitor<R> { 5 interface Visitor<R> {
6 R visitBlock(Block node); 6 R visitBlock(Block node);
7 R visitBreakStatement(BreakStatement node); 7 R visitBreakStatement(BreakStatement node);
8 R visitCatchBlock(CatchBlock node); 8 R visitCatchBlock(CatchBlock node);
9 R visitClassNode(ClassNode node); 9 R visitClassNode(ClassNode node);
10 R visitConditional(Conditional node); 10 R visitConditional(Conditional node);
11 R visitContinueStatement(ContinueStatement node); 11 R visitContinueStatement(ContinueStatement node);
12 R visitDoWhile(DoWhile node); 12 R visitDoWhile(DoWhile node);
13 R visitEmptyStatement(EmptyStatement node); 13 R visitEmptyStatement(EmptyStatement node);
14 R visitExpressionStatement(ExpressionStatement node); 14 R visitExpressionStatement(ExpressionStatement node);
15 R visitFor(For node); 15 R visitFor(For node);
16 R visitForInStatement(ForInStatement node); 16 R visitForInStatement(ForInStatement node);
17 R visitFunctionDeclaration(FunctionDeclaration node);
17 R visitFunctionExpression(FunctionExpression node); 18 R visitFunctionExpression(FunctionExpression node);
18 R visitIdentifier(Identifier node); 19 R visitIdentifier(Identifier node);
19 R visitIf(If node); 20 R visitIf(If node);
20 R visitLabelledStatement(LabelledStatement node); 21 R visitLabelledStatement(LabelledStatement node);
21 R visitLiteralBool(LiteralBool node); 22 R visitLiteralBool(LiteralBool node);
22 R visitLiteralDouble(LiteralDouble node); 23 R visitLiteralDouble(LiteralDouble node);
23 R visitLiteralInt(LiteralInt node); 24 R visitLiteralInt(LiteralInt node);
24 R visitLiteralList(LiteralList node); 25 R visitLiteralList(LiteralList node);
25 R visitLiteralMap(LiteralMap node); 26 R visitLiteralMap(LiteralMap node);
26 R visitLiteralMapEntry(LiteralMapEntry node); 27 R visitLiteralMapEntry(LiteralMapEntry node);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 CatchBlock asCatchBlock() => null; 100 CatchBlock asCatchBlock() => null;
100 ClassNode asClassNode() => null; 101 ClassNode asClassNode() => null;
101 Conditional asConditional() => null; 102 Conditional asConditional() => null;
102 ContinueStatement asContinueStatement() => null; 103 ContinueStatement asContinueStatement() => null;
103 DoWhile asDoWhile() => null; 104 DoWhile asDoWhile() => null;
104 EmptyStatement asEmptyStatement() => null; 105 EmptyStatement asEmptyStatement() => null;
105 Expression asExpression() => null; 106 Expression asExpression() => null;
106 ExpressionStatement asExpressionStatement() => null; 107 ExpressionStatement asExpressionStatement() => null;
107 For asFor() => null; 108 For asFor() => null;
108 ForInStatement asForInStatement() => null; 109 ForInStatement asForInStatement() => null;
110 FunctionDeclaration asFunctionDeclaration() => null;
109 FunctionExpression asFunctionExpression() => null; 111 FunctionExpression asFunctionExpression() => null;
110 Identifier asIdentifier() => null; 112 Identifier asIdentifier() => null;
111 If asIf() => null; 113 If asIf() => null;
112 LabelledStatement asLabelledStatement() => null; 114 LabelledStatement asLabelledStatement() => null;
113 LiteralBool asLiteralBool() => null; 115 LiteralBool asLiteralBool() => null;
114 LiteralDouble asLiteralDouble() => null; 116 LiteralDouble asLiteralDouble() => null;
115 LiteralInt asLiteralInt() => null; 117 LiteralInt asLiteralInt() => null;
116 LiteralList asLiteralList() => null; 118 LiteralList asLiteralList() => null;
117 LiteralMap asLiteralMap() => null; 119 LiteralMap asLiteralMap() => null;
118 LiteralMapEntry asLiteralMapEntry() => null; 120 LiteralMapEntry asLiteralMapEntry() => null;
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 if (body !== null) body.accept(visitor); 500 if (body !== null) body.accept(visitor);
499 } 501 }
500 502
501 Token getBeginToken() => forToken; 503 Token getBeginToken() => forToken;
502 504
503 Token getEndToken() { 505 Token getEndToken() {
504 return body.getEndToken(); 506 return body.getEndToken();
505 } 507 }
506 } 508 }
507 509
510 class FunctionDeclaration extends Statement {
511 final FunctionExpression function;
512
513 FunctionDeclaration(this.function);
514
515 FunctionDeclaration asFunctionDeclaration() => this;
516
517 accept(Visitor visitor) => visitor.visitFunctionDeclaration(this);
518
519 visitChildren(Visitor visitor) => function.accept(visitor);
520
521 Token getBeginToken() => function.getBeginToken();
522 Token getEndToken() => function.getEndToken();
523 }
524
508 class FunctionExpression extends Expression { 525 class FunctionExpression extends Expression {
509 final Node name; 526 final Node name;
510 527
511 /** 528 /**
512 * List of VariableDefinitions or NodeList. 529 * List of VariableDefinitions or NodeList.
513 * 530 *
514 * A NodeList can only occur at the end and holds named parameters. 531 * A NodeList can only occur at the end and holds named parameters.
515 */ 532 */
516 final NodeList parameters; 533 final NodeList parameters;
517 534
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 static bool isConstructorRedirect(Send node) { 1568 static bool isConstructorRedirect(Send node) {
1552 return (node.receiver === null && 1569 return (node.receiver === null &&
1553 node.selector.asIdentifier() !== null && 1570 node.selector.asIdentifier() !== null &&
1554 node.selector.asIdentifier().isThis()) || 1571 node.selector.asIdentifier().isThis()) ||
1555 (node.receiver !== null && 1572 (node.receiver !== null &&
1556 node.receiver.asIdentifier() !== null && 1573 node.receiver.asIdentifier() !== null &&
1557 node.receiver.asIdentifier().isThis() && 1574 node.receiver.asIdentifier().isThis() &&
1558 node.selector.asIdentifier() !== null); 1575 node.selector.asIdentifier() !== null);
1559 } 1576 }
1560 } 1577 }
OLDNEW
« 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