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

Side by Side Diff: lib/src/visitor.dart

Issue 1712793002: Add the content of the package. (Closed) Base URL: git@github.com:dart-lang/boolean_selector@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « lib/src/validator.dart ('k') | 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) 2016, 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 import 'ast.dart';
6
7 /// The interface for visitors of the boolean selector AST.
8 abstract class Visitor<T> {
9 T visitVariable(VariableNode node);
10 T visitNot(NotNode node);
11 T visitOr(OrNode node);
12 T visitAnd(AndNode node);
13 T visitConditional(ConditionalNode node);
14 }
15
16 /// An abstract superclass for side-effect-based visitors.
17 ///
18 /// The default implementations of this visitor's methods just traverse the AST
19 /// and do nothing with it.
20 abstract class RecursiveVisitor implements Visitor {
21 const RecursiveVisitor();
22
23 void visitVariable(VariableNode node) {}
24
25 void visitNot(NotNode node) {
26 node.child.accept(this);
27 }
28
29 void visitOr(OrNode node) {
30 node.left.accept(this);
31 node.right.accept(this);
32 }
33
34 void visitAnd(AndNode node) {
35 node.left.accept(this);
36 node.right.accept(this);
37 }
38
39 void visitConditional(ConditionalNode node) {
40 node.condition.accept(this);
41 node.whenTrue.accept(this);
42 node.whenFalse.accept(this);
43 }
44 }
OLDNEW
« no previous file with comments | « lib/src/validator.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698