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

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

Issue 2685783009: (Re)move methods from internal.Lists that are not used, or only used once. (Closed)
Patch Set: Don't be clever (doubles can be equal to ints) and change all occurrences. Created 3 years, 10 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
« no previous file with comments | « no previous file | runtime/lib/internal_patch.dart » ('j') | runtime/lib/internal_patch.dart » ('J')
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 _List<E> extends FixedLengthListBase<E> { 7 class _List<E> extends FixedLengthListBase<E> {
8 8
9 factory _List(length) native "List_allocate"; 9 factory _List(length) native "List_allocate";
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 skipCount--; 53 skipCount--;
54 } 54 }
55 for (int i = start; i < end; i++) { 55 for (int i = start; i < end; i++) {
56 if (!it.moveNext()) return; 56 if (!it.moveNext()) return;
57 this[i] = it.current; 57 this[i] = it.current;
58 } 58 }
59 } 59 }
60 } 60 }
61 61
62 List<E> sublist(int start, [int end]) { 62 List<E> sublist(int start, [int end]) {
63 Lists.indicesCheck(this, start, end); 63 end = RangeError.checkValidRange(start, end, this.length);
64 if (end == null) end = this.length;
65 int length = end - start; 64 int length = end - start;
66 if (start == end) return <E>[]; 65 if (length == 0) return <E>[];
67 var result = new _GrowableList<E>.withData(_slice(start, length, false)); 66 var result = new _GrowableList<E>.withData(_slice(start, length, false));
68 result._setLength(length); 67 result._setLength(length);
69 return result; 68 return result;
70 } 69 }
71 70
72 // Iterable interface. 71 // Iterable interface.
73 72
74 void forEach(f(E element)) { 73 void forEach(f(E element)) {
75 final length = this.length; 74 final length = this.length;
76 for (int i = 0; i < length; i++) { 75 for (int i = 0; i < length; i++) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 128 }
130 129
131 factory _ImmutableList._from(List from, int offset, int length) 130 factory _ImmutableList._from(List from, int offset, int length)
132 native "ImmutableList_from"; 131 native "ImmutableList_from";
133 132
134 E operator [](int index) native "List_getIndexed"; 133 E operator [](int index) native "List_getIndexed";
135 134
136 int get length native "List_getLength"; 135 int get length native "List_getLength";
137 136
138 List<E> sublist(int start, [int end]) { 137 List<E> sublist(int start, [int end]) {
139 Lists.indicesCheck(this, start, end); 138 end = RangeError.checkValidRange(start, end, this.length);
140 if (end == null) end = this.length;
141 int length = end - start; 139 int length = end - start;
142 if (length == 0) return <E>[]; 140 if (length == 0) return <E>[];
143 List list = new _List(length); 141 List list = new _List(length);
144 for (int i = 0; i < length; i++) { 142 for (int i = 0; i < length; i++) {
145 list[i] = this[start + i]; 143 list[i] = this[start + i];
146 } 144 }
147 var result = new _GrowableList<E>.withData(list); 145 var result = new _GrowableList<E>.withData(list);
148 result._setLength(length); 146 result._setLength(length);
149 return result; 147 return result;
150 } 148 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 bool moveNext() { 210 bool moveNext() {
213 if (_index >= _length) { 211 if (_index >= _length) {
214 _current = null; 212 _current = null;
215 return false; 213 return false;
216 } 214 }
217 _current = _array[_index]; 215 _current = _array[_index];
218 _index++; 216 _index++;
219 return true; 217 return true;
220 } 218 }
221 } 219 }
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/internal_patch.dart » ('j') | runtime/lib/internal_patch.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698