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

Side by Side Diff: tools/testing/dart/status_expression.dart

Issue 2863253002: Tighten up a bunch of types in test.dart. (Closed)
Patch Set: Merge branch 'master' into types-for-test Created 3 years, 7 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 | « tools/testing/dart/record_and_replay.dart ('k') | tools/testing/dart/status_file_parser.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 status_expression; 5 library status_expression;
6 6
7 /** 7 /**
8 * Parse and evaluate expressions in a .status file for Dart and V8. 8 * Parse and evaluate expressions in a .status file for Dart and V8.
9 * There are set expressions and Boolean expressions in a .status file. 9 * There are set expressions and Boolean expressions in a .status file.
10 * The grammar is: 10 * The grammar is:
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 ? left.evaluate(environment) 165 ? left.evaluate(environment)
166 : new Set<String>(); 166 : new Set<String>();
167 String toString() => "($left if $right)"; 167 String toString() => "($left if $right)";
168 } 168 }
169 169
170 class SetConstant implements SetExpression { 170 class SetConstant implements SetExpression {
171 String value; 171 String value;
172 172
173 SetConstant(String v) : value = v.toLowerCase(); 173 SetConstant(String v) : value = v.toLowerCase();
174 174
175 Set<String> evaluate(environment) => new Set<String>.from([value]); 175 Set<String> evaluate(environment) => [value].toSet();
176 String toString() => value; 176 String toString() => value;
177 } 177 }
178 178
179 // An iterator that allows peeking at the current token. 179 // An iterator that allows peeking at the current token.
180 class Scanner { 180 class Scanner {
181 List<String> tokens; 181 List<String> tokens;
182 Iterator tokenIterator; 182 Iterator tokenIterator;
183 String current; 183 String current;
184 184
185 Scanner(this.tokens) { 185 Scanner(this.tokens) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 "Expected value in expression, got ${scanner.current}"); 305 "Expected value in expression, got ${scanner.current}");
306 } 306 }
307 TermConstant right = new TermConstant(scanner.current); 307 TermConstant right = new TermConstant(scanner.current);
308 scanner.advance(); 308 scanner.advance();
309 return new Comparison(left, right, negate); 309 return new Comparison(left, right, negate);
310 } else { 310 } else {
311 return new BooleanVariable(left); 311 return new BooleanVariable(left);
312 } 312 }
313 } 313 }
314 } 314 }
OLDNEW
« no previous file with comments | « tools/testing/dart/record_and_replay.dart ('k') | tools/testing/dart/status_file_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698