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

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

Issue 1269833003: Mark Dartium and content shell as isDartVM. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 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
« no previous file with comments | « CHANGELOG.md ('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
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 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 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 test.backend.platform_selector.evaluator; 5 library test.backend.platform_selector.evaluator;
6 6
7 import '../operating_system.dart'; 7 import '../operating_system.dart';
8 import '../test_platform.dart'; 8 import '../test_platform.dart';
9 import 'ast.dart'; 9 import 'ast.dart';
10 import 'visitor.dart'; 10 import 'visitor.dart';
11 11
12 /// A visitor for evaluating platform selectors against a specific 12 /// A visitor for evaluating platform selectors against a specific
13 /// [TestPlatform] and [OperatingSystem]. 13 /// [TestPlatform] and [OperatingSystem].
14 class Evaluator implements Visitor<bool> { 14 class Evaluator implements Visitor<bool> {
15 /// The platform to test against. 15 /// The platform to test against.
16 final TestPlatform _platform; 16 final TestPlatform _platform;
17 17
18 /// The operating system to test against. 18 /// The operating system to test against.
19 final OperatingSystem _os; 19 final OperatingSystem _os;
20 20
21 Evaluator(this._platform, {OperatingSystem os}) 21 Evaluator(this._platform, {OperatingSystem os})
22 : _os = os == null ? OperatingSystem.none : os; 22 : _os = os == null ? OperatingSystem.none : os;
23 23
24 bool visitVariable(VariableNode node) { 24 bool visitVariable(VariableNode node) {
25 if (node.name == _platform.identifier) return true; 25 if (node.name == _platform.identifier) return true;
26 if (node.name == _os.name) return true; 26 if (node.name == _os.name) return true;
27 27
28 switch (node.name) { 28 switch (node.name) {
29 case "dart-vm": return _platform.isDartVm; 29 case "dart-vm": return _platform.isDartVM;
30 case "browser": return _platform.isBrowser; 30 case "browser": return _platform.isBrowser;
31 case "js": return _platform.isJS; 31 case "js": return _platform.isJS;
32 case "blink": return _platform.isBlink; 32 case "blink": return _platform.isBlink;
33 case "posix": return _os.isPosix; 33 case "posix": return _os.isPosix;
34 default: return false; 34 default: return false;
35 } 35 }
36 } 36 }
37 37
38 bool visitNot(NotNode node) => !node.child.accept(this); 38 bool visitNot(NotNode node) => !node.child.accept(this);
39 39
40 bool visitOr(OrNode node) => 40 bool visitOr(OrNode node) =>
41 node.left.accept(this) || node.right.accept(this); 41 node.left.accept(this) || node.right.accept(this);
42 42
43 bool visitAnd(AndNode node) => 43 bool visitAnd(AndNode node) =>
44 node.left.accept(this) && node.right.accept(this); 44 node.left.accept(this) && node.right.accept(this);
45 45
46 bool visitConditional(ConditionalNode node) => node.condition.accept(this) 46 bool visitConditional(ConditionalNode node) => node.condition.accept(this)
47 ? node.whenTrue.accept(this) 47 ? node.whenTrue.accept(this)
48 : node.whenFalse.accept(this); 48 : node.whenFalse.accept(this);
49 } 49 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/backend/test_platform.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698