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

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

Issue 1038583004: Rationalize coercions (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase Created 5 years, 9 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 RangeError.checkValidRange(start, end, this.length); 270 RangeError.checkValidRange(start, end, this.length);
271 int length = end - start; 271 int length = end - start;
272 if (length == 0) return; RangeError.checkNotNegative(skipCount, "skipCount"); 272 if (length == 0) return; RangeError.checkNotNegative(skipCount, "skipCount");
273 List otherList; 273 List otherList;
274 int otherStart; 274 int otherStart;
275 if (iterable is List) { 275 if (iterable is List) {
276 otherList = DEVC$RT.cast(iterable, DEVC$RT.type((Iterable<E> _) { 276 otherList = DEVC$RT.cast(iterable, DEVC$RT.type((Iterable<E> _) {
277 } 277 }
278 ), DEVC$RT.type((List<dynamic> _) { 278 ), DEVC$RT.type((List<dynamic> _) {
279 } 279 }
280 ), "CastGeneral", """line 369, column 19 of dart:collection/list.dart: """, it erable is List<dynamic>, true); 280 ), "ImplicitCast", """line 369, column 19 of dart:collection/list.dart: """, i terable is List<dynamic>, true);
281 otherStart = skipCount; 281 otherStart = skipCount;
282 } 282 }
283 else { 283 else {
284 otherList = iterable.skip(skipCount).toList(growable: false); 284 otherList = iterable.skip(skipCount).toList(growable: false);
285 otherStart = 0; 285 otherStart = 0;
286 } 286 }
287 if (otherStart + length > otherList.length) { 287 if (otherStart + length > otherList.length) {
288 throw IterableElementError.tooFew(); 288 throw IterableElementError.tooFew();
289 } 289 }
290 if (otherStart < start) { 290 if (otherStart < start) {
291 for (int i = length - 1; i >= 0; i--) { 291 for (int i = length - 1; i >= 0; i--) {
292 this[start + i] = ((__x11) => DEVC$RT.cast(__x11, dynamic, E, "CastGeneral", """line 381, column 27 of dart:collection/list.dart: """, __x11 is E, false))(o therList[otherStart + i]); 292 this[start + i] = ((__x11) => DEVC$RT.cast(__x11, dynamic, E, "CompositeCast ", """line 381, column 27 of dart:collection/list.dart: """, __x11 is E, false)) (otherList[otherStart + i]);
293 } 293 }
294 } 294 }
295 else { 295 else {
296 for (int i = 0; i < length; i++) { 296 for (int i = 0; i < length; i++) {
297 this[start + i] = ((__x12) => DEVC$RT.cast(__x12, dynamic, E, "CastGeneral", """line 385, column 27 of dart:collection/list.dart: """, __x12 is E, false))(o therList[otherStart + i]); 297 this[start + i] = ((__x12) => DEVC$RT.cast(__x12, dynamic, E, "CompositeCast ", """line 385, column 27 of dart:collection/list.dart: """, __x12 is E, false)) (otherList[otherStart + i]);
298 } 298 }
299 } 299 }
300 } 300 }
301 void replaceRange(int start, int end, Iterable<E> newContents) { 301 void replaceRange(int start, int end, Iterable<E> newContents) {
302 RangeError.checkValidRange(start, end, this.length); 302 RangeError.checkValidRange(start, end, this.length);
303 if (newContents is! EfficientLength) { 303 if (newContents is! EfficientLength) {
304 newContents = newContents.toList(); 304 newContents = newContents.toList();
305 } 305 }
306 int removeLength = end - start; 306 int removeLength = end - start;
307 int insertLength = newContents.length; 307 int insertLength = newContents.length;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 } 389 }
390 else { 390 else {
391 for (E element in iterable) { 391 for (E element in iterable) {
392 this[index++] = element; 392 this[index++] = element;
393 } 393 }
394 } 394 }
395 } 395 }
396 Iterable<E> get reversed => new ReversedListIterable<E>(this); 396 Iterable<E> get reversed => new ReversedListIterable<E>(this);
397 String toString() => IterableBase.iterableToFullString(this, '[', ']'); 397 String toString() => IterableBase.iterableToFullString(this, '[', ']');
398 } 398 }
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/collection/linked_list.dart ('k') | test/dart_codegen/expect/collection/maps.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698