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

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

Issue 1010893004: Allow S->T <: dynamic->T (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Add comment Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 part of dart.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 = ((__x37) => DEVC$RT.cast(__x37, DEVC$RT.type ((StreamController<T> _) { 4 _StreamController<T> controller = ((__x29) => DEVC$RT.cast(__x29, DEVC$RT.type ((StreamController<T> _) {
5 } 5 }
6 ), DEVC$RT.type((_StreamController<T> _) { 6 ), DEVC$RT.type((_StreamController<T> _) {
7 } 7 }
8 ), "CastExact", """line 87, column 39 of dart:async/stream.dart: """, __x37 is _StreamController<T>, false))(new StreamController<T>(sync: true)); 8 ), "CastExact", """line 87, column 39 of dart:async/stream.dart: """, __x29 is _StreamController<T>, false))(new StreamController<T>(sync: true));
9 future.then((value) { 9 future.then(((__x35) => DEVC$RT.wrap((dynamic f(dynamic __u30)) {
10 dynamic c(dynamic x0) => f(x0);
11 return f == null ? null : c;
12 }
13 , __x35, __t33, DEVC$RT.type((__t31<T> _) {
14 }
15 ), "WrapLiteral", """line 88, column 17 of dart:async/stream.dart: """, __x35 is __t31<T>))((value) {
10 controller._add(DEVC$RT.cast(value, dynamic, T, "CastGeneral", """line 89, c olumn 25 of dart:async/stream.dart: """, value is T, false)); 16 controller._add(DEVC$RT.cast(value, dynamic, T, "CastGeneral", """line 89, c olumn 25 of dart:async/stream.dart: """, value is T, false));
11 controller._closeUnchecked(); 17 controller._closeUnchecked();
12 } 18 }
13 , onError: (error, stackTrace) { 19 ), onError: (error, stackTrace) {
14 controller._addError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "C astGeneral", """line 93, column 37 of dart:async/stream.dart: """, stackTrace is StackTrace, true)); 20 controller._addError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "C astGeneral", """line 93, column 37 of dart:async/stream.dart: """, stackTrace is StackTrace, true));
15 controller._closeUnchecked(); 21 controller._closeUnchecked();
16 } 22 }
17 ); 23 );
18 return controller.stream; 24 return controller.stream;
19 } 25 }
20 factory Stream.fromIterable(Iterable<T> data) { 26 factory Stream.fromIterable(Iterable<T> data) {
21 return new _GeneratedStreamImpl<T>(() => new _IterablePendingEvents<T>(data)); 27 return new _GeneratedStreamImpl<T>(() => new _IterablePendingEvents<T>(data));
22 } 28 }
23 factory Stream.periodic(Duration period, [T computation(int computationCount)]) { 29 factory Stream.periodic(Duration period, [T computation(int computationCount)]) {
24 if (computation == null) computation = ((i) => null); 30 if (computation == null) computation = ((__x41) => DEVC$RT.wrap((dynamic f(dyn amic __u36)) {
31 dynamic c(dynamic x0) => f(x0);
32 return f == null ? null : c;
33 }
34 , __x41, __t39, DEVC$RT.type((__t37<T> _) {
35 }
36 ), "Wrap", """line 126, column 44 of dart:async/stream.dart: """, __x41 is __t 37<T>))(((i) => null));
25 Timer timer; 37 Timer timer;
26 int computationCount = 0; 38 int computationCount = 0;
27 StreamController<T> controller; 39 StreamController<T> controller;
28 Stopwatch watch = new Stopwatch(); 40 Stopwatch watch = new Stopwatch();
29 void sendEvent() { 41 void sendEvent() {
30 watch.reset(); 42 watch.reset();
31 T data = computation(computationCount++); 43 T data = computation(computationCount++);
32 controller.add(data); 44 controller.add(data);
33 } 45 }
34 void startPeriodicTimer() { 46 void startPeriodicTimer() {
(...skipping 22 matching lines...) Expand all
57 ); 69 );
58 } 70 }
59 , onCancel: () { 71 , onCancel: () {
60 if (timer != null) timer.cancel(); 72 if (timer != null) timer.cancel();
61 timer = null; 73 timer = null;
62 } 74 }
63 ); 75 );
64 return controller.stream; 76 return controller.stream;
65 } 77 }
66 factory Stream.eventTransformed(Stream source, EventSink mapSink(EventSink<T> s ink)) { 78 factory Stream.eventTransformed(Stream source, EventSink mapSink(EventSink<T> s ink)) {
67 return ((__x38) => DEVC$RT.cast(__x38, DEVC$RT.type((_BoundSinkStream<dynamic, dynamic> _) { 79 return ((__x42) => DEVC$RT.cast(__x42, DEVC$RT.type((_BoundSinkStream<dynamic, dynamic> _) {
68 } 80 }
69 ), DEVC$RT.type((Stream<T> _) { 81 ), DEVC$RT.type((Stream<T> _) {
70 } 82 }
71 ), "CastExact", """line 216, column 12 of dart:async/stream.dart: """, __x38 i s Stream<T>, false))(new _BoundSinkStream(source, DEVC$RT.wrap((EventSink<dynami c> f(EventSink<T> __u39)) { 83 ), "CastExact", """line 216, column 12 of dart:async/stream.dart: """, __x42 i s Stream<T>, false))(new _BoundSinkStream(source, DEVC$RT.wrap((EventSink<dynami c> f(EventSink<T> __u43)) {
72 EventSink<dynamic> c(EventSink<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((Ev entSink<dynamic> _) { 84 EventSink<dynamic> c(EventSink<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((Ev entSink<dynamic> _) {
73 } 85 }
74 ), DEVC$RT.type((EventSink<T> _) { 86 ), DEVC$RT.type((EventSink<T> _) {
75 } 87 }
76 ), "CastParam", """line 216, column 41 of dart:async/stream.dart: """, x0 is EventSink<T>, false)); 88 ), "CastParam", """line 216, column 41 of dart:async/stream.dart: """, x0 is EventSink<T>, false));
77 return f == null ? null : c; 89 return f == null ? null : c;
78 } 90 }
79 , mapSink, DEVC$RT.type((__t42<T> _) { 91 , mapSink, DEVC$RT.type((__t46<T> _) {
80 } 92 }
81 ), __t40, "Wrap", """line 216, column 41 of dart:async/stream.dart: """, mapSi nk is __t40))); 93 ), __t44, "Wrap", """line 216, column 41 of dart:async/stream.dart: """, mapSi nk is __t44)));
82 } 94 }
83 bool get isBroadcast => false; 95 bool get isBroadcast => false;
84 Stream<T> asBroadcastStream({ 96 Stream<T> asBroadcastStream({
85 void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscri ption<T> subscription)} 97 void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscri ption<T> subscription)}
86 ) { 98 ) {
87 return new _AsBroadcastStream<T>(this, DEVC$RT.wrap((void f(StreamSubscription <T> __u44)) { 99 return new _AsBroadcastStream<T>(this, DEVC$RT.wrap((void f(StreamSubscription <T> __u48)) {
88 void c(StreamSubscription<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((StreamS ubscription<dynamic> _) { 100 void c(StreamSubscription<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((StreamS ubscription<dynamic> _) {
89 } 101 }
90 ), DEVC$RT.type((StreamSubscription<T> _) { 102 ), DEVC$RT.type((StreamSubscription<T> _) {
91 } 103 }
92 ), "CastParam", """line 248, column 44 of dart:async/stream.dart: """, x0 is StreamSubscription<T>, false)); 104 ), "CastParam", """line 248, column 44 of dart:async/stream.dart: """, x0 is StreamSubscription<T>, false));
93 return f == null ? null : c; 105 return f == null ? null : c;
94 } 106 }
95 , onListen, DEVC$RT.type((__t47<T> _) { 107 , onListen, DEVC$RT.type((__t51<T> _) {
96 } 108 }
97 ), __t45, "Wrap", """line 248, column 44 of dart:async/stream.dart: """, onLis ten is __t45), DEVC$RT.wrap((void f(StreamSubscription<T> __u49)) { 109 ), __t49, "Wrap", """line 248, column 44 of dart:async/stream.dart: """, onLis ten is __t49), DEVC$RT.wrap((void f(StreamSubscription<T> __u53)) {
98 void c(StreamSubscription<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((StreamS ubscription<dynamic> _) { 110 void c(StreamSubscription<T> x0) => f(DEVC$RT.cast(x0, DEVC$RT.type((StreamS ubscription<dynamic> _) {
99 } 111 }
100 ), DEVC$RT.type((StreamSubscription<T> _) { 112 ), DEVC$RT.type((StreamSubscription<T> _) {
101 } 113 }
102 ), "CastParam", """line 248, column 54 of dart:async/stream.dart: """, x0 is StreamSubscription<T>, false)); 114 ), "CastParam", """line 248, column 54 of dart:async/stream.dart: """, x0 is StreamSubscription<T>, false));
103 return f == null ? null : c; 115 return f == null ? null : c;
104 } 116 }
105 , onCancel, DEVC$RT.type((__t47<T> _) { 117 , onCancel, DEVC$RT.type((__t51<T> _) {
106 } 118 }
107 ), __t45, "Wrap", """line 248, column 54 of dart:async/stream.dart: """, onCan cel is __t45)); 119 ), __t49, "Wrap", """line 248, column 54 of dart:async/stream.dart: """, onCan cel is __t49));
108 } 120 }
109 StreamSubscription<T> listen(void onData(T event), { 121 StreamSubscription<T> listen(void onData(T event), {
110 Function onError, void onDone(), bool cancelOnError} 122 Function onError, void onDone(), bool cancelOnError}
111 ); 123 );
112 Stream<T> where(bool test(T event)) { 124 Stream<T> where(bool test(T event)) {
113 return new _WhereStream<T>(this, test); 125 return new _WhereStream<T>(this, test);
114 } 126 }
115 Stream map(convert(T event)) { 127 Stream map(convert(T event)) {
116 return new _MapStream<T, dynamic>(this, convert); 128 return new _MapStream<T, dynamic>(this, convert);
117 } 129 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 Stream transform(StreamTransformer<T, dynamic> streamTransformer) { 226 Stream transform(StreamTransformer<T, dynamic> streamTransformer) {
215 return streamTransformer.bind(this); 227 return streamTransformer.bind(this);
216 } 228 }
217 Future<T> reduce(T combine(T previous, T element)) { 229 Future<T> reduce(T combine(T previous, T element)) {
218 _Future<T> result = new _Future<T>(); 230 _Future<T> result = new _Future<T>();
219 bool seenFirst = false; 231 bool seenFirst = false;
220 T value; 232 T value;
221 StreamSubscription subscription; 233 StreamSubscription subscription;
222 subscription = this.listen((T element) { 234 subscription = this.listen((T element) {
223 if (seenFirst) { 235 if (seenFirst) {
224 _runUserCode(() => combine(value, element), ((__x55) => DEVC$RT.wrap((dyna mic f(T __u50)) { 236 _runUserCode(() => combine(value, element), (T newValue) {
225 dynamic c(T x0) => f(DEVC$RT.cast(x0, dynamic, T, "CastParam", """line 5 00, column 24 of dart:async/stream.dart: """, x0 is T, false));
226 return f == null ? null : c;
227 }
228 , __x55, DEVC$RT.type((__t53<T> _) {
229 }
230 ), __t51, "WrapLiteral", """line 500, column 24 of dart:async/stream.dart: """, __x55 is __t51))((T newValue) {
231 value = newValue; 237 value = newValue;
232 } 238 }
233 ), ((__x59) => DEVC$RT.cast(__x59, dynamic, __t56, "CastGeneral", """line 501, column 24 of dart:async/stream.dart: """, __x59 is __t56, false))(_cancelAn dErrorClosure(subscription, result))); 239 , ((__x57) => DEVC$RT.cast(__x57, dynamic, __t54, "CastGeneral", """line 5 01, column 24 of dart:async/stream.dart: """, __x57 is __t54, false))(_cancelAnd ErrorClosure(subscription, result)));
234 } 240 }
235 else { 241 else {
236 value = element; 242 value = element;
237 seenFirst = true; 243 seenFirst = true;
238 } 244 }
239 } 245 }
240 , onError: result._completeError, onDone: () { 246 , onError: result._completeError, onDone: () {
241 if (!seenFirst) { 247 if (!seenFirst) {
242 try { 248 try {
243 throw IterableElementError.noElement(); 249 throw IterableElementError.noElement();
(...skipping 10 matching lines...) Expand all
254 return result; 260 return result;
255 } 261 }
256 Future fold(var initialValue, combine(var previous, T element)) { 262 Future fold(var initialValue, combine(var previous, T element)) {
257 _Future result = new _Future(); 263 _Future result = new _Future();
258 var value = initialValue; 264 var value = initialValue;
259 StreamSubscription subscription; 265 StreamSubscription subscription;
260 subscription = this.listen((T element) { 266 subscription = this.listen((T element) {
261 _runUserCode(() => combine(value, element), (newValue) { 267 _runUserCode(() => combine(value, element), (newValue) {
262 value = newValue; 268 value = newValue;
263 } 269 }
264 , ((__x60) => DEVC$RT.cast(__x60, dynamic, __t56, "CastGeneral", """line 534 , column 11 of dart:async/stream.dart: """, __x60 is __t56, false))(_cancelAndEr rorClosure(subscription, result))); 270 , ((__x58) => DEVC$RT.cast(__x58, dynamic, __t54, "CastGeneral", """line 534 , column 11 of dart:async/stream.dart: """, __x58 is __t54, false))(_cancelAndEr rorClosure(subscription, result)));
265 } 271 }
266 , onError: (e, st) { 272 , onError: (e, st) {
267 result._completeError(e, DEVC$RT.cast(st, dynamic, StackTrace, "CastGeneral" , """line 538, column 34 of dart:async/stream.dart: """, st is StackTrace, true) ); 273 result._completeError(e, DEVC$RT.cast(st, dynamic, StackTrace, "CastGeneral" , """line 538, column 34 of dart:async/stream.dart: """, st is StackTrace, true) );
268 } 274 }
269 , onDone: () { 275 , onDone: () {
270 result._complete(value); 276 result._complete(value);
271 } 277 }
272 , cancelOnError: true); 278 , cancelOnError: true);
273 return result; 279 return result;
274 } 280 }
(...skipping 20 matching lines...) Expand all
295 , onDone: () { 301 , onDone: () {
296 result._complete(buffer.toString()); 302 result._complete(buffer.toString());
297 } 303 }
298 , cancelOnError: true); 304 , cancelOnError: true);
299 return result; 305 return result;
300 } 306 }
301 Future<bool> contains(Object needle) { 307 Future<bool> contains(Object needle) {
302 _Future<bool> future = new _Future<bool>(); 308 _Future<bool> future = new _Future<bool>();
303 StreamSubscription subscription; 309 StreamSubscription subscription;
304 subscription = this.listen((T element) { 310 subscription = this.listen((T element) {
305 _runUserCode(() => (element == needle), ((__x64) => DEVC$RT.wrap((dynamic f( bool __u61)) { 311 _runUserCode(() => (element == needle), (bool isMatch) {
306 dynamic c(bool x0) => f(DEVC$RT.cast(x0, dynamic, bool, "CastParam", """li ne 597, column 13 of dart:async/stream.dart: """, x0 is bool, true));
307 return f == null ? null : c;
308 }
309 , __x64, __t62, __t51, "WrapLiteral", """line 597, column 13 of dart:async/s tream.dart: """, __x64 is __t51))((bool isMatch) {
310 if (isMatch) { 312 if (isMatch) {
311 _cancelAndValue(subscription, future, true); 313 _cancelAndValue(subscription, future, true);
312 } 314 }
313 } 315 }
314 ), ((__x65) => DEVC$RT.cast(__x65, dynamic, __t56, "CastGeneral", """line 60 2, column 13 of dart:async/stream.dart: """, __x65 is __t56, false))(_cancelAndE rrorClosure(subscription, future))); 316 , ((__x59) => DEVC$RT.cast(__x59, dynamic, __t54, "CastGeneral", """line 602 , column 13 of dart:async/stream.dart: """, __x59 is __t54, false))(_cancelAndEr rorClosure(subscription, future)));
315 } 317 }
316 , onError: future._completeError, onDone: () { 318 , onError: future._completeError, onDone: () {
317 future._complete(false); 319 future._complete(false);
318 } 320 }
319 , cancelOnError: true); 321 , cancelOnError: true);
320 return future; 322 return future;
321 } 323 }
322 Future forEach(void action(T element)) { 324 Future forEach(void action(T element)) {
323 _Future future = new _Future(); 325 _Future future = new _Future();
324 StreamSubscription subscription; 326 StreamSubscription subscription;
325 subscription = this.listen((T element) { 327 subscription = this.listen((T element) {
326 _runUserCode(() => action(element), (_) { 328 _runUserCode(() => action(element), (_) {
327 } 329 }
328 , ((__x66) => DEVC$RT.cast(__x66, dynamic, __t56, "CastGeneral", """line 628 , column 13 of dart:async/stream.dart: """, __x66 is __t56, false))(_cancelAndEr rorClosure(subscription, future))); 330 , ((__x60) => DEVC$RT.cast(__x60, dynamic, __t54, "CastGeneral", """line 628 , column 13 of dart:async/stream.dart: """, __x60 is __t54, false))(_cancelAndEr rorClosure(subscription, future)));
329 } 331 }
330 , onError: future._completeError, onDone: () { 332 , onError: future._completeError, onDone: () {
331 future._complete(null); 333 future._complete(null);
332 } 334 }
333 , cancelOnError: true); 335 , cancelOnError: true);
334 return future; 336 return future;
335 } 337 }
336 Future<bool> every(bool test(T element)) { 338 Future<bool> every(bool test(T element)) {
337 _Future<bool> future = new _Future<bool>(); 339 _Future<bool> future = new _Future<bool>();
338 StreamSubscription subscription; 340 StreamSubscription subscription;
339 subscription = this.listen((T element) { 341 subscription = this.listen((T element) {
340 _runUserCode(() => test(element), ((__x68) => DEVC$RT.wrap((dynamic f(bool _ _u67)) { 342 _runUserCode(() => test(element), (bool isMatch) {
341 dynamic c(bool x0) => f(DEVC$RT.cast(x0, dynamic, bool, "CastParam", """li ne 652, column 13 of dart:async/stream.dart: """, x0 is bool, true));
342 return f == null ? null : c;
343 }
344 , __x68, __t62, __t51, "WrapLiteral", """line 652, column 13 of dart:async/s tream.dart: """, __x68 is __t51))((bool isMatch) {
345 if (!isMatch) { 343 if (!isMatch) {
346 _cancelAndValue(subscription, future, false); 344 _cancelAndValue(subscription, future, false);
347 } 345 }
348 } 346 }
349 ), ((__x69) => DEVC$RT.cast(__x69, dynamic, __t56, "CastGeneral", """line 65 7, column 13 of dart:async/stream.dart: """, __x69 is __t56, false))(_cancelAndE rrorClosure(subscription, future))); 347 , ((__x61) => DEVC$RT.cast(__x61, dynamic, __t54, "CastGeneral", """line 657 , column 13 of dart:async/stream.dart: """, __x61 is __t54, false))(_cancelAndEr rorClosure(subscription, future)));
350 } 348 }
351 , onError: future._completeError, onDone: () { 349 , onError: future._completeError, onDone: () {
352 future._complete(true); 350 future._complete(true);
353 } 351 }
354 , cancelOnError: true); 352 , cancelOnError: true);
355 return future; 353 return future;
356 } 354 }
357 Future<bool> any(bool test(T element)) { 355 Future<bool> any(bool test(T element)) {
358 _Future<bool> future = new _Future<bool>(); 356 _Future<bool> future = new _Future<bool>();
359 StreamSubscription subscription; 357 StreamSubscription subscription;
360 subscription = this.listen((T element) { 358 subscription = this.listen((T element) {
361 _runUserCode(() => test(element), ((__x71) => DEVC$RT.wrap((dynamic f(bool _ _u70)) { 359 _runUserCode(() => test(element), (bool isMatch) {
362 dynamic c(bool x0) => f(DEVC$RT.cast(x0, dynamic, bool, "CastParam", """li ne 689, column 13 of dart:async/stream.dart: """, x0 is bool, true));
363 return f == null ? null : c;
364 }
365 , __x71, __t62, __t51, "WrapLiteral", """line 689, column 13 of dart:async/s tream.dart: """, __x71 is __t51))((bool isMatch) {
366 if (isMatch) { 360 if (isMatch) {
367 _cancelAndValue(subscription, future, true); 361 _cancelAndValue(subscription, future, true);
368 } 362 }
369 } 363 }
370 ), ((__x72) => DEVC$RT.cast(__x72, dynamic, __t56, "CastGeneral", """line 69 4, column 13 of dart:async/stream.dart: """, __x72 is __t56, false))(_cancelAndE rrorClosure(subscription, future))); 364 , ((__x62) => DEVC$RT.cast(__x62, dynamic, __t54, "CastGeneral", """line 694 , column 13 of dart:async/stream.dart: """, __x62 is __t54, false))(_cancelAndEr rorClosure(subscription, future)));
371 } 365 }
372 , onError: future._completeError, onDone: () { 366 , onError: future._completeError, onDone: () {
373 future._complete(false); 367 future._complete(false);
374 } 368 }
375 , cancelOnError: true); 369 , cancelOnError: true);
376 return future; 370 return future;
377 } 371 }
378 Future<int> get length { 372 Future<int> get length {
379 _Future<int> future = new _Future<int>(); 373 _Future<int> future = new _Future<int>();
380 int count = 0; 374 int count = 0;
381 this.listen((_) { 375 this.listen(((__x66) => DEVC$RT.wrap((dynamic f(dynamic __u63)) {
376 dynamic c(dynamic x0) => f(x0);
377 return f == null ? null : c;
378 }
379 , __x66, __t33, DEVC$RT.type((__t64<T> _) {
380 }
381 ), "WrapLiteral", """line 711, column 7 of dart:async/stream.dart: """, __x66 is __t64<T>))((_) {
382 count++; 382 count++;
383 } 383 }
384 , onError: future._completeError, onDone: () { 384 ), onError: future._completeError, onDone: () {
385 future._complete(count); 385 future._complete(count);
386 } 386 }
387 , cancelOnError: true); 387 , cancelOnError: true);
388 return future; 388 return future;
389 } 389 }
390 Future<bool> get isEmpty { 390 Future<bool> get isEmpty {
391 _Future<bool> future = new _Future<bool>(); 391 _Future<bool> future = new _Future<bool>();
392 StreamSubscription subscription; 392 StreamSubscription subscription;
393 subscription = this.listen((_) { 393 subscription = this.listen(((__x68) => DEVC$RT.wrap((dynamic f(dynamic __u67) ) {
394 dynamic c(dynamic x0) => f(x0);
395 return f == null ? null : c;
396 }
397 , __x68, __t33, DEVC$RT.type((__t64<T> _) {
398 }
399 ), "WrapLiteral", """line 733, column 7 of dart:async/stream.dart: """, __x68 is __t64<T>))((_) {
394 _cancelAndValue(subscription, future, false); 400 _cancelAndValue(subscription, future, false);
395 } 401 }
396 , onError: future._completeError, onDone: () { 402 ), onError: future._completeError, onDone: () {
397 future._complete(true); 403 future._complete(true);
398 } 404 }
399 , cancelOnError: true); 405 , cancelOnError: true);
400 return future; 406 return future;
401 } 407 }
402 Future<List<T>> toList() { 408 Future<List<T>> toList() {
403 List<T> result = <T> []; 409 List<T> result = <T> [];
404 _Future<List<T>> future = new _Future<List<T>>(); 410 _Future<List<T>> future = new _Future<List<T>>();
405 this.listen((T data) { 411 this.listen((T data) {
406 result.add(data); 412 result.add(data);
(...skipping 11 matching lines...) Expand all
418 result.add(data); 424 result.add(data);
419 } 425 }
420 , onError: future._completeError, onDone: () { 426 , onError: future._completeError, onDone: () {
421 future._complete(result); 427 future._complete(result);
422 } 428 }
423 , cancelOnError: true); 429 , cancelOnError: true);
424 return future; 430 return future;
425 } 431 }
426 Future drain([var futureValue]) => listen(null, cancelOnError: true).asFuture(f utureValue); 432 Future drain([var futureValue]) => listen(null, cancelOnError: true).asFuture(f utureValue);
427 Stream<T> take(int count) { 433 Stream<T> take(int count) {
428 return ((__x73) => DEVC$RT.cast(__x73, DEVC$RT.type((_TakeStream<dynamic> _) { 434 return ((__x69) => DEVC$RT.cast(__x69, DEVC$RT.type((_TakeStream<dynamic> _) {
429 } 435 }
430 ), DEVC$RT.type((Stream<T> _) { 436 ), DEVC$RT.type((Stream<T> _) {
431 } 437 }
432 ), "CastExact", """line 819, column 12 of dart:async/stream.dart: """, __x73 i s Stream<T>, false))(new _TakeStream(this, count)); 438 ), "CastExact", """line 819, column 12 of dart:async/stream.dart: """, __x69 i s Stream<T>, false))(new _TakeStream(this, count));
433 } 439 }
434 Stream<T> takeWhile(bool test(T element)) { 440 Stream<T> takeWhile(bool test(T element)) {
435 return ((__x74) => DEVC$RT.cast(__x74, DEVC$RT.type((_TakeWhileStream<dynamic> _) { 441 return ((__x70) => DEVC$RT.cast(__x70, DEVC$RT.type((_TakeWhileStream<dynamic> _) {
436 } 442 }
437 ), DEVC$RT.type((Stream<T> _) { 443 ), DEVC$RT.type((Stream<T> _) {
438 } 444 }
439 ), "CastExact", """line 841, column 12 of dart:async/stream.dart: """, __x74 i s Stream<T>, false))(new _TakeWhileStream(this, DEVC$RT.wrap((bool f(T __u75)) { 445 ), "CastExact", """line 841, column 12 of dart:async/stream.dart: """, __x70 i s Stream<T>, false))(new _TakeWhileStream(this, test));
440 bool c(T x0) => f(DEVC$RT.cast(x0, dynamic, T, "CastParam", """line 841, col umn 39 of dart:async/stream.dart: """, x0 is T, false));
441 return f == null ? null : c;
442 }
443 , test, DEVC$RT.type((__t78<T> _) {
444 }
445 ), __t76, "Wrap", """line 841, column 39 of dart:async/stream.dart: """, test is __t76)));
446 } 446 }
447 Stream<T> skip(int count) { 447 Stream<T> skip(int count) {
448 return ((__x80) => DEVC$RT.cast(__x80, DEVC$RT.type((_SkipStream<dynamic> _) { 448 return ((__x71) => DEVC$RT.cast(__x71, DEVC$RT.type((_SkipStream<dynamic> _) {
449 } 449 }
450 ), DEVC$RT.type((Stream<T> _) { 450 ), DEVC$RT.type((Stream<T> _) {
451 } 451 }
452 ), "CastExact", """line 852, column 12 of dart:async/stream.dart: """, __x80 i s Stream<T>, false))(new _SkipStream(this, count)); 452 ), "CastExact", """line 852, column 12 of dart:async/stream.dart: """, __x71 i s Stream<T>, false))(new _SkipStream(this, count));
453 } 453 }
454 Stream<T> skipWhile(bool test(T element)) { 454 Stream<T> skipWhile(bool test(T element)) {
455 return ((__x81) => DEVC$RT.cast(__x81, DEVC$RT.type((_SkipWhileStream<dynamic> _) { 455 return ((__x72) => DEVC$RT.cast(__x72, DEVC$RT.type((_SkipWhileStream<dynamic> _) {
456 } 456 }
457 ), DEVC$RT.type((Stream<T> _) { 457 ), DEVC$RT.type((Stream<T> _) {
458 } 458 }
459 ), "CastExact", """line 868, column 12 of dart:async/stream.dart: """, __x81 i s Stream<T>, false))(new _SkipWhileStream(this, DEVC$RT.wrap((bool f(T __u82)) { 459 ), "CastExact", """line 868, column 12 of dart:async/stream.dart: """, __x72 i s Stream<T>, false))(new _SkipWhileStream(this, test));
460 bool c(T x0) => f(DEVC$RT.cast(x0, dynamic, T, "CastParam", """line 868, col umn 39 of dart:async/stream.dart: """, x0 is T, false));
461 return f == null ? null : c;
462 }
463 , test, DEVC$RT.type((__t78<T> _) {
464 }
465 ), __t76, "Wrap", """line 868, column 39 of dart:async/stream.dart: """, test is __t76)));
466 } 460 }
467 Stream<T> distinct([bool equals(T previous, T next)]) { 461 Stream<T> distinct([bool equals(T previous, T next)]) {
468 return ((__x83) => DEVC$RT.cast(__x83, DEVC$RT.type((_DistinctStream<dynamic> _) { 462 return ((__x73) => DEVC$RT.cast(__x73, DEVC$RT.type((_DistinctStream<dynamic> _) {
469 } 463 }
470 ), DEVC$RT.type((Stream<T> _) { 464 ), DEVC$RT.type((Stream<T> _) {
471 } 465 }
472 ), "CastExact", """line 885, column 12 of dart:async/stream.dart: """, __x83 i s Stream<T>, false))(new _DistinctStream(this, DEVC$RT.wrap((bool f(T __u84, T _ _u85)) { 466 ), "CastExact", """line 885, column 12 of dart:async/stream.dart: """, __x73 i s Stream<T>, false))(new _DistinctStream(this, equals));
473 bool c(T x0, T x1) => f(DEVC$RT.cast(x0, dynamic, T, "CastParam", """line 88 5, column 38 of dart:async/stream.dart: """, x0 is T, false), DEVC$RT.cast(x1, d ynamic, T, "CastParam", """line 885, column 38 of dart:async/stream.dart: """, x 1 is T, false));
474 return f == null ? null : c;
475 }
476 , equals, DEVC$RT.type((__t89<T> _) {
477 }
478 ), __t86, "Wrap", """line 885, column 38 of dart:async/stream.dart: """, equal s is __t86)));
479 } 467 }
480 Future<T> get first { 468 Future<T> get first {
481 _Future<T> future = new _Future<T>(); 469 _Future<T> future = new _Future<T>();
482 StreamSubscription subscription; 470 StreamSubscription subscription;
483 subscription = this.listen((T value) { 471 subscription = this.listen((T value) {
484 _cancelAndValue(subscription, future, value); 472 _cancelAndValue(subscription, future, value);
485 } 473 }
486 , onError: future._completeError, onDone: () { 474 , onError: future._completeError, onDone: () {
487 try { 475 try {
488 throw IterableElementError.noElement(); 476 throw IterableElementError.noElement();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 } 535 }
548 , cancelOnError: true); 536 , cancelOnError: true);
549 return future; 537 return future;
550 } 538 }
551 Future<dynamic> firstWhere(bool test(T element), { 539 Future<dynamic> firstWhere(bool test(T element), {
552 Object defaultValue()} 540 Object defaultValue()}
553 ) { 541 ) {
554 _Future<dynamic> future = new _Future(); 542 _Future<dynamic> future = new _Future();
555 StreamSubscription subscription; 543 StreamSubscription subscription;
556 subscription = this.listen((T value) { 544 subscription = this.listen((T value) {
557 _runUserCode(() => test(value), ((__x93) => DEVC$RT.wrap((dynamic f(bool __u 92)) { 545 _runUserCode(() => test(value), (bool isMatch) {
558 dynamic c(bool x0) => f(DEVC$RT.cast(x0, dynamic, bool, "CastParam", """li ne 1031, column 11 of dart:async/stream.dart: """, x0 is bool, true));
559 return f == null ? null : c;
560 }
561 , __x93, __t62, __t51, "WrapLiteral", """line 1031, column 11 of dart:async/ stream.dart: """, __x93 is __t51))((bool isMatch) {
562 if (isMatch) { 546 if (isMatch) {
563 _cancelAndValue(subscription, future, value); 547 _cancelAndValue(subscription, future, value);
564 } 548 }
565 } 549 }
566 ), ((__x94) => DEVC$RT.cast(__x94, dynamic, __t56, "CastGeneral", """line 10 36, column 11 of dart:async/stream.dart: """, __x94 is __t56, false))(_cancelAnd ErrorClosure(subscription, future))); 550 , ((__x74) => DEVC$RT.cast(__x74, dynamic, __t54, "CastGeneral", """line 103 6, column 11 of dart:async/stream.dart: """, __x74 is __t54, false))(_cancelAndE rrorClosure(subscription, future)));
567 } 551 }
568 , onError: future._completeError, onDone: () { 552 , onError: future._completeError, onDone: () {
569 if (defaultValue != null) { 553 if (defaultValue != null) {
570 _runUserCode(defaultValue, future._complete, future._completeError); 554 _runUserCode(defaultValue, future._complete, future._completeError);
571 return;} 555 return;}
572 try { 556 try {
573 throw IterableElementError.noElement(); 557 throw IterableElementError.noElement();
574 } 558 }
575 catch (e, s) { 559 catch (e, s) {
576 _completeWithErrorCallback(future, e, s); 560 _completeWithErrorCallback(future, e, s);
577 } 561 }
578 } 562 }
579 , cancelOnError: true); 563 , cancelOnError: true);
580 return future; 564 return future;
581 } 565 }
582 Future<dynamic> lastWhere(bool test(T element), { 566 Future<dynamic> lastWhere(bool test(T element), {
583 Object defaultValue()} 567 Object defaultValue()}
584 ) { 568 ) {
585 _Future<dynamic> future = new _Future(); 569 _Future<dynamic> future = new _Future();
586 T result = null; 570 T result = null;
587 bool foundResult = false; 571 bool foundResult = false;
588 StreamSubscription subscription; 572 StreamSubscription subscription;
589 subscription = this.listen((T value) { 573 subscription = this.listen((T value) {
590 _runUserCode(() => true == test(value), ((__x96) => DEVC$RT.wrap((dynamic f( bool __u95)) { 574 _runUserCode(() => true == test(value), (bool isMatch) {
591 dynamic c(bool x0) => f(DEVC$RT.cast(x0, dynamic, bool, "CastParam", """li ne 1071, column 11 of dart:async/stream.dart: """, x0 is bool, true));
592 return f == null ? null : c;
593 }
594 , __x96, __t62, __t51, "WrapLiteral", """line 1071, column 11 of dart:async/ stream.dart: """, __x96 is __t51))((bool isMatch) {
595 if (isMatch) { 575 if (isMatch) {
596 foundResult = true; 576 foundResult = true;
597 result = value; 577 result = value;
598 } 578 }
599 } 579 }
600 ), ((__x97) => DEVC$RT.cast(__x97, dynamic, __t56, "CastGeneral", """line 10 77, column 11 of dart:async/stream.dart: """, __x97 is __t56, false))(_cancelAnd ErrorClosure(subscription, future))); 580 , ((__x75) => DEVC$RT.cast(__x75, dynamic, __t54, "CastGeneral", """line 107 7, column 11 of dart:async/stream.dart: """, __x75 is __t54, false))(_cancelAndE rrorClosure(subscription, future)));
601 } 581 }
602 , onError: future._completeError, onDone: () { 582 , onError: future._completeError, onDone: () {
603 if (foundResult) { 583 if (foundResult) {
604 future._complete(result); 584 future._complete(result);
605 return;} 585 return;}
606 if (defaultValue != null) { 586 if (defaultValue != null) {
607 _runUserCode(defaultValue, future._complete, future._completeError); 587 _runUserCode(defaultValue, future._complete, future._completeError);
608 return;} 588 return;}
609 try { 589 try {
610 throw IterableElementError.noElement(); 590 throw IterableElementError.noElement();
611 } 591 }
612 catch (e, s) { 592 catch (e, s) {
613 _completeWithErrorCallback(future, e, s); 593 _completeWithErrorCallback(future, e, s);
614 } 594 }
615 } 595 }
616 , cancelOnError: true); 596 , cancelOnError: true);
617 return future; 597 return future;
618 } 598 }
619 Future<T> singleWhere(bool test(T element)) { 599 Future<T> singleWhere(bool test(T element)) {
620 _Future<T> future = new _Future<T>(); 600 _Future<T> future = new _Future<T>();
621 T result = null; 601 T result = null;
622 bool foundResult = false; 602 bool foundResult = false;
623 StreamSubscription subscription; 603 StreamSubscription subscription;
624 subscription = this.listen((T value) { 604 subscription = this.listen((T value) {
625 _runUserCode(() => true == test(value), ((__x99) => DEVC$RT.wrap((dynamic f( bool __u98)) { 605 _runUserCode(() => true == test(value), (bool isMatch) {
626 dynamic c(bool x0) => f(DEVC$RT.cast(x0, dynamic, bool, "CastParam", """li ne 1115, column 11 of dart:async/stream.dart: """, x0 is bool, true));
627 return f == null ? null : c;
628 }
629 , __x99, __t62, __t51, "WrapLiteral", """line 1115, column 11 of dart:async/ stream.dart: """, __x99 is __t51))((bool isMatch) {
630 if (isMatch) { 606 if (isMatch) {
631 if (foundResult) { 607 if (foundResult) {
632 try { 608 try {
633 throw IterableElementError.tooMany(); 609 throw IterableElementError.tooMany();
634 } 610 }
635 catch (e, s) { 611 catch (e, s) {
636 _cancelAndErrorWithReplacement(subscription, future, e, s); 612 _cancelAndErrorWithReplacement(subscription, future, e, s);
637 } 613 }
638 return;} 614 return;}
639 foundResult = true; 615 foundResult = true;
640 result = value; 616 result = value;
641 } 617 }
642 } 618 }
643 ), ((__x100) => DEVC$RT.cast(__x100, dynamic, __t56, "CastGeneral", """line 1129, column 11 of dart:async/stream.dart: """, __x100 is __t56, false))(_cancel AndErrorClosure(subscription, future))); 619 , ((__x76) => DEVC$RT.cast(__x76, dynamic, __t54, "CastGeneral", """line 112 9, column 11 of dart:async/stream.dart: """, __x76 is __t54, false))(_cancelAndE rrorClosure(subscription, future)));
644 } 620 }
645 , onError: future._completeError, onDone: () { 621 , onError: future._completeError, onDone: () {
646 if (foundResult) { 622 if (foundResult) {
647 future._complete(result); 623 future._complete(result);
648 return;} 624 return;}
649 try { 625 try {
650 throw IterableElementError.noElement(); 626 throw IterableElementError.noElement();
651 } 627 }
652 catch (e, s) { 628 catch (e, s) {
653 _completeWithErrorCallback(future, e, s); 629 _completeWithErrorCallback(future, e, s);
(...skipping 23 matching lines...) Expand all
677 void onTimeout(EventSink sink)} 653 void onTimeout(EventSink sink)}
678 ) { 654 ) {
679 StreamController controller; 655 StreamController controller;
680 StreamSubscription<T> subscription; 656 StreamSubscription<T> subscription;
681 Timer timer; 657 Timer timer;
682 Zone zone; 658 Zone zone;
683 Function timeout; 659 Function timeout;
684 void onData(T event) { 660 void onData(T event) {
685 timer.cancel(); 661 timer.cancel();
686 controller.add(event); 662 controller.add(event);
687 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t101, "CastGeneral", """line 1219, column 43 of dart:async/stream.dart: """, timeout is __t101, false)); 663 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t77, "CastGeneral", """line 1219, column 43 of dart:async/stream.dart: """, timeout i s __t77, false));
688 } 664 }
689 void onError(error, StackTrace stackTrace) { 665 void onError(error, StackTrace stackTrace) {
690 timer.cancel(); 666 timer.cancel();
691 assert (controller is _StreamController || controller is _BroadcastStreamCo ntroller); var eventSink = controller; 667 assert (controller is _StreamController || controller is _BroadcastStreamCo ntroller); var eventSink = controller;
692 eventSink._addError(error, stackTrace); 668 eventSink._addError(error, stackTrace);
693 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t101, "CastGeneral", """line 1227, column 43 of dart:async/stream.dart: """, timeout is __t101, false)); 669 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t77, "CastGeneral", """line 1227, column 43 of dart:async/stream.dart: """, timeout i s __t77, false));
694 } 670 }
695 void onDone() { 671 void onDone() {
696 timer.cancel(); 672 timer.cancel();
697 controller.close(); 673 controller.close();
698 } 674 }
699 void onListen() { 675 void onListen() {
700 zone = Zone.current; 676 zone = Zone.current;
701 if (onTimeout == null) { 677 if (onTimeout == null) {
702 timeout = () { 678 timeout = () {
703 controller.addError(new TimeoutException("No stream event", timeLimit), null); 679 controller.addError(new TimeoutException("No stream event", timeLimit), null);
704 } 680 }
705 ; 681 ;
706 } 682 }
707 else { 683 else {
708 onTimeout = zone.registerUnaryCallback(DEVC$RT.wrap((void f(EventSink<dyna mic> __u102)) { 684 onTimeout = ((__x81) => DEVC$RT.wrap((dynamic f(dynamic __u78)) {
709 void c(EventSink<dynamic> x0) => f(DEVC$RT.cast(x0, dynamic, DEVC$RT.typ e((EventSink<dynamic> _) { 685 dynamic c(dynamic x0) => f(x0);
710 }
711 ), "CastParam", """line 1245, column 48 of dart:async/stream.dart: """, x0 is EventSink<dynamic>, true));
712 return f == null ? null : c; 686 return f == null ? null : c;
713 } 687 }
714 , onTimeout, __t103, __t51, "Wrap", """line 1245, column 48 of dart:async/ stream.dart: """, onTimeout is __t51)); 688 , __x81, __t33, __t79, "Wrap", """line 1245, column 21 of dart:async/strea m.dart: """, __x81 is __t79))(zone.registerUnaryCallback(onTimeout));
715 _ControllerEventSinkWrapper wrapper = new _ControllerEventSinkWrapper(nul l); 689 _ControllerEventSinkWrapper wrapper = new _ControllerEventSinkWrapper(nul l);
716 timeout = () { 690 timeout = () {
717 wrapper._sink = controller; 691 wrapper._sink = controller;
718 zone.runUnaryGuarded(DEVC$RT.wrap((void f(EventSink<dynamic> __u105)) { 692 zone.runUnaryGuarded(onTimeout, wrapper);
719 void c(EventSink<dynamic> x0) => f(DEVC$RT.cast(x0, dynamic, DEVC$RT.t ype((EventSink<dynamic> _) {
720 }
721 ), "CastParam", """line 1250, column 32 of dart:async/stream.dart: """ , x0 is EventSink<dynamic>, true));
722 return f == null ? null : c;
723 }
724 , onTimeout, __t103, __t51, "Wrap", """line 1250, column 32 of dart:asyn c/stream.dart: """, onTimeout is __t51), wrapper);
725 wrapper._sink = null; 693 wrapper._sink = null;
726 } 694 }
727 ; 695 ;
728 } 696 }
729 subscription = this.listen(onData, onError: onError, onDone: onDone); 697 subscription = this.listen(onData, onError: onError, onDone: onDone);
730 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t101, "CastGeneral", """line 1256, column 43 of dart:async/stream.dart: """, timeout is __t101, false)); 698 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t77, "CastGeneral", """line 1256, column 43 of dart:async/stream.dart: """, timeout i s __t77, false));
731 } 699 }
732 Future onCancel() { 700 Future onCancel() {
733 timer.cancel(); 701 timer.cancel();
734 Future result = subscription.cancel(); 702 Future result = subscription.cancel();
735 subscription = null; 703 subscription = null;
736 return result; 704 return result;
737 } 705 }
738 controller = isBroadcast ? new _SyncBroadcastStreamController(onListen, onCan cel) : new _SyncStreamController(onListen, () { 706 controller = isBroadcast ? new _SyncBroadcastStreamController(onListen, onCan cel) : new _SyncStreamController(onListen, () {
739 timer.cancel(); 707 timer.cancel();
740 subscription.pause(); 708 subscription.pause();
741 } 709 }
742 , () { 710 , () {
743 subscription.resume(); 711 subscription.resume();
744 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t101, "CastGeneral", """line 1275, column 53 of dart:async/stream.dart: """, timeout is __t101, false)); 712 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t77, "CastGeneral", """line 1275, column 53 of dart:async/stream.dart: """, timeout i s __t77, false));
745 } 713 }
746 , onCancel); 714 , onCancel);
747 return controller.stream; 715 return controller.stream;
748 } 716 }
749 } 717 }
750 abstract class StreamSubscription<T> {Future cancel(); 718 abstract class StreamSubscription<T> {Future cancel();
751 void onData(void handleData(T data)); 719 void onData(void handleData(T data));
752 void onError(Function handleError); 720 void onError(Function handleError);
753 void onDone(void handleDone()); 721 void onDone(void handleDone());
754 void pause([Future resumeSignal]); 722 void pause([Future resumeSignal]);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 void add(T data) { 762 void add(T data) {
795 _sink.add(data); 763 _sink.add(data);
796 } 764 }
797 void addError(error, [StackTrace stackTrace]) { 765 void addError(error, [StackTrace stackTrace]) {
798 _sink.addError(error, stackTrace); 766 _sink.addError(error, stackTrace);
799 } 767 }
800 void close() { 768 void close() {
801 _sink.close(); 769 _sink.close();
802 } 770 }
803 } 771 }
804 typedef EventSink<dynamic> __t40(EventSink<dynamic> __u41); 772 typedef dynamic __t31<T>(T __u32);
805 typedef EventSink<dynamic> __t42<T>(EventSink<T> __u43); 773 typedef dynamic __t33(dynamic __u34);
806 typedef void __t45(StreamSubscription<dynamic> __u46); 774 typedef T __t37<T>(int __u38);
807 typedef void __t47<T>(StreamSubscription<T> __u48); 775 typedef dynamic __t39(dynamic __u40);
808 typedef dynamic __t51(dynamic __u52); 776 typedef EventSink<dynamic> __t44(EventSink<dynamic> __u45);
809 typedef dynamic __t53<T>(T __u54); 777 typedef EventSink<dynamic> __t46<T>(EventSink<T> __u47);
810 typedef dynamic __t56(dynamic __u57, StackTrace __u58); 778 typedef void __t49(StreamSubscription<dynamic> __u50);
811 typedef dynamic __t62(bool __u63); 779 typedef void __t51<T>(StreamSubscription<T> __u52);
812 typedef bool __t76(dynamic __u77); 780 typedef dynamic __t54(dynamic __u55, StackTrace __u56);
813 typedef bool __t78<T>(T __u79); 781 typedef void __t64<T>(T __u65);
814 typedef bool __t86(dynamic __u87, dynamic __u88); 782 typedef void __t77();
815 typedef bool __t89<T>(T __u90, T __u91); 783 typedef void __t79(EventSink<dynamic> __u80);
816 typedef void __t101();
817 typedef void __t103(EventSink<dynamic> __u104);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698