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

Unified Diff: test/dart_codegen/expect/collection/iterable.dart

Issue 1148283010: Remove dart backend (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: test/dart_codegen/expect/collection/iterable.dart
diff --git a/test/dart_codegen/expect/collection/iterable.dart b/test/dart_codegen/expect/collection/iterable.dart
deleted file mode 100644
index 41daebb1451ef29f8a2710ff7357f8bd4c88bb68..0000000000000000000000000000000000000000
--- a/test/dart_codegen/expect/collection/iterable.dart
+++ /dev/null
@@ -1,434 +0,0 @@
-part of dart.collection;
- abstract class IterableMixin<E> implements Iterable<E> {Iterable map(f(E element)) => new MappedIterable<E, dynamic>(this, f);
- Iterable<E> where(bool f(E element)) => new WhereIterable<E>(this, f);
- Iterable expand(Iterable f(E element)) => new ExpandIterable<E, dynamic>(this, f);
- bool contains(Object element) {
- for (E e in this) {
- if (e == element) return true;
- }
- return false;
- }
- void forEach(void f(E element)) {
- for (E element in this) f(element);
- }
- E reduce(E combine(E value, E element)) {
- Iterator<E> iterator = this.iterator;
- if (!iterator.moveNext()) {
- throw IterableElementError.noElement();
- }
- E value = iterator.current;
- while (iterator.moveNext()) {
- value = combine(value, iterator.current);
- }
- return value;
- }
- dynamic fold(var initialValue, dynamic combine(var previousValue, E element)) {
- var value = initialValue;
- for (E element in this) value = combine(value, element);
- return value;
- }
- bool every(bool f(E element)) {
- for (E element in this) {
- if (!f(element)) return false;
- }
- return true;
- }
- String join([String separator = ""]) {
- Iterator<E> iterator = this.iterator;
- if (!iterator.moveNext()) return "";
- StringBuffer buffer = new StringBuffer();
- if (separator == null || separator == "") {
- do {
- buffer.write("${iterator.current}");
- }
- while (iterator.moveNext());}
- else {
- buffer.write("${iterator.current}");
- while (iterator.moveNext()) {
- buffer.write(separator);
- buffer.write("${iterator.current}");
- }
- }
- return buffer.toString();
- }
- bool any(bool f(E element)) {
- for (E element in this) {
- if (f(element)) return true;
- }
- return false;
- }
- List<E> toList({
- bool growable : true}
-) => new List<E>.from(this, growable: growable);
- Set<E> toSet() => new Set<E>.from(this);
- int get length {
- assert (this is! EfficientLength); int count = 0;
- Iterator it = iterator;
- while (it.moveNext()) {
- count++;
- }
- return count;
- }
- bool get isEmpty => !iterator.moveNext();
- bool get isNotEmpty => !isEmpty;
- Iterable<E> take(int n) {
- return new TakeIterable<E>(this, n);
- }
- Iterable<E> takeWhile(bool test(E value)) {
- return new TakeWhileIterable<E>(this, test);
- }
- Iterable<E> skip(int n) {
- return new SkipIterable<E>(this, n);
- }
- Iterable<E> skipWhile(bool test(E value)) {
- return new SkipWhileIterable<E>(this, test);
- }
- E get first {
- Iterator<E> it = iterator;
- if (!it.moveNext()) {
- throw IterableElementError.noElement();
- }
- return it.current;
- }
- E get last {
- Iterator<E> it = iterator;
- if (!it.moveNext()) {
- throw IterableElementError.noElement();
- }
- E result;
- do {
- result = it.current;
- }
- while (it.moveNext()); return result;
- }
- E get single {
- Iterator<E> it = iterator;
- if (!it.moveNext()) throw IterableElementError.noElement();
- E result = it.current;
- if (it.moveNext()) throw IterableElementError.tooMany();
- return result;
- }
- E firstWhere(bool test(E value), {
- E orElse()}
-) {
- for (E element in this) {
- if (test(element)) return element;
- }
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
- }
- E lastWhere(bool test(E value), {
- E orElse()}
-) {
- E result = null;
- bool foundMatching = false;
- for (E element in this) {
- if (test(element)) {
- result = element;
- foundMatching = true;
- }
- }
- if (foundMatching) return result;
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
- }
- E singleWhere(bool test(E value)) {
- E result = null;
- bool foundMatching = false;
- for (E element in this) {
- if (test(element)) {
- if (foundMatching) {
- throw IterableElementError.tooMany();
- }
- result = element;
- foundMatching = true;
- }
- }
- if (foundMatching) return result;
- throw IterableElementError.noElement();
- }
- E elementAt(int index) {
- if (index is! int) throw new ArgumentError.notNull("index");
- RangeError.checkNotNegative(index, "index");
- int elementIndex = 0;
- for (E element in this) {
- if (index == elementIndex) return element;
- elementIndex++;
- }
- throw new RangeError.index(index, this, "index", null, elementIndex);
- }
- String toString() => IterableBase.iterableToShortString(this, '(', ')');
-}
- abstract class IterableBase<E> implements Iterable<E> {const IterableBase();
- Iterable map(f(E element)) => new MappedIterable<E, dynamic>(this, f);
- Iterable<E> where(bool f(E element)) => new WhereIterable<E>(this, f);
- Iterable expand(Iterable f(E element)) => new ExpandIterable<E, dynamic>(this, f);
- bool contains(Object element) {
-for (E e in this) {
- if (e == element) return true;
- }
- return false;
-}
- void forEach(void f(E element)) {
-for (E element in this) f(element);
-}
- E reduce(E combine(E value, E element)) {
-Iterator<E> iterator = this.iterator;
- if (!iterator.moveNext()) {
- throw IterableElementError.noElement();
- }
- E value = iterator.current;
- while (iterator.moveNext()) {
- value = combine(value, iterator.current);
- }
- return value;
-}
- dynamic fold(var initialValue, dynamic combine(var previousValue, E element)) {
-var value = initialValue;
- for (E element in this) value = combine(value, element);
- return value;
-}
- bool every(bool f(E element)) {
-for (E element in this) {
- if (!f(element)) return false;
- }
- return true;
-}
- String join([String separator = ""]) {
-Iterator<E> iterator = this.iterator;
- if (!iterator.moveNext()) return "";
- StringBuffer buffer = new StringBuffer();
- if (separator == null || separator == "") {
- do {
- buffer.write("${iterator.current}");
- }
- while (iterator.moveNext());}
- else {
- buffer.write("${iterator.current}");
- while (iterator.moveNext()) {
- buffer.write(separator);
- buffer.write("${iterator.current}");
- }
- }
- return buffer.toString();
-}
- bool any(bool f(E element)) {
-for (E element in this) {
- if (f(element)) return true;
- }
- return false;
-}
- List<E> toList({
-bool growable : true}
-) => new List<E>.from(this, growable: growable);
- Set<E> toSet() => new Set<E>.from(this);
- int get length {
-assert (this is! EfficientLength); int count = 0;
- Iterator<E> it = iterator;
- while (it.moveNext()) {
- count++;
- }
- return count;
-}
- bool get isEmpty => !iterator.moveNext();
- bool get isNotEmpty => !isEmpty;
- Iterable<E> take(int n) {
-return new TakeIterable<E>(this, n);
-}
- Iterable<E> takeWhile(bool test(E value)) {
-return new TakeWhileIterable<E>(this, test);
-}
- Iterable<E> skip(int n) {
-return new SkipIterable<E>(this, n);
-}
- Iterable<E> skipWhile(bool test(E value)) {
-return new SkipWhileIterable<E>(this, test);
-}
- E get first {
-Iterator<E> it = iterator;
- if (!it.moveNext()) {
- throw IterableElementError.noElement();
- }
- return it.current;
-}
- E get last {
-Iterator<E> it = iterator;
- if (!it.moveNext()) {
- throw IterableElementError.noElement();
- }
- E result;
- do {
- result = it.current;
- }
- while (it.moveNext()); return result;
-}
- E get single {
-Iterator<E> it = iterator;
- if (!it.moveNext()) throw IterableElementError.noElement();
- E result = it.current;
- if (it.moveNext()) throw IterableElementError.tooMany();
- return result;
-}
- E firstWhere(bool test(E value), {
-E orElse()}
-) {
-for (E element in this) {
- if (test(element)) return element;
- }
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
-}
- E lastWhere(bool test(E value), {
-E orElse()}
-) {
-E result = null;
- bool foundMatching = false;
- for (E element in this) {
- if (test(element)) {
- result = element;
- foundMatching = true;
- }
- }
- if (foundMatching) return result;
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
-}
- E singleWhere(bool test(E value)) {
-E result = null;
- bool foundMatching = false;
- for (E element in this) {
- if (test(element)) {
- if (foundMatching) {
- throw IterableElementError.tooMany();
- }
- result = element;
- foundMatching = true;
- }
- }
- if (foundMatching) return result;
- throw IterableElementError.noElement();
-}
- E elementAt(int index) {
-if (index is! int) throw new ArgumentError.notNull("index");
- RangeError.checkNotNegative(index, "index");
- int elementIndex = 0;
- for (E element in this) {
- if (index == elementIndex) return element;
- elementIndex++;
- }
- throw new RangeError.index(index, this, "index", null, elementIndex);
-}
- String toString() => iterableToShortString(this, '(', ')');
- static String iterableToShortString(Iterable iterable, [String leftDelimiter = '(', String rightDelimiter = ')']) {
-if (_isToStringVisiting(iterable)) {
- if (leftDelimiter == "(" && rightDelimiter == ")") {
- return "(...)";
- }
- return "$leftDelimiter...$rightDelimiter";
- }
- List parts = [];
- _toStringVisiting.add(iterable);
- try {
- _iterablePartsToStrings(iterable, parts);
- }
- finally {
- assert (identical(_toStringVisiting.last, iterable)); _toStringVisiting.removeLast();
- }
- return (new StringBuffer(leftDelimiter)..writeAll(parts, ", ")..write(rightDelimiter)).toString();
-}
- static String iterableToFullString(Iterable iterable, [String leftDelimiter = '(', String rightDelimiter = ')']) {
-if (_isToStringVisiting(iterable)) {
- return "$leftDelimiter...$rightDelimiter";
- }
- StringBuffer buffer = new StringBuffer(leftDelimiter);
- _toStringVisiting.add(iterable);
- try {
- buffer.writeAll(iterable, ", ");
- }
- finally {
- assert (identical(_toStringVisiting.last, iterable)); _toStringVisiting.removeLast();
- }
- buffer.write(rightDelimiter);
- return buffer.toString();
-}
- static final List _toStringVisiting = [];
- static bool _isToStringVisiting(Object o) {
-for (int i = 0; i < _toStringVisiting.length; i++) {
- if (identical(o, _toStringVisiting[i])) return true;
- }
- return false;
-}
- static void _iterablePartsToStrings(Iterable iterable, List parts) {
-const int LENGTH_LIMIT = 80;
- const int HEAD_COUNT = 3;
- const int TAIL_COUNT = 2;
- const int MAX_COUNT = 100;
- const int OVERHEAD = 2;
- const int ELLIPSIS_SIZE = 3;
- int length = 0;
- int count = 0;
- Iterator it = iterable.iterator;
- while (length < LENGTH_LIMIT || count < HEAD_COUNT) {
- if (!it.moveNext()) return; String next = "${it.current}";
- parts.add(next);
- length += next.length + OVERHEAD;
- count++;
- }
- String penultimateString;
- String ultimateString;
- var penultimate = null;
- var ultimate = null;
- if (!it.moveNext()) {
- if (count <= HEAD_COUNT + TAIL_COUNT) return; ultimateString = ((__x0) => DEVC$RT.cast(__x0, dynamic, String, "DynamicCast", """line 530, column 24 of dart:collection/iterable.dart: """, __x0 is String, true))(parts.removeLast());
- penultimateString = ((__x1) => DEVC$RT.cast(__x1, dynamic, String, "DynamicCast", """line 531, column 27 of dart:collection/iterable.dart: """, __x1 is String, true))(parts.removeLast());
- }
- else {
- penultimate = it.current;
- count++;
- if (!it.moveNext()) {
- if (count <= HEAD_COUNT + 1) {
- parts.add("$penultimate");
- return;}
- ultimateString = "$penultimate";
- penultimateString = ((__x2) => DEVC$RT.cast(__x2, dynamic, String, "DynamicCast", """line 541, column 29 of dart:collection/iterable.dart: """, __x2 is String, true))(parts.removeLast());
- length += ultimateString.length + OVERHEAD;
- }
- else {
- ultimate = it.current;
- count++;
- assert (count < MAX_COUNT); while (it.moveNext()) {
- penultimate = ultimate;
- ultimate = it.current;
- count++;
- if (count > MAX_COUNT) {
- while (length > LENGTH_LIMIT - ELLIPSIS_SIZE - OVERHEAD && count > HEAD_COUNT) {
- length -= ((__x3) => DEVC$RT.cast(__x3, dynamic, int, "DynamicCast", """line 562, column 25 of dart:collection/iterable.dart: """, __x3 is int, true))(parts.removeLast().length + OVERHEAD);
- count--;
- }
- parts.add("...");
- return;}
- }
- penultimateString = "$penultimate";
- ultimateString = "$ultimate";
- length += ultimateString.length + penultimateString.length + 2 * OVERHEAD;
- }
- }
- String elision = null;
- if (count > parts.length + TAIL_COUNT) {
- elision = "...";
- length += ELLIPSIS_SIZE + OVERHEAD;
- }
- while (length > LENGTH_LIMIT && parts.length > HEAD_COUNT) {
- length -= ((__x4) => DEVC$RT.cast(__x4, dynamic, int, "DynamicCast", """line 588, column 17 of dart:collection/iterable.dart: """, __x4 is int, true))(parts.removeLast().length + OVERHEAD);
- if (elision == null) {
- elision = "...";
- length += ELLIPSIS_SIZE + OVERHEAD;
- }
- }
- if (elision != null) {
- parts.add(elision);
- }
- parts.add(penultimateString);
- parts.add(ultimateString);
-}
-}
« no previous file with comments | « test/dart_codegen/expect/collection/hash_set.dart ('k') | test/dart_codegen/expect/collection/iterator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698