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 abstract class RecursiveVisitor extends Visitor { | 28 abstract class RecursiveVisitor extends Visitor { |
28 visitExpression(Expression e); | 29 visitExpression(Expression e); |
29 | 30 |
30 visitEmptyExpression(EmptyExpression e) => visitExpression(e); | 31 visitEmptyExpression(EmptyExpression e) => visitExpression(e); |
31 | 32 |
32 visitParenthesizedExpression(ParenthesizedExpression e) { | 33 visitParenthesizedExpression(ParenthesizedExpression e) { |
33 visit(e.child); | 34 visit(e.child); |
34 visitExpression(e); | 35 visitExpression(e); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 visit(o.trueExpr); | 96 visit(o.trueExpr); |
96 visit(o.falseExpr); | 97 visit(o.falseExpr); |
97 visitExpression(o); | 98 visitExpression(o); |
98 } | 99 } |
99 | 100 |
100 visitInExpression(InExpression c) { | 101 visitInExpression(InExpression c) { |
101 visit(c.left); | 102 visit(c.left); |
102 visit(c.right); | 103 visit(c.right); |
103 visitExpression(c); | 104 visitExpression(c); |
104 } | 105 } |
| 106 |
| 107 visitAsExpression(AsExpression c) { |
| 108 visit(c.left); |
| 109 visit(c.right); |
| 110 visitExpression(c); |
| 111 } |
105 } | 112 } |
OLD | NEW |