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

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

Issue 1052383003: Disable closure wrapping by default (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: 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 = new StreamController<T>(sync: true); 4 _StreamController<T> controller = new StreamController<T>(sync: true);
5 future.then(((__x30) => DEVC$RT.wrap((dynamic f(dynamic __u25)) { 5 future.then(((__x25) => DEVC$RT.cast(__x25, __t23, DEVC$RT.type((__t21<T> _) {
6 dynamic c(dynamic x0) => f(x0);
7 return f == null ? null : c;
8 } 6 }
9 , __x30, __t28, DEVC$RT.type((__t26<T> _) { 7 ), "InferableClosure", """line 88, column 17 of dart:async/stream.dart: """, _ _x25 is __t21<T>, false))((value) {
10 }
11 ), "WrapLiteral", """line 88, column 17 of dart:async/stream.dart: """, __x30 is __t26<T>))((value) {
12 controller._add(DEVC$RT.cast(value, dynamic, T, "CompositeCast", """line 89, column 25 of dart:async/stream.dart: """, value is T, false)); 8 controller._add(DEVC$RT.cast(value, dynamic, T, "CompositeCast", """line 89, column 25 of dart:async/stream.dart: """, value is T, false));
13 controller._closeUnchecked(); 9 controller._closeUnchecked();
14 } 10 }
15 ), onError: (error, stackTrace) { 11 ), onError: (error, stackTrace) {
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)); 12 controller._addError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "D ynamicCast", """line 93, column 37 of dart:async/stream.dart: """, stackTrace is StackTrace, true));
17 controller._closeUnchecked(); 13 controller._closeUnchecked();
18 } 14 }
19 ); 15 );
20 return controller.stream; 16 return controller.stream;
21 } 17 }
22 factory Stream.fromIterable(Iterable<T> data) { 18 factory Stream.fromIterable(Iterable<T> data) {
23 return new _GeneratedStreamImpl<T>(() => new _IterablePendingEvents<T>(data)); 19 return new _GeneratedStreamImpl<T>(() => new _IterablePendingEvents<T>(data));
24 } 20 }
25 factory Stream.periodic(Duration period, [T computation(int computationCount)]) { 21 factory Stream.periodic(Duration period, [T computation(int computationCount)]) {
26 if (computation == null) computation = ((__x36) => DEVC$RT.wrap((dynamic f(dyn amic __u31)) { 22 if (computation == null) computation = ((__x30) => DEVC$RT.cast(__x30, __t28, DEVC$RT.type((__t26<T> _) {
27 dynamic c(dynamic x0) => f(x0);
28 return f == null ? null : c;
29 } 23 }
30 , __x36, __t34, DEVC$RT.type((__t32<T> _) { 24 ), "CompositeCast", """line 126, column 44 of dart:async/stream.dart: """, __x 30 is __t26<T>, false))(((i) => null));
31 }
32 ), "Wrap", """line 126, column 44 of dart:async/stream.dart: """, __x36 is __t 32<T>))(((i) => null));
33 Timer timer; 25 Timer timer;
34 int computationCount = 0; 26 int computationCount = 0;
35 StreamController<T> controller; 27 StreamController<T> controller;
36 Stopwatch watch = new Stopwatch(); 28 Stopwatch watch = new Stopwatch();
37 void sendEvent() { 29 void sendEvent() {
38 watch.reset(); 30 watch.reset();
39 T data = computation(computationCount++); 31 T data = computation(computationCount++);
40 controller.add(data); 32 controller.add(data);
41 } 33 }
42 void startPeriodicTimer() { 34 void startPeriodicTimer() {
(...skipping 22 matching lines...) Expand all
65 ); 57 );
66 } 58 }
67 , onCancel: () { 59 , onCancel: () {
68 if (timer != null) timer.cancel(); 60 if (timer != null) timer.cancel();
69 timer = null; 61 timer = null;
70 } 62 }
71 ); 63 );
72 return controller.stream; 64 return controller.stream;
73 } 65 }
74 factory Stream.eventTransformed(Stream source, EventSink mapSink(EventSink<T> s ink)) { 66 factory Stream.eventTransformed(Stream source, EventSink mapSink(EventSink<T> s ink)) {
75 return new _BoundSinkStream<dynamic, T>(source, DEVC$RT.wrap((EventSink<dynami c> f(EventSink<T> __u37)) { 67 return new _BoundSinkStream<dynamic, T>(source, DEVC$RT.cast(mapSink, DEVC$RT. type((__t33<T> _) {
76 EventSink<dynamic> c(EventSink<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((Ev entSink<dynamic> _) {
77 }
78 ), DEVC$RT.type((EventSink<T> _) {
79 }
80 ), "CastParam", """line 216, column 41 of dart:async/stream.dart: """, x0 is EventSink<T>, false));
81 return f == null ? null : c;
82 } 68 }
83 , mapSink, DEVC$RT.type((__t40<T> _) { 69 ), __t31, "CompositeCast", """line 216, column 41 of dart:async/stream.dart: " "", mapSink is __t31, false));
84 }
85 ), __t38, "Wrap", """line 216, column 41 of dart:async/stream.dart: """, mapSi nk is __t38));
86 } 70 }
87 bool get isBroadcast => false; 71 bool get isBroadcast => false;
88 Stream<T> asBroadcastStream({ 72 Stream<T> asBroadcastStream({
89 void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscri ption<T> subscription)} 73 void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscri ption<T> subscription)}
90 ) { 74 ) {
91 return new _AsBroadcastStream<T>(this, DEVC$RT.wrap((void f(StreamSubscription <T> __u42)) { 75 return new _AsBroadcastStream<T>(this, DEVC$RT.cast(onListen, DEVC$RT.type((__ t37<T> _) {
92 void c(StreamSubscription<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((StreamS ubscription<dynamic> _) {
93 }
94 ), DEVC$RT.type((StreamSubscription<T> _) {
95 }
96 ), "CastParam", """line 248, column 44 of dart:async/stream.dart: """, x0 is StreamSubscription<T>, false));
97 return f == null ? null : c;
98 } 76 }
99 , onListen, DEVC$RT.type((__t45<T> _) { 77 ), __t35, "CompositeCast", """line 248, column 44 of dart:async/stream.dart: " "", onListen is __t35, false), DEVC$RT.cast(onCancel, DEVC$RT.type((__t37<T> _) {
100 } 78 }
101 ), __t43, "Wrap", """line 248, column 44 of dart:async/stream.dart: """, onLis ten is __t43), DEVC$RT.wrap((void f(StreamSubscription<T> __u47)) { 79 ), __t35, "CompositeCast", """line 248, column 54 of dart:async/stream.dart: " "", onCancel is __t35, false));
102 void c(StreamSubscription<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((StreamS ubscription<dynamic> _) {
103 }
104 ), DEVC$RT.type((StreamSubscription<T> _) {
105 }
106 ), "CastParam", """line 248, column 54 of dart:async/stream.dart: """, x0 is StreamSubscription<T>, false));
107 return f == null ? null : c;
108 }
109 , onCancel, DEVC$RT.type((__t45<T> _) {
110 }
111 ), __t43, "Wrap", """line 248, column 54 of dart:async/stream.dart: """, onCan cel is __t43));
112 } 80 }
113 StreamSubscription<T> listen(void onData(T event), { 81 StreamSubscription<T> listen(void onData(T event), {
114 Function onError, void onDone(), bool cancelOnError} 82 Function onError, void onDone(), bool cancelOnError}
115 ); 83 );
116 Stream<T> where(bool test(T event)) { 84 Stream<T> where(bool test(T event)) {
117 return new _WhereStream<T>(this, test); 85 return new _WhereStream<T>(this, test);
118 } 86 }
119 Stream map(convert(T event)) { 87 Stream map(convert(T event)) {
120 return new _MapStream<T, dynamic>(this, convert); 88 return new _MapStream<T, dynamic>(this, convert);
121 } 89 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 Future<T> reduce(T combine(T previous, T element)) { 189 Future<T> reduce(T combine(T previous, T element)) {
222 _Future<T> result = new _Future<T>(); 190 _Future<T> result = new _Future<T>();
223 bool seenFirst = false; 191 bool seenFirst = false;
224 T value; 192 T value;
225 StreamSubscription subscription; 193 StreamSubscription subscription;
226 subscription = this.listen((T element) { 194 subscription = this.listen((T element) {
227 if (seenFirst) { 195 if (seenFirst) {
228 _runUserCode(() => combine(value, element), (T newValue) { 196 _runUserCode(() => combine(value, element), (T newValue) {
229 value = newValue; 197 value = newValue;
230 } 198 }
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))); 199 , ((__x42) => DEVC$RT.cast(__x42, dynamic, __t39, "CompositeCast", """line 501, column 24 of dart:async/stream.dart: """, __x42 is __t39, false))(_cancelA ndErrorClosure(subscription, result)));
232 } 200 }
233 else { 201 else {
234 value = element; 202 value = element;
235 seenFirst = true; 203 seenFirst = true;
236 } 204 }
237 } 205 }
238 , onError: result._completeError, onDone: () { 206 , onError: result._completeError, onDone: () {
239 if (!seenFirst) { 207 if (!seenFirst) {
240 try { 208 try {
241 throw IterableElementError.noElement(); 209 throw IterableElementError.noElement();
(...skipping 10 matching lines...) Expand all
252 return result; 220 return result;
253 } 221 }
254 Future fold(var initialValue, combine(var previous, T element)) { 222 Future fold(var initialValue, combine(var previous, T element)) {
255 _Future result = new _Future(); 223 _Future result = new _Future();
256 var value = initialValue; 224 var value = initialValue;
257 StreamSubscription subscription; 225 StreamSubscription subscription;
258 subscription = this.listen((T element) { 226 subscription = this.listen((T element) {
259 _runUserCode(() => combine(value, element), (newValue) { 227 _runUserCode(() => combine(value, element), (newValue) {
260 value = newValue; 228 value = newValue;
261 } 229 }
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))); 230 , ((__x43) => DEVC$RT.cast(__x43, dynamic, __t39, "CompositeCast", """line 5 34, column 11 of dart:async/stream.dart: """, __x43 is __t39, false))(_cancelAnd ErrorClosure(subscription, result)));
263 } 231 }
264 , onError: (e, st) { 232 , onError: (e, st) {
265 result._completeError(e, DEVC$RT.cast(st, dynamic, StackTrace, "DynamicCast" , """line 538, column 34 of dart:async/stream.dart: """, st is StackTrace, true) ); 233 result._completeError(e, DEVC$RT.cast(st, dynamic, StackTrace, "DynamicCast" , """line 538, column 34 of dart:async/stream.dart: """, st is StackTrace, true) );
266 } 234 }
267 , onDone: () { 235 , onDone: () {
268 result._complete(value); 236 result._complete(value);
269 } 237 }
270 , cancelOnError: true); 238 , cancelOnError: true);
271 return result; 239 return result;
272 } 240 }
(...skipping 25 matching lines...) Expand all
298 } 266 }
299 Future<bool> contains(Object needle) { 267 Future<bool> contains(Object needle) {
300 _Future<bool> future = new _Future<bool>(); 268 _Future<bool> future = new _Future<bool>();
301 StreamSubscription subscription; 269 StreamSubscription subscription;
302 subscription = this.listen((T element) { 270 subscription = this.listen((T element) {
303 _runUserCode(() => (element == needle), (bool isMatch) { 271 _runUserCode(() => (element == needle), (bool isMatch) {
304 if (isMatch) { 272 if (isMatch) {
305 _cancelAndValue(subscription, future, true); 273 _cancelAndValue(subscription, future, true);
306 } 274 }
307 } 275 }
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))); 276 , ((__x44) => DEVC$RT.cast(__x44, dynamic, __t39, "CompositeCast", """line 6 02, column 13 of dart:async/stream.dart: """, __x44 is __t39, false))(_cancelAnd ErrorClosure(subscription, future)));
309 } 277 }
310 , onError: future._completeError, onDone: () { 278 , onError: future._completeError, onDone: () {
311 future._complete(false); 279 future._complete(false);
312 } 280 }
313 , cancelOnError: true); 281 , cancelOnError: true);
314 return future; 282 return future;
315 } 283 }
316 Future forEach(void action(T element)) { 284 Future forEach(void action(T element)) {
317 _Future future = new _Future(); 285 _Future future = new _Future();
318 StreamSubscription subscription; 286 StreamSubscription subscription;
319 subscription = this.listen((T element) { 287 subscription = this.listen((T element) {
320 _runUserCode(() => action(element), (_) { 288 _runUserCode(() => action(element), (_) {
321 } 289 }
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))); 290 , ((__x45) => DEVC$RT.cast(__x45, dynamic, __t39, "CompositeCast", """line 6 28, column 13 of dart:async/stream.dart: """, __x45 is __t39, false))(_cancelAnd ErrorClosure(subscription, future)));
323 } 291 }
324 , onError: future._completeError, onDone: () { 292 , onError: future._completeError, onDone: () {
325 future._complete(null); 293 future._complete(null);
326 } 294 }
327 , cancelOnError: true); 295 , cancelOnError: true);
328 return future; 296 return future;
329 } 297 }
330 Future<bool> every(bool test(T element)) { 298 Future<bool> every(bool test(T element)) {
331 _Future<bool> future = new _Future<bool>(); 299 _Future<bool> future = new _Future<bool>();
332 StreamSubscription subscription; 300 StreamSubscription subscription;
333 subscription = this.listen((T element) { 301 subscription = this.listen((T element) {
334 _runUserCode(() => test(element), (bool isMatch) { 302 _runUserCode(() => test(element), (bool isMatch) {
335 if (!isMatch) { 303 if (!isMatch) {
336 _cancelAndValue(subscription, future, false); 304 _cancelAndValue(subscription, future, false);
337 } 305 }
338 } 306 }
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))); 307 , ((__x46) => DEVC$RT.cast(__x46, dynamic, __t39, "CompositeCast", """line 6 57, column 13 of dart:async/stream.dart: """, __x46 is __t39, false))(_cancelAnd ErrorClosure(subscription, future)));
340 } 308 }
341 , onError: future._completeError, onDone: () { 309 , onError: future._completeError, onDone: () {
342 future._complete(true); 310 future._complete(true);
343 } 311 }
344 , cancelOnError: true); 312 , cancelOnError: true);
345 return future; 313 return future;
346 } 314 }
347 Future<bool> any(bool test(T element)) { 315 Future<bool> any(bool test(T element)) {
348 _Future<bool> future = new _Future<bool>(); 316 _Future<bool> future = new _Future<bool>();
349 StreamSubscription subscription; 317 StreamSubscription subscription;
350 subscription = this.listen((T element) { 318 subscription = this.listen((T element) {
351 _runUserCode(() => test(element), (bool isMatch) { 319 _runUserCode(() => test(element), (bool isMatch) {
352 if (isMatch) { 320 if (isMatch) {
353 _cancelAndValue(subscription, future, true); 321 _cancelAndValue(subscription, future, true);
354 } 322 }
355 } 323 }
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))); 324 , ((__x47) => DEVC$RT.cast(__x47, dynamic, __t39, "CompositeCast", """line 6 94, column 13 of dart:async/stream.dart: """, __x47 is __t39, false))(_cancelAnd ErrorClosure(subscription, future)));
357 } 325 }
358 , onError: future._completeError, onDone: () { 326 , onError: future._completeError, onDone: () {
359 future._complete(false); 327 future._complete(false);
360 } 328 }
361 , cancelOnError: true); 329 , cancelOnError: true);
362 return future; 330 return future;
363 } 331 }
364 Future<int> get length { 332 Future<int> get length {
365 _Future<int> future = new _Future<int>(); 333 _Future<int> future = new _Future<int>();
366 int count = 0; 334 int count = 0;
367 this.listen(((__x60) => DEVC$RT.wrap((dynamic f(dynamic __u57)) { 335 this.listen(((__x50) => DEVC$RT.cast(__x50, __t23, DEVC$RT.type((__t48<T> _) {
368 dynamic c(dynamic x0) => f(x0);
369 return f == null ? null : c;
370 } 336 }
371 , __x60, __t28, DEVC$RT.type((__t58<T> _) { 337 ), "InferableClosure", """line 711, column 7 of dart:async/stream.dart: """, _ _x50 is __t48<T>, false))((_) {
372 }
373 ), "WrapLiteral", """line 711, column 7 of dart:async/stream.dart: """, __x60 is __t58<T>))((_) {
374 count++; 338 count++;
375 } 339 }
376 ), onError: future._completeError, onDone: () { 340 ), onError: future._completeError, onDone: () {
377 future._complete(count); 341 future._complete(count);
378 } 342 }
379 , cancelOnError: true); 343 , cancelOnError: true);
380 return future; 344 return future;
381 } 345 }
382 Future<bool> get isEmpty { 346 Future<bool> get isEmpty {
383 _Future<bool> future = new _Future<bool>(); 347 _Future<bool> future = new _Future<bool>();
384 StreamSubscription subscription; 348 StreamSubscription subscription;
385 subscription = this.listen(((__x62) => DEVC$RT.wrap((dynamic f(dynamic __u61) ) { 349 subscription = this.listen(((__x51) => DEVC$RT.cast(__x51, __t23, DEVC$RT.typ e((__t48<T> _) {
386 dynamic c(dynamic x0) => f(x0);
387 return f == null ? null : c;
388 } 350 }
389 , __x62, __t28, DEVC$RT.type((__t58<T> _) { 351 ), "InferableClosure", """line 733, column 7 of dart:async/stream.dart: """, _ _x51 is __t48<T>, false))((_) {
390 }
391 ), "WrapLiteral", """line 733, column 7 of dart:async/stream.dart: """, __x62 is __t58<T>))((_) {
392 _cancelAndValue(subscription, future, false); 352 _cancelAndValue(subscription, future, false);
393 } 353 }
394 ), onError: future._completeError, onDone: () { 354 ), onError: future._completeError, onDone: () {
395 future._complete(true); 355 future._complete(true);
396 } 356 }
397 , cancelOnError: true); 357 , cancelOnError: true);
398 return future; 358 return future;
399 } 359 }
400 Future<List<T>> toList() { 360 Future<List<T>> toList() {
401 List<T> result = <T> []; 361 List<T> result = <T> [];
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 Object defaultValue()} 472 Object defaultValue()}
513 ) { 473 ) {
514 _Future<dynamic> future = new _Future(); 474 _Future<dynamic> future = new _Future();
515 StreamSubscription subscription; 475 StreamSubscription subscription;
516 subscription = this.listen((T value) { 476 subscription = this.listen((T value) {
517 _runUserCode(() => test(value), (bool isMatch) { 477 _runUserCode(() => test(value), (bool isMatch) {
518 if (isMatch) { 478 if (isMatch) {
519 _cancelAndValue(subscription, future, value); 479 _cancelAndValue(subscription, future, value);
520 } 480 }
521 } 481 }
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))); 482 , ((__x52) => DEVC$RT.cast(__x52, dynamic, __t39, "CompositeCast", """line 1 036, column 11 of dart:async/stream.dart: """, __x52 is __t39, false))(_cancelAn dErrorClosure(subscription, future)));
523 } 483 }
524 , onError: future._completeError, onDone: () { 484 , onError: future._completeError, onDone: () {
525 if (defaultValue != null) { 485 if (defaultValue != null) {
526 _runUserCode(defaultValue, future._complete, future._completeError); 486 _runUserCode(defaultValue, future._complete, future._completeError);
527 return;} 487 return;}
528 try { 488 try {
529 throw IterableElementError.noElement(); 489 throw IterableElementError.noElement();
530 } 490 }
531 catch (e, s) { 491 catch (e, s) {
532 _completeWithErrorCallback(future, e, s); 492 _completeWithErrorCallback(future, e, s);
533 } 493 }
534 } 494 }
535 , cancelOnError: true); 495 , cancelOnError: true);
536 return future; 496 return future;
537 } 497 }
538 Future<dynamic> lastWhere(bool test(T element), { 498 Future<dynamic> lastWhere(bool test(T element), {
539 Object defaultValue()} 499 Object defaultValue()}
540 ) { 500 ) {
541 _Future<dynamic> future = new _Future(); 501 _Future<dynamic> future = new _Future();
542 T result = null; 502 T result = null;
543 bool foundResult = false; 503 bool foundResult = false;
544 StreamSubscription subscription; 504 StreamSubscription subscription;
545 subscription = this.listen((T value) { 505 subscription = this.listen((T value) {
546 _runUserCode(() => true == test(value), (bool isMatch) { 506 _runUserCode(() => true == test(value), (bool isMatch) {
547 if (isMatch) { 507 if (isMatch) {
548 foundResult = true; 508 foundResult = true;
549 result = value; 509 result = value;
550 } 510 }
551 } 511 }
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))); 512 , ((__x53) => DEVC$RT.cast(__x53, dynamic, __t39, "CompositeCast", """line 1 077, column 11 of dart:async/stream.dart: """, __x53 is __t39, false))(_cancelAn dErrorClosure(subscription, future)));
553 } 513 }
554 , onError: future._completeError, onDone: () { 514 , onError: future._completeError, onDone: () {
555 if (foundResult) { 515 if (foundResult) {
556 future._complete(result); 516 future._complete(result);
557 return;} 517 return;}
558 if (defaultValue != null) { 518 if (defaultValue != null) {
559 _runUserCode(defaultValue, future._complete, future._completeError); 519 _runUserCode(defaultValue, future._complete, future._completeError);
560 return;} 520 return;}
561 try { 521 try {
562 throw IterableElementError.noElement(); 522 throw IterableElementError.noElement();
(...skipping 18 matching lines...) Expand all
581 throw IterableElementError.tooMany(); 541 throw IterableElementError.tooMany();
582 } 542 }
583 catch (e, s) { 543 catch (e, s) {
584 _cancelAndErrorWithReplacement(subscription, future, e, s); 544 _cancelAndErrorWithReplacement(subscription, future, e, s);
585 } 545 }
586 return;} 546 return;}
587 foundResult = true; 547 foundResult = true;
588 result = value; 548 result = value;
589 } 549 }
590 } 550 }
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))); 551 , ((__x54) => DEVC$RT.cast(__x54, dynamic, __t39, "CompositeCast", """line 1 129, column 11 of dart:async/stream.dart: """, __x54 is __t39, false))(_cancelAn dErrorClosure(subscription, future)));
592 } 552 }
593 , onError: future._completeError, onDone: () { 553 , onError: future._completeError, onDone: () {
594 if (foundResult) { 554 if (foundResult) {
595 future._complete(result); 555 future._complete(result);
596 return;} 556 return;}
597 try { 557 try {
598 throw IterableElementError.noElement(); 558 throw IterableElementError.noElement();
599 } 559 }
600 catch (e, s) { 560 catch (e, s) {
601 _completeWithErrorCallback(future, e, s); 561 _completeWithErrorCallback(future, e, s);
(...skipping 23 matching lines...) Expand all
625 void onTimeout(EventSink sink)} 585 void onTimeout(EventSink sink)}
626 ) { 586 ) {
627 StreamController controller; 587 StreamController controller;
628 StreamSubscription<T> subscription; 588 StreamSubscription<T> subscription;
629 Timer timer; 589 Timer timer;
630 Zone zone; 590 Zone zone;
631 Function timeout; 591 Function timeout;
632 void onData(T event) { 592 void onData(T event) {
633 timer.cancel(); 593 timer.cancel();
634 controller.add(event); 594 controller.add(event);
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)); 595 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t55, "CompositeCast", """line 1219, column 43 of dart:async/stream.dart: """, timeout is __t55, false));
636 } 596 }
637 void onError(error, StackTrace stackTrace) { 597 void onError(error, StackTrace stackTrace) {
638 timer.cancel(); 598 timer.cancel();
639 assert (controller is _StreamController || controller is _BroadcastStreamCo ntroller); var eventSink = controller; 599 assert (controller is _StreamController || controller is _BroadcastStreamCo ntroller); var eventSink = controller;
640 eventSink._addError(error, stackTrace); 600 eventSink._addError(error, stackTrace);
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)); 601 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t55, "CompositeCast", """line 1227, column 43 of dart:async/stream.dart: """, timeout is __t55, false));
642 } 602 }
643 void onDone() { 603 void onDone() {
644 timer.cancel(); 604 timer.cancel();
645 controller.close(); 605 controller.close();
646 } 606 }
647 void onListen() { 607 void onListen() {
648 zone = Zone.current; 608 zone = Zone.current;
649 if (onTimeout == null) { 609 if (onTimeout == null) {
650 timeout = () { 610 timeout = () {
651 controller.addError(new TimeoutException("No stream event", timeLimit), null); 611 controller.addError(new TimeoutException("No stream event", timeLimit), null);
652 } 612 }
653 ; 613 ;
654 } 614 }
655 else { 615 else {
656 onTimeout = ((__x70) => DEVC$RT.wrap((dynamic f(dynamic __u67)) { 616 onTimeout = ((__x58) => DEVC$RT.cast(__x58, __t23, __t56, "CompositeCast", """line 1245, column 21 of dart:async/stream.dart: """, __x58 is __t56, false)) (zone.registerUnaryCallback(onTimeout));
657 dynamic c(dynamic x0) => f(x0);
658 return f == null ? null : c;
659 }
660 , __x70, __t28, __t68, "Wrap", """line 1245, column 21 of dart:async/strea m.dart: """, __x70 is __t68))(zone.registerUnaryCallback(onTimeout));
661 _ControllerEventSinkWrapper wrapper = new _ControllerEventSinkWrapper(nul l); 617 _ControllerEventSinkWrapper wrapper = new _ControllerEventSinkWrapper(nul l);
662 timeout = () { 618 timeout = () {
663 wrapper._sink = controller; 619 wrapper._sink = controller;
664 zone.runUnaryGuarded(onTimeout, wrapper); 620 zone.runUnaryGuarded(onTimeout, wrapper);
665 wrapper._sink = null; 621 wrapper._sink = null;
666 } 622 }
667 ; 623 ;
668 } 624 }
669 subscription = this.listen(onData, onError: onError, onDone: onDone); 625 subscription = this.listen(onData, onError: onError, onDone: onDone);
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)); 626 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t55, "CompositeCast", """line 1256, column 43 of dart:async/stream.dart: """, timeout is __t55, false));
671 } 627 }
672 Future onCancel() { 628 Future onCancel() {
673 timer.cancel(); 629 timer.cancel();
674 Future result = subscription.cancel(); 630 Future result = subscription.cancel();
675 subscription = null; 631 subscription = null;
676 return result; 632 return result;
677 } 633 }
678 controller = isBroadcast ? new _SyncBroadcastStreamController(onListen, onCan cel) : new _SyncStreamController(onListen, () { 634 controller = isBroadcast ? new _SyncBroadcastStreamController(onListen, onCan cel) : new _SyncStreamController(onListen, () {
679 timer.cancel(); 635 timer.cancel();
680 subscription.pause(); 636 subscription.pause();
681 } 637 }
682 , () { 638 , () {
683 subscription.resume(); 639 subscription.resume();
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)); 640 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t55, "CompositeCast", """line 1275, column 53 of dart:async/stream.dart: """, timeout is __t55, false));
685 } 641 }
686 , onCancel); 642 , onCancel);
687 return controller.stream; 643 return controller.stream;
688 } 644 }
689 } 645 }
690 abstract class StreamSubscription<T> {Future cancel(); 646 abstract class StreamSubscription<T> {Future cancel();
691 void onData(void handleData(T data)); 647 void onData(void handleData(T data));
692 void onError(Function handleError); 648 void onError(Function handleError);
693 void onDone(void handleDone()); 649 void onDone(void handleDone());
694 void pause([Future resumeSignal]); 650 void pause([Future resumeSignal]);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 void add(T data) { 690 void add(T data) {
735 _sink.add(data); 691 _sink.add(data);
736 } 692 }
737 void addError(error, [StackTrace stackTrace]) { 693 void addError(error, [StackTrace stackTrace]) {
738 _sink.addError(error, stackTrace); 694 _sink.addError(error, stackTrace);
739 } 695 }
740 void close() { 696 void close() {
741 _sink.close(); 697 _sink.close();
742 } 698 }
743 } 699 }
744 typedef dynamic __t26<T>(T __u27); 700 typedef dynamic __t21<T>(T __u22);
701 typedef dynamic __t23(dynamic __u24);
702 typedef T __t26<T>(int __u27);
745 typedef dynamic __t28(dynamic __u29); 703 typedef dynamic __t28(dynamic __u29);
746 typedef T __t32<T>(int __u33); 704 typedef EventSink<dynamic> __t31(EventSink<dynamic> __u32);
747 typedef dynamic __t34(dynamic __u35); 705 typedef EventSink<dynamic> __t33<T>(EventSink<T> __u34);
748 typedef EventSink<dynamic> __t38(EventSink<dynamic> __u39); 706 typedef void __t35(StreamSubscription<dynamic> __u36);
749 typedef EventSink<dynamic> __t40<T>(EventSink<T> __u41); 707 typedef void __t37<T>(StreamSubscription<T> __u38);
750 typedef void __t43(StreamSubscription<dynamic> __u44); 708 typedef dynamic __t39(dynamic __u40, StackTrace __u41);
751 typedef void __t45<T>(StreamSubscription<T> __u46); 709 typedef void __t48<T>(T __u49);
752 typedef dynamic __t48(dynamic __u49, StackTrace __u50); 710 typedef void __t55();
753 typedef void __t58<T>(T __u59); 711 typedef void __t56(EventSink<dynamic> __u57);
754 typedef void __t66();
755 typedef void __t68(EventSink<dynamic> __u69);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698