| OLD | NEW |
| 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(((__x25) => DEVC$RT.cast(__x25, __t23, DEVC$RT.type((__t21<T> _)
{ | 5 future.then((value) { |
| 6 } | |
| 7 ), "InferableClosure", """line 88, column 17 of dart:async/stream.dart: """, _
_x25 is __t21<T>, false))((value) { | |
| 8 controller._add(DEVC$RT.cast(value, dynamic, T, "CompositeCast", """line 89,
column 25 of dart:async/stream.dart: """, value is T, false)); | 6 controller._add(DEVC$RT.cast(value, dynamic, T, "CompositeCast", """line 89,
column 25 of dart:async/stream.dart: """, value is T, false)); |
| 9 controller._closeUnchecked(); | 7 controller._closeUnchecked(); |
| 10 } | 8 } |
| 11 ), onError: (error, stackTrace) { | 9 , onError: (error, stackTrace) { |
| 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)); | 10 controller._addError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "D
ynamicCast", """line 93, column 37 of dart:async/stream.dart: """, stackTrace is
StackTrace, true)); |
| 13 controller._closeUnchecked(); | 11 controller._closeUnchecked(); |
| 14 } | 12 } |
| 15 ); | 13 ); |
| 16 return controller.stream; | 14 return controller.stream; |
| 17 } | 15 } |
| 18 factory Stream.fromIterable(Iterable<T> data) { | 16 factory Stream.fromIterable(Iterable<T> data) { |
| 19 return new _GeneratedStreamImpl<T>(() => new _IterablePendingEvents<T>(data)); | 17 return new _GeneratedStreamImpl<T>(() => new _IterablePendingEvents<T>(data)); |
| 20 } | 18 } |
| 21 factory Stream.periodic(Duration period, [T computation(int computationCount)])
{ | 19 factory Stream.periodic(Duration period, [T computation(int computationCount)])
{ |
| 22 if (computation == null) computation = ((__x30) => DEVC$RT.cast(__x30, __t28,
DEVC$RT.type((__t26<T> _) { | 20 if (computation == null) computation = ((__x25) => DEVC$RT.cast(__x25, __t23,
DEVC$RT.type((__t21<T> _) { |
| 23 } | 21 } |
| 24 ), "CompositeCast", """line 126, column 44 of dart:async/stream.dart: """, __x
30 is __t26<T>, false))(((i) => null)); | 22 ), "CompositeCast", """line 126, column 44 of dart:async/stream.dart: """, __x
25 is __t21<T>, false))(((i) => null)); |
| 25 Timer timer; | 23 Timer timer; |
| 26 int computationCount = 0; | 24 int computationCount = 0; |
| 27 StreamController<T> controller; | 25 StreamController<T> controller; |
| 28 Stopwatch watch = new Stopwatch(); | 26 Stopwatch watch = new Stopwatch(); |
| 29 void sendEvent() { | 27 void sendEvent() { |
| 30 watch.reset(); | 28 watch.reset(); |
| 31 T data = computation(computationCount++); | 29 T data = computation(computationCount++); |
| 32 controller.add(data); | 30 controller.add(data); |
| 33 } | 31 } |
| 34 void startPeriodicTimer() { | 32 void startPeriodicTimer() { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 57 ); | 55 ); |
| 58 } | 56 } |
| 59 , onCancel: () { | 57 , onCancel: () { |
| 60 if (timer != null) timer.cancel(); | 58 if (timer != null) timer.cancel(); |
| 61 timer = null; | 59 timer = null; |
| 62 } | 60 } |
| 63 ); | 61 ); |
| 64 return controller.stream; | 62 return controller.stream; |
| 65 } | 63 } |
| 66 factory Stream.eventTransformed(Stream source, EventSink mapSink(EventSink<T> s
ink)) { | 64 factory Stream.eventTransformed(Stream source, EventSink mapSink(EventSink<T> s
ink)) { |
| 67 return new _BoundSinkStream<dynamic, T>(source, DEVC$RT.cast(mapSink, DEVC$RT.
type((__t33<T> _) { | 65 return new _BoundSinkStream<dynamic, T>(source, DEVC$RT.cast(mapSink, DEVC$RT.
type((__t28<T> _) { |
| 68 } | 66 } |
| 69 ), __t31, "CompositeCast", """line 216, column 41 of dart:async/stream.dart: "
"", mapSink is __t31, false)); | 67 ), __t26, "CompositeCast", """line 216, column 41 of dart:async/stream.dart: "
"", mapSink is __t26, false)); |
| 70 } | 68 } |
| 71 bool get isBroadcast => false; | 69 bool get isBroadcast => false; |
| 72 Stream<T> asBroadcastStream({ | 70 Stream<T> asBroadcastStream({ |
| 73 void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscri
ption<T> subscription)} | 71 void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscri
ption<T> subscription)} |
| 74 ) { | 72 ) { |
| 75 return new _AsBroadcastStream<T>(this, DEVC$RT.cast(onListen, DEVC$RT.type((__
t37<T> _) { | 73 return new _AsBroadcastStream<T>(this, DEVC$RT.cast(onListen, DEVC$RT.type((__
t32<T> _) { |
| 76 } | 74 } |
| 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> _)
{ | 75 ), __t30, "CompositeCast", """line 248, column 44 of dart:async/stream.dart: "
"", onListen is __t30, false), DEVC$RT.cast(onCancel, DEVC$RT.type((__t32<T> _)
{ |
| 78 } | 76 } |
| 79 ), __t35, "CompositeCast", """line 248, column 54 of dart:async/stream.dart: "
"", onCancel is __t35, false)); | 77 ), __t30, "CompositeCast", """line 248, column 54 of dart:async/stream.dart: "
"", onCancel is __t30, false)); |
| 80 } | 78 } |
| 81 StreamSubscription<T> listen(void onData(T event), { | 79 StreamSubscription<T> listen(void onData(T event), { |
| 82 Function onError, void onDone(), bool cancelOnError} | 80 Function onError, void onDone(), bool cancelOnError} |
| 83 ); | 81 ); |
| 84 Stream<T> where(bool test(T event)) { | 82 Stream<T> where(bool test(T event)) { |
| 85 return new _WhereStream<T>(this, test); | 83 return new _WhereStream<T>(this, test); |
| 86 } | 84 } |
| 87 Stream map(convert(T event)) { | 85 Stream map(convert(T event)) { |
| 88 return new _MapStream<T, dynamic>(this, convert); | 86 return new _MapStream<T, dynamic>(this, convert); |
| 89 } | 87 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 Future<T> reduce(T combine(T previous, T element)) { | 187 Future<T> reduce(T combine(T previous, T element)) { |
| 190 _Future<T> result = new _Future<T>(); | 188 _Future<T> result = new _Future<T>(); |
| 191 bool seenFirst = false; | 189 bool seenFirst = false; |
| 192 T value; | 190 T value; |
| 193 StreamSubscription subscription; | 191 StreamSubscription subscription; |
| 194 subscription = this.listen((T element) { | 192 subscription = this.listen((T element) { |
| 195 if (seenFirst) { | 193 if (seenFirst) { |
| 196 _runUserCode(() => combine(value, element), (T newValue) { | 194 _runUserCode(() => combine(value, element), (T newValue) { |
| 197 value = newValue; | 195 value = newValue; |
| 198 } | 196 } |
| 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))); | 197 , ((__x37) => DEVC$RT.cast(__x37, dynamic, __t34, "CompositeCast", """line
501, column 24 of dart:async/stream.dart: """, __x37 is __t34, false))(_cancelA
ndErrorClosure(subscription, result))); |
| 200 } | 198 } |
| 201 else { | 199 else { |
| 202 value = element; | 200 value = element; |
| 203 seenFirst = true; | 201 seenFirst = true; |
| 204 } | 202 } |
| 205 } | 203 } |
| 206 , onError: result._completeError, onDone: () { | 204 , onError: result._completeError, onDone: () { |
| 207 if (!seenFirst) { | 205 if (!seenFirst) { |
| 208 try { | 206 try { |
| 209 throw IterableElementError.noElement(); | 207 throw IterableElementError.noElement(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 220 return result; | 218 return result; |
| 221 } | 219 } |
| 222 Future fold(var initialValue, combine(var previous, T element)) { | 220 Future fold(var initialValue, combine(var previous, T element)) { |
| 223 _Future result = new _Future(); | 221 _Future result = new _Future(); |
| 224 var value = initialValue; | 222 var value = initialValue; |
| 225 StreamSubscription subscription; | 223 StreamSubscription subscription; |
| 226 subscription = this.listen((T element) { | 224 subscription = this.listen((T element) { |
| 227 _runUserCode(() => combine(value, element), (newValue) { | 225 _runUserCode(() => combine(value, element), (newValue) { |
| 228 value = newValue; | 226 value = newValue; |
| 229 } | 227 } |
| 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))); | 228 , ((__x38) => DEVC$RT.cast(__x38, dynamic, __t34, "CompositeCast", """line 5
34, column 11 of dart:async/stream.dart: """, __x38 is __t34, false))(_cancelAnd
ErrorClosure(subscription, result))); |
| 231 } | 229 } |
| 232 , onError: (e, st) { | 230 , onError: (e, st) { |
| 233 result._completeError(e, DEVC$RT.cast(st, dynamic, StackTrace, "DynamicCast"
, """line 538, column 34 of dart:async/stream.dart: """, st is StackTrace, true)
); | 231 result._completeError(e, DEVC$RT.cast(st, dynamic, StackTrace, "DynamicCast"
, """line 538, column 34 of dart:async/stream.dart: """, st is StackTrace, true)
); |
| 234 } | 232 } |
| 235 , onDone: () { | 233 , onDone: () { |
| 236 result._complete(value); | 234 result._complete(value); |
| 237 } | 235 } |
| 238 , cancelOnError: true); | 236 , cancelOnError: true); |
| 239 return result; | 237 return result; |
| 240 } | 238 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 266 } | 264 } |
| 267 Future<bool> contains(Object needle) { | 265 Future<bool> contains(Object needle) { |
| 268 _Future<bool> future = new _Future<bool>(); | 266 _Future<bool> future = new _Future<bool>(); |
| 269 StreamSubscription subscription; | 267 StreamSubscription subscription; |
| 270 subscription = this.listen((T element) { | 268 subscription = this.listen((T element) { |
| 271 _runUserCode(() => (element == needle), (bool isMatch) { | 269 _runUserCode(() => (element == needle), (bool isMatch) { |
| 272 if (isMatch) { | 270 if (isMatch) { |
| 273 _cancelAndValue(subscription, future, true); | 271 _cancelAndValue(subscription, future, true); |
| 274 } | 272 } |
| 275 } | 273 } |
| 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))); | 274 , ((__x39) => DEVC$RT.cast(__x39, dynamic, __t34, "CompositeCast", """line 6
02, column 13 of dart:async/stream.dart: """, __x39 is __t34, false))(_cancelAnd
ErrorClosure(subscription, future))); |
| 277 } | 275 } |
| 278 , onError: future._completeError, onDone: () { | 276 , onError: future._completeError, onDone: () { |
| 279 future._complete(false); | 277 future._complete(false); |
| 280 } | 278 } |
| 281 , cancelOnError: true); | 279 , cancelOnError: true); |
| 282 return future; | 280 return future; |
| 283 } | 281 } |
| 284 Future forEach(void action(T element)) { | 282 Future forEach(void action(T element)) { |
| 285 _Future future = new _Future(); | 283 _Future future = new _Future(); |
| 286 StreamSubscription subscription; | 284 StreamSubscription subscription; |
| 287 subscription = this.listen((T element) { | 285 subscription = this.listen((T element) { |
| 288 _runUserCode(() => action(element), (_) { | 286 _runUserCode(() => action(element), (_) { |
| 289 } | 287 } |
| 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))); | 288 , ((__x40) => DEVC$RT.cast(__x40, dynamic, __t34, "CompositeCast", """line 6
28, column 13 of dart:async/stream.dart: """, __x40 is __t34, false))(_cancelAnd
ErrorClosure(subscription, future))); |
| 291 } | 289 } |
| 292 , onError: future._completeError, onDone: () { | 290 , onError: future._completeError, onDone: () { |
| 293 future._complete(null); | 291 future._complete(null); |
| 294 } | 292 } |
| 295 , cancelOnError: true); | 293 , cancelOnError: true); |
| 296 return future; | 294 return future; |
| 297 } | 295 } |
| 298 Future<bool> every(bool test(T element)) { | 296 Future<bool> every(bool test(T element)) { |
| 299 _Future<bool> future = new _Future<bool>(); | 297 _Future<bool> future = new _Future<bool>(); |
| 300 StreamSubscription subscription; | 298 StreamSubscription subscription; |
| 301 subscription = this.listen((T element) { | 299 subscription = this.listen((T element) { |
| 302 _runUserCode(() => test(element), (bool isMatch) { | 300 _runUserCode(() => test(element), (bool isMatch) { |
| 303 if (!isMatch) { | 301 if (!isMatch) { |
| 304 _cancelAndValue(subscription, future, false); | 302 _cancelAndValue(subscription, future, false); |
| 305 } | 303 } |
| 306 } | 304 } |
| 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))); | 305 , ((__x41) => DEVC$RT.cast(__x41, dynamic, __t34, "CompositeCast", """line 6
57, column 13 of dart:async/stream.dart: """, __x41 is __t34, false))(_cancelAnd
ErrorClosure(subscription, future))); |
| 308 } | 306 } |
| 309 , onError: future._completeError, onDone: () { | 307 , onError: future._completeError, onDone: () { |
| 310 future._complete(true); | 308 future._complete(true); |
| 311 } | 309 } |
| 312 , cancelOnError: true); | 310 , cancelOnError: true); |
| 313 return future; | 311 return future; |
| 314 } | 312 } |
| 315 Future<bool> any(bool test(T element)) { | 313 Future<bool> any(bool test(T element)) { |
| 316 _Future<bool> future = new _Future<bool>(); | 314 _Future<bool> future = new _Future<bool>(); |
| 317 StreamSubscription subscription; | 315 StreamSubscription subscription; |
| 318 subscription = this.listen((T element) { | 316 subscription = this.listen((T element) { |
| 319 _runUserCode(() => test(element), (bool isMatch) { | 317 _runUserCode(() => test(element), (bool isMatch) { |
| 320 if (isMatch) { | 318 if (isMatch) { |
| 321 _cancelAndValue(subscription, future, true); | 319 _cancelAndValue(subscription, future, true); |
| 322 } | 320 } |
| 323 } | 321 } |
| 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))); | 322 , ((__x42) => DEVC$RT.cast(__x42, dynamic, __t34, "CompositeCast", """line 6
94, column 13 of dart:async/stream.dart: """, __x42 is __t34, false))(_cancelAnd
ErrorClosure(subscription, future))); |
| 325 } | 323 } |
| 326 , onError: future._completeError, onDone: () { | 324 , onError: future._completeError, onDone: () { |
| 327 future._complete(false); | 325 future._complete(false); |
| 328 } | 326 } |
| 329 , cancelOnError: true); | 327 , cancelOnError: true); |
| 330 return future; | 328 return future; |
| 331 } | 329 } |
| 332 Future<int> get length { | 330 Future<int> get length { |
| 333 _Future<int> future = new _Future<int>(); | 331 _Future<int> future = new _Future<int>(); |
| 334 int count = 0; | 332 int count = 0; |
| 335 this.listen(((__x50) => DEVC$RT.cast(__x50, __t23, DEVC$RT.type((__t48<T> _)
{ | 333 this.listen((_) { |
| 336 } | |
| 337 ), "InferableClosure", """line 711, column 7 of dart:async/stream.dart: """, _
_x50 is __t48<T>, false))((_) { | |
| 338 count++; | 334 count++; |
| 339 } | 335 } |
| 340 ), onError: future._completeError, onDone: () { | 336 , onError: future._completeError, onDone: () { |
| 341 future._complete(count); | 337 future._complete(count); |
| 342 } | 338 } |
| 343 , cancelOnError: true); | 339 , cancelOnError: true); |
| 344 return future; | 340 return future; |
| 345 } | 341 } |
| 346 Future<bool> get isEmpty { | 342 Future<bool> get isEmpty { |
| 347 _Future<bool> future = new _Future<bool>(); | 343 _Future<bool> future = new _Future<bool>(); |
| 348 StreamSubscription subscription; | 344 StreamSubscription subscription; |
| 349 subscription = this.listen(((__x51) => DEVC$RT.cast(__x51, __t23, DEVC$RT.typ
e((__t48<T> _) { | 345 subscription = this.listen((_) { |
| 350 } | |
| 351 ), "InferableClosure", """line 733, column 7 of dart:async/stream.dart: """, _
_x51 is __t48<T>, false))((_) { | |
| 352 _cancelAndValue(subscription, future, false); | 346 _cancelAndValue(subscription, future, false); |
| 353 } | 347 } |
| 354 ), onError: future._completeError, onDone: () { | 348 , onError: future._completeError, onDone: () { |
| 355 future._complete(true); | 349 future._complete(true); |
| 356 } | 350 } |
| 357 , cancelOnError: true); | 351 , cancelOnError: true); |
| 358 return future; | 352 return future; |
| 359 } | 353 } |
| 360 Future<List<T>> toList() { | 354 Future<List<T>> toList() { |
| 361 List<T> result = <T> []; | 355 List<T> result = <T> []; |
| 362 _Future<List<T>> future = new _Future<List<T>>(); | 356 _Future<List<T>> future = new _Future<List<T>>(); |
| 363 this.listen((T data) { | 357 this.listen((T data) { |
| 364 result.add(data); | 358 result.add(data); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 Object defaultValue()} | 466 Object defaultValue()} |
| 473 ) { | 467 ) { |
| 474 _Future<dynamic> future = new _Future(); | 468 _Future<dynamic> future = new _Future(); |
| 475 StreamSubscription subscription; | 469 StreamSubscription subscription; |
| 476 subscription = this.listen((T value) { | 470 subscription = this.listen((T value) { |
| 477 _runUserCode(() => test(value), (bool isMatch) { | 471 _runUserCode(() => test(value), (bool isMatch) { |
| 478 if (isMatch) { | 472 if (isMatch) { |
| 479 _cancelAndValue(subscription, future, value); | 473 _cancelAndValue(subscription, future, value); |
| 480 } | 474 } |
| 481 } | 475 } |
| 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))); | 476 , ((__x43) => DEVC$RT.cast(__x43, dynamic, __t34, "CompositeCast", """line 1
036, column 11 of dart:async/stream.dart: """, __x43 is __t34, false))(_cancelAn
dErrorClosure(subscription, future))); |
| 483 } | 477 } |
| 484 , onError: future._completeError, onDone: () { | 478 , onError: future._completeError, onDone: () { |
| 485 if (defaultValue != null) { | 479 if (defaultValue != null) { |
| 486 _runUserCode(defaultValue, future._complete, future._completeError); | 480 _runUserCode(defaultValue, future._complete, future._completeError); |
| 487 return;} | 481 return;} |
| 488 try { | 482 try { |
| 489 throw IterableElementError.noElement(); | 483 throw IterableElementError.noElement(); |
| 490 } | 484 } |
| 491 catch (e, s) { | 485 catch (e, s) { |
| 492 _completeWithErrorCallback(future, e, s); | 486 _completeWithErrorCallback(future, e, s); |
| 493 } | 487 } |
| 494 } | 488 } |
| 495 , cancelOnError: true); | 489 , cancelOnError: true); |
| 496 return future; | 490 return future; |
| 497 } | 491 } |
| 498 Future<dynamic> lastWhere(bool test(T element), { | 492 Future<dynamic> lastWhere(bool test(T element), { |
| 499 Object defaultValue()} | 493 Object defaultValue()} |
| 500 ) { | 494 ) { |
| 501 _Future<dynamic> future = new _Future(); | 495 _Future<dynamic> future = new _Future(); |
| 502 T result = null; | 496 T result = null; |
| 503 bool foundResult = false; | 497 bool foundResult = false; |
| 504 StreamSubscription subscription; | 498 StreamSubscription subscription; |
| 505 subscription = this.listen((T value) { | 499 subscription = this.listen((T value) { |
| 506 _runUserCode(() => true == test(value), (bool isMatch) { | 500 _runUserCode(() => true == test(value), (bool isMatch) { |
| 507 if (isMatch) { | 501 if (isMatch) { |
| 508 foundResult = true; | 502 foundResult = true; |
| 509 result = value; | 503 result = value; |
| 510 } | 504 } |
| 511 } | 505 } |
| 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))); | 506 , ((__x44) => DEVC$RT.cast(__x44, dynamic, __t34, "CompositeCast", """line 1
077, column 11 of dart:async/stream.dart: """, __x44 is __t34, false))(_cancelAn
dErrorClosure(subscription, future))); |
| 513 } | 507 } |
| 514 , onError: future._completeError, onDone: () { | 508 , onError: future._completeError, onDone: () { |
| 515 if (foundResult) { | 509 if (foundResult) { |
| 516 future._complete(result); | 510 future._complete(result); |
| 517 return;} | 511 return;} |
| 518 if (defaultValue != null) { | 512 if (defaultValue != null) { |
| 519 _runUserCode(defaultValue, future._complete, future._completeError); | 513 _runUserCode(defaultValue, future._complete, future._completeError); |
| 520 return;} | 514 return;} |
| 521 try { | 515 try { |
| 522 throw IterableElementError.noElement(); | 516 throw IterableElementError.noElement(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 541 throw IterableElementError.tooMany(); | 535 throw IterableElementError.tooMany(); |
| 542 } | 536 } |
| 543 catch (e, s) { | 537 catch (e, s) { |
| 544 _cancelAndErrorWithReplacement(subscription, future, e, s); | 538 _cancelAndErrorWithReplacement(subscription, future, e, s); |
| 545 } | 539 } |
| 546 return;} | 540 return;} |
| 547 foundResult = true; | 541 foundResult = true; |
| 548 result = value; | 542 result = value; |
| 549 } | 543 } |
| 550 } | 544 } |
| 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))); | 545 , ((__x45) => DEVC$RT.cast(__x45, dynamic, __t34, "CompositeCast", """line 1
129, column 11 of dart:async/stream.dart: """, __x45 is __t34, false))(_cancelAn
dErrorClosure(subscription, future))); |
| 552 } | 546 } |
| 553 , onError: future._completeError, onDone: () { | 547 , onError: future._completeError, onDone: () { |
| 554 if (foundResult) { | 548 if (foundResult) { |
| 555 future._complete(result); | 549 future._complete(result); |
| 556 return;} | 550 return;} |
| 557 try { | 551 try { |
| 558 throw IterableElementError.noElement(); | 552 throw IterableElementError.noElement(); |
| 559 } | 553 } |
| 560 catch (e, s) { | 554 catch (e, s) { |
| 561 _completeWithErrorCallback(future, e, s); | 555 _completeWithErrorCallback(future, e, s); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 585 void onTimeout(EventSink sink)} | 579 void onTimeout(EventSink sink)} |
| 586 ) { | 580 ) { |
| 587 StreamController controller; | 581 StreamController controller; |
| 588 StreamSubscription<T> subscription; | 582 StreamSubscription<T> subscription; |
| 589 Timer timer; | 583 Timer timer; |
| 590 Zone zone; | 584 Zone zone; |
| 591 Function timeout; | 585 Function timeout; |
| 592 void onData(T event) { | 586 void onData(T event) { |
| 593 timer.cancel(); | 587 timer.cancel(); |
| 594 controller.add(event); | 588 controller.add(event); |
| 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)); | 589 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t46,
"CompositeCast", """line 1219, column 43 of dart:async/stream.dart: """, timeout
is __t46, false)); |
| 596 } | 590 } |
| 597 void onError(error, StackTrace stackTrace) { | 591 void onError(error, StackTrace stackTrace) { |
| 598 timer.cancel(); | 592 timer.cancel(); |
| 599 assert (controller is _StreamController || controller is _BroadcastStreamCo
ntroller); var eventSink = controller; | 593 assert (controller is _StreamController || controller is _BroadcastStreamCo
ntroller); var eventSink = controller; |
| 600 eventSink._addError(error, stackTrace); | 594 eventSink._addError(error, stackTrace); |
| 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)); | 595 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t46,
"CompositeCast", """line 1227, column 43 of dart:async/stream.dart: """, timeout
is __t46, false)); |
| 602 } | 596 } |
| 603 void onDone() { | 597 void onDone() { |
| 604 timer.cancel(); | 598 timer.cancel(); |
| 605 controller.close(); | 599 controller.close(); |
| 606 } | 600 } |
| 607 void onListen() { | 601 void onListen() { |
| 608 zone = Zone.current; | 602 zone = Zone.current; |
| 609 if (onTimeout == null) { | 603 if (onTimeout == null) { |
| 610 timeout = () { | 604 timeout = () { |
| 611 controller.addError(new TimeoutException("No stream event", timeLimit),
null); | 605 controller.addError(new TimeoutException("No stream event", timeLimit),
null); |
| 612 } | 606 } |
| 613 ; | 607 ; |
| 614 } | 608 } |
| 615 else { | 609 else { |
| 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)); | 610 onTimeout = ((__x51) => DEVC$RT.cast(__x51, __t49, __t47, "CompositeCast",
"""line 1245, column 21 of dart:async/stream.dart: """, __x51 is __t47, false))
(zone.registerUnaryCallback(onTimeout)); |
| 617 _ControllerEventSinkWrapper wrapper = new _ControllerEventSinkWrapper(nul
l); | 611 _ControllerEventSinkWrapper wrapper = new _ControllerEventSinkWrapper(nul
l); |
| 618 timeout = () { | 612 timeout = () { |
| 619 wrapper._sink = controller; | 613 wrapper._sink = controller; |
| 620 zone.runUnaryGuarded(onTimeout, wrapper); | 614 zone.runUnaryGuarded(onTimeout, wrapper); |
| 621 wrapper._sink = null; | 615 wrapper._sink = null; |
| 622 } | 616 } |
| 623 ; | 617 ; |
| 624 } | 618 } |
| 625 subscription = this.listen(onData, onError: onError, onDone: onDone); | 619 subscription = this.listen(onData, onError: onError, onDone: onDone); |
| 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)); | 620 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t46,
"CompositeCast", """line 1256, column 43 of dart:async/stream.dart: """, timeout
is __t46, false)); |
| 627 } | 621 } |
| 628 Future onCancel() { | 622 Future onCancel() { |
| 629 timer.cancel(); | 623 timer.cancel(); |
| 630 Future result = subscription.cancel(); | 624 Future result = subscription.cancel(); |
| 631 subscription = null; | 625 subscription = null; |
| 632 return result; | 626 return result; |
| 633 } | 627 } |
| 634 controller = isBroadcast ? new _SyncBroadcastStreamController(onListen, onCan
cel) : new _SyncStreamController(onListen, () { | 628 controller = isBroadcast ? new _SyncBroadcastStreamController(onListen, onCan
cel) : new _SyncStreamController(onListen, () { |
| 635 timer.cancel(); | 629 timer.cancel(); |
| 636 subscription.pause(); | 630 subscription.pause(); |
| 637 } | 631 } |
| 638 , () { | 632 , () { |
| 639 subscription.resume(); | 633 subscription.resume(); |
| 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)); | 634 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t46,
"CompositeCast", """line 1275, column 53 of dart:async/stream.dart: """, timeout
is __t46, false)); |
| 641 } | 635 } |
| 642 , onCancel); | 636 , onCancel); |
| 643 return controller.stream; | 637 return controller.stream; |
| 644 } | 638 } |
| 645 } | 639 } |
| 646 abstract class StreamSubscription<T> {Future cancel(); | 640 abstract class StreamSubscription<T> {Future cancel(); |
| 647 void onData(void handleData(T data)); | 641 void onData(void handleData(T data)); |
| 648 void onError(Function handleError); | 642 void onError(Function handleError); |
| 649 void onDone(void handleDone()); | 643 void onDone(void handleDone()); |
| 650 void pause([Future resumeSignal]); | 644 void pause([Future resumeSignal]); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 void add(T data) { | 684 void add(T data) { |
| 691 _sink.add(data); | 685 _sink.add(data); |
| 692 } | 686 } |
| 693 void addError(error, [StackTrace stackTrace]) { | 687 void addError(error, [StackTrace stackTrace]) { |
| 694 _sink.addError(error, stackTrace); | 688 _sink.addError(error, stackTrace); |
| 695 } | 689 } |
| 696 void close() { | 690 void close() { |
| 697 _sink.close(); | 691 _sink.close(); |
| 698 } | 692 } |
| 699 } | 693 } |
| 700 typedef dynamic __t21<T>(T __u22); | 694 typedef T __t21<T>(int __u22); |
| 701 typedef dynamic __t23(dynamic __u24); | 695 typedef dynamic __t23(dynamic __u24); |
| 702 typedef T __t26<T>(int __u27); | 696 typedef EventSink<dynamic> __t26(EventSink<dynamic> __u27); |
| 703 typedef dynamic __t28(dynamic __u29); | 697 typedef EventSink<dynamic> __t28<T>(EventSink<T> __u29); |
| 704 typedef EventSink<dynamic> __t31(EventSink<dynamic> __u32); | 698 typedef void __t30(StreamSubscription<dynamic> __u31); |
| 705 typedef EventSink<dynamic> __t33<T>(EventSink<T> __u34); | 699 typedef void __t32<T>(StreamSubscription<T> __u33); |
| 706 typedef void __t35(StreamSubscription<dynamic> __u36); | 700 typedef dynamic __t34(dynamic __u35, StackTrace __u36); |
| 707 typedef void __t37<T>(StreamSubscription<T> __u38); | 701 typedef void __t46(); |
| 708 typedef dynamic __t39(dynamic __u40, StackTrace __u41); | 702 typedef void __t47(EventSink<dynamic> __u48); |
| 709 typedef void __t48<T>(T __u49); | 703 typedef dynamic __t49(dynamic __u50); |
| 710 typedef void __t55(); | |
| 711 typedef void __t56(EventSink<dynamic> __u57); | |
| OLD | NEW |