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

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

Issue 8648003: Fix bug 557: Disallow user side allocation of ImmutableArray. Also added "instantiation-checks" f... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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 | « runtime/lib/bool.dart ('k') | runtime/lib/immutable_map.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 GrowableObjectArray<T> implements List<T> { 5 class GrowableObjectArray<T> implements List<T> {
6 ObjectArray<T> backingArray; 6 ObjectArray<T> backingArray;
7 7
8 factory GrowableObjectArray._uninstantiable() {
9 throw const UnsupportedOperationException(
10 "GrowableObjectArray can only be allocated by the VM");
11 }
12
8 void copyFrom(List<Object> src, int srcStart, int dstStart, int count) { 13 void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
9 Arrays.copy(src, srcStart, this, dstStart, count); 14 Arrays.copy(src, srcStart, this, dstStart, count);
10 } 15 }
11 16
12 void setRange(int start, int length, List<T> from, [int startFrom = 0]) { 17 void setRange(int start, int length, List<T> from, [int startFrom = 0]) {
13 if (length < 0) { 18 if (length < 0) {
14 throw new IllegalArgumentException("negative length $length"); 19 throw new IllegalArgumentException("negative length $length");
15 } 20 }
16 Arrays.copy(from, startFrom, this, start, length); 21 Arrays.copy(from, startFrom, this, start, length);
17 } 22 }
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if (!hasNext()) { 245 if (!hasNext()) {
241 throw const NoMoreElementsException(); 246 throw const NoMoreElementsException();
242 } 247 }
243 return _array[_pos++]; 248 return _array[_pos++];
244 } 249 }
245 250
246 final GrowableObjectArray<T> _array; 251 final GrowableObjectArray<T> _array;
247 int _pos; 252 int _pos;
248 } 253 }
249 254
OLDNEW
« no previous file with comments | « runtime/lib/bool.dart ('k') | runtime/lib/immutable_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698