OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library polymer_expressions.visitor; | 5 library polymer_expressions.visitor; |
6 | 6 |
7 import 'expression.dart'; | 7 import 'expression.dart'; |
8 | 8 |
9 abstract class Visitor { | 9 abstract class Visitor { |
10 visit(Expression s) => s.accept(this); | 10 visit(Expression s) => s.accept(this); |
11 visitEmptyExpression(EmptyExpression e); | 11 visitEmptyExpression(EmptyExpression e); |
12 visitParenthesizedExpression(ParenthesizedExpression e); | 12 visitParenthesizedExpression(ParenthesizedExpression e); |
13 visitGetter(Getter i); | 13 visitGetter(Getter i); |
14 visitIndex(Index i); | 14 visitIndex(Index i); |
15 visitInvoke(Invoke i); | 15 visitInvoke(Invoke i); |
16 visitLiteral(Literal l); | 16 visitLiteral(Literal l); |
17 visitListLiteral(ListLiteral l); | 17 visitListLiteral(ListLiteral l); |
18 visitMapLiteral(MapLiteral l); | 18 visitMapLiteral(MapLiteral l); |
19 visitMapLiteralEntry(MapLiteralEntry l); | 19 visitMapLiteralEntry(MapLiteralEntry l); |
20 visitIdentifier(Identifier i); | 20 visitIdentifier(Identifier i); |
21 visitBinaryOperator(BinaryOperator o); | 21 visitBinaryOperator(BinaryOperator o); |
22 visitUnaryOperator(UnaryOperator o); | 22 visitUnaryOperator(UnaryOperator o); |
23 visitTernaryOperator(TernaryOperator o); | 23 visitTernaryOperator(TernaryOperator o); |
24 visitInExpression(InExpression c); | 24 visitInExpression(InExpression c); |
| 25 visitAsExpression(AsExpression c); |
25 } | 26 } |
26 | 27 |
27 class RecursiveVisitor extends Visitor { | 28 class RecursiveVisitor extends Visitor { |
28 preVisitExpression(Expression e) {} | 29 preVisitExpression(Expression e) {} |
29 visitExpression(Expression e) {} | 30 visitExpression(Expression e) {} |
30 | 31 |
31 visitEmptyExpression(EmptyExpression e) { | 32 visitEmptyExpression(EmptyExpression e) { |
32 preVisitExpression(e); | 33 preVisitExpression(e); |
33 visitExpression(e); | 34 visitExpression(e); |
34 } | 35 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 visit(o.falseExpr); | 117 visit(o.falseExpr); |
117 visitExpression(o); | 118 visitExpression(o); |
118 } | 119 } |
119 | 120 |
120 visitInExpression(InExpression c) { | 121 visitInExpression(InExpression c) { |
121 preVisitExpression(c); | 122 preVisitExpression(c); |
122 visit(c.left); | 123 visit(c.left); |
123 visit(c.right); | 124 visit(c.right); |
124 visitExpression(c); | 125 visitExpression(c); |
125 } | 126 } |
| 127 |
| 128 visitAsExpression(AsExpression c) { |
| 129 visit(c.left); |
| 130 visit(c.right); |
| 131 visitExpression(c); |
| 132 } |
126 } | 133 } |
OLD | NEW |