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

Side by Side Diff: lib/compiler/implementation/lib/mockimpl.dart

Issue 10534114: Reapply "Refactor Date implementation in VM." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 80chars Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/lib/js_helper.dart ('k') | runtime/lib/date.cc » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Mocks of classes and interfaces that Leg cannot read directly. 5 // Mocks of classes and interfaces that Leg cannot read directly.
6 6
7 // TODO(ahe): Remove this file. 7 // TODO(ahe): Remove this file.
8 8
9 class JSSyntaxRegExp implements RegExp { 9 class JSSyntaxRegExp implements RegExp {
10 final String pattern; 10 final String pattern;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 if (epochValue === null) { 236 if (epochValue === null) {
237 throw new IllegalArgumentException(formattedString); 237 throw new IllegalArgumentException(formattedString);
238 } 238 }
239 if (addOneMillisecond) epochValue++; 239 if (addOneMillisecond) epochValue++;
240 return new DateImplementation.fromEpoch(epochValue, isUtc); 240 return new DateImplementation.fromEpoch(epochValue, isUtc);
241 } else { 241 } else {
242 throw new IllegalArgumentException(formattedString); 242 throw new IllegalArgumentException(formattedString);
243 } 243 }
244 } 244 }
245 245
246 static final int _MAX_VALUE = 8640000000000000;
247
246 DateImplementation.fromEpoch(this.value, [bool isUtc = false]) 248 DateImplementation.fromEpoch(this.value, [bool isUtc = false])
247 : _isUtc = checkNull(isUtc); 249 : _isUtc = checkNull(isUtc) {
250 if (value.abs() > _MAX_VALUE) throw new IllegalArgumentException(value);
251 }
248 252
249 bool operator ==(other) { 253 bool operator ==(other) {
250 if (!(other is DateImplementation)) return false; 254 if (!(other is DateImplementation)) return false;
251 return (value == other.value); 255 return (value == other.value);
252 } 256 }
253 257
254 bool operator <(Date other) => value < other.value; 258 bool operator <(Date other) => value < other.value;
255 259
256 bool operator <=(Date other) => value <= other.value; 260 bool operator <=(Date other) => value <= other.value;
257 261
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 factory List.from(Iterable<E> other) { 374 factory List.from(Iterable<E> other) {
371 List<E> result = new List<E>(); 375 List<E> result = new List<E>();
372 // TODO(ahe): Use for-in when it is implemented correctly. 376 // TODO(ahe): Use for-in when it is implemented correctly.
373 Iterator<E> iterator = other.iterator(); 377 Iterator<E> iterator = other.iterator();
374 while (iterator.hasNext()) { 378 while (iterator.hasNext()) {
375 result.add(iterator.next()); 379 result.add(iterator.next());
376 } 380 }
377 return result; 381 return result;
378 } 382 }
379 } 383 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/lib/js_helper.dart ('k') | runtime/lib/date.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698