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

Side by Side Diff: pkg/polymer_expressions/lib/visitor.dart

Issue 22950008: move fancy_syntax into Dart SVN (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | « pkg/polymer_expressions/lib/tokenizer.dart ('k') | pkg/polymer_expressions/pubspec.yaml » ('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) 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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library polymer_expressions.visitor;
6
7 import 'expression.dart';
8
9 abstract class Visitor<E extends Expression> {
10 visit(E s) => s.accept(this);
11 visitEmptyExpression(EmptyExpression e);
12 visitParenthesizedExpression(ParenthesizedExpression e);
13 visitInvoke(Invoke i);
14 visitLiteral(Literal l);
15 visitMapLiteral(MapLiteral l);
16 visitMapLiteralEntry(MapLiteralEntry l);
17 visitIdentifier(Identifier i);
18 visitBinaryOperator(BinaryOperator o);
19 visitUnaryOperator(UnaryOperator o);
20 visitInExpression(InExpression c);
21 }
22
23 abstract class RecursiveVisitor<E> extends Visitor<E> {
24 visitExpression(E e);
25
26 visitEmptyExpression(EmptyExpression e) => visitExpression(e);
27
28 visitParenthesizedExpression(ParenthesizedExpression e) {
29 visit(e);
30 visitExpression(e);
31 }
32
33 visitInvoke(Invoke i) {
34 visit(i.receiver);
35 if (i.arguments != null) {
36 for (var a in i.arguments) {
37 visit(a);
38 }
39 }
40 visitExpression(i);
41 }
42
43 visitLiteral(Literal l) => visitExpression(l);
44
45 visitMapLiteral(MapLiteral l) {
46 for (var e in l.entries) {
47 visit(e);
48 }
49 visitExpression(l);
50 }
51
52 visitMapLiteralEntry(MapLiteralEntry e) {
53 visit(e.key);
54 visit(e.entryValue);
55 visitExpression(e);
56 }
57
58 visitIdentifier(Identifier i) => visitExpression(i);
59
60 visitBinaryOperator(BinaryOperator o) {
61 visit(o.left);
62 visit(o.right);
63 visitExpression(o);
64 }
65
66 visitUnaryOperator(UnaryOperator o) {
67 visit(o.child);
68 visitExpression(o);
69 }
70
71 visitInExpression(InExpression c) {
72 visit(c.left);
73 visit(c.right);
74 visitExpression(c);
75 }
76 }
OLDNEW
« no previous file with comments | « pkg/polymer_expressions/lib/tokenizer.dart ('k') | pkg/polymer_expressions/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698