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

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

Issue 959003003: Typecheck constructor initializers properly (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase Created 5 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 | « test/dart_codegen/expect/async/zone.dart ('k') | test/dart_codegen/expect/collection/maps.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 104 }
105 if (matchFound) return match; 105 if (matchFound) return match;
106 throw IterableElementError.noElement(); 106 throw IterableElementError.noElement();
107 } 107 }
108 String join([String separator = ""]) { 108 String join([String separator = ""]) {
109 if (length == 0) return ""; 109 if (length == 0) return "";
110 StringBuffer buffer = new StringBuffer()..writeAll(this, separator); 110 StringBuffer buffer = new StringBuffer()..writeAll(this, separator);
111 return buffer.toString(); 111 return buffer.toString();
112 } 112 }
113 Iterable<E> where(bool test(E element)) => new WhereIterable<E>(this, test); 113 Iterable<E> where(bool test(E element)) => new WhereIterable<E>(this, test);
114 Iterable map(f(E element)) => new MappedListIterable(this, f); 114 Iterable map(f(E element)) => new MappedListIterable(this, DDC$RT.wrap((dynamic f(E __u10)) {
115 dynamic c(E x0) => f(DDC$RT.cast(x0, dynamic, E, "CastParam", """line 178, colum n 62 of dart:collection/list.dart: """, x0 is E, false));
116 return f == null ? null : c;
117 }
118 , f, DDC$RT.type((__t13<E> _) {
119 }
120 ), __t11, "Wrap", """line 178, column 62 of dart:collection/list.dart: """, f is __t11));
115 Iterable expand(Iterable f(E element)) => new ExpandIterable<E, dynamic>(this, f); 121 Iterable expand(Iterable f(E element)) => new ExpandIterable<E, dynamic>(this, f);
116 E reduce(E combine(E previousValue, E element)) { 122 E reduce(E combine(E previousValue, E element)) {
117 int length = this.length; 123 int length = this.length;
118 if (length == 0) throw IterableElementError.noElement(); 124 if (length == 0) throw IterableElementError.noElement();
119 E value = this[0]; 125 E value = this[0];
120 for (int i = 1; i < length; i++) { 126 for (int i = 1; i < length; i++) {
121 value = combine(value, this[i]); 127 value = combine(value, this[i]);
122 if (length != this.length) { 128 if (length != this.length) {
123 throw new ConcurrentModificationError(this); 129 throw new ConcurrentModificationError(this);
124 } 130 }
125 } 131 }
126 return value; 132 return value;
127 } 133 }
128 fold(var initialValue, combine(var previousValue, E element)) { 134 fold(var initialValue, combine(var previousValue, E element)) {
129 var value = initialValue; 135 var value = initialValue;
130 int length = this.length; 136 int length = this.length;
131 for (int i = 0; i < length; i++) { 137 for (int i = 0; i < length; i++) {
132 value = combine(value, this[i]); 138 value = combine(value, this[i]);
133 if (length != this.length) { 139 if (length != this.length) {
134 throw new ConcurrentModificationError(this); 140 throw new ConcurrentModificationError(this);
135 } 141 }
136 } 142 }
137 return value; 143 return value;
138 } 144 }
139 Iterable<E> skip(int count) => new SubListIterable<E>(this, count, null); 145 Iterable<E> skip(int count) => new SubListIterable<E>(this, count, ((__x15) => DDC$RT.cast(__x15, Null, int, "CastLiteral", """line 208, column 70 of dart:coll ection/list.dart: """, __x15 is int, true))(null));
140 Iterable<E> skipWhile(bool test(E element)) { 146 Iterable<E> skipWhile(bool test(E element)) {
141 return new SkipWhileIterable<E>(this, test); 147 return new SkipWhileIterable<E>(this, test);
142 } 148 }
143 Iterable<E> take(int count) => new SubListIterable<E>(this, 0, count); 149 Iterable<E> take(int count) => new SubListIterable<E>(this, 0, count);
144 Iterable<E> takeWhile(bool test(E element)) { 150 Iterable<E> takeWhile(bool test(E element)) {
145 return new TakeWhileIterable<E>(this, test); 151 return new TakeWhileIterable<E>(this, test);
146 } 152 }
147 List<E> toList({ 153 List<E> toList({
148 bool growable : true} 154 bool growable : true}
149 ) { 155 ) {
(...skipping 28 matching lines...) Expand all
178 for (int i = 0; i < this.length; i++) { 184 for (int i = 0; i < this.length; i++) {
179 if (this[i] == element) { 185 if (this[i] == element) {
180 this.setRange(i, this.length - 1, this, i + 1); 186 this.setRange(i, this.length - 1, this, i + 1);
181 this.length -= 1; 187 this.length -= 1;
182 return true; 188 return true;
183 } 189 }
184 } 190 }
185 return false; 191 return false;
186 } 192 }
187 void removeWhere(bool test(E element)) { 193 void removeWhere(bool test(E element)) {
188 _filter(this, DDC$RT.wrap((bool f(E __u10)) { 194 _filter(this, DDC$RT.wrap((bool f(E __u16)) {
189 bool c(E x0) => f(DDC$RT.cast(x0, dynamic, E, "CastParam", """line 264, column 19 of dart:collection/list.dart: """, x0 is E, false)); 195 bool c(E x0) => f(DDC$RT.cast(x0, dynamic, E, "CastParam", """line 264, column 19 of dart:collection/list.dart: """, x0 is E, false));
190 return f == null ? null : c; 196 return f == null ? null : c;
191 } 197 }
192 , test, DDC$RT.type((__t13<E> _) { 198 , test, DDC$RT.type((__t19<E> _) {
193 } 199 }
194 ), __t11, "Wrap", """line 264, column 19 of dart:collection/list.dart: """, test is __t11), false); 200 ), __t17, "Wrap", """line 264, column 19 of dart:collection/list.dart: """, test is __t17), false);
195 } 201 }
196 void retainWhere(bool test(E element)) { 202 void retainWhere(bool test(E element)) {
197 _filter(this, DDC$RT.wrap((bool f(E __u15)) { 203 _filter(this, DDC$RT.wrap((bool f(E __u21)) {
198 bool c(E x0) => f(DDC$RT.cast(x0, dynamic, E, "CastParam", """line 268, column 19 of dart:collection/list.dart: """, x0 is E, false)); 204 bool c(E x0) => f(DDC$RT.cast(x0, dynamic, E, "CastParam", """line 268, column 19 of dart:collection/list.dart: """, x0 is E, false));
199 return f == null ? null : c; 205 return f == null ? null : c;
200 } 206 }
201 , test, DDC$RT.type((__t13<E> _) { 207 , test, DDC$RT.type((__t19<E> _) {
202 } 208 }
203 ), __t11, "Wrap", """line 268, column 19 of dart:collection/list.dart: """, test is __t11), true); 209 ), __t17, "Wrap", """line 268, column 19 of dart:collection/list.dart: """, test is __t17), true);
204 } 210 }
205 static void _filter(List source, bool test(var element), bool retainMatching) { 211 static void _filter(List source, bool test(var element), bool retainMatching) {
206 List retained = []; 212 List retained = [];
207 int length = source.length; 213 int length = source.length;
208 for (int i = 0; i < length; i++) { 214 for (int i = 0; i < length; i++) {
209 var element = source[i]; 215 var element = source[i];
210 if (test(element) == retainMatching) { 216 if (test(element) == retainMatching) {
211 retained.add(element); 217 retained.add(element);
212 } 218 }
213 if (length != source.length) { 219 if (length != source.length) {
(...skipping 14 matching lines...) Expand all
228 } 234 }
229 E result = this[length - 1]; 235 E result = this[length - 1];
230 length--; 236 length--;
231 return result; 237 return result;
232 } 238 }
233 void sort([int compare(E a, E b)]) { 239 void sort([int compare(E a, E b)]) {
234 if (compare == null) { 240 if (compare == null) {
235 var defaultCompare = Comparable.compare; 241 var defaultCompare = Comparable.compare;
236 compare = defaultCompare; 242 compare = defaultCompare;
237 } 243 }
238 Sort.sort(this, DDC$RT.wrap((int f(E __u16, E __u17)) { 244 Sort.sort(this, DDC$RT.wrap((int f(E __u22, E __u23)) {
239 int c(E x0, E x1) => f(DDC$RT.cast(x0, dynamic, E, "CastParam", """line 309, c olumn 21 of dart:collection/list.dart: """, x0 is E, false), DDC$RT.cast(x1, dyn amic, E, "CastParam", """line 309, column 21 of dart:collection/list.dart: """, x1 is E, false)); 245 int c(E x0, E x1) => f(DDC$RT.cast(x0, dynamic, E, "CastParam", """line 309, c olumn 21 of dart:collection/list.dart: """, x0 is E, false), DDC$RT.cast(x1, dyn amic, E, "CastParam", """line 309, column 21 of dart:collection/list.dart: """, x1 is E, false));
240 return f == null ? null : c; 246 return f == null ? null : c;
241 } 247 }
242 , compare, DDC$RT.type((__t21<E> _) { 248 , compare, DDC$RT.type((__t27<E> _) {
243 } 249 }
244 ), __t18, "Wrap", """line 309, column 21 of dart:collection/list.dart: """, comp are is __t18)); 250 ), __t24, "Wrap", """line 309, column 21 of dart:collection/list.dart: """, comp are is __t24));
245 } 251 }
246 void shuffle([Random random]) { 252 void shuffle([Random random]) {
247 if (random == null) random = new Random(); 253 if (random == null) random = new Random();
248 int length = this.length; 254 int length = this.length;
249 while (length > 1) { 255 while (length > 1) {
250 int pos = random.nextInt(length); 256 int pos = random.nextInt(length);
251 length -= 1; 257 length -= 1;
252 var tmp = this[length]; 258 var tmp = this[length];
253 this[length] = this[pos]; 259 this[length] = this[pos];
254 this[pos] = tmp; 260 this[pos] = tmp;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 306 }
301 else { 307 else {
302 otherList = iterable.skip(skipCount).toList(growable: false); 308 otherList = iterable.skip(skipCount).toList(growable: false);
303 otherStart = 0; 309 otherStart = 0;
304 } 310 }
305 if (otherStart + length > otherList.length) { 311 if (otherStart + length > otherList.length) {
306 throw IterableElementError.tooFew(); 312 throw IterableElementError.tooFew();
307 } 313 }
308 if (otherStart < start) { 314 if (otherStart < start) {
309 for (int i = length - 1; i >= 0; i--) { 315 for (int i = length - 1; i >= 0; i--) {
310 this[start + i] = ((__x24) => DDC$RT.cast(__x24, dynamic, E, "CastGeneral", """line 381, column 27 of dart:collection/list.dart: """, __x24 is E, false))(ot herList[otherStart + i]); 316 this[start + i] = ((__x30) => DDC$RT.cast(__x30, dynamic, E, "CastGeneral", """line 381, column 27 of dart:collection/list.dart: """, __x30 is E, false))(ot herList[otherStart + i]);
311 } 317 }
312 } 318 }
313 else { 319 else {
314 for (int i = 0; i < length; i++) { 320 for (int i = 0; i < length; i++) {
315 this[start + i] = ((__x25) => DDC$RT.cast(__x25, dynamic, E, "CastGeneral", """line 385, column 27 of dart:collection/list.dart: """, __x25 is E, false))(ot herList[otherStart + i]); 321 this[start + i] = ((__x31) => DDC$RT.cast(__x31, dynamic, E, "CastGeneral", """line 385, column 27 of dart:collection/list.dart: """, __x31 is E, false))(ot herList[otherStart + i]);
316 } 322 }
317 } 323 }
318 } 324 }
319 void replaceRange(int start, int end, Iterable<E> newContents) { 325 void replaceRange(int start, int end, Iterable<E> newContents) {
320 RangeError.checkValidRange(start, end, this.length); 326 RangeError.checkValidRange(start, end, this.length);
321 if (newContents is! EfficientLength) { 327 if (newContents is! EfficientLength) {
322 newContents = newContents.toList(); 328 newContents = newContents.toList();
323 } 329 }
324 int removeLength = end - start; 330 int removeLength = end - start;
325 int insertLength = newContents.length; 331 int insertLength = newContents.length;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 } 413 }
408 else { 414 else {
409 for (E element in iterable) { 415 for (E element in iterable) {
410 this[index++] = element; 416 this[index++] = element;
411 } 417 }
412 } 418 }
413 } 419 }
414 Iterable<E> get reversed => new ReversedListIterable<E>(this); 420 Iterable<E> get reversed => new ReversedListIterable<E>(this);
415 String toString() => IterableBase.iterableToFullString(this, '[', ']'); 421 String toString() => IterableBase.iterableToFullString(this, '[', ']');
416 } 422 }
417 typedef bool __t11(dynamic __u12); 423 typedef dynamic __t11(dynamic __u12);
418 typedef bool __t13<E>(E __u14); 424 typedef dynamic __t13<E>(E __u14);
419 typedef int __t18(dynamic __u19, dynamic __u20); 425 typedef bool __t17(dynamic __u18);
420 typedef int __t21<E>(E __u22, E __u23); 426 typedef bool __t19<E>(E __u20);
427 typedef int __t24(dynamic __u25, dynamic __u26);
428 typedef int __t27<E>(E __u28, E __u29);
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/async/zone.dart ('k') | test/dart_codegen/expect/collection/maps.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698