| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 "return this.slice(start, start + length);"; |
| 74 | 74 |
| 75 void setRange(int start, int length, List<E> from, [int startFrom]) native; | 75 void setRange(int start, int length, List<E> from, [int startFrom = 0]) { |
| 76 // length of 0 prevails and should not throw exceptions. |
| 77 if (length == 0) return; |
| 78 if (length < 0) throw new IllegalArgumentException('length is negative'); |
| 79 |
| 80 if (start < 0) throw new IndexOutOfRangeException(start); |
| 81 |
| 82 int end = start + length; |
| 83 if (end > this.length) throw new IndexOutOfRangeException(end); |
| 84 |
| 85 if (startFrom < 0) throw new IndexOutOfRangeException(startFrom); |
| 86 |
| 87 int endFrom = startFrom + length; |
| 88 if (endFrom > from.length) throw new IndexOutOfRangeException(endFrom); |
| 89 |
| 90 for (var i = 0; i < length; ++i) |
| 91 this[start + i] = from[startFrom + i]; |
| 92 } |
| 93 |
| 76 void removeRange(int start, int length) native "this.splice(start, length);"; | 94 void removeRange(int start, int length) native "this.splice(start, length);"; |
| 77 | 95 |
| 78 void insertRange(int start, int length, [E initialValue]) native | 96 void insertRange(int start, int length, [E initialValue]) native |
| 79 """ | 97 """ |
| 80 // Splice in the values with a minimum of array allocations. | 98 // Splice in the values with a minimum of array allocations. |
| 81 var args = new Array(length + 2); | 99 var args = new Array(length + 2); |
| 82 args[0] = start; | 100 args[0] = start; |
| 83 args[1] = 0; | 101 args[1] = 0; |
| 84 for (var i = 0; i < length; i++) { | 102 for (var i = 0; i < length; i++) { |
| 85 args[i + 2] = initialValue; | 103 args[i + 2] = initialValue; |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 } else if (isNaN()) { | 465 } else if (isNaN()) { |
| 448 if (other.isNaN()) { | 466 if (other.isNaN()) { |
| 449 return 0; | 467 return 0; |
| 450 } | 468 } |
| 451 return 1; | 469 return 1; |
| 452 } else { | 470 } else { |
| 453 return -1; | 471 return -1; |
| 454 } | 472 } |
| 455 } | 473 } |
| 456 } | 474 } |
| OLD | NEW |