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

Side by Side Diff: frog/leg/tree/visitors.dart

Issue 9873021: Move frog/leg to lib/compiler/implementation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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/tree/unparser.dart ('k') | frog/leg/tree_validator.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 class AbstractVisitor<R> implements Visitor<R> {
6 const AbstractVisitor();
7
8 abstract R visitNode(Node node);
9
10 R visitBlock(Block node) => visitStatement(node);
11 R visitBreakStatement(BreakStatement node) => visitGotoStatement(node);
12 R visitCatchBlock(CatchBlock node) => visitNode(node);
13 R visitClassNode(ClassNode node) => visitNode(node);
14 R visitConditional(Conditional node) => visitExpression(node);
15 R visitContinueStatement(ContinueStatement node) => visitGotoStatement(node);
16 R visitDoWhile(DoWhile node) => visitLoop(node);
17 R visitEmptyStatement(EmptyStatement node) => visitStatement(node);
18 R visitExpression(Expression node) => visitNode(node);
19 R visitExpressionStatement(ExpressionStatement node) => visitStatement(node);
20 R visitFor(For node) => visitLoop(node);
21 R visitForInStatement(ForInStatement node) => visitLoop(node);
22 R visitFunctionDeclaration(FunctionDeclaration node) => visitStatement(node);
23 R visitFunctionExpression(FunctionExpression node) => visitExpression(node);
24 R visitGotoStatement(GotoStatement node) => visitStatement(node);
25 R visitIdentifier(Identifier node) => visitExpression(node);
26 R visitIf(If node) => visitStatement(node);
27 R visitLabeledStatement(LabeledStatement node) => visitStatement(node);
28 R visitLiteral(Literal node) => visitExpression(node);
29 R visitLiteralBool(LiteralBool node) => visitLiteral(node);
30 R visitLiteralDouble(LiteralDouble node) => visitLiteral(node);
31 R visitLiteralInt(LiteralInt node) => visitLiteral(node);
32 R visitLiteralList(LiteralList node) => visitExpression(node);
33 R visitLiteralMap(LiteralMap node) => visitExpression(node);
34 R visitLiteralMapEntry(LiteralMapEntry node) => visitNode(node);
35 R visitLiteralNull(LiteralNull node) => visitLiteral(node);
36 R visitLiteralString(LiteralString node) => visitStringNode(node);
37 R visitStringJuxtaposition(StringJuxtaposition node) => visitStringNode(node);
38 R visitLoop(Loop node) => visitStatement(node);
39 R visitModifiers(Modifiers node) => visitNode(node);
40 R visitNamedArgument(NamedArgument node) => visitExpression(node);
41 R visitNewExpression(NewExpression node) => visitExpression(node);
42 R visitNodeList(NodeList node) => visitNode(node);
43 R visitOperator(Operator node) => visitIdentifier(node);
44 R visitParenthesizedExpression(ParenthesizedExpression node) {
45 return visitExpression(node);
46 }
47 R visitPostfix(Postfix node) => visitNodeList(node);
48 R visitPrefix(Prefix node) => visitNodeList(node);
49 R visitReturn(Return node) => visitStatement(node);
50 R visitScriptTag(ScriptTag node) => visitNode(node);
51 R visitSend(Send node) => visitExpression(node);
52 R visitSendSet(SendSet node) => visitSend(node);
53 R visitStatement(Statement node) => visitNode(node);
54 R visitStringNode(StringNode node) => visitExpression(node);
55 R visitStringInterpolation(StringInterpolation node) => visitStringNode(node);
56 R visitStringInterpolationPart(StringInterpolationPart node) {
57 return visitNode(node);
58 }
59 R visitSwitchCase(SwitchCase node) => visitNode(node);
60 R visitSwitchStatement(SwitchStatement node) => visitStatement(node);
61 R visitThrow(Throw node) => visitStatement(node);
62 R visitTryStatement(TryStatement node) => visitStatement(node);
63 R visitTypeAnnotation(TypeAnnotation node) => visitNode(node);
64 R visitTypedef(Typedef node) => visitNode(node);
65 R visitTypeVariable(TypeVariable node) => visitNode(node);
66 R visitVariableDefinitions(VariableDefinitions node) => visitStatement(node);
67 R visitWhile(While node) => visitLoop(node);
68 }
69
70 /**
71 * This visitor takes another visitor and applies it to every
72 * node in the tree. There is currently no way to control the
73 * traversal.
74 */
75 class TraversingVisitor extends AbstractVisitor {
76 final Visitor visitor;
77
78 TraversingVisitor(Visitor this.visitor);
79
80 visitNode(Node node) {
81 node.accept(visitor);
82 node.visitChildren(this);
83 }
84 }
OLDNEW
« no previous file with comments | « frog/leg/tree/unparser.dart ('k') | frog/leg/tree_validator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698