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

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

Issue 977613002: Make int and double nullable by default (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: actually upload changes 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 IterableMixin<E> implements Iterable<E> {Iterable map(f(E elemen t)) => new MappedIterable<E, dynamic>(this, f); 2 abstract class IterableMixin<E> implements Iterable<E> {Iterable map(f(E elemen t)) => new MappedIterable<E, dynamic>(this, f);
3 Iterable<E> where(bool f(E element)) => new WhereIterable<E>(this, f); 3 Iterable<E> where(bool f(E element)) => new WhereIterable<E>(this, f);
4 Iterable expand(Iterable f(E element)) => new ExpandIterable<E, dynamic>(this, f); 4 Iterable expand(Iterable f(E element)) => new ExpandIterable<E, dynamic>(this, f);
5 bool contains(Object element) { 5 bool contains(Object element) {
6 for (E e in this) { 6 for (E e in this) {
7 if (e == element) return true; 7 if (e == element) return true;
8 } 8 }
9 return false; 9 return false;
10 } 10 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 ) { 113 ) {
114 for (E element in this) { 114 for (E element in this) {
115 if (test(element)) return element; 115 if (test(element)) return element;
116 } 116 }
117 if (orElse != null) return orElse(); 117 if (orElse != null) return orElse();
118 throw IterableElementError.noElement(); 118 throw IterableElementError.noElement();
119 } 119 }
120 E lastWhere(bool test(E value), { 120 E lastWhere(bool test(E value), {
121 E orElse()} 121 E orElse()}
122 ) { 122 ) {
123 E result = ((__x0) => DDC$RT.cast(__x0, Null, E, "CastLiteral", """line 159, c olumn 16 of dart:collection/iterable.dart: """, __x0 is E, false))(null); 123 E result = null;
124 bool foundMatching = false; 124 bool foundMatching = false;
125 for (E element in this) { 125 for (E element in this) {
126 if (test(element)) { 126 if (test(element)) {
127 result = element; 127 result = element;
128 foundMatching = true; 128 foundMatching = true;
129 } 129 }
130 } 130 }
131 if (foundMatching) return result; 131 if (foundMatching) return result;
132 if (orElse != null) return orElse(); 132 if (orElse != null) return orElse();
133 throw IterableElementError.noElement(); 133 throw IterableElementError.noElement();
134 } 134 }
135 E singleWhere(bool test(E value)) { 135 E singleWhere(bool test(E value)) {
136 E result = ((__x1) => DDC$RT.cast(__x1, Null, E, "CastLiteral", """line 173, c olumn 16 of dart:collection/iterable.dart: """, __x1 is E, false))(null); 136 E result = null;
137 bool foundMatching = false; 137 bool foundMatching = false;
138 for (E element in this) { 138 for (E element in this) {
139 if (test(element)) { 139 if (test(element)) {
140 if (foundMatching) { 140 if (foundMatching) {
141 throw IterableElementError.tooMany(); 141 throw IterableElementError.tooMany();
142 } 142 }
143 result = element; 143 result = element;
144 foundMatching = true; 144 foundMatching = true;
145 } 145 }
146 } 146 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 ) { 274 ) {
275 for (E element in this) { 275 for (E element in this) {
276 if (test(element)) return element; 276 if (test(element)) return element;
277 } 277 }
278 if (orElse != null) return orElse(); 278 if (orElse != null) return orElse();
279 throw IterableElementError.noElement(); 279 throw IterableElementError.noElement();
280 } 280 }
281 E lastWhere(bool test(E value), { 281 E lastWhere(bool test(E value), {
282 E orElse()} 282 E orElse()}
283 ) { 283 ) {
284 E result = ((__x2) => DDC$RT.cast(__x2, Null, E, "CastLiteral", """line 355, col umn 16 of dart:collection/iterable.dart: """, __x2 is E, false))(null); 284 E result = null;
285 bool foundMatching = false; 285 bool foundMatching = false;
286 for (E element in this) { 286 for (E element in this) {
287 if (test(element)) { 287 if (test(element)) {
288 result = element; 288 result = element;
289 foundMatching = true; 289 foundMatching = true;
290 } 290 }
291 } 291 }
292 if (foundMatching) return result; 292 if (foundMatching) return result;
293 if (orElse != null) return orElse(); 293 if (orElse != null) return orElse();
294 throw IterableElementError.noElement(); 294 throw IterableElementError.noElement();
295 } 295 }
296 E singleWhere(bool test(E value)) { 296 E singleWhere(bool test(E value)) {
297 E result = ((__x3) => DDC$RT.cast(__x3, Null, E, "CastLiteral", """line 369, col umn 16 of dart:collection/iterable.dart: """, __x3 is E, false))(null); 297 E result = null;
298 bool foundMatching = false; 298 bool foundMatching = false;
299 for (E element in this) { 299 for (E element in this) {
300 if (test(element)) { 300 if (test(element)) {
301 if (foundMatching) { 301 if (foundMatching) {
302 throw IterableElementError.tooMany(); 302 throw IterableElementError.tooMany();
303 } 303 }
304 result = element; 304 result = element;
305 foundMatching = true; 305 foundMatching = true;
306 } 306 }
307 } 307 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 if (!it.moveNext()) return; String next = "${it.current}"; 372 if (!it.moveNext()) return; String next = "${it.current}";
373 parts.add(next); 373 parts.add(next);
374 length += next.length + OVERHEAD; 374 length += next.length + OVERHEAD;
375 count++; 375 count++;
376 } 376 }
377 String penultimateString; 377 String penultimateString;
378 String ultimateString; 378 String ultimateString;
379 var penultimate = null; 379 var penultimate = null;
380 var ultimate = null; 380 var ultimate = null;
381 if (!it.moveNext()) { 381 if (!it.moveNext()) {
382 if (count <= HEAD_COUNT + TAIL_COUNT) return; ultimateString = ((__x4) => DDC$ RT.cast(__x4, dynamic, String, "CastGeneral", """line 530, column 24 of dart:col lection/iterable.dart: """, __x4 is String, true))(parts.removeLast()); 382 if (count <= HEAD_COUNT + TAIL_COUNT) return; ultimateString = ((__x0) => DDC$ RT.cast(__x0, dynamic, String, "CastGeneral", """line 530, column 24 of dart:col lection/iterable.dart: """, __x0 is String, true))(parts.removeLast());
383 penultimateString = ((__x5) => DDC$RT.cast(__x5, dynamic, String, "CastGenera l", """line 531, column 27 of dart:collection/iterable.dart: """, __x5 is String , true))(parts.removeLast()); 383 penultimateString = ((__x1) => DDC$RT.cast(__x1, dynamic, String, "CastGenera l", """line 531, column 27 of dart:collection/iterable.dart: """, __x1 is String , true))(parts.removeLast());
384 } 384 }
385 else { 385 else {
386 penultimate = it.current; 386 penultimate = it.current;
387 count++; 387 count++;
388 if (!it.moveNext()) { 388 if (!it.moveNext()) {
389 if (count <= HEAD_COUNT + 1) { 389 if (count <= HEAD_COUNT + 1) {
390 parts.add("$penultimate"); 390 parts.add("$penultimate");
391 return;} 391 return;}
392 ultimateString = "$penultimate"; 392 ultimateString = "$penultimate";
393 penultimateString = ((__x6) => DDC$RT.cast(__x6, dynamic, String, "CastGene ral", """line 541, column 29 of dart:collection/iterable.dart: """, __x6 is Stri ng, true))(parts.removeLast()); 393 penultimateString = ((__x2) => DDC$RT.cast(__x2, dynamic, String, "CastGene ral", """line 541, column 29 of dart:collection/iterable.dart: """, __x2 is Stri ng, true))(parts.removeLast());
394 length += ultimateString.length + OVERHEAD; 394 length += ultimateString.length + OVERHEAD;
395 } 395 }
396 else { 396 else {
397 ultimate = it.current; 397 ultimate = it.current;
398 count++; 398 count++;
399 assert (count < MAX_COUNT); while (it.moveNext()) { 399 assert (count < MAX_COUNT); while (it.moveNext()) {
400 penultimate = ultimate; 400 penultimate = ultimate;
401 ultimate = it.current; 401 ultimate = it.current;
402 count++; 402 count++;
403 if (count > MAX_COUNT) { 403 if (count > MAX_COUNT) {
404 while (length > LENGTH_LIMIT - ELLIPSIS_SIZE - OVERHEAD && count > HEAD_ COUNT) { 404 while (length > LENGTH_LIMIT - ELLIPSIS_SIZE - OVERHEAD && count > HEAD_ COUNT) {
405 length -= ((__x7) => DDC$RT.cast(__x7, dynamic, int, "CastGeneral", "" "line 562, column 25 of dart:collection/iterable.dart: """, __x7 is int, true))( parts.removeLast().length + OVERHEAD); 405 length -= ((__x3) => DDC$RT.cast(__x3, dynamic, int, "CastGeneral", "" "line 562, column 25 of dart:collection/iterable.dart: """, __x3 is int, true))( parts.removeLast().length + OVERHEAD);
406 count--; 406 count--;
407 } 407 }
408 parts.add("..."); 408 parts.add("...");
409 return;} 409 return;}
410 } 410 }
411 penultimateString = "$penultimate"; 411 penultimateString = "$penultimate";
412 ultimateString = "$ultimate"; 412 ultimateString = "$ultimate";
413 length += ultimateString.length + penultimateString.length + 2 * OVERHEAD; 413 length += ultimateString.length + penultimateString.length + 2 * OVERHEAD;
414 } 414 }
415 } 415 }
416 String elision = null; 416 String elision = null;
417 if (count > parts.length + TAIL_COUNT) { 417 if (count > parts.length + TAIL_COUNT) {
418 elision = "..."; 418 elision = "...";
419 length += ELLIPSIS_SIZE + OVERHEAD; 419 length += ELLIPSIS_SIZE + OVERHEAD;
420 } 420 }
421 while (length > LENGTH_LIMIT && parts.length > HEAD_COUNT) { 421 while (length > LENGTH_LIMIT && parts.length > HEAD_COUNT) {
422 length -= ((__x8) => DDC$RT.cast(__x8, dynamic, int, "CastGeneral", """line 58 8, column 17 of dart:collection/iterable.dart: """, __x8 is int, true))(parts.re moveLast().length + OVERHEAD); 422 length -= ((__x4) => DDC$RT.cast(__x4, dynamic, int, "CastGeneral", """line 58 8, column 17 of dart:collection/iterable.dart: """, __x4 is int, true))(parts.re moveLast().length + OVERHEAD);
423 if (elision == null) { 423 if (elision == null) {
424 elision = "..."; 424 elision = "...";
425 length += ELLIPSIS_SIZE + OVERHEAD; 425 length += ELLIPSIS_SIZE + OVERHEAD;
426 } 426 }
427 } 427 }
428 if (elision != null) { 428 if (elision != null) {
429 parts.add(elision); 429 parts.add(elision);
430 } 430 }
431 parts.add(penultimateString); 431 parts.add(penultimateString);
432 parts.add(ultimateString); 432 parts.add(ultimateString);
433 } 433 }
434 } 434 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698