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

Unified Diff: lib/src/backend/platform_selector/evaluator.dart

Issue 1717483002: Make PlatformSelector use boolean_selector. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/backend/platform_selector/ast.dart ('k') | lib/src/backend/platform_selector/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/backend/platform_selector/evaluator.dart
diff --git a/lib/src/backend/platform_selector/evaluator.dart b/lib/src/backend/platform_selector/evaluator.dart
deleted file mode 100644
index 9d04d6dc8faee5a9d64724653a59dde58f2c37f9..0000000000000000000000000000000000000000
--- a/lib/src/backend/platform_selector/evaluator.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import '../operating_system.dart';
-import '../test_platform.dart';
-import 'ast.dart';
-import 'visitor.dart';
-
-/// A visitor for evaluating platform selectors against a specific
-/// [TestPlatform] and [OperatingSystem].
-class Evaluator implements Visitor<bool> {
- /// The platform to test against.
- final TestPlatform _platform;
-
- /// The operating system to test against.
- final OperatingSystem _os;
-
- Evaluator(this._platform, {OperatingSystem os})
- : _os = os == null ? OperatingSystem.none : os;
-
- bool visitVariable(VariableNode node) {
- if (node.name == _platform.identifier) return true;
- if (node.name == _os.name) return true;
-
- switch (node.name) {
- case "dart-vm": return _platform.isDartVM;
- case "browser": return _platform.isBrowser;
- case "js": return _platform.isJS;
- case "blink": return _platform.isBlink;
- case "posix": return _os.isPosix;
- default: return false;
- }
- }
-
- bool visitNot(NotNode node) => !node.child.accept(this);
-
- bool visitOr(OrNode node) =>
- node.left.accept(this) || node.right.accept(this);
-
- bool visitAnd(AndNode node) =>
- node.left.accept(this) && node.right.accept(this);
-
- bool visitConditional(ConditionalNode node) => node.condition.accept(this)
- ? node.whenTrue.accept(this)
- : node.whenFalse.accept(this);
-}
« no previous file with comments | « lib/src/backend/platform_selector/ast.dart ('k') | lib/src/backend/platform_selector/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698