Chromium Code Reviews| 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 // TODO(ngeoffray): Rename to Lists. | 5 // TODO(ngeoffray): Rename to Lists. |
| 6 class Arrays { | 6 class Arrays { |
|
Ivan Posva
2012/10/26 04:48:17
In general I expected that we are going away from
Anders Johnsen
2012/10/26 09:23:15
Exactly, but first thing we do is eliminating core
| |
| 7 static void copy(List src, int srcStart, | 7 static void copy(List src, int srcStart, |
| 8 List dst, int dstStart, int count) { | 8 List dst, int dstStart, int count) { |
| 9 if (srcStart === null) srcStart = 0; | 9 if (srcStart === null) srcStart = 0; |
| 10 if (dstStart === null) dstStart = 0; | 10 if (dstStart === null) dstStart = 0; |
| 11 | 11 |
| 12 if (srcStart < dstStart) { | 12 if (srcStart < dstStart) { |
| 13 for (int i = srcStart + count - 1, j = dstStart + count - 1; | 13 for (int i = srcStart + count - 1, j = dstStart + count - 1; |
| 14 i >= srcStart; i--, j--) { | 14 i >= srcStart; i--, j--) { |
| 15 dst[j] = src[i]; | 15 dst[j] = src[i]; |
| 16 } | 16 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 if (start < 0 ) { | 83 if (start < 0 ) { |
| 84 String message = "$start must be greater than or equal to 0"; | 84 String message = "$start must be greater than or equal to 0"; |
| 85 throw new IndexOutOfRangeException(message); | 85 throw new IndexOutOfRangeException(message); |
| 86 } | 86 } |
| 87 if (start + length > a.length) { | 87 if (start + length > a.length) { |
| 88 String message = "$start + $length must be in the range [0..${a.length})"; | 88 String message = "$start + $length must be in the range [0..${a.length})"; |
| 89 throw new IndexOutOfRangeException(message); | 89 throw new IndexOutOfRangeException(message); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | |
| OLD | NEW |