OLD | NEW |
---|---|
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("dart:coreimpl"); | 5 #library("dart:coreimpl"); |
6 | 6 |
7 #source("../../corelib/src/implementation/dual_pivot_quicksort.dart"); | 7 #source("../../corelib/src/implementation/dual_pivot_quicksort.dart"); |
8 #source("../../corelib/src/implementation/duration_implementation.dart"); | 8 #source("../../corelib/src/implementation/duration_implementation.dart"); |
9 #source("../../corelib/src/implementation/exceptions.dart"); | 9 #source("../../corelib/src/implementation/exceptions.dart"); |
10 #source("../../corelib/src/implementation/future_implementation.dart"); | 10 #source("../../corelib/src/implementation/future_implementation.dart"); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 void clear() { length = 0; } | 61 void clear() { length = 0; } |
62 | 62 |
63 E removeLast() native "return this.pop();"; | 63 E removeLast() native "return this.pop();"; |
64 | 64 |
65 E last() => this[this.length-1]; | 65 E last() => this[this.length-1]; |
66 | 66 |
67 List<E> getRange(int start, int length) native | 67 List<E> getRange(int start, int length) native |
68 "return this.slice(start, start + length);"; | 68 "return this.slice(start, start + length);"; |
69 | 69 |
70 void setRange(int start, int length, List<E> from, [int startFrom]) native; | 70 void setRange(int start, int length, List<E> from, [int startFrom]) native; |
71 void removeRange(int start, int length) native; | 71 void removeRange(int start, int length) native "this.splice(start, length);"; |
72 void insertRange(int start, int length, [E initialValue]) native; | 72 |
73 void insertRange(int start, int length, [E initialValue]) native | |
74 """ | |
75 // Splice in the values with a minimum of array allocations. | |
76 var args = new Array(length + 2); | |
77 args[0] = start; | |
78 args[1] = 0; | |
79 for (var i = 0; i < length; i++) args[i + 2] = initialValue; | |
nweiz
2011/11/28 22:50:45
Are single-line loops supported by the styleguide?
Jennifer Messerly
2011/11/28 23:08:13
you should be able to surround this with an if:
Bob Nystrom
2011/11/29 02:44:08
Oops, you're right. Fixed.
| |
80 this.splice.apply(this, args); | |
81 """; | |
73 | 82 |
74 // Collection<E> members: | 83 // Collection<E> members: |
75 void forEach(void f(E element)) native; | 84 void forEach(void f(E element)) native; |
76 Collection<E> filter(bool f(E element)) native; | 85 Collection<E> filter(bool f(E element)) native; |
77 bool every(bool f(E element)) native; | 86 bool every(bool f(E element)) native; |
78 bool some(bool f(E element)) native; | 87 bool some(bool f(E element)) native; |
79 bool isEmpty() => length == 0; | 88 bool isEmpty() => length == 0; |
80 | 89 |
81 // Iterable<E> members: | 90 // Iterable<E> members: |
82 Iterator<E> iterator() => new ListIterator(this); | 91 Iterator<E> iterator() => new ListIterator(this); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
412 } else if (isNaN()) { | 421 } else if (isNaN()) { |
413 if (other.isNaN()) { | 422 if (other.isNaN()) { |
414 return 0; | 423 return 0; |
415 } | 424 } |
416 return 1; | 425 return 1; |
417 } else { | 426 } else { |
418 return -1; | 427 return -1; |
419 } | 428 } |
420 } | 429 } |
421 } | 430 } |
OLD | NEW |