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

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

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

Powered by Google App Engine
This is Rietveld 408576698