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

Side by Side Diff: runtime/lib/array.dart

Issue 8277007: IllegalArgumentException expects a string. (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.dart ('k') | runtime/lib/growable_array.dart » ('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 class ArrayFactory<T> { 5 class ArrayFactory<T> {
6 factory Array.from(Iterable<T> other) { 6 factory Array.from(Iterable<T> other) {
7 GrowableObjectArray<T> array = new GrowableObjectArray<T>(); 7 GrowableObjectArray<T> array = new GrowableObjectArray<T>();
8 for (final e in other) { 8 for (final e in other) {
9 array.add(e); 9 array.add(e);
10 } 10 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 } 87 }
88 88
89 void _copyFromObjectArray(ObjectArray src, 89 void _copyFromObjectArray(ObjectArray src,
90 int srcStart, 90 int srcStart,
91 int dstStart, 91 int dstStart,
92 int count) 92 int count)
93 native "ObjectArray_copyFromObjectArray"; 93 native "ObjectArray_copyFromObjectArray";
94 94
95 void setRange(int start, int length, List<T> from, [int startFrom = 0]) { 95 void setRange(int start, int length, List<T> from, [int startFrom = 0]) {
96 if (length < 0) throw new IllegalArgumentException(length); 96 if (length < 0) {
97 throw new IllegalArgumentException("negative length $length");
98 }
97 copyFrom(from, start, startFrom, count); 99 copyFrom(from, start, startFrom, count);
98 } 100 }
99 101
100 void removeRange(int start, int length) { 102 void removeRange(int start, int length) {
101 throw const UnsupportedOperationException( 103 throw const UnsupportedOperationException(
102 "Cannot remove range of a non-extendable array"); 104 "Cannot remove range of a non-extendable array");
103 } 105 }
104 106
105 void insertRange(int start, int length, [T initialValue = null]) { 107 void insertRange(int start, int length, [T initialValue = null]) {
106 throw const NotImplementedException(); 108 throw const NotImplementedException();
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 if (!hasNext()) { 323 if (!hasNext()) {
322 throw const NoMoreElementsException(); 324 throw const NoMoreElementsException();
323 } 325 }
324 return _array[_pos++]; 326 return _array[_pos++];
325 } 327 }
326 328
327 final Array<T> _array; 329 final Array<T> _array;
328 final int _length; // Cache array length for faster access. 330 final int _length; // Cache array length for faster access.
329 int _pos; 331 int _pos;
330 } 332 }
OLDNEW
« no previous file with comments | « compiler/lib/implementation/array.dart ('k') | runtime/lib/growable_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698