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

Side by Side Diff: test/dart_codegen/expect/collection/list.dart

Issue 1112403004: SDK fixes (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Formatting fix Created 5 years, 7 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
OLDNEW
1 part of dart.collection; 1 part of dart.collection;
2 abstract class ListBase<E> extends Object with ListMixin<E> {static String list ToString(List list) => IterableBase.iterableToFullString(list, '[', ']'); 2 abstract class ListBase<E> extends Object with ListMixin<E> {static String list ToString(List list) => IterableBase.iterableToFullString(list, '[', ']');
3 } 3 }
4 abstract class ListMixin<E> implements List<E> {Iterator<E> get iterator => new ListIterator<E>(this); 4 abstract class ListMixin<E> implements List<E> {Iterator<E> get iterator => new ListIterator<E>(this);
5 E elementAt(int index) => this[index]; 5 E elementAt(int index) => this[index];
6 void forEach(void action(E element)) { 6 void forEach(void action(E element)) {
7 int length = this.length; 7 int length = this.length;
8 for (int i = 0; i < length; i++) { 8 for (int i = 0; i < length; i++) {
9 action(this[i]); 9 action(this[i]);
10 if (length != this.length) { 10 if (length != this.length) {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 212 }
213 E removeLast() { 213 E removeLast() {
214 if (length == 0) { 214 if (length == 0) {
215 throw IterableElementError.noElement(); 215 throw IterableElementError.noElement();
216 } 216 }
217 E result = this[length - 1]; 217 E result = this[length - 1];
218 length--; 218 length--;
219 return result; 219 return result;
220 } 220 }
221 void sort([int compare(E a, E b)]) { 221 void sort([int compare(E a, E b)]) {
222 if (compare == null) { 222 Sort.sort(this, ((__x8) => DEVC$RT.cast(__x8, dynamic, __CastType5, "CompositeCa st", """line 305, column 21 of dart:collection/list.dart: """, __x8 is __CastTyp e5, false))(compare == null ? Comparable.compare : compare));
223 var defaultCompare = Comparable.compare;
224 compare = defaultCompare;
225 }
226 Sort.sort(this, compare);
227 } 223 }
228 void shuffle([Random random]) { 224 void shuffle([Random random]) {
229 if (random == null) random = new Random(); 225 if (random == null) random = new Random();
230 int length = this.length; 226 int length = this.length;
231 while (length > 1) { 227 while (length > 1) {
232 int pos = random.nextInt(length); 228 int pos = random.nextInt(length);
233 length -= 1; 229 length -= 1;
234 var tmp = this[length]; 230 var tmp = this[length];
235 this[length] = this[pos]; 231 this[length] = this[pos];
236 this[pos] = tmp; 232 this[pos] = tmp;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 RangeError.checkValidRange(start, end, this.length); 266 RangeError.checkValidRange(start, end, this.length);
271 int length = end - start; 267 int length = end - start;
272 if (length == 0) return; RangeError.checkNotNegative(skipCount, "skipCount"); 268 if (length == 0) return; RangeError.checkNotNegative(skipCount, "skipCount");
273 List otherList; 269 List otherList;
274 int otherStart; 270 int otherStart;
275 if (iterable is List) { 271 if (iterable is List) {
276 otherList = DEVC$RT.cast(iterable, DEVC$RT.type((Iterable<E> _) { 272 otherList = DEVC$RT.cast(iterable, DEVC$RT.type((Iterable<E> _) {
277 } 273 }
278 ), DEVC$RT.type((List<dynamic> _) { 274 ), DEVC$RT.type((List<dynamic> _) {
279 } 275 }
280 ), "ImplicitCast", """line 369, column 19 of dart:collection/list.dart: """, i terable is List<dynamic>, true); 276 ), "ImplicitCast", """line 365, column 19 of dart:collection/list.dart: """, i terable is List<dynamic>, true);
281 otherStart = skipCount; 277 otherStart = skipCount;
282 } 278 }
283 else { 279 else {
284 otherList = iterable.skip(skipCount).toList(growable: false); 280 otherList = iterable.skip(skipCount).toList(growable: false);
285 otherStart = 0; 281 otherStart = 0;
286 } 282 }
287 if (otherStart + length > otherList.length) { 283 if (otherStart + length > otherList.length) {
288 throw IterableElementError.tooFew(); 284 throw IterableElementError.tooFew();
289 } 285 }
290 if (otherStart < start) { 286 if (otherStart < start) {
291 for (int i = length - 1; i >= 0; i--) { 287 for (int i = length - 1; i >= 0; i--) {
292 this[start + i] = ((__x5) => DEVC$RT.cast(__x5, dynamic, E, "CompositeCast", """line 381, column 27 of dart:collection/list.dart: """, __x5 is E, false))(ot herList[otherStart + i]); 288 this[start + i] = ((__x9) => DEVC$RT.cast(__x9, dynamic, E, "CompositeCast", """line 377, column 27 of dart:collection/list.dart: """, __x9 is E, false))(ot herList[otherStart + i]);
293 } 289 }
294 } 290 }
295 else { 291 else {
296 for (int i = 0; i < length; i++) { 292 for (int i = 0; i < length; i++) {
297 this[start + i] = ((__x6) => DEVC$RT.cast(__x6, dynamic, E, "CompositeCast", """line 385, column 27 of dart:collection/list.dart: """, __x6 is E, false))(ot herList[otherStart + i]); 293 this[start + i] = ((__x10) => DEVC$RT.cast(__x10, dynamic, E, "CompositeCast ", """line 381, column 27 of dart:collection/list.dart: """, __x10 is E, false)) (otherList[otherStart + i]);
298 } 294 }
299 } 295 }
300 } 296 }
301 void replaceRange(int start, int end, Iterable<E> newContents) { 297 void replaceRange(int start, int end, Iterable<E> newContents) {
302 RangeError.checkValidRange(start, end, this.length); 298 RangeError.checkValidRange(start, end, this.length);
303 if (newContents is! EfficientLength) { 299 if (newContents is! EfficientLength) {
304 newContents = newContents.toList(); 300 newContents = newContents.toList();
305 } 301 }
306 int removeLength = end - start; 302 int removeLength = end - start;
307 int insertLength = newContents.length; 303 int insertLength = newContents.length;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 } 385 }
390 else { 386 else {
391 for (E element in iterable) { 387 for (E element in iterable) {
392 this[index++] = element; 388 this[index++] = element;
393 } 389 }
394 } 390 }
395 } 391 }
396 Iterable<E> get reversed => new ReversedListIterable<E>(this); 392 Iterable<E> get reversed => new ReversedListIterable<E>(this);
397 String toString() => IterableBase.iterableToFullString(this, '[', ']'); 393 String toString() => IterableBase.iterableToFullString(this, '[', ']');
398 } 394 }
395 typedef int __CastType5(dynamic __u6, dynamic __u7);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698