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

Side by Side Diff: lib/src/frontend/timeout.dart

Issue 1960503002: Fix all strong-mode errors and warnings. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: .analysis_options Created 4 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 | « lib/src/frontend/throws_matcher.dart ('k') | lib/src/runner.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 import 'package:string_scanner/string_scanner.dart'; 5 import 'package:string_scanner/string_scanner.dart';
6 6
7 /// A regular expression that matches text until a letter or whitespace. 7 /// A regular expression that matches text until a letter or whitespace.
8 /// 8 ///
9 /// This is intended to scan through a number without actually encoding the full 9 /// This is intended to scan through a number without actually encoding the full
10 /// Dart number grammar. It doesn't stop on "e" because that can be a component 10 /// Dart number grammar. It doesn't stop on "e" because that can be a component
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 var number = double.parse(scanner.lastMatch[0]); 82 var number = double.parse(scanner.lastMatch[0]);
83 83
84 // A number followed by "x" is a scale factor. 84 // A number followed by "x" is a scale factor.
85 if (scanner.scan("x") || scanner.scan("X")) { 85 if (scanner.scan("x") || scanner.scan("X")) {
86 scanner.expectDone(); 86 scanner.expectDone();
87 return new Timeout.factor(number); 87 return new Timeout.factor(number);
88 } 88 }
89 89
90 // Parse time units until none are left. The condition is in the middle of 90 // Parse time units until none are left. The condition is in the middle of
91 // the loop because we've already parsed the first number. 91 // the loop because we've already parsed the first number.
92 var microseconds = 0; 92 var microseconds = 0.0;
93 while (true) { 93 while (true) {
94 scanner.expect(_unit, name: "unit"); 94 scanner.expect(_unit, name: "unit");
95 microseconds += _microsecondsFor(number, scanner.lastMatch[0]); 95 microseconds += _microsecondsFor(number, scanner.lastMatch[0]);
96 96
97 scanner.scan(_whitespace); 97 scanner.scan(_whitespace);
98 98
99 // Scan the next number, if it's avaialble. 99 // Scan the next number, if it's avaialble.
100 if (!scanner.scan(_untilUnit)) break; 100 if (!scanner.scan(_untilUnit)) break;
101 number = double.parse(scanner.lastMatch[0]); 101 number = double.parse(scanner.lastMatch[0]);
102 } 102 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 bool operator==(other) => other is Timeout && other.duration == duration && 144 bool operator==(other) => other is Timeout && other.duration == duration &&
145 other.scaleFactor == scaleFactor; 145 other.scaleFactor == scaleFactor;
146 146
147 String toString() { 147 String toString() {
148 if (duration != null) return duration.toString(); 148 if (duration != null) return duration.toString();
149 if (scaleFactor != null) return "${scaleFactor}x"; 149 if (scaleFactor != null) return "${scaleFactor}x";
150 return "none"; 150 return "none";
151 } 151 }
152 } 152 }
OLDNEW
« no previous file with comments | « lib/src/frontend/throws_matcher.dart ('k') | lib/src/runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698