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

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

Issue 13956006: Remove insertRange. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebuild DOM (unrelated CL) and update status files. Created 7 years, 8 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 | « pkg/yaml/test/yaml_test.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) 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 5
6 // TODO(srdjan): Use shared array implementation. 6 // TODO(srdjan): Use shared array implementation.
7 class _ObjectArray<E> implements List<E> { 7 class _ObjectArray<E> implements List<E> {
8 8
9 factory _ObjectArray(length) native "ObjectArray_allocate"; 9 factory _ObjectArray(length) native "ObjectArray_allocate";
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 otherStart = skipCount; 74 otherStart = skipCount;
75 } else { 75 } else {
76 otherList = 76 otherList =
77 iterable.skip(skipCount).take(length).toList(growable: false); 77 iterable.skip(skipCount).take(length).toList(growable: false);
78 otherStart = 0; 78 otherStart = 0;
79 } 79 }
80 Arrays.copy(otherList, otherStart, this, start, length); 80 Arrays.copy(otherList, otherStart, this, start, length);
81 } 81 }
82 } 82 }
83 83
84 void removeRange(int start, int length) { 84 void removeRange(int start, int end) {
85 throw new UnsupportedError( 85 throw new UnsupportedError(
86 "Cannot remove range of a non-extendable array"); 86 "Cannot remove range of a non-extendable array");
87 } 87 }
88 88
89 void insertRange(int start, int length, [E initialValue = null]) {
90 throw new UnsupportedError(
91 "Cannot insert range in a non-extendable array");
92 }
93
94
95 List<E> sublist(int start, [int end]) { 89 List<E> sublist(int start, [int end]) {
96 Arrays.indicesCheck(this, start, end); 90 Arrays.indicesCheck(this, start, end);
97 if (end == null) end = this.length; 91 if (end == null) end = this.length;
98 int length = end - start; 92 int length = end - start;
99 if (start == end) return []; 93 if (start == end) return [];
100 List list = new _GrowableObjectArray<E>.withCapacity(length); 94 List list = new _GrowableObjectArray<E>.withCapacity(length);
101 list.length = length; 95 list.length = length;
102 Arrays.copy(this, start, list, 0, length); 96 Arrays.copy(this, start, list, 0, length);
103 return list; 97 return list;
104 } 98 }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 void copyFrom(List src, int srcStart, int dstStart, int count) { 300 void copyFrom(List src, int srcStart, int dstStart, int count) {
307 throw new UnsupportedError( 301 throw new UnsupportedError(
308 "Cannot modify an immutable array"); 302 "Cannot modify an immutable array");
309 } 303 }
310 304
311 void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) { 305 void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) {
312 throw new UnsupportedError( 306 throw new UnsupportedError(
313 "Cannot modify an immutable array"); 307 "Cannot modify an immutable array");
314 } 308 }
315 309
316 void removeRange(int start, int length) { 310 void removeRange(int start, int end) {
317 throw new UnsupportedError( 311 throw new UnsupportedError(
318 "Cannot remove range of an immutable array"); 312 "Cannot remove range of an immutable array");
319 } 313 }
320 314
321 void insertRange(int start, int length, [E initialValue = null]) {
322 throw new UnsupportedError(
323 "Cannot insert range in an immutable array");
324 }
325
326 List<E> sublist(int start, [int end]) { 315 List<E> sublist(int start, [int end]) {
327 Arrays.indicesCheck(this, start, end); 316 Arrays.indicesCheck(this, start, end);
328 if (end == null) end = this.length; 317 if (end == null) end = this.length;
329 int length = end - start; 318 int length = end - start;
330 if (start == end) return []; 319 if (start == end) return [];
331 List list = new List<E>(); 320 List list = new List<E>();
332 list.length = length; 321 list.length = length;
333 Arrays.copy(this, start, list, 0, length); 322 Arrays.copy(this, start, list, 0, length);
334 return list; 323 return list;
335 } 324 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 } 505 }
517 _position = _length; 506 _position = _length;
518 _current = null; 507 _current = null;
519 return false; 508 return false;
520 } 509 }
521 510
522 E get current { 511 E get current {
523 return _current; 512 return _current;
524 } 513 }
525 } 514 }
OLDNEW
« no previous file with comments | « pkg/yaml/test/yaml_test.dart ('k') | runtime/lib/growable_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698