| OLD | NEW |
| 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 #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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 void sort(int compare(E a, E b)) native; | 62 void sort(int compare(E a, E b)) native; |
| 63 void copyFrom(List<Object> src, int srcStart, int dstStart, int count) native; | 63 void copyFrom(List<Object> src, int srcStart, int dstStart, int count) native; |
| 64 int indexOf(E element, [int start]) native; | 64 int indexOf(E element, [int start]) native; |
| 65 int lastIndexOf(E element, [int start]) native; | 65 int lastIndexOf(E element, [int start]) native; |
| 66 void clear() { length = 0; } | 66 void clear() { length = 0; } |
| 67 | 67 |
| 68 E removeLast() native "return this.pop();"; | 68 E removeLast() native "return this.pop();"; |
| 69 | 69 |
| 70 E last() => this[this.length-1]; | 70 E last() => this[this.length-1]; |
| 71 | 71 |
| 72 List<E> getRange(int start, int length) native | 72 List<E> getRange(int start, int length) native """ |
| 73 "return this.slice(start, start + length);"; | 73 if (length == 0) return []; |
| 74 if (length < 0) throw new IllegalArgumentException('length'); |
| 75 if (start < 0 || start + length > this.length) |
| 76 throw new IndexOutOfRangeException(start); |
| 77 return this.slice(start, start + length); |
| 78 """ { throw new IllegalArgumentException(''); |
| 79 throw new IndexOutOfRangeException(0); } |
| 74 | 80 |
| 75 void setRange(int start, int length, List<E> from, [int startFrom = 0]) { | 81 void setRange(int start, int length, List<E> from, [int startFrom = 0]) { |
| 76 // length of 0 prevails and should not throw exceptions. | 82 // length of 0 prevails and should not throw exceptions. |
| 77 if (length == 0) return; | 83 if (length == 0) return; |
| 78 if (length < 0) throw new IllegalArgumentException('length is negative'); | 84 if (length < 0) throw new IllegalArgumentException('length is negative'); |
| 79 | 85 |
| 80 if (start < 0) throw new IndexOutOfRangeException(start); | 86 if (start < 0) throw new IndexOutOfRangeException(start); |
| 81 | 87 |
| 82 int end = start + length; | 88 int end = start + length; |
| 83 if (end > this.length) throw new IndexOutOfRangeException(end); | 89 if (end > this.length) throw new IndexOutOfRangeException(end); |
| 84 | 90 |
| 85 if (startFrom < 0) throw new IndexOutOfRangeException(startFrom); | 91 if (startFrom < 0) throw new IndexOutOfRangeException(startFrom); |
| 86 | 92 |
| 87 int endFrom = startFrom + length; | 93 int endFrom = startFrom + length; |
| 88 if (endFrom > from.length) throw new IndexOutOfRangeException(endFrom); | 94 if (endFrom > from.length) throw new IndexOutOfRangeException(endFrom); |
| 89 | 95 |
| 90 for (var i = 0; i < length; ++i) | 96 for (var i = 0; i < length; ++i) |
| 91 this[start + i] = from[startFrom + i]; | 97 this[start + i] = from[startFrom + i]; |
| 92 } | 98 } |
| 93 | 99 |
| 94 void removeRange(int start, int length) native "this.splice(start, length);"; | 100 void removeRange(int start, int length) native """ |
| 101 if (length == 0) return; |
| 102 if (length < 0) throw new IllegalArgumentException('length'); |
| 103 if (start < 0 || start + length > this.length) |
| 104 throw new IndexOutOfRangeException(start); |
| 105 this.splice(start, length); |
| 106 """ { throw new IllegalArgumentException(''); |
| 107 throw new IndexOutOfRangeException(0); } |
| 95 | 108 |
| 96 void insertRange(int start, int length, [E initialValue]) native | 109 void insertRange(int start, int length, [E initialValue]) native """ |
| 97 """ | 110 if (length == 0) return; |
| 111 if (length < 0) throw new IllegalArgumentException('length'); |
| 112 if (start < 0 || start > this.length) |
| 113 throw new IndexOutOfRangeException(start); |
| 114 |
| 98 // Splice in the values with a minimum of array allocations. | 115 // Splice in the values with a minimum of array allocations. |
| 99 var args = new Array(length + 2); | 116 var args = new Array(length + 2); |
| 100 args[0] = start; | 117 args[0] = start; |
| 101 args[1] = 0; | 118 args[1] = 0; |
| 102 for (var i = 0; i < length; i++) { | 119 for (var i = 0; i < length; i++) { |
| 103 args[i + 2] = initialValue; | 120 args[i + 2] = initialValue; |
| 104 } | 121 } |
| 105 this.splice.apply(this, args); | 122 this.splice.apply(this, args); |
| 106 """; | 123 """ { throw new IllegalArgumentException(''); |
| 124 throw new IndexOutOfRangeException(0); } |
| 107 | 125 |
| 108 // Collection<E> members: | 126 // Collection<E> members: |
| 109 void forEach(void f(E element)) native; | 127 void forEach(void f(E element)) native; |
| 110 Collection<E> filter(bool f(E element)) native; | 128 Collection<E> filter(bool f(E element)) native; |
| 111 Collection map(f(E element)) native; | 129 Collection map(f(E element)) native; |
| 112 bool every(bool f(E element)) native; | 130 bool every(bool f(E element)) native; |
| 113 bool some(bool f(E element)) native; | 131 bool some(bool f(E element)) native; |
| 114 bool isEmpty() => length == 0; | 132 bool isEmpty() => length == 0; |
| 115 | 133 |
| 116 // Iterable<E> members: | 134 // Iterable<E> members: |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 } else if (isNaN()) { | 523 } else if (isNaN()) { |
| 506 if (other.isNaN()) { | 524 if (other.isNaN()) { |
| 507 return 0; | 525 return 0; |
| 508 } | 526 } |
| 509 return 1; | 527 return 1; |
| 510 } else { | 528 } else { |
| 511 return -1; | 529 return -1; |
| 512 } | 530 } |
| 513 } | 531 } |
| 514 } | 532 } |
| OLD | NEW |