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

Side by Side Diff: compiler/lib/implementation/arrays.dart

Issue 8321024: Clean up (most) uses of Array. Still more to come in the VM corelib code base. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 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
« no previous file with comments | « compiler/lib/implementation/array.js ('k') | compiler/lib/implementation/isolate.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // TODO(ngeoffray): Rename to Lists.
5 class Arrays { 6 class Arrays {
6 7
7 static void copy(List<Object> src, int srcStart, 8 static void copy(List<Object> src, int srcStart,
8 List<Object> dst, int dstStart, int count) { 9 List<Object> dst, int dstStart, int count) {
9 if (srcStart === null) srcStart = 0; 10 if (srcStart === null) srcStart = 0;
10 if (dstStart === null) dstStart = 0; 11 if (dstStart === null) dstStart = 0;
11 12
12 if (srcStart < dstStart) { 13 if (srcStart < dstStart) {
13 for (int i = srcStart + count - 1, j = dstStart + count - 1; 14 for (int i = srcStart + count - 1, j = dstStart + count - 1;
14 i >= srcStart; i--, j--) { 15 i >= srcStart; i--, j--) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 startIndex = a.length - 1; 58 startIndex = a.length - 1;
58 } 59 }
59 for (int i = startIndex; i >= 0; i--) { 60 for (int i = startIndex; i >= 0; i--) {
60 if (a[i] == element) { 61 if (a[i] == element) {
61 return i; 62 return i;
62 } 63 }
63 } 64 }
64 return -1; 65 return -1;
65 } 66 }
66 67
67 static void rangeCheck(Array a, int start, int length) { 68 static void rangeCheck(List a, int start, int length) {
68 if (length < 0) { 69 if (length < 0) {
69 throw new IllegalArgumentException("negative length $length"); 70 throw new IllegalArgumentException("negative length $length");
70 } 71 }
71 if (start < 0 || start >= a.length) { 72 if (start < 0 || start >= a.length) {
72 throw new IndexOutOfRangeException(start); 73 throw new IndexOutOfRangeException(start);
73 } 74 }
74 if (start + length > a.length) { 75 if (start + length > a.length) {
75 throw new IndexOutOfRangeException(start + length); 76 throw new IndexOutOfRangeException(start + length);
76 } 77 }
77 } 78 }
78 } 79 }
OLDNEW
« no previous file with comments | « compiler/lib/implementation/array.js ('k') | compiler/lib/implementation/isolate.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698