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

Side by Side Diff: test/dart_codegen/expect/async/stream.dart

Issue 1038213003: Downward inference (Closed) Base URL: git@github.com:dart-lang/dart-dev-compiler.git@master
Patch Set: Rebase Created 5 years, 8 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.async; 1 part of dart.async;
2 abstract class Stream<T> {Stream(); 2 abstract class Stream<T> {Stream();
3 factory Stream.fromFuture(Future<T> future) { 3 factory Stream.fromFuture(Future<T> future) {
4 _StreamController<T> controller = ((__x29) => DEVC$RT.cast(__x29, DEVC$RT.type ((StreamController<T> _) { 4 _StreamController<T> controller = new StreamController<T>(sync: true);
5 } 5 future.then(((__x30) => DEVC$RT.wrap((dynamic f(dynamic __u25)) {
6 ), DEVC$RT.type((_StreamController<T> _) {
7 }
8 ), "InferableAllocation", """line 87, column 39 of dart:async/stream.dart: """ , __x29 is _StreamController<T>, false))(new StreamController<T>(sync: true));
9 future.then(((__x35) => DEVC$RT.wrap((dynamic f(dynamic __u30)) {
10 dynamic c(dynamic x0) => f(x0); 6 dynamic c(dynamic x0) => f(x0);
11 return f == null ? null : c; 7 return f == null ? null : c;
12 } 8 }
13 , __x35, __t33, DEVC$RT.type((__t31<T> _) { 9 , __x30, __t28, DEVC$RT.type((__t26<T> _) {
14 } 10 }
15 ), "WrapLiteral", """line 88, column 17 of dart:async/stream.dart: """, __x35 is __t31<T>))((value) { 11 ), "WrapLiteral", """line 88, column 17 of dart:async/stream.dart: """, __x30 is __t26<T>))((value) {
16 controller._add(DEVC$RT.cast(value, dynamic, T, "CompositeCast", """line 89, column 25 of dart:async/stream.dart: """, value is T, false)); 12 controller._add(DEVC$RT.cast(value, dynamic, T, "CompositeCast", """line 89, column 25 of dart:async/stream.dart: """, value is T, false));
17 controller._closeUnchecked(); 13 controller._closeUnchecked();
18 } 14 }
19 ), onError: (error, stackTrace) { 15 ), onError: (error, stackTrace) {
20 controller._addError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "D ynamicCast", """line 93, column 37 of dart:async/stream.dart: """, stackTrace is StackTrace, true)); 16 controller._addError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "D ynamicCast", """line 93, column 37 of dart:async/stream.dart: """, stackTrace is StackTrace, true));
21 controller._closeUnchecked(); 17 controller._closeUnchecked();
22 } 18 }
23 ); 19 );
24 return controller.stream; 20 return controller.stream;
25 } 21 }
26 factory Stream.fromIterable(Iterable<T> data) { 22 factory Stream.fromIterable(Iterable<T> data) {
27 return new _GeneratedStreamImpl<T>(() => new _IterablePendingEvents<T>(data)); 23 return new _GeneratedStreamImpl<T>(() => new _IterablePendingEvents<T>(data));
28 } 24 }
29 factory Stream.periodic(Duration period, [T computation(int computationCount)]) { 25 factory Stream.periodic(Duration period, [T computation(int computationCount)]) {
30 if (computation == null) computation = ((__x41) => DEVC$RT.wrap((dynamic f(dyn amic __u36)) { 26 if (computation == null) computation = ((__x36) => DEVC$RT.wrap((dynamic f(dyn amic __u31)) {
31 dynamic c(dynamic x0) => f(x0); 27 dynamic c(dynamic x0) => f(x0);
32 return f == null ? null : c; 28 return f == null ? null : c;
33 } 29 }
34 , __x41, __t39, DEVC$RT.type((__t37<T> _) { 30 , __x36, __t34, DEVC$RT.type((__t32<T> _) {
35 } 31 }
36 ), "Wrap", """line 126, column 44 of dart:async/stream.dart: """, __x41 is __t 37<T>))(((i) => null)); 32 ), "Wrap", """line 126, column 44 of dart:async/stream.dart: """, __x36 is __t 32<T>))(((i) => null));
37 Timer timer; 33 Timer timer;
38 int computationCount = 0; 34 int computationCount = 0;
39 StreamController<T> controller; 35 StreamController<T> controller;
40 Stopwatch watch = new Stopwatch(); 36 Stopwatch watch = new Stopwatch();
41 void sendEvent() { 37 void sendEvent() {
42 watch.reset(); 38 watch.reset();
43 T data = computation(computationCount++); 39 T data = computation(computationCount++);
44 controller.add(data); 40 controller.add(data);
45 } 41 }
46 void startPeriodicTimer() { 42 void startPeriodicTimer() {
(...skipping 22 matching lines...) Expand all
69 ); 65 );
70 } 66 }
71 , onCancel: () { 67 , onCancel: () {
72 if (timer != null) timer.cancel(); 68 if (timer != null) timer.cancel();
73 timer = null; 69 timer = null;
74 } 70 }
75 ); 71 );
76 return controller.stream; 72 return controller.stream;
77 } 73 }
78 factory Stream.eventTransformed(Stream source, EventSink mapSink(EventSink<T> s ink)) { 74 factory Stream.eventTransformed(Stream source, EventSink mapSink(EventSink<T> s ink)) {
79 return ((__x42) => DEVC$RT.cast(__x42, DEVC$RT.type((_BoundSinkStream<dynamic, dynamic> _) { 75 return new _BoundSinkStream<dynamic, T>(source, DEVC$RT.wrap((EventSink<dynami c> f(EventSink<T> __u37)) {
80 }
81 ), DEVC$RT.type((Stream<T> _) {
82 }
83 ), "InferableAllocation", """line 216, column 12 of dart:async/stream.dart: "" ", __x42 is Stream<T>, false))(new _BoundSinkStream(source, DEVC$RT.wrap((EventS ink<dynamic> f(EventSink<T> __u43)) {
84 EventSink<dynamic> c(EventSink<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((Ev entSink<dynamic> _) { 76 EventSink<dynamic> c(EventSink<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((Ev entSink<dynamic> _) {
85 } 77 }
86 ), DEVC$RT.type((EventSink<T> _) { 78 ), DEVC$RT.type((EventSink<T> _) {
87 } 79 }
88 ), "CastParam", """line 216, column 41 of dart:async/stream.dart: """, x0 is EventSink<T>, false)); 80 ), "CastParam", """line 216, column 41 of dart:async/stream.dart: """, x0 is EventSink<T>, false));
89 return f == null ? null : c; 81 return f == null ? null : c;
90 } 82 }
91 , mapSink, DEVC$RT.type((__t46<T> _) { 83 , mapSink, DEVC$RT.type((__t40<T> _) {
92 } 84 }
93 ), __t44, "Wrap", """line 216, column 41 of dart:async/stream.dart: """, mapSi nk is __t44))); 85 ), __t38, "Wrap", """line 216, column 41 of dart:async/stream.dart: """, mapSi nk is __t38));
94 } 86 }
95 bool get isBroadcast => false; 87 bool get isBroadcast => false;
96 Stream<T> asBroadcastStream({ 88 Stream<T> asBroadcastStream({
97 void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscri ption<T> subscription)} 89 void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscri ption<T> subscription)}
98 ) { 90 ) {
99 return new _AsBroadcastStream<T>(this, DEVC$RT.wrap((void f(StreamSubscription <T> __u48)) { 91 return new _AsBroadcastStream<T>(this, DEVC$RT.wrap((void f(StreamSubscription <T> __u42)) {
100 void c(StreamSubscription<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((StreamS ubscription<dynamic> _) { 92 void c(StreamSubscription<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((StreamS ubscription<dynamic> _) {
101 } 93 }
102 ), DEVC$RT.type((StreamSubscription<T> _) { 94 ), DEVC$RT.type((StreamSubscription<T> _) {
103 } 95 }
104 ), "CastParam", """line 248, column 44 of dart:async/stream.dart: """, x0 is StreamSubscription<T>, false)); 96 ), "CastParam", """line 248, column 44 of dart:async/stream.dart: """, x0 is StreamSubscription<T>, false));
105 return f == null ? null : c; 97 return f == null ? null : c;
106 } 98 }
107 , onListen, DEVC$RT.type((__t51<T> _) { 99 , onListen, DEVC$RT.type((__t45<T> _) {
108 } 100 }
109 ), __t49, "Wrap", """line 248, column 44 of dart:async/stream.dart: """, onLis ten is __t49), DEVC$RT.wrap((void f(StreamSubscription<T> __u53)) { 101 ), __t43, "Wrap", """line 248, column 44 of dart:async/stream.dart: """, onLis ten is __t43), DEVC$RT.wrap((void f(StreamSubscription<T> __u47)) {
110 void c(StreamSubscription<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((StreamS ubscription<dynamic> _) { 102 void c(StreamSubscription<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((StreamS ubscription<dynamic> _) {
111 } 103 }
112 ), DEVC$RT.type((StreamSubscription<T> _) { 104 ), DEVC$RT.type((StreamSubscription<T> _) {
113 } 105 }
114 ), "CastParam", """line 248, column 54 of dart:async/stream.dart: """, x0 is StreamSubscription<T>, false)); 106 ), "CastParam", """line 248, column 54 of dart:async/stream.dart: """, x0 is StreamSubscription<T>, false));
115 return f == null ? null : c; 107 return f == null ? null : c;
116 } 108 }
117 , onCancel, DEVC$RT.type((__t51<T> _) { 109 , onCancel, DEVC$RT.type((__t45<T> _) {
118 } 110 }
119 ), __t49, "Wrap", """line 248, column 54 of dart:async/stream.dart: """, onCan cel is __t49)); 111 ), __t43, "Wrap", """line 248, column 54 of dart:async/stream.dart: """, onCan cel is __t43));
120 } 112 }
121 StreamSubscription<T> listen(void onData(T event), { 113 StreamSubscription<T> listen(void onData(T event), {
122 Function onError, void onDone(), bool cancelOnError} 114 Function onError, void onDone(), bool cancelOnError}
123 ); 115 );
124 Stream<T> where(bool test(T event)) { 116 Stream<T> where(bool test(T event)) {
125 return new _WhereStream<T>(this, test); 117 return new _WhereStream<T>(this, test);
126 } 118 }
127 Stream map(convert(T event)) { 119 Stream map(convert(T event)) {
128 return new _MapStream<T, dynamic>(this, convert); 120 return new _MapStream<T, dynamic>(this, convert);
129 } 121 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 Future<T> reduce(T combine(T previous, T element)) { 221 Future<T> reduce(T combine(T previous, T element)) {
230 _Future<T> result = new _Future<T>(); 222 _Future<T> result = new _Future<T>();
231 bool seenFirst = false; 223 bool seenFirst = false;
232 T value; 224 T value;
233 StreamSubscription subscription; 225 StreamSubscription subscription;
234 subscription = this.listen((T element) { 226 subscription = this.listen((T element) {
235 if (seenFirst) { 227 if (seenFirst) {
236 _runUserCode(() => combine(value, element), (T newValue) { 228 _runUserCode(() => combine(value, element), (T newValue) {
237 value = newValue; 229 value = newValue;
238 } 230 }
239 , ((__x57) => DEVC$RT.cast(__x57, dynamic, __t54, "CompositeCast", """line 501, column 24 of dart:async/stream.dart: """, __x57 is __t54, false))(_cancelA ndErrorClosure(subscription, result))); 231 , ((__x51) => DEVC$RT.cast(__x51, dynamic, __t48, "CompositeCast", """line 501, column 24 of dart:async/stream.dart: """, __x51 is __t48, false))(_cancelA ndErrorClosure(subscription, result)));
240 } 232 }
241 else { 233 else {
242 value = element; 234 value = element;
243 seenFirst = true; 235 seenFirst = true;
244 } 236 }
245 } 237 }
246 , onError: result._completeError, onDone: () { 238 , onError: result._completeError, onDone: () {
247 if (!seenFirst) { 239 if (!seenFirst) {
248 try { 240 try {
249 throw IterableElementError.noElement(); 241 throw IterableElementError.noElement();
(...skipping 10 matching lines...) Expand all
260 return result; 252 return result;
261 } 253 }
262 Future fold(var initialValue, combine(var previous, T element)) { 254 Future fold(var initialValue, combine(var previous, T element)) {
263 _Future result = new _Future(); 255 _Future result = new _Future();
264 var value = initialValue; 256 var value = initialValue;
265 StreamSubscription subscription; 257 StreamSubscription subscription;
266 subscription = this.listen((T element) { 258 subscription = this.listen((T element) {
267 _runUserCode(() => combine(value, element), (newValue) { 259 _runUserCode(() => combine(value, element), (newValue) {
268 value = newValue; 260 value = newValue;
269 } 261 }
270 , ((__x58) => DEVC$RT.cast(__x58, dynamic, __t54, "CompositeCast", """line 5 34, column 11 of dart:async/stream.dart: """, __x58 is __t54, false))(_cancelAnd ErrorClosure(subscription, result))); 262 , ((__x52) => DEVC$RT.cast(__x52, dynamic, __t48, "CompositeCast", """line 5 34, column 11 of dart:async/stream.dart: """, __x52 is __t48, false))(_cancelAnd ErrorClosure(subscription, result)));
271 } 263 }
272 , onError: (e, st) { 264 , onError: (e, st) {
273 result._completeError(e, DEVC$RT.cast(st, dynamic, StackTrace, "DynamicCast" , """line 538, column 34 of dart:async/stream.dart: """, st is StackTrace, true) ); 265 result._completeError(e, DEVC$RT.cast(st, dynamic, StackTrace, "DynamicCast" , """line 538, column 34 of dart:async/stream.dart: """, st is StackTrace, true) );
274 } 266 }
275 , onDone: () { 267 , onDone: () {
276 result._complete(value); 268 result._complete(value);
277 } 269 }
278 , cancelOnError: true); 270 , cancelOnError: true);
279 return result; 271 return result;
280 } 272 }
(...skipping 25 matching lines...) Expand all
306 } 298 }
307 Future<bool> contains(Object needle) { 299 Future<bool> contains(Object needle) {
308 _Future<bool> future = new _Future<bool>(); 300 _Future<bool> future = new _Future<bool>();
309 StreamSubscription subscription; 301 StreamSubscription subscription;
310 subscription = this.listen((T element) { 302 subscription = this.listen((T element) {
311 _runUserCode(() => (element == needle), (bool isMatch) { 303 _runUserCode(() => (element == needle), (bool isMatch) {
312 if (isMatch) { 304 if (isMatch) {
313 _cancelAndValue(subscription, future, true); 305 _cancelAndValue(subscription, future, true);
314 } 306 }
315 } 307 }
316 , ((__x59) => DEVC$RT.cast(__x59, dynamic, __t54, "CompositeCast", """line 6 02, column 13 of dart:async/stream.dart: """, __x59 is __t54, false))(_cancelAnd ErrorClosure(subscription, future))); 308 , ((__x53) => DEVC$RT.cast(__x53, dynamic, __t48, "CompositeCast", """line 6 02, column 13 of dart:async/stream.dart: """, __x53 is __t48, false))(_cancelAnd ErrorClosure(subscription, future)));
317 } 309 }
318 , onError: future._completeError, onDone: () { 310 , onError: future._completeError, onDone: () {
319 future._complete(false); 311 future._complete(false);
320 } 312 }
321 , cancelOnError: true); 313 , cancelOnError: true);
322 return future; 314 return future;
323 } 315 }
324 Future forEach(void action(T element)) { 316 Future forEach(void action(T element)) {
325 _Future future = new _Future(); 317 _Future future = new _Future();
326 StreamSubscription subscription; 318 StreamSubscription subscription;
327 subscription = this.listen((T element) { 319 subscription = this.listen((T element) {
328 _runUserCode(() => action(element), (_) { 320 _runUserCode(() => action(element), (_) {
329 } 321 }
330 , ((__x60) => DEVC$RT.cast(__x60, dynamic, __t54, "CompositeCast", """line 6 28, column 13 of dart:async/stream.dart: """, __x60 is __t54, false))(_cancelAnd ErrorClosure(subscription, future))); 322 , ((__x54) => DEVC$RT.cast(__x54, dynamic, __t48, "CompositeCast", """line 6 28, column 13 of dart:async/stream.dart: """, __x54 is __t48, false))(_cancelAnd ErrorClosure(subscription, future)));
331 } 323 }
332 , onError: future._completeError, onDone: () { 324 , onError: future._completeError, onDone: () {
333 future._complete(null); 325 future._complete(null);
334 } 326 }
335 , cancelOnError: true); 327 , cancelOnError: true);
336 return future; 328 return future;
337 } 329 }
338 Future<bool> every(bool test(T element)) { 330 Future<bool> every(bool test(T element)) {
339 _Future<bool> future = new _Future<bool>(); 331 _Future<bool> future = new _Future<bool>();
340 StreamSubscription subscription; 332 StreamSubscription subscription;
341 subscription = this.listen((T element) { 333 subscription = this.listen((T element) {
342 _runUserCode(() => test(element), (bool isMatch) { 334 _runUserCode(() => test(element), (bool isMatch) {
343 if (!isMatch) { 335 if (!isMatch) {
344 _cancelAndValue(subscription, future, false); 336 _cancelAndValue(subscription, future, false);
345 } 337 }
346 } 338 }
347 , ((__x61) => DEVC$RT.cast(__x61, dynamic, __t54, "CompositeCast", """line 6 57, column 13 of dart:async/stream.dart: """, __x61 is __t54, false))(_cancelAnd ErrorClosure(subscription, future))); 339 , ((__x55) => DEVC$RT.cast(__x55, dynamic, __t48, "CompositeCast", """line 6 57, column 13 of dart:async/stream.dart: """, __x55 is __t48, false))(_cancelAnd ErrorClosure(subscription, future)));
348 } 340 }
349 , onError: future._completeError, onDone: () { 341 , onError: future._completeError, onDone: () {
350 future._complete(true); 342 future._complete(true);
351 } 343 }
352 , cancelOnError: true); 344 , cancelOnError: true);
353 return future; 345 return future;
354 } 346 }
355 Future<bool> any(bool test(T element)) { 347 Future<bool> any(bool test(T element)) {
356 _Future<bool> future = new _Future<bool>(); 348 _Future<bool> future = new _Future<bool>();
357 StreamSubscription subscription; 349 StreamSubscription subscription;
358 subscription = this.listen((T element) { 350 subscription = this.listen((T element) {
359 _runUserCode(() => test(element), (bool isMatch) { 351 _runUserCode(() => test(element), (bool isMatch) {
360 if (isMatch) { 352 if (isMatch) {
361 _cancelAndValue(subscription, future, true); 353 _cancelAndValue(subscription, future, true);
362 } 354 }
363 } 355 }
364 , ((__x62) => DEVC$RT.cast(__x62, dynamic, __t54, "CompositeCast", """line 6 94, column 13 of dart:async/stream.dart: """, __x62 is __t54, false))(_cancelAnd ErrorClosure(subscription, future))); 356 , ((__x56) => DEVC$RT.cast(__x56, dynamic, __t48, "CompositeCast", """line 6 94, column 13 of dart:async/stream.dart: """, __x56 is __t48, false))(_cancelAnd ErrorClosure(subscription, future)));
365 } 357 }
366 , onError: future._completeError, onDone: () { 358 , onError: future._completeError, onDone: () {
367 future._complete(false); 359 future._complete(false);
368 } 360 }
369 , cancelOnError: true); 361 , cancelOnError: true);
370 return future; 362 return future;
371 } 363 }
372 Future<int> get length { 364 Future<int> get length {
373 _Future<int> future = new _Future<int>(); 365 _Future<int> future = new _Future<int>();
374 int count = 0; 366 int count = 0;
375 this.listen(((__x66) => DEVC$RT.wrap((dynamic f(dynamic __u63)) { 367 this.listen(((__x60) => DEVC$RT.wrap((dynamic f(dynamic __u57)) {
376 dynamic c(dynamic x0) => f(x0); 368 dynamic c(dynamic x0) => f(x0);
377 return f == null ? null : c; 369 return f == null ? null : c;
378 } 370 }
379 , __x66, __t33, DEVC$RT.type((__t64<T> _) { 371 , __x60, __t28, DEVC$RT.type((__t58<T> _) {
380 } 372 }
381 ), "WrapLiteral", """line 711, column 7 of dart:async/stream.dart: """, __x66 is __t64<T>))((_) { 373 ), "WrapLiteral", """line 711, column 7 of dart:async/stream.dart: """, __x60 is __t58<T>))((_) {
382 count++; 374 count++;
383 } 375 }
384 ), onError: future._completeError, onDone: () { 376 ), onError: future._completeError, onDone: () {
385 future._complete(count); 377 future._complete(count);
386 } 378 }
387 , cancelOnError: true); 379 , cancelOnError: true);
388 return future; 380 return future;
389 } 381 }
390 Future<bool> get isEmpty { 382 Future<bool> get isEmpty {
391 _Future<bool> future = new _Future<bool>(); 383 _Future<bool> future = new _Future<bool>();
392 StreamSubscription subscription; 384 StreamSubscription subscription;
393 subscription = this.listen(((__x68) => DEVC$RT.wrap((dynamic f(dynamic __u67) ) { 385 subscription = this.listen(((__x62) => DEVC$RT.wrap((dynamic f(dynamic __u61) ) {
394 dynamic c(dynamic x0) => f(x0); 386 dynamic c(dynamic x0) => f(x0);
395 return f == null ? null : c; 387 return f == null ? null : c;
396 } 388 }
397 , __x68, __t33, DEVC$RT.type((__t64<T> _) { 389 , __x62, __t28, DEVC$RT.type((__t58<T> _) {
398 } 390 }
399 ), "WrapLiteral", """line 733, column 7 of dart:async/stream.dart: """, __x68 is __t64<T>))((_) { 391 ), "WrapLiteral", """line 733, column 7 of dart:async/stream.dart: """, __x62 is __t58<T>))((_) {
400 _cancelAndValue(subscription, future, false); 392 _cancelAndValue(subscription, future, false);
401 } 393 }
402 ), onError: future._completeError, onDone: () { 394 ), onError: future._completeError, onDone: () {
403 future._complete(true); 395 future._complete(true);
404 } 396 }
405 , cancelOnError: true); 397 , cancelOnError: true);
406 return future; 398 return future;
407 } 399 }
408 Future<List<T>> toList() { 400 Future<List<T>> toList() {
409 List<T> result = <T> []; 401 List<T> result = <T> [];
(...skipping 14 matching lines...) Expand all
424 result.add(data); 416 result.add(data);
425 } 417 }
426 , onError: future._completeError, onDone: () { 418 , onError: future._completeError, onDone: () {
427 future._complete(result); 419 future._complete(result);
428 } 420 }
429 , cancelOnError: true); 421 , cancelOnError: true);
430 return future; 422 return future;
431 } 423 }
432 Future drain([var futureValue]) => listen(null, cancelOnError: true).asFuture(f utureValue); 424 Future drain([var futureValue]) => listen(null, cancelOnError: true).asFuture(f utureValue);
433 Stream<T> take(int count) { 425 Stream<T> take(int count) {
434 return ((__x69) => DEVC$RT.cast(__x69, DEVC$RT.type((_TakeStream<dynamic> _) { 426 return new _TakeStream<T>(this, count);
435 }
436 ), DEVC$RT.type((Stream<T> _) {
437 }
438 ), "InferableAllocation", """line 819, column 12 of dart:async/stream.dart: "" ", __x69 is Stream<T>, false))(new _TakeStream(this, count));
439 } 427 }
440 Stream<T> takeWhile(bool test(T element)) { 428 Stream<T> takeWhile(bool test(T element)) {
441 return ((__x70) => DEVC$RT.cast(__x70, DEVC$RT.type((_TakeWhileStream<dynamic> _) { 429 return new _TakeWhileStream<T>(this, test);
442 }
443 ), DEVC$RT.type((Stream<T> _) {
444 }
445 ), "InferableAllocation", """line 841, column 12 of dart:async/stream.dart: "" ", __x70 is Stream<T>, false))(new _TakeWhileStream(this, test));
446 } 430 }
447 Stream<T> skip(int count) { 431 Stream<T> skip(int count) {
448 return ((__x71) => DEVC$RT.cast(__x71, DEVC$RT.type((_SkipStream<dynamic> _) { 432 return new _SkipStream<T>(this, count);
449 }
450 ), DEVC$RT.type((Stream<T> _) {
451 }
452 ), "InferableAllocation", """line 852, column 12 of dart:async/stream.dart: "" ", __x71 is Stream<T>, false))(new _SkipStream(this, count));
453 } 433 }
454 Stream<T> skipWhile(bool test(T element)) { 434 Stream<T> skipWhile(bool test(T element)) {
455 return ((__x72) => DEVC$RT.cast(__x72, DEVC$RT.type((_SkipWhileStream<dynamic> _) { 435 return new _SkipWhileStream<T>(this, test);
456 }
457 ), DEVC$RT.type((Stream<T> _) {
458 }
459 ), "InferableAllocation", """line 868, column 12 of dart:async/stream.dart: "" ", __x72 is Stream<T>, false))(new _SkipWhileStream(this, test));
460 } 436 }
461 Stream<T> distinct([bool equals(T previous, T next)]) { 437 Stream<T> distinct([bool equals(T previous, T next)]) {
462 return ((__x73) => DEVC$RT.cast(__x73, DEVC$RT.type((_DistinctStream<dynamic> _) { 438 return new _DistinctStream<T>(this, equals);
463 }
464 ), DEVC$RT.type((Stream<T> _) {
465 }
466 ), "InferableAllocation", """line 885, column 12 of dart:async/stream.dart: "" ", __x73 is Stream<T>, false))(new _DistinctStream(this, equals));
467 } 439 }
468 Future<T> get first { 440 Future<T> get first {
469 _Future<T> future = new _Future<T>(); 441 _Future<T> future = new _Future<T>();
470 StreamSubscription subscription; 442 StreamSubscription subscription;
471 subscription = this.listen((T value) { 443 subscription = this.listen((T value) {
472 _cancelAndValue(subscription, future, value); 444 _cancelAndValue(subscription, future, value);
473 } 445 }
474 , onError: future._completeError, onDone: () { 446 , onError: future._completeError, onDone: () {
475 try { 447 try {
476 throw IterableElementError.noElement(); 448 throw IterableElementError.noElement();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 Object defaultValue()} 512 Object defaultValue()}
541 ) { 513 ) {
542 _Future<dynamic> future = new _Future(); 514 _Future<dynamic> future = new _Future();
543 StreamSubscription subscription; 515 StreamSubscription subscription;
544 subscription = this.listen((T value) { 516 subscription = this.listen((T value) {
545 _runUserCode(() => test(value), (bool isMatch) { 517 _runUserCode(() => test(value), (bool isMatch) {
546 if (isMatch) { 518 if (isMatch) {
547 _cancelAndValue(subscription, future, value); 519 _cancelAndValue(subscription, future, value);
548 } 520 }
549 } 521 }
550 , ((__x74) => DEVC$RT.cast(__x74, dynamic, __t54, "CompositeCast", """line 1 036, column 11 of dart:async/stream.dart: """, __x74 is __t54, false))(_cancelAn dErrorClosure(subscription, future))); 522 , ((__x63) => DEVC$RT.cast(__x63, dynamic, __t48, "CompositeCast", """line 1 036, column 11 of dart:async/stream.dart: """, __x63 is __t48, false))(_cancelAn dErrorClosure(subscription, future)));
551 } 523 }
552 , onError: future._completeError, onDone: () { 524 , onError: future._completeError, onDone: () {
553 if (defaultValue != null) { 525 if (defaultValue != null) {
554 _runUserCode(defaultValue, future._complete, future._completeError); 526 _runUserCode(defaultValue, future._complete, future._completeError);
555 return;} 527 return;}
556 try { 528 try {
557 throw IterableElementError.noElement(); 529 throw IterableElementError.noElement();
558 } 530 }
559 catch (e, s) { 531 catch (e, s) {
560 _completeWithErrorCallback(future, e, s); 532 _completeWithErrorCallback(future, e, s);
561 } 533 }
562 } 534 }
563 , cancelOnError: true); 535 , cancelOnError: true);
564 return future; 536 return future;
565 } 537 }
566 Future<dynamic> lastWhere(bool test(T element), { 538 Future<dynamic> lastWhere(bool test(T element), {
567 Object defaultValue()} 539 Object defaultValue()}
568 ) { 540 ) {
569 _Future<dynamic> future = new _Future(); 541 _Future<dynamic> future = new _Future();
570 T result = null; 542 T result = null;
571 bool foundResult = false; 543 bool foundResult = false;
572 StreamSubscription subscription; 544 StreamSubscription subscription;
573 subscription = this.listen((T value) { 545 subscription = this.listen((T value) {
574 _runUserCode(() => true == test(value), (bool isMatch) { 546 _runUserCode(() => true == test(value), (bool isMatch) {
575 if (isMatch) { 547 if (isMatch) {
576 foundResult = true; 548 foundResult = true;
577 result = value; 549 result = value;
578 } 550 }
579 } 551 }
580 , ((__x75) => DEVC$RT.cast(__x75, dynamic, __t54, "CompositeCast", """line 1 077, column 11 of dart:async/stream.dart: """, __x75 is __t54, false))(_cancelAn dErrorClosure(subscription, future))); 552 , ((__x64) => DEVC$RT.cast(__x64, dynamic, __t48, "CompositeCast", """line 1 077, column 11 of dart:async/stream.dart: """, __x64 is __t48, false))(_cancelAn dErrorClosure(subscription, future)));
581 } 553 }
582 , onError: future._completeError, onDone: () { 554 , onError: future._completeError, onDone: () {
583 if (foundResult) { 555 if (foundResult) {
584 future._complete(result); 556 future._complete(result);
585 return;} 557 return;}
586 if (defaultValue != null) { 558 if (defaultValue != null) {
587 _runUserCode(defaultValue, future._complete, future._completeError); 559 _runUserCode(defaultValue, future._complete, future._completeError);
588 return;} 560 return;}
589 try { 561 try {
590 throw IterableElementError.noElement(); 562 throw IterableElementError.noElement();
(...skipping 18 matching lines...) Expand all
609 throw IterableElementError.tooMany(); 581 throw IterableElementError.tooMany();
610 } 582 }
611 catch (e, s) { 583 catch (e, s) {
612 _cancelAndErrorWithReplacement(subscription, future, e, s); 584 _cancelAndErrorWithReplacement(subscription, future, e, s);
613 } 585 }
614 return;} 586 return;}
615 foundResult = true; 587 foundResult = true;
616 result = value; 588 result = value;
617 } 589 }
618 } 590 }
619 , ((__x76) => DEVC$RT.cast(__x76, dynamic, __t54, "CompositeCast", """line 1 129, column 11 of dart:async/stream.dart: """, __x76 is __t54, false))(_cancelAn dErrorClosure(subscription, future))); 591 , ((__x65) => DEVC$RT.cast(__x65, dynamic, __t48, "CompositeCast", """line 1 129, column 11 of dart:async/stream.dart: """, __x65 is __t48, false))(_cancelAn dErrorClosure(subscription, future)));
620 } 592 }
621 , onError: future._completeError, onDone: () { 593 , onError: future._completeError, onDone: () {
622 if (foundResult) { 594 if (foundResult) {
623 future._complete(result); 595 future._complete(result);
624 return;} 596 return;}
625 try { 597 try {
626 throw IterableElementError.noElement(); 598 throw IterableElementError.noElement();
627 } 599 }
628 catch (e, s) { 600 catch (e, s) {
629 _completeWithErrorCallback(future, e, s); 601 _completeWithErrorCallback(future, e, s);
(...skipping 23 matching lines...) Expand all
653 void onTimeout(EventSink sink)} 625 void onTimeout(EventSink sink)}
654 ) { 626 ) {
655 StreamController controller; 627 StreamController controller;
656 StreamSubscription<T> subscription; 628 StreamSubscription<T> subscription;
657 Timer timer; 629 Timer timer;
658 Zone zone; 630 Zone zone;
659 Function timeout; 631 Function timeout;
660 void onData(T event) { 632 void onData(T event) {
661 timer.cancel(); 633 timer.cancel();
662 controller.add(event); 634 controller.add(event);
663 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t77, "CompositeCast", """line 1219, column 43 of dart:async/stream.dart: """, timeout is __t77, false)); 635 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t66, "CompositeCast", """line 1219, column 43 of dart:async/stream.dart: """, timeout is __t66, false));
664 } 636 }
665 void onError(error, StackTrace stackTrace) { 637 void onError(error, StackTrace stackTrace) {
666 timer.cancel(); 638 timer.cancel();
667 assert (controller is _StreamController || controller is _BroadcastStreamCo ntroller); var eventSink = controller; 639 assert (controller is _StreamController || controller is _BroadcastStreamCo ntroller); var eventSink = controller;
668 eventSink._addError(error, stackTrace); 640 eventSink._addError(error, stackTrace);
669 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t77, "CompositeCast", """line 1227, column 43 of dart:async/stream.dart: """, timeout is __t77, false)); 641 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t66, "CompositeCast", """line 1227, column 43 of dart:async/stream.dart: """, timeout is __t66, false));
670 } 642 }
671 void onDone() { 643 void onDone() {
672 timer.cancel(); 644 timer.cancel();
673 controller.close(); 645 controller.close();
674 } 646 }
675 void onListen() { 647 void onListen() {
676 zone = Zone.current; 648 zone = Zone.current;
677 if (onTimeout == null) { 649 if (onTimeout == null) {
678 timeout = () { 650 timeout = () {
679 controller.addError(new TimeoutException("No stream event", timeLimit), null); 651 controller.addError(new TimeoutException("No stream event", timeLimit), null);
680 } 652 }
681 ; 653 ;
682 } 654 }
683 else { 655 else {
684 onTimeout = ((__x81) => DEVC$RT.wrap((dynamic f(dynamic __u78)) { 656 onTimeout = ((__x70) => DEVC$RT.wrap((dynamic f(dynamic __u67)) {
685 dynamic c(dynamic x0) => f(x0); 657 dynamic c(dynamic x0) => f(x0);
686 return f == null ? null : c; 658 return f == null ? null : c;
687 } 659 }
688 , __x81, __t33, __t79, "Wrap", """line 1245, column 21 of dart:async/strea m.dart: """, __x81 is __t79))(zone.registerUnaryCallback(onTimeout)); 660 , __x70, __t28, __t68, "Wrap", """line 1245, column 21 of dart:async/strea m.dart: """, __x70 is __t68))(zone.registerUnaryCallback(onTimeout));
689 _ControllerEventSinkWrapper wrapper = new _ControllerEventSinkWrapper(nul l); 661 _ControllerEventSinkWrapper wrapper = new _ControllerEventSinkWrapper(nul l);
690 timeout = () { 662 timeout = () {
691 wrapper._sink = controller; 663 wrapper._sink = controller;
692 zone.runUnaryGuarded(onTimeout, wrapper); 664 zone.runUnaryGuarded(onTimeout, wrapper);
693 wrapper._sink = null; 665 wrapper._sink = null;
694 } 666 }
695 ; 667 ;
696 } 668 }
697 subscription = this.listen(onData, onError: onError, onDone: onDone); 669 subscription = this.listen(onData, onError: onError, onDone: onDone);
698 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t77, "CompositeCast", """line 1256, column 43 of dart:async/stream.dart: """, timeout is __t77, false)); 670 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t66, "CompositeCast", """line 1256, column 43 of dart:async/stream.dart: """, timeout is __t66, false));
699 } 671 }
700 Future onCancel() { 672 Future onCancel() {
701 timer.cancel(); 673 timer.cancel();
702 Future result = subscription.cancel(); 674 Future result = subscription.cancel();
703 subscription = null; 675 subscription = null;
704 return result; 676 return result;
705 } 677 }
706 controller = isBroadcast ? new _SyncBroadcastStreamController(onListen, onCan cel) : new _SyncStreamController(onListen, () { 678 controller = isBroadcast ? new _SyncBroadcastStreamController(onListen, onCan cel) : new _SyncStreamController(onListen, () {
707 timer.cancel(); 679 timer.cancel();
708 subscription.pause(); 680 subscription.pause();
709 } 681 }
710 , () { 682 , () {
711 subscription.resume(); 683 subscription.resume();
712 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t77, "CompositeCast", """line 1275, column 53 of dart:async/stream.dart: """, timeout is __t77, false)); 684 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t66, "CompositeCast", """line 1275, column 53 of dart:async/stream.dart: """, timeout is __t66, false));
713 } 685 }
714 , onCancel); 686 , onCancel);
715 return controller.stream; 687 return controller.stream;
716 } 688 }
717 } 689 }
718 abstract class StreamSubscription<T> {Future cancel(); 690 abstract class StreamSubscription<T> {Future cancel();
719 void onData(void handleData(T data)); 691 void onData(void handleData(T data));
720 void onError(Function handleError); 692 void onError(Function handleError);
721 void onDone(void handleDone()); 693 void onDone(void handleDone());
722 void pause([Future resumeSignal]); 694 void pause([Future resumeSignal]);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 void add(T data) { 734 void add(T data) {
763 _sink.add(data); 735 _sink.add(data);
764 } 736 }
765 void addError(error, [StackTrace stackTrace]) { 737 void addError(error, [StackTrace stackTrace]) {
766 _sink.addError(error, stackTrace); 738 _sink.addError(error, stackTrace);
767 } 739 }
768 void close() { 740 void close() {
769 _sink.close(); 741 _sink.close();
770 } 742 }
771 } 743 }
772 typedef dynamic __t31<T>(T __u32); 744 typedef dynamic __t26<T>(T __u27);
773 typedef dynamic __t33(dynamic __u34); 745 typedef dynamic __t28(dynamic __u29);
774 typedef T __t37<T>(int __u38); 746 typedef T __t32<T>(int __u33);
775 typedef dynamic __t39(dynamic __u40); 747 typedef dynamic __t34(dynamic __u35);
776 typedef EventSink<dynamic> __t44(EventSink<dynamic> __u45); 748 typedef EventSink<dynamic> __t38(EventSink<dynamic> __u39);
777 typedef EventSink<dynamic> __t46<T>(EventSink<T> __u47); 749 typedef EventSink<dynamic> __t40<T>(EventSink<T> __u41);
778 typedef void __t49(StreamSubscription<dynamic> __u50); 750 typedef void __t43(StreamSubscription<dynamic> __u44);
779 typedef void __t51<T>(StreamSubscription<T> __u52); 751 typedef void __t45<T>(StreamSubscription<T> __u46);
780 typedef dynamic __t54(dynamic __u55, StackTrace __u56); 752 typedef dynamic __t48(dynamic __u49, StackTrace __u50);
781 typedef void __t64<T>(T __u65); 753 typedef void __t58<T>(T __u59);
782 typedef void __t77(); 754 typedef void __t66();
783 typedef void __t79(EventSink<dynamic> __u80); 755 typedef void __t68(EventSink<dynamic> __u69);
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/async/schedule_microtask.dart ('k') | test/dart_codegen/expect/async/stream_controller.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698