| 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); |
| 14 visitIndex(Index i); |
| 13 visitInvoke(Invoke i); | 15 visitInvoke(Invoke i); |
| 14 visitLiteral(Literal l); | 16 visitLiteral(Literal l); |
| 15 visitMapLiteral(MapLiteral l); | 17 visitMapLiteral(MapLiteral l); |
| 16 visitMapLiteralEntry(MapLiteralEntry l); | 18 visitMapLiteralEntry(MapLiteralEntry l); |
| 17 visitIdentifier(Identifier i); | 19 visitIdentifier(Identifier i); |
| 18 visitBinaryOperator(BinaryOperator o); | 20 visitBinaryOperator(BinaryOperator o); |
| 19 visitUnaryOperator(UnaryOperator o); | 21 visitUnaryOperator(UnaryOperator o); |
| 20 visitInExpression(InExpression c); | 22 visitInExpression(InExpression c); |
| 21 } | 23 } |
| 22 | 24 |
| 23 abstract class RecursiveVisitor extends Visitor { | 25 abstract class RecursiveVisitor extends Visitor { |
| 24 visitExpression(Expression e); | 26 visitExpression(Expression e); |
| 25 | 27 |
| 26 visitEmptyExpression(EmptyExpression e) => visitExpression(e); | 28 visitEmptyExpression(EmptyExpression e) => visitExpression(e); |
| 27 | 29 |
| 28 visitParenthesizedExpression(ParenthesizedExpression e) { | 30 visitParenthesizedExpression(ParenthesizedExpression e) { |
| 29 visit(e); | 31 visit(e); |
| 30 visitExpression(e); | 32 visitExpression(e); |
| 31 } | 33 } |
| 32 | 34 |
| 35 visitGetter(Getter i) { |
| 36 visit(i.receiver); |
| 37 visitExpression(i); |
| 38 } |
| 39 |
| 40 visitIndex(Index i) { |
| 41 visit(i.receiver); |
| 42 visit(i.argument); |
| 43 visitExpression(i); |
| 44 } |
| 45 |
| 33 visitInvoke(Invoke i) { | 46 visitInvoke(Invoke i) { |
| 34 visit(i.receiver); | 47 visit(i.receiver); |
| 35 if (i.arguments != null) { | 48 if (i.arguments != null) { |
| 36 for (var a in i.arguments) { | 49 for (var a in i.arguments) { |
| 37 visit(a); | 50 visit(a); |
| 38 } | 51 } |
| 39 } | 52 } |
| 40 visitExpression(i); | 53 visitExpression(i); |
| 41 } | 54 } |
| 42 | 55 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 67 visit(o.child); | 80 visit(o.child); |
| 68 visitExpression(o); | 81 visitExpression(o); |
| 69 } | 82 } |
| 70 | 83 |
| 71 visitInExpression(InExpression c) { | 84 visitInExpression(InExpression c) { |
| 72 visit(c.left); | 85 visit(c.left); |
| 73 visit(c.right); | 86 visit(c.right); |
| 74 visitExpression(c); | 87 visitExpression(c); |
| 75 } | 88 } |
| 76 } | 89 } |
| OLD | NEW |