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

Side by Side Diff: dart/frog/leg/lib/mockimpl.dart

Issue 9355031: Improve List implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
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 JSSyntaxRegExp(String pattern, 10 JSSyntaxRegExp(String pattern,
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } else { 477 } else {
478 equivalentYear = years; 478 equivalentYear = years;
479 offsetInSeconds = 0; 479 offsetInSeconds = 0;
480 } 480 }
481 int secondsSinceEpoch = Primitives.brokenDownDateToSecondsSinceEpoch( 481 int secondsSinceEpoch = Primitives.brokenDownDateToSecondsSinceEpoch(
482 equivalentYear, month, day, hours, minutes, seconds, isUtc); 482 equivalentYear, month, day, hours, minutes, seconds, isUtc);
483 int adjustedSeconds = secondsSinceEpoch + offsetInSeconds; 483 int adjustedSeconds = secondsSinceEpoch + offsetInSeconds;
484 return adjustedSeconds * Duration.MILLISECONDS_PER_SECOND + milliseconds; 484 return adjustedSeconds * Duration.MILLISECONDS_PER_SECOND + milliseconds;
485 } 485 }
486 } 486 }
487
488 class ListFactory<E> implements List<E> {
489 factory List([int length]) => Primitives.newList(length);
490 factory List.from(Iterable<E> other) {
491 List<E> result = new List<E>();
492 Iterator<E> iterator = other.iterator();
kasperl 2012/02/21 07:16:43 Wouldn't it be simpler with: for (E element in
ahe 2012/02/21 23:03:25 Yes. I'll add a todo because for-in and bailout is
493 while (iterator.hasNext()) {
494 result.add(iterator.next());
495 }
496 return result;
497 }
498 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698