| OLD | NEW |
| 1 var async; | 1 var async; |
| 2 (function(exports) { | 2 (function(exports) { |
| 3 'use strict'; | 3 'use strict'; |
| 4 // Function _invokeErrorHandler: (Function, Object, StackTrace) → dynamic | 4 // Function _invokeErrorHandler: (Function, Object, StackTrace) → dynamic |
| 5 function _invokeErrorHandler(errorHandler, error, stackTrace) { | 5 function _invokeErrorHandler(errorHandler, error, stackTrace) { |
| 6 if (dart.is(errorHandler, ZoneBinaryCallback)) { | 6 if (dart.is(errorHandler, ZoneBinaryCallback)) { |
| 7 return dart.dinvokef(errorHandler, error, stackTrace); | 7 return dart.dinvokef(errorHandler, error, stackTrace); |
| 8 } else { | 8 } else { |
| 9 return dart.dinvokef(errorHandler, error); | 9 return dart.dinvokef(errorHandler, error); |
| 10 } | 10 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 let _onListen = Symbol('_onListen'); | 53 let _onListen = Symbol('_onListen'); |
| 54 let _addError = Symbol('_addError'); | 54 let _addError = Symbol('_addError'); |
| 55 let _completeError = Symbol('_completeError'); | 55 let _completeError = Symbol('_completeError'); |
| 56 let _complete = Symbol('_complete'); | 56 let _complete = Symbol('_complete'); |
| 57 let _sink = Symbol('_sink'); | 57 let _sink = Symbol('_sink'); |
| 58 let Stream$ = dart.generic(function(T) { | 58 let Stream$ = dart.generic(function(T) { |
| 59 class Stream extends core.Object { | 59 class Stream extends core.Object { |
| 60 Stream() { | 60 Stream() { |
| 61 } | 61 } |
| 62 fromFuture(future) { | 62 fromFuture(future) { |
| 63 let controller = dart.as(new StreamController({sync: true}), _StreamCont
roller$(T)); | 63 let controller = dart.as(new (StreamController$(T))({sync: true}), _Stre
amController$(T)); |
| 64 future.then(dart.closureWrap(((value) => { | 64 future.then(dart.closureWrap(((value) => { |
| 65 controller._add(dart.as(value, T)); | 65 controller._add(dart.as(value, T)); |
| 66 controller._closeUnchecked(); | 66 controller._closeUnchecked(); |
| 67 }).bind(this), "(T) → dynamic"), {onError: ((error, stackTrace) => { | 67 }).bind(this), "(T) → dynamic"), {onError: ((error, stackTrace) => { |
| 68 controller._addError(error, dart.as(stackTrace, core.StackTrace)); | 68 controller._addError(error, dart.as(stackTrace, core.StackTrace)); |
| 69 controller._closeUnchecked(); | 69 controller._closeUnchecked(); |
| 70 }).bind(this)}); | 70 }).bind(this)}); |
| 71 return controller.stream; | 71 return controller.stream; |
| 72 } | 72 } |
| 73 fromIterable(data) { | 73 fromIterable(data) { |
| 74 return new _GeneratedStreamImpl(() => new _IterablePendingEvents(data)); | 74 return new (_GeneratedStreamImpl$(T))(() => new (_IterablePendingEvents$
(T))(data)); |
| 75 } | 75 } |
| 76 periodic(period, computation) { | 76 periodic(period, computation) { |
| 77 if (computation === void 0) | 77 if (computation === void 0) |
| 78 computation = null; | 78 computation = null; |
| 79 if (computation == null) | 79 if (computation == null) |
| 80 computation = dart.closureWrap((i) => null, "(int) → T"); | 80 computation = dart.closureWrap((i) => null, "(int) → T"); |
| 81 let timer = null; | 81 let timer = null; |
| 82 let computationCount = 0; | 82 let computationCount = 0; |
| 83 let controller = null; | 83 let controller = null; |
| 84 let watch = new core.Stopwatch(); | 84 let watch = new core.Stopwatch(); |
| 85 // Function sendEvent: () → void | 85 // Function sendEvent: () → void |
| 86 function sendEvent() { | 86 function sendEvent() { |
| 87 watch.reset(); | 87 watch.reset(); |
| 88 let data = computation(((x) => computationCount = dart.notNull(x) + 1,
x)(computationCount)); | 88 let data = computation(((x) => computationCount = dart.notNull(x) + 1,
x)(computationCount)); |
| 89 controller.add(data); | 89 controller.add(data); |
| 90 } | 90 } |
| 91 // Function startPeriodicTimer: () → void | 91 // Function startPeriodicTimer: () → void |
| 92 function startPeriodicTimer() { | 92 function startPeriodicTimer() { |
| 93 dart.assert(timer == null); | 93 dart.assert(timer == null); |
| 94 timer = new Timer.periodic(period, (timer) => { | 94 timer = new Timer.periodic(period, (timer) => { |
| 95 sendEvent(); | 95 sendEvent(); |
| 96 }); | 96 }); |
| 97 } | 97 } |
| 98 controller = new StreamController({sync: true, onListen: (() => { | 98 controller = new (StreamController$(T))({sync: true, onListen: (() => { |
| 99 watch.start(); | 99 watch.start(); |
| 100 startPeriodicTimer(); | 100 startPeriodicTimer(); |
| 101 }).bind(this), onPause: (() => { | 101 }).bind(this), onPause: (() => { |
| 102 timer.cancel(); | 102 timer.cancel(); |
| 103 timer = null; | 103 timer = null; |
| 104 watch.stop(); | 104 watch.stop(); |
| 105 }).bind(this), onResume: (() => { | 105 }).bind(this), onResume: (() => { |
| 106 dart.assert(timer == null); | 106 dart.assert(timer == null); |
| 107 let elapsed = watch.elapsed; | 107 let elapsed = watch.elapsed; |
| 108 watch.start(); | 108 watch.start(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 120 } | 120 } |
| 121 eventTransformed(source, mapSink) { | 121 eventTransformed(source, mapSink) { |
| 122 return dart.as(new _BoundSinkStream(source, dart.closureWrap(mapSink, "(
EventSink<dynamic>) → EventSink")), Stream$(T)); | 122 return dart.as(new _BoundSinkStream(source, dart.closureWrap(mapSink, "(
EventSink<dynamic>) → EventSink")), Stream$(T)); |
| 123 } | 123 } |
| 124 get isBroadcast() { | 124 get isBroadcast() { |
| 125 return false; | 125 return false; |
| 126 } | 126 } |
| 127 asBroadcastStream(opts) { | 127 asBroadcastStream(opts) { |
| 128 let onListen = opts && 'onListen' in opts ? opts.onListen : null; | 128 let onListen = opts && 'onListen' in opts ? opts.onListen : null; |
| 129 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; | 129 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; |
| 130 return new _AsBroadcastStream(this, dart.closureWrap(onListen, "(StreamS
ubscription<dynamic>) → void"), dart.closureWrap(onCancel, "(StreamSubscription<
dynamic>) → void")); | 130 return new (_AsBroadcastStream$(T))(this, dart.closureWrap(onListen, "(S
treamSubscription<dynamic>) → void"), dart.closureWrap(onCancel, "(StreamSubscri
ption<dynamic>) → void")); |
| 131 } | 131 } |
| 132 where(test) { | 132 where(test) { |
| 133 return new _WhereStream(this, test); | 133 return new (_WhereStream$(T))(this, test); |
| 134 } | 134 } |
| 135 map(convert) { | 135 map(convert) { |
| 136 return new _MapStream(this, convert); | 136 return new (_MapStream$(T, dynamic))(this, convert); |
| 137 } | 137 } |
| 138 asyncMap(convert) { | 138 asyncMap(convert) { |
| 139 let controller = null; | 139 let controller = null; |
| 140 let subscription = null; | 140 let subscription = null; |
| 141 // Function onListen: () → void | 141 // Function onListen: () → void |
| 142 function onListen() { | 142 function onListen() { |
| 143 let add = controller.add; | 143 let add = controller.add; |
| 144 dart.assert(dart.notNull(dart.is(controller, _StreamController)) || da
rt.notNull(dart.is(controller, _BroadcastStreamController))); | 144 dart.assert(dart.notNull(dart.is(controller, _StreamController)) || da
rt.notNull(dart.is(controller, _BroadcastStreamController))); |
| 145 let eventSink = controller; | 145 let eventSink = controller; |
| 146 let addError = eventSink[_addError]; | 146 let addError = eventSink[_addError]; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 }).bind(this), onResume: (() => { | 210 }).bind(this), onResume: (() => { |
| 211 subscription.resume(); | 211 subscription.resume(); |
| 212 }).bind(this), onCancel: (() => { | 212 }).bind(this), onCancel: (() => { |
| 213 subscription.cancel(); | 213 subscription.cancel(); |
| 214 }).bind(this), sync: true}); | 214 }).bind(this), sync: true}); |
| 215 } | 215 } |
| 216 return controller.stream; | 216 return controller.stream; |
| 217 } | 217 } |
| 218 handleError(onError, opts) { | 218 handleError(onError, opts) { |
| 219 let test = opts && 'test' in opts ? opts.test : null; | 219 let test = opts && 'test' in opts ? opts.test : null; |
| 220 return new _HandleErrorStream(this, onError, test); | 220 return new (_HandleErrorStream$(T))(this, onError, test); |
| 221 } | 221 } |
| 222 expand(convert) { | 222 expand(convert) { |
| 223 return new _ExpandStream(this, convert); | 223 return new (_ExpandStream$(T, dynamic))(this, convert); |
| 224 } | 224 } |
| 225 pipe(streamConsumer) { | 225 pipe(streamConsumer) { |
| 226 return streamConsumer.addStream(this).then(((_) => streamConsumer.close(
)).bind(this)); | 226 return streamConsumer.addStream(this).then(((_) => streamConsumer.close(
)).bind(this)); |
| 227 } | 227 } |
| 228 transform(streamTransformer) { | 228 transform(streamTransformer) { |
| 229 return streamTransformer.bind(this); | 229 return streamTransformer.bind(this); |
| 230 } | 230 } |
| 231 reduce(combine) { | 231 reduce(combine) { |
| 232 let result = new _Future(); | 232 let result = new (_Future$(T))(); |
| 233 let seenFirst = false; | 233 let seenFirst = false; |
| 234 let value = null; | 234 let value = null; |
| 235 let subscription = null; | 235 let subscription = null; |
| 236 subscription = this.listen((element) => { | 236 subscription = this.listen((element) => { |
| 237 if (seenFirst) { | 237 if (seenFirst) { |
| 238 _runUserCode(() => combine(value, element), (newValue) => { | 238 _runUserCode(() => combine(value, element), (newValue) => { |
| 239 value = newValue; | 239 value = newValue; |
| 240 }, dart.as(_cancelAndErrorClosure(subscription, result), dart.throw_
("Unimplemented type (dynamic, StackTrace) → dynamic"))); | 240 }, dart.as(_cancelAndErrorClosure(subscription, result), dart.throw_
("Unimplemented type (dynamic, StackTrace) → dynamic"))); |
| 241 } else { | 241 } else { |
| 242 value = element; | 242 value = element; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 268 }, {onError: ((e, st) => { | 268 }, {onError: ((e, st) => { |
| 269 result._completeError(e, dart.as(st, core.StackTrace)); | 269 result._completeError(e, dart.as(st, core.StackTrace)); |
| 270 }).bind(this), onDone: (() => { | 270 }).bind(this), onDone: (() => { |
| 271 result._complete(value); | 271 result._complete(value); |
| 272 }).bind(this), cancelOnError: true}); | 272 }).bind(this), cancelOnError: true}); |
| 273 return result; | 273 return result; |
| 274 } | 274 } |
| 275 join(separator) { | 275 join(separator) { |
| 276 if (separator === void 0) | 276 if (separator === void 0) |
| 277 separator = ""; | 277 separator = ""; |
| 278 let result = new _Future(); | 278 let result = new (_Future$(core.String))(); |
| 279 let buffer = new core.StringBuffer(); | 279 let buffer = new core.StringBuffer(); |
| 280 let subscription = null; | 280 let subscription = null; |
| 281 let first = true; | 281 let first = true; |
| 282 subscription = this.listen(((element) => { | 282 subscription = this.listen(((element) => { |
| 283 if (!dart.notNull(first)) { | 283 if (!dart.notNull(first)) { |
| 284 buffer.write(separator); | 284 buffer.write(separator); |
| 285 } | 285 } |
| 286 first = false; | 286 first = false; |
| 287 try { | 287 try { |
| 288 buffer.write(element); | 288 buffer.write(element); |
| 289 } catch (e) { | 289 } catch (e) { |
| 290 let s = dart.stackTrace(e); | 290 let s = dart.stackTrace(e); |
| 291 _cancelAndErrorWithReplacement(subscription, result, e, s); | 291 _cancelAndErrorWithReplacement(subscription, result, e, s); |
| 292 } | 292 } |
| 293 | 293 |
| 294 }).bind(this), {onError: ((e) => { | 294 }).bind(this), {onError: ((e) => { |
| 295 result._completeError(e); | 295 result._completeError(e); |
| 296 }).bind(this), onDone: (() => { | 296 }).bind(this), onDone: (() => { |
| 297 result._complete(buffer.toString()); | 297 result._complete(buffer.toString()); |
| 298 }).bind(this), cancelOnError: true}); | 298 }).bind(this), cancelOnError: true}); |
| 299 return result; | 299 return result; |
| 300 } | 300 } |
| 301 contains(needle) { | 301 contains(needle) { |
| 302 let future = new _Future(); | 302 let future = new (_Future$(core.bool))(); |
| 303 let subscription = null; | 303 let subscription = null; |
| 304 subscription = this.listen((element) => { | 304 subscription = this.listen((element) => { |
| 305 _runUserCode(() => dart.equals(element, needle), (isMatch) => { | 305 _runUserCode(() => dart.equals(element, needle), (isMatch) => { |
| 306 if (isMatch) { | 306 if (isMatch) { |
| 307 _cancelAndValue(subscription, future, true); | 307 _cancelAndValue(subscription, future, true); |
| 308 } | 308 } |
| 309 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_("
Unimplemented type (dynamic, StackTrace) → dynamic"))); | 309 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_("
Unimplemented type (dynamic, StackTrace) → dynamic"))); |
| 310 }, {onError: future[_completeError], onDone: (() => { | 310 }, {onError: future[_completeError], onDone: (() => { |
| 311 future._complete(false); | 311 future._complete(false); |
| 312 }).bind(this), cancelOnError: true}); | 312 }).bind(this), cancelOnError: true}); |
| 313 return future; | 313 return future; |
| 314 } | 314 } |
| 315 forEach(action) { | 315 forEach(action) { |
| 316 let future = new _Future(); | 316 let future = new _Future(); |
| 317 let subscription = null; | 317 let subscription = null; |
| 318 subscription = this.listen((element) => { | 318 subscription = this.listen((element) => { |
| 319 _runUserCode(() => action(element), (_) => { | 319 _runUserCode(() => action(element), (_) => { |
| 320 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_("
Unimplemented type (dynamic, StackTrace) → dynamic"))); | 320 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_("
Unimplemented type (dynamic, StackTrace) → dynamic"))); |
| 321 }, {onError: future[_completeError], onDone: (() => { | 321 }, {onError: future[_completeError], onDone: (() => { |
| 322 future._complete(null); | 322 future._complete(null); |
| 323 }).bind(this), cancelOnError: true}); | 323 }).bind(this), cancelOnError: true}); |
| 324 return future; | 324 return future; |
| 325 } | 325 } |
| 326 every(test) { | 326 every(test) { |
| 327 let future = new _Future(); | 327 let future = new (_Future$(core.bool))(); |
| 328 let subscription = null; | 328 let subscription = null; |
| 329 subscription = this.listen((element) => { | 329 subscription = this.listen((element) => { |
| 330 _runUserCode(() => test(element), (isMatch) => { | 330 _runUserCode(() => test(element), (isMatch) => { |
| 331 if (!dart.notNull(isMatch)) { | 331 if (!dart.notNull(isMatch)) { |
| 332 _cancelAndValue(subscription, future, false); | 332 _cancelAndValue(subscription, future, false); |
| 333 } | 333 } |
| 334 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_("
Unimplemented type (dynamic, StackTrace) → dynamic"))); | 334 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_("
Unimplemented type (dynamic, StackTrace) → dynamic"))); |
| 335 }, {onError: future[_completeError], onDone: (() => { | 335 }, {onError: future[_completeError], onDone: (() => { |
| 336 future._complete(true); | 336 future._complete(true); |
| 337 }).bind(this), cancelOnError: true}); | 337 }).bind(this), cancelOnError: true}); |
| 338 return future; | 338 return future; |
| 339 } | 339 } |
| 340 any(test) { | 340 any(test) { |
| 341 let future = new _Future(); | 341 let future = new (_Future$(core.bool))(); |
| 342 let subscription = null; | 342 let subscription = null; |
| 343 subscription = this.listen((element) => { | 343 subscription = this.listen((element) => { |
| 344 _runUserCode(() => test(element), (isMatch) => { | 344 _runUserCode(() => test(element), (isMatch) => { |
| 345 if (isMatch) { | 345 if (isMatch) { |
| 346 _cancelAndValue(subscription, future, true); | 346 _cancelAndValue(subscription, future, true); |
| 347 } | 347 } |
| 348 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_("
Unimplemented type (dynamic, StackTrace) → dynamic"))); | 348 }, dart.as(_cancelAndErrorClosure(subscription, future), dart.throw_("
Unimplemented type (dynamic, StackTrace) → dynamic"))); |
| 349 }, {onError: future[_completeError], onDone: (() => { | 349 }, {onError: future[_completeError], onDone: (() => { |
| 350 future._complete(false); | 350 future._complete(false); |
| 351 }).bind(this), cancelOnError: true}); | 351 }).bind(this), cancelOnError: true}); |
| 352 return future; | 352 return future; |
| 353 } | 353 } |
| 354 get length() { | 354 get length() { |
| 355 let future = new _Future(); | 355 let future = new (_Future$(core.int))(); |
| 356 let count = 0; | 356 let count = 0; |
| 357 this.listen(dart.closureWrap((_) => { | 357 this.listen(dart.closureWrap((_) => { |
| 358 count = dart.notNull(count) + 1; | 358 count = dart.notNull(count) + 1; |
| 359 }, "(T) → void"), {onError: future[_completeError], onDone: (() => { | 359 }, "(T) → void"), {onError: future[_completeError], onDone: (() => { |
| 360 future._complete(count); | 360 future._complete(count); |
| 361 }).bind(this), cancelOnError: true}); | 361 }).bind(this), cancelOnError: true}); |
| 362 return future; | 362 return future; |
| 363 } | 363 } |
| 364 get isEmpty() { | 364 get isEmpty() { |
| 365 let future = new _Future(); | 365 let future = new (_Future$(core.bool))(); |
| 366 let subscription = null; | 366 let subscription = null; |
| 367 subscription = this.listen(dart.closureWrap((_) => { | 367 subscription = this.listen(dart.closureWrap((_) => { |
| 368 _cancelAndValue(subscription, future, false); | 368 _cancelAndValue(subscription, future, false); |
| 369 }, "(T) → void"), {onError: future[_completeError], onDone: (() => { | 369 }, "(T) → void"), {onError: future[_completeError], onDone: (() => { |
| 370 future._complete(true); | 370 future._complete(true); |
| 371 }).bind(this), cancelOnError: true}); | 371 }).bind(this), cancelOnError: true}); |
| 372 return future; | 372 return future; |
| 373 } | 373 } |
| 374 toList() { | 374 toList() { |
| 375 let result = new core.List$(T).from([]); | 375 let result = new core.List$(T).from([]); |
| 376 let future = new _Future(); | 376 let future = new (_Future$(core.List$(T)))(); |
| 377 this.listen(((data) => { | 377 this.listen(((data) => { |
| 378 result.add(data); | 378 result.add(data); |
| 379 }).bind(this), {onError: future[_completeError], onDone: (() => { | 379 }).bind(this), {onError: future[_completeError], onDone: (() => { |
| 380 future._complete(result); | 380 future._complete(result); |
| 381 }).bind(this), cancelOnError: true}); | 381 }).bind(this), cancelOnError: true}); |
| 382 return future; | 382 return future; |
| 383 } | 383 } |
| 384 toSet() { | 384 toSet() { |
| 385 let result = new core.Set(); | 385 let result = new (core.Set$(T))(); |
| 386 let future = new _Future(); | 386 let future = new (_Future$(core.Set$(T)))(); |
| 387 this.listen(((data) => { | 387 this.listen(((data) => { |
| 388 result.add(data); | 388 result.add(data); |
| 389 }).bind(this), {onError: future[_completeError], onDone: (() => { | 389 }).bind(this), {onError: future[_completeError], onDone: (() => { |
| 390 future._complete(result); | 390 future._complete(result); |
| 391 }).bind(this), cancelOnError: true}); | 391 }).bind(this), cancelOnError: true}); |
| 392 return future; | 392 return future; |
| 393 } | 393 } |
| 394 drain(futureValue) { | 394 drain(futureValue) { |
| 395 if (futureValue === void 0) | 395 if (futureValue === void 0) |
| 396 futureValue = null; | 396 futureValue = null; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 407 } | 407 } |
| 408 skipWhile(test) { | 408 skipWhile(test) { |
| 409 return dart.as(new _SkipWhileStream(this, test), Stream$(T)); | 409 return dart.as(new _SkipWhileStream(this, test), Stream$(T)); |
| 410 } | 410 } |
| 411 distinct(equals) { | 411 distinct(equals) { |
| 412 if (equals === void 0) | 412 if (equals === void 0) |
| 413 equals = null; | 413 equals = null; |
| 414 return dart.as(new _DistinctStream(this, equals), Stream$(T)); | 414 return dart.as(new _DistinctStream(this, equals), Stream$(T)); |
| 415 } | 415 } |
| 416 get first() { | 416 get first() { |
| 417 let future = new _Future(); | 417 let future = new (_Future$(T))(); |
| 418 let subscription = null; | 418 let subscription = null; |
| 419 subscription = this.listen((value) => { | 419 subscription = this.listen((value) => { |
| 420 _cancelAndValue(subscription, future, value); | 420 _cancelAndValue(subscription, future, value); |
| 421 }, { | 421 }, { |
| 422 onError: future[_completeError], | 422 onError: future[_completeError], |
| 423 onDone: () => { | 423 onDone: () => { |
| 424 try { | 424 try { |
| 425 throw _internal.IterableElementError.noElement(); | 425 throw _internal.IterableElementError.noElement(); |
| 426 } catch (e) { | 426 } catch (e) { |
| 427 let s = dart.stackTrace(e); | 427 let s = dart.stackTrace(e); |
| 428 _completeWithErrorCallback(future, e, s); | 428 _completeWithErrorCallback(future, e, s); |
| 429 } | 429 } |
| 430 | 430 |
| 431 }, | 431 }, |
| 432 cancelOnError: true | 432 cancelOnError: true |
| 433 }); | 433 }); |
| 434 return future; | 434 return future; |
| 435 } | 435 } |
| 436 get last() { | 436 get last() { |
| 437 let future = new _Future(); | 437 let future = new (_Future$(T))(); |
| 438 let result = null; | 438 let result = null; |
| 439 let foundResult = false; | 439 let foundResult = false; |
| 440 let subscription = null; | 440 let subscription = null; |
| 441 subscription = this.listen((value) => { | 441 subscription = this.listen((value) => { |
| 442 foundResult = true; | 442 foundResult = true; |
| 443 result = value; | 443 result = value; |
| 444 }, {onError: future[_completeError], onDone: (() => { | 444 }, {onError: future[_completeError], onDone: (() => { |
| 445 if (foundResult) { | 445 if (foundResult) { |
| 446 future._complete(result); | 446 future._complete(result); |
| 447 return; | 447 return; |
| 448 } | 448 } |
| 449 try { | 449 try { |
| 450 throw _internal.IterableElementError.noElement(); | 450 throw _internal.IterableElementError.noElement(); |
| 451 } catch (e) { | 451 } catch (e) { |
| 452 let s = dart.stackTrace(e); | 452 let s = dart.stackTrace(e); |
| 453 _completeWithErrorCallback(future, e, s); | 453 _completeWithErrorCallback(future, e, s); |
| 454 } | 454 } |
| 455 | 455 |
| 456 }).bind(this), cancelOnError: true}); | 456 }).bind(this), cancelOnError: true}); |
| 457 return future; | 457 return future; |
| 458 } | 458 } |
| 459 get single() { | 459 get single() { |
| 460 let future = new _Future(); | 460 let future = new (_Future$(T))(); |
| 461 let result = null; | 461 let result = null; |
| 462 let foundResult = false; | 462 let foundResult = false; |
| 463 let subscription = null; | 463 let subscription = null; |
| 464 subscription = this.listen((value) => { | 464 subscription = this.listen((value) => { |
| 465 if (foundResult) { | 465 if (foundResult) { |
| 466 try { | 466 try { |
| 467 throw _internal.IterableElementError.tooMany(); | 467 throw _internal.IterableElementError.tooMany(); |
| 468 } catch (e) { | 468 } catch (e) { |
| 469 let s = dart.stackTrace(e); | 469 let s = dart.stackTrace(e); |
| 470 _cancelAndErrorWithReplacement(subscription, future, e, s); | 470 _cancelAndErrorWithReplacement(subscription, future, e, s); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 throw _internal.IterableElementError.noElement(); | 540 throw _internal.IterableElementError.noElement(); |
| 541 } catch (e) { | 541 } catch (e) { |
| 542 let s = dart.stackTrace(e); | 542 let s = dart.stackTrace(e); |
| 543 _completeWithErrorCallback(future, e, s); | 543 _completeWithErrorCallback(future, e, s); |
| 544 } | 544 } |
| 545 | 545 |
| 546 }).bind(this), cancelOnError: true}); | 546 }).bind(this), cancelOnError: true}); |
| 547 return future; | 547 return future; |
| 548 } | 548 } |
| 549 singleWhere(test) { | 549 singleWhere(test) { |
| 550 let future = new _Future(); | 550 let future = new (_Future$(T))(); |
| 551 let result = null; | 551 let result = null; |
| 552 let foundResult = false; | 552 let foundResult = false; |
| 553 let subscription = null; | 553 let subscription = null; |
| 554 subscription = this.listen((value) => { | 554 subscription = this.listen((value) => { |
| 555 _runUserCode(() => true == test(value), (isMatch) => { | 555 _runUserCode(() => true == test(value), (isMatch) => { |
| 556 if (isMatch) { | 556 if (isMatch) { |
| 557 if (foundResult) { | 557 if (foundResult) { |
| 558 try { | 558 try { |
| 559 throw _internal.IterableElementError.tooMany(); | 559 throw _internal.IterableElementError.tooMany(); |
| 560 } catch (e) { | 560 } catch (e) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 579 let s = dart.stackTrace(e); | 579 let s = dart.stackTrace(e); |
| 580 _completeWithErrorCallback(future, e, s); | 580 _completeWithErrorCallback(future, e, s); |
| 581 } | 581 } |
| 582 | 582 |
| 583 }).bind(this), cancelOnError: true}); | 583 }).bind(this), cancelOnError: true}); |
| 584 return future; | 584 return future; |
| 585 } | 585 } |
| 586 elementAt(index) { | 586 elementAt(index) { |
| 587 if (dart.notNull(!(typeof index == 'number')) || dart.notNull(index) < 0
) | 587 if (dart.notNull(!(typeof index == 'number')) || dart.notNull(index) < 0
) |
| 588 throw new core.ArgumentError(index); | 588 throw new core.ArgumentError(index); |
| 589 let future = new _Future(); | 589 let future = new (_Future$(T))(); |
| 590 let subscription = null; | 590 let subscription = null; |
| 591 let elementIndex = 0; | 591 let elementIndex = 0; |
| 592 subscription = this.listen((value) => { | 592 subscription = this.listen((value) => { |
| 593 if (index == elementIndex) { | 593 if (index == elementIndex) { |
| 594 _cancelAndValue(subscription, future, value); | 594 _cancelAndValue(subscription, future, value); |
| 595 return; | 595 return; |
| 596 } | 596 } |
| 597 elementIndex = 1; | 597 elementIndex = 1; |
| 598 }, {onError: future[_completeError], onDone: (() => { | 598 }, {onError: future[_completeError], onDone: (() => { |
| 599 future._completeError(new core.RangeError.index(index, this, "index"
, null, elementIndex)); | 599 future._completeError(new core.RangeError.index(index, this, "index"
, null, elementIndex)); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 listen(onData, opts) { | 674 listen(onData, opts) { |
| 675 let onError = opts && 'onError' in opts ? opts.onError : null; | 675 let onError = opts && 'onError' in opts ? opts.onError : null; |
| 676 let onDone = opts && 'onDone' in opts ? opts.onDone : null; | 676 let onDone = opts && 'onDone' in opts ? opts.onDone : null; |
| 677 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError
: null; | 677 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError
: null; |
| 678 cancelOnError = core.identical(true, cancelOnError); | 678 cancelOnError = core.identical(true, cancelOnError); |
| 679 let subscription = this[_createSubscription](onData, onError, onDone, ca
ncelOnError); | 679 let subscription = this[_createSubscription](onData, onError, onDone, ca
ncelOnError); |
| 680 this[_onListen](subscription); | 680 this[_onListen](subscription); |
| 681 return dart.as(subscription, StreamSubscription$(T)); | 681 return dart.as(subscription, StreamSubscription$(T)); |
| 682 } | 682 } |
| 683 [_createSubscription](onData, onError, onDone, cancelOnError) { | 683 [_createSubscription](onData, onError, onDone, cancelOnError) { |
| 684 return new _BufferingStreamSubscription(onData, onError, onDone, cancelO
nError); | 684 return new (_BufferingStreamSubscription$(T))(onData, onError, onDone, c
ancelOnError); |
| 685 } | 685 } |
| 686 [_onListen](subscription) {} | 686 [_onListen](subscription) {} |
| 687 } | 687 } |
| 688 return _StreamImpl; | 688 return _StreamImpl; |
| 689 }); | 689 }); |
| 690 let _StreamImpl = _StreamImpl$(dart.dynamic); | 690 let _StreamImpl = _StreamImpl$(dart.dynamic); |
| 691 let _ControllerStream$ = dart.generic(function(T) { | 691 let _ControllerStream$ = dart.generic(function(T) { |
| 692 class _ControllerStream extends _StreamImpl$(T) { | 692 class _ControllerStream extends _StreamImpl$(T) { |
| 693 _ControllerStream(controller$) { | 693 _ControllerStream(controller$) { |
| 694 this[_controller] = controller$; | 694 this[_controller] = controller$; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 cancel() { | 862 cancel() { |
| 863 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_WAIT_FO
R_CANCEL]); | 863 this[_state] = ~dart.notNull(_BufferingStreamSubscription[_STATE_WAIT_FO
R_CANCEL]); |
| 864 if (this[_isCanceled]) | 864 if (this[_isCanceled]) |
| 865 return this[_cancelFuture]; | 865 return this[_cancelFuture]; |
| 866 this[_cancel](); | 866 this[_cancel](); |
| 867 return this[_cancelFuture]; | 867 return this[_cancelFuture]; |
| 868 } | 868 } |
| 869 asFuture(futureValue) { | 869 asFuture(futureValue) { |
| 870 if (futureValue === void 0) | 870 if (futureValue === void 0) |
| 871 futureValue = null; | 871 futureValue = null; |
| 872 let result = new _Future(); | 872 let result = new (_Future$(T))(); |
| 873 this[_onDone] = (() => { | 873 this[_onDone] = (() => { |
| 874 result._complete(futureValue); | 874 result._complete(futureValue); |
| 875 }).bind(this); | 875 }).bind(this); |
| 876 this[_onError] = ((error, stackTrace) => { | 876 this[_onError] = ((error, stackTrace) => { |
| 877 this.cancel(); | 877 this.cancel(); |
| 878 result._completeError(error, dart.as(stackTrace, core.StackTrace)); | 878 result._completeError(error, dart.as(stackTrace, core.StackTrace)); |
| 879 }).bind(this); | 879 }).bind(this); |
| 880 return result; | 880 return result; |
| 881 } | 881 } |
| 882 get [_isInputPaused]() { | 882 get [_isInputPaused]() { |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 this[_onListen] = onListen$; | 1173 this[_onListen] = onListen$; |
| 1174 this[_onCancel] = onCancel$; | 1174 this[_onCancel] = onCancel$; |
| 1175 this[_state] = _BroadcastStreamController[_STATE_INITIAL]; | 1175 this[_state] = _BroadcastStreamController[_STATE_INITIAL]; |
| 1176 this[_next] = null; | 1176 this[_next] = null; |
| 1177 this[_previous] = null; | 1177 this[_previous] = null; |
| 1178 this[_addStreamState] = null; | 1178 this[_addStreamState] = null; |
| 1179 this[_doneFuture] = null; | 1179 this[_doneFuture] = null; |
| 1180 this[_next] = this[_previous] = this; | 1180 this[_next] = this[_previous] = this; |
| 1181 } | 1181 } |
| 1182 get stream() { | 1182 get stream() { |
| 1183 return new _BroadcastStream(this); | 1183 return new (_BroadcastStream$(T))(this); |
| 1184 } | 1184 } |
| 1185 get sink() { | 1185 get sink() { |
| 1186 return new _StreamSinkWrapper(this); | 1186 return new (_StreamSinkWrapper$(T))(this); |
| 1187 } | 1187 } |
| 1188 get isClosed() { | 1188 get isClosed() { |
| 1189 return (dart.notNull(this[_state]) & dart.notNull(_BroadcastStreamContro
ller[_STATE_CLOSED])) != 0; | 1189 return (dart.notNull(this[_state]) & dart.notNull(_BroadcastStreamContro
ller[_STATE_CLOSED])) != 0; |
| 1190 } | 1190 } |
| 1191 get isPaused() { | 1191 get isPaused() { |
| 1192 return false; | 1192 return false; |
| 1193 } | 1193 } |
| 1194 get hasListener() { | 1194 get hasListener() { |
| 1195 return !dart.notNull(this[_isEmpty]); | 1195 return !dart.notNull(this[_isEmpty]); |
| 1196 } | 1196 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 let previous = subscription[_previous]; | 1229 let previous = subscription[_previous]; |
| 1230 let next = subscription[_next]; | 1230 let next = subscription[_next]; |
| 1231 previous[_next] = next; | 1231 previous[_next] = next; |
| 1232 next[_previous] = previous; | 1232 next[_previous] = previous; |
| 1233 subscription[_next] = subscription[_previous] = subscription; | 1233 subscription[_next] = subscription[_previous] = subscription; |
| 1234 } | 1234 } |
| 1235 [_subscribe](onData, onError, onDone, cancelOnError) { | 1235 [_subscribe](onData, onError, onDone, cancelOnError) { |
| 1236 if (this.isClosed) { | 1236 if (this.isClosed) { |
| 1237 if (onDone == null) | 1237 if (onDone == null) |
| 1238 onDone = _nullDoneHandler; | 1238 onDone = _nullDoneHandler; |
| 1239 return new _DoneStreamSubscription(onDone); | 1239 return new (_DoneStreamSubscription$(T))(onDone); |
| 1240 } | 1240 } |
| 1241 let subscription = new _BroadcastSubscription(this, onData, onError, onD
one, cancelOnError); | 1241 let subscription = new (_BroadcastSubscription$(T))(this, onData, onErro
r, onDone, cancelOnError); |
| 1242 this[_addListener](dart.as(subscription, _BroadcastSubscription$(T))); | 1242 this[_addListener](dart.as(subscription, _BroadcastSubscription$(T))); |
| 1243 if (core.identical(this[_next], this[_previous])) { | 1243 if (core.identical(this[_next], this[_previous])) { |
| 1244 _runGuarded(this[_onListen]); | 1244 _runGuarded(this[_onListen]); |
| 1245 } | 1245 } |
| 1246 return dart.as(subscription, StreamSubscription$(T)); | 1246 return dart.as(subscription, StreamSubscription$(T)); |
| 1247 } | 1247 } |
| 1248 [_recordCancel](subscription) { | 1248 [_recordCancel](subscription) { |
| 1249 if (core.identical(subscription[_next], subscription)) | 1249 if (core.identical(subscription[_next], subscription)) |
| 1250 return null; | 1250 return null; |
| 1251 dart.assert(!dart.notNull(core.identical(subscription[_next], subscripti
on))); | 1251 dart.assert(!dart.notNull(core.identical(subscription[_next], subscripti
on))); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 return dart.notNull(this[_pending] != null) && !dart.notNull(this[_pendi
ng].isEmpty); | 1457 return dart.notNull(this[_pending] != null) && !dart.notNull(this[_pendi
ng].isEmpty); |
| 1458 } | 1458 } |
| 1459 [_addPendingEvent](event) { | 1459 [_addPendingEvent](event) { |
| 1460 if (this[_pending] == null) { | 1460 if (this[_pending] == null) { |
| 1461 this[_pending] = new _StreamImplEvents(); | 1461 this[_pending] = new _StreamImplEvents(); |
| 1462 } | 1462 } |
| 1463 this[_pending].add(event); | 1463 this[_pending].add(event); |
| 1464 } | 1464 } |
| 1465 add(data) { | 1465 add(data) { |
| 1466 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) { | 1466 if (!dart.notNull(this.isClosed) && dart.notNull(this[_isFiring])) { |
| 1467 this[_addPendingEvent](new _DelayedData(data)); | 1467 this[_addPendingEvent](new (_DelayedData$(T))(data)); |
| 1468 return; | 1468 return; |
| 1469 } | 1469 } |
| 1470 super.add(data); | 1470 super.add(data); |
| 1471 while (this[_hasPending]) { | 1471 while (this[_hasPending]) { |
| 1472 this[_pending].handleNext(this); | 1472 this[_pending].handleNext(this); |
| 1473 } | 1473 } |
| 1474 } | 1474 } |
| 1475 addError(error, stackTrace) { | 1475 addError(error, stackTrace) { |
| 1476 if (stackTrace === void 0) | 1476 if (stackTrace === void 0) |
| 1477 stackTrace = null; | 1477 stackTrace = null; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 this[_s] = s$; | 1564 this[_s] = s$; |
| 1565 } | 1565 } |
| 1566 toString() { | 1566 toString() { |
| 1567 return `DeferredLoadException: '${this[_s]}'`; | 1567 return `DeferredLoadException: '${this[_s]}'`; |
| 1568 } | 1568 } |
| 1569 } | 1569 } |
| 1570 DeferredLoadException[dart.implements] = () => [core.Exception]; | 1570 DeferredLoadException[dart.implements] = () => [core.Exception]; |
| 1571 let Future$ = dart.generic(function(T) { | 1571 let Future$ = dart.generic(function(T) { |
| 1572 class Future extends core.Object { | 1572 class Future extends core.Object { |
| 1573 Future(computation) { | 1573 Future(computation) { |
| 1574 let result = new _Future(); | 1574 let result = new (_Future$(T))(); |
| 1575 Timer.run((() => { | 1575 Timer.run((() => { |
| 1576 try { | 1576 try { |
| 1577 result._complete(computation()); | 1577 result._complete(computation()); |
| 1578 } catch (e) { | 1578 } catch (e) { |
| 1579 let s = dart.stackTrace(e); | 1579 let s = dart.stackTrace(e); |
| 1580 _completeWithErrorCallback(result, e, s); | 1580 _completeWithErrorCallback(result, e, s); |
| 1581 } | 1581 } |
| 1582 | 1582 |
| 1583 }).bind(this)); | 1583 }).bind(this)); |
| 1584 return dart.as(result, Future$(T)); | 1584 return dart.as(result, Future$(T)); |
| 1585 } | 1585 } |
| 1586 microtask(computation) { | 1586 microtask(computation) { |
| 1587 let result = new _Future(); | 1587 let result = new (_Future$(T))(); |
| 1588 scheduleMicrotask((() => { | 1588 scheduleMicrotask((() => { |
| 1589 try { | 1589 try { |
| 1590 result._complete(computation()); | 1590 result._complete(computation()); |
| 1591 } catch (e) { | 1591 } catch (e) { |
| 1592 let s = dart.stackTrace(e); | 1592 let s = dart.stackTrace(e); |
| 1593 _completeWithErrorCallback(result, e, s); | 1593 _completeWithErrorCallback(result, e, s); |
| 1594 } | 1594 } |
| 1595 | 1595 |
| 1596 }).bind(this)); | 1596 }).bind(this)); |
| 1597 return dart.as(result, Future$(T)); | 1597 return dart.as(result, Future$(T)); |
| 1598 } | 1598 } |
| 1599 sync(computation) { | 1599 sync(computation) { |
| 1600 try { | 1600 try { |
| 1601 let result = computation(); | 1601 let result = computation(); |
| 1602 return new Future.value(result); | 1602 return new Future$(T).value(result); |
| 1603 } catch (error) { | 1603 } catch (error) { |
| 1604 let stackTrace = dart.stackTrace(error); | 1604 let stackTrace = dart.stackTrace(error); |
| 1605 return new Future.error(error, stackTrace); | 1605 return new Future$(T).error(error, stackTrace); |
| 1606 } | 1606 } |
| 1607 | 1607 |
| 1608 } | 1608 } |
| 1609 value(value) { | 1609 value(value) { |
| 1610 if (value === void 0) | 1610 if (value === void 0) |
| 1611 value = null; | 1611 value = null; |
| 1612 return new _Future.immediate(value); | 1612 return new _Future$(T).immediate(value); |
| 1613 } | 1613 } |
| 1614 error(error, stackTrace) { | 1614 error(error, stackTrace) { |
| 1615 if (stackTrace === void 0) | 1615 if (stackTrace === void 0) |
| 1616 stackTrace = null; | 1616 stackTrace = null; |
| 1617 error = _nonNullError(error); | 1617 error = _nonNullError(error); |
| 1618 if (!dart.notNull(core.identical(Zone.current, _ROOT_ZONE))) { | 1618 if (!dart.notNull(core.identical(Zone.current, _ROOT_ZONE))) { |
| 1619 let replacement = Zone.current.errorCallback(error, stackTrace); | 1619 let replacement = Zone.current.errorCallback(error, stackTrace); |
| 1620 if (replacement != null) { | 1620 if (replacement != null) { |
| 1621 error = _nonNullError(replacement.error); | 1621 error = _nonNullError(replacement.error); |
| 1622 stackTrace = replacement.stackTrace; | 1622 stackTrace = replacement.stackTrace; |
| 1623 } | 1623 } |
| 1624 } | 1624 } |
| 1625 return new _Future.immediateError(error, stackTrace); | 1625 return new _Future$(T).immediateError(error, stackTrace); |
| 1626 } | 1626 } |
| 1627 delayed(duration, computation) { | 1627 delayed(duration, computation) { |
| 1628 if (computation === void 0) | 1628 if (computation === void 0) |
| 1629 computation = null; | 1629 computation = null; |
| 1630 let result = new _Future(); | 1630 let result = new (_Future$(T))(); |
| 1631 new Timer(duration, (() => { | 1631 new Timer(duration, (() => { |
| 1632 try { | 1632 try { |
| 1633 result._complete(computation == null ? null : computation()); | 1633 result._complete(computation == null ? null : computation()); |
| 1634 } catch (e) { | 1634 } catch (e) { |
| 1635 let s = dart.stackTrace(e); | 1635 let s = dart.stackTrace(e); |
| 1636 _completeWithErrorCallback(result, e, s); | 1636 _completeWithErrorCallback(result, e, s); |
| 1637 } | 1637 } |
| 1638 | 1638 |
| 1639 }).bind(this)); | 1639 }).bind(this)); |
| 1640 return dart.as(result, Future$(T)); | 1640 return dart.as(result, Future$(T)); |
| 1641 } | 1641 } |
| 1642 static wait(futures, opts) { | 1642 static wait(futures, opts) { |
| 1643 let eagerError = opts && 'eagerError' in opts ? opts.eagerError : false; | 1643 let eagerError = opts && 'eagerError' in opts ? opts.eagerError : false; |
| 1644 let cleanUp = opts && 'cleanUp' in opts ? opts.cleanUp : null; | 1644 let cleanUp = opts && 'cleanUp' in opts ? opts.cleanUp : null; |
| 1645 let result = new _Future(); | 1645 let result = new (_Future$(core.List))(); |
| 1646 let values = null; | 1646 let values = null; |
| 1647 let remaining = 0; | 1647 let remaining = 0; |
| 1648 let error = null; | 1648 let error = null; |
| 1649 let stackTrace = null; | 1649 let stackTrace = null; |
| 1650 // Function handleError: (dynamic, dynamic) → void | 1650 // Function handleError: (dynamic, dynamic) → void |
| 1651 function handleError(theError, theStackTrace) { | 1651 function handleError(theError, theStackTrace) { |
| 1652 remaining = dart.notNull(remaining) - 1; | 1652 remaining = dart.notNull(remaining) - 1; |
| 1653 if (values != null) { | 1653 if (values != null) { |
| 1654 if (cleanUp != null) { | 1654 if (cleanUp != null) { |
| 1655 for (let value of values) { | 1655 for (let value of values) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1746 result = `TimeoutException after ${this.duration}`; | 1746 result = `TimeoutException after ${this.duration}`; |
| 1747 if (this.message != null) | 1747 if (this.message != null) |
| 1748 result = `${result}: ${this.message}`; | 1748 result = `${result}: ${this.message}`; |
| 1749 return result; | 1749 return result; |
| 1750 } | 1750 } |
| 1751 } | 1751 } |
| 1752 TimeoutException[dart.implements] = () => [core.Exception]; | 1752 TimeoutException[dart.implements] = () => [core.Exception]; |
| 1753 let Completer$ = dart.generic(function(T) { | 1753 let Completer$ = dart.generic(function(T) { |
| 1754 class Completer extends core.Object { | 1754 class Completer extends core.Object { |
| 1755 Completer() { | 1755 Completer() { |
| 1756 return new _AsyncCompleter(); | 1756 return new (_AsyncCompleter$(T))(); |
| 1757 } | 1757 } |
| 1758 sync() { | 1758 sync() { |
| 1759 return new _SyncCompleter(); | 1759 return new (_SyncCompleter$(T))(); |
| 1760 } | 1760 } |
| 1761 } | 1761 } |
| 1762 dart.defineNamedConstructor(Completer, 'sync'); | 1762 dart.defineNamedConstructor(Completer, 'sync'); |
| 1763 return Completer; | 1763 return Completer; |
| 1764 }); | 1764 }); |
| 1765 let Completer = Completer$(dart.dynamic); | 1765 let Completer = Completer$(dart.dynamic); |
| 1766 // Function _completeWithErrorCallback: (_Future<dynamic>, dynamic, dynamic) →
void | 1766 // Function _completeWithErrorCallback: (_Future<dynamic>, dynamic, dynamic) →
void |
| 1767 function _completeWithErrorCallback(result, error, stackTrace) { | 1767 function _completeWithErrorCallback(result, error, stackTrace) { |
| 1768 let replacement = Zone.current.errorCallback(error, dart.as(stackTrace, core
.StackTrace)); | 1768 let replacement = Zone.current.errorCallback(error, dart.as(stackTrace, core
.StackTrace)); |
| 1769 if (replacement != null) { | 1769 if (replacement != null) { |
| 1770 error = _nonNullError(replacement.error); | 1770 error = _nonNullError(replacement.error); |
| 1771 stackTrace = replacement.stackTrace; | 1771 stackTrace = replacement.stackTrace; |
| 1772 } | 1772 } |
| 1773 result._completeError(error, dart.as(stackTrace, core.StackTrace)); | 1773 result._completeError(error, dart.as(stackTrace, core.StackTrace)); |
| 1774 } | 1774 } |
| 1775 // Function _nonNullError: (Object) → Object | 1775 // Function _nonNullError: (Object) → Object |
| 1776 function _nonNullError(error) { | 1776 function _nonNullError(error) { |
| 1777 return error != null ? error : new core.NullThrownError(); | 1777 return error != null ? error : new core.NullThrownError(); |
| 1778 } | 1778 } |
| 1779 let _Completer$ = dart.generic(function(T) { | 1779 let _Completer$ = dart.generic(function(T) { |
| 1780 class _Completer extends core.Object { | 1780 class _Completer extends core.Object { |
| 1781 _Completer() { | 1781 _Completer() { |
| 1782 this.future = new _Future(); | 1782 this.future = new (_Future$(T))(); |
| 1783 } | 1783 } |
| 1784 completeError(error, stackTrace) { | 1784 completeError(error, stackTrace) { |
| 1785 if (stackTrace === void 0) | 1785 if (stackTrace === void 0) |
| 1786 stackTrace = null; | 1786 stackTrace = null; |
| 1787 error = _nonNullError(error); | 1787 error = _nonNullError(error); |
| 1788 if (!dart.notNull(this.future[_mayComplete])) | 1788 if (!dart.notNull(this.future[_mayComplete])) |
| 1789 throw new core.StateError("Future already completed"); | 1789 throw new core.StateError("Future already completed"); |
| 1790 let replacement = Zone.current.errorCallback(error, stackTrace); | 1790 let replacement = Zone.current.errorCallback(error, stackTrace); |
| 1791 if (replacement != null) { | 1791 if (replacement != null) { |
| 1792 error = _nonNullError(replacement.error); | 1792 error = _nonNullError(replacement.error); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1997 let result = new _Future(); | 1997 let result = new _Future(); |
| 1998 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) { | 1998 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) { |
| 1999 onError = _registerErrorHandler(onError, result[_zone]); | 1999 onError = _registerErrorHandler(onError, result[_zone]); |
| 2000 if (test != null) | 2000 if (test != null) |
| 2001 test = dart.closureWrap(result[_zone].registerUnaryCallback(test), "
(dynamic) → bool"); | 2001 test = dart.closureWrap(result[_zone].registerUnaryCallback(test), "
(dynamic) → bool"); |
| 2002 } | 2002 } |
| 2003 this[_addListener](new _FutureListener.catchError(result, onError, test)
); | 2003 this[_addListener](new _FutureListener.catchError(result, onError, test)
); |
| 2004 return result; | 2004 return result; |
| 2005 } | 2005 } |
| 2006 whenComplete(action) { | 2006 whenComplete(action) { |
| 2007 let result = new _Future(); | 2007 let result = new (_Future$(T))(); |
| 2008 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) { | 2008 if (!dart.notNull(core.identical(result[_zone], _ROOT_ZONE))) { |
| 2009 action = result[_zone].registerCallback(action); | 2009 action = result[_zone].registerCallback(action); |
| 2010 } | 2010 } |
| 2011 this[_addListener](new _FutureListener.whenComplete(result, action)); | 2011 this[_addListener](new _FutureListener.whenComplete(result, action)); |
| 2012 return dart.as(result, Future$(T)); | 2012 return dart.as(result, Future$(T)); |
| 2013 } | 2013 } |
| 2014 asStream() { | 2014 asStream() { |
| 2015 return dart.as(new Stream.fromFuture(this), Stream$(T)); | 2015 return dart.as(new Stream.fromFuture(this), Stream$(T)); |
| 2016 } | 2016 } |
| 2017 [_markPendingCompletion]() { | 2017 [_markPendingCompletion]() { |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2560 return new _StreamHandlerTransformer(opts); | 2560 return new _StreamHandlerTransformer(opts); |
| 2561 } | 2561 } |
| 2562 } | 2562 } |
| 2563 dart.defineNamedConstructor(StreamTransformer, 'fromHandlers'); | 2563 dart.defineNamedConstructor(StreamTransformer, 'fromHandlers'); |
| 2564 return StreamTransformer; | 2564 return StreamTransformer; |
| 2565 }); | 2565 }); |
| 2566 let StreamTransformer = StreamTransformer$(dart.dynamic, dart.dynamic); | 2566 let StreamTransformer = StreamTransformer$(dart.dynamic, dart.dynamic); |
| 2567 let StreamIterator$ = dart.generic(function(T) { | 2567 let StreamIterator$ = dart.generic(function(T) { |
| 2568 class StreamIterator extends core.Object { | 2568 class StreamIterator extends core.Object { |
| 2569 StreamIterator(stream) { | 2569 StreamIterator(stream) { |
| 2570 return new _StreamIteratorImpl(stream); | 2570 return new (_StreamIteratorImpl$(T))(stream); |
| 2571 } | 2571 } |
| 2572 } | 2572 } |
| 2573 return StreamIterator; | 2573 return StreamIterator; |
| 2574 }); | 2574 }); |
| 2575 let StreamIterator = StreamIterator$(dart.dynamic); | 2575 let StreamIterator = StreamIterator$(dart.dynamic); |
| 2576 let _ControllerEventSinkWrapper$ = dart.generic(function(T) { | 2576 let _ControllerEventSinkWrapper$ = dart.generic(function(T) { |
| 2577 class _ControllerEventSinkWrapper extends core.Object { | 2577 class _ControllerEventSinkWrapper extends core.Object { |
| 2578 _ControllerEventSinkWrapper(sink$) { | 2578 _ControllerEventSinkWrapper(sink$) { |
| 2579 this[_sink] = sink$; | 2579 this[_sink] = sink$; |
| 2580 } | 2580 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2598 class StreamController extends core.Object { | 2598 class StreamController extends core.Object { |
| 2599 StreamController(opts) { | 2599 StreamController(opts) { |
| 2600 let onListen = opts && 'onListen' in opts ? opts.onListen : null; | 2600 let onListen = opts && 'onListen' in opts ? opts.onListen : null; |
| 2601 let onPause = opts && 'onPause' in opts ? opts.onPause : null; | 2601 let onPause = opts && 'onPause' in opts ? opts.onPause : null; |
| 2602 let onResume = opts && 'onResume' in opts ? opts.onResume : null; | 2602 let onResume = opts && 'onResume' in opts ? opts.onResume : null; |
| 2603 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; | 2603 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; |
| 2604 let sync = opts && 'sync' in opts ? opts.sync : false; | 2604 let sync = opts && 'sync' in opts ? opts.sync : false; |
| 2605 if (dart.notNull(onListen == null) && dart.notNull(onPause == null) && d
art.notNull(onResume == null) && dart.notNull(onCancel == null)) { | 2605 if (dart.notNull(onListen == null) && dart.notNull(onPause == null) && d
art.notNull(onResume == null) && dart.notNull(onCancel == null)) { |
| 2606 return dart.as(sync ? new _NoCallbackSyncStreamController() : new _NoC
allbackAsyncStreamController(), StreamController$(T)); | 2606 return dart.as(sync ? new _NoCallbackSyncStreamController() : new _NoC
allbackAsyncStreamController(), StreamController$(T)); |
| 2607 } | 2607 } |
| 2608 return sync ? new _SyncStreamController(onListen, onPause, onResume, onC
ancel) : new _AsyncStreamController(onListen, onPause, onResume, onCancel); | 2608 return sync ? new (_SyncStreamController$(T))(onListen, onPause, onResum
e, onCancel) : new (_AsyncStreamController$(T))(onListen, onPause, onResume, onC
ancel); |
| 2609 } | 2609 } |
| 2610 broadcast(opts) { | 2610 broadcast(opts) { |
| 2611 let onListen = opts && 'onListen' in opts ? opts.onListen : null; | 2611 let onListen = opts && 'onListen' in opts ? opts.onListen : null; |
| 2612 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; | 2612 let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; |
| 2613 let sync = opts && 'sync' in opts ? opts.sync : false; | 2613 let sync = opts && 'sync' in opts ? opts.sync : false; |
| 2614 return sync ? new _SyncBroadcastStreamController(onListen, onCancel) : n
ew _AsyncBroadcastStreamController(onListen, onCancel); | 2614 return sync ? new (_SyncBroadcastStreamController$(T))(onListen, onCance
l) : new (_AsyncBroadcastStreamController$(T))(onListen, onCancel); |
| 2615 } | 2615 } |
| 2616 } | 2616 } |
| 2617 StreamController[dart.implements] = () => [StreamSink$(T)]; | 2617 StreamController[dart.implements] = () => [StreamSink$(T)]; |
| 2618 dart.defineNamedConstructor(StreamController, 'broadcast'); | 2618 dart.defineNamedConstructor(StreamController, 'broadcast'); |
| 2619 return StreamController; | 2619 return StreamController; |
| 2620 }); | 2620 }); |
| 2621 let StreamController = StreamController$(dart.dynamic); | 2621 let StreamController = StreamController$(dart.dynamic); |
| 2622 let _StreamControllerLifecycle$ = dart.generic(function(T) { | 2622 let _StreamControllerLifecycle$ = dart.generic(function(T) { |
| 2623 class _StreamControllerLifecycle extends core.Object { | 2623 class _StreamControllerLifecycle extends core.Object { |
| 2624 [_recordPause](subscription) {} | 2624 [_recordPause](subscription) {} |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2644 class _StreamController extends core.Object { | 2644 class _StreamController extends core.Object { |
| 2645 _StreamController() { | 2645 _StreamController() { |
| 2646 this[_varData] = null; | 2646 this[_varData] = null; |
| 2647 this[_state] = _StreamController[_STATE_INITIAL]; | 2647 this[_state] = _StreamController[_STATE_INITIAL]; |
| 2648 this[_doneFuture] = null; | 2648 this[_doneFuture] = null; |
| 2649 } | 2649 } |
| 2650 get stream() { | 2650 get stream() { |
| 2651 return dart.as(new _ControllerStream(this), Stream$(T)); | 2651 return dart.as(new _ControllerStream(this), Stream$(T)); |
| 2652 } | 2652 } |
| 2653 get sink() { | 2653 get sink() { |
| 2654 return new _StreamSinkWrapper(this); | 2654 return new (_StreamSinkWrapper$(T))(this); |
| 2655 } | 2655 } |
| 2656 get [_isCanceled]() { | 2656 get [_isCanceled]() { |
| 2657 return (dart.notNull(this[_state]) & dart.notNull(_StreamController[_STA
TE_CANCELED])) != 0; | 2657 return (dart.notNull(this[_state]) & dart.notNull(_StreamController[_STA
TE_CANCELED])) != 0; |
| 2658 } | 2658 } |
| 2659 get hasListener() { | 2659 get hasListener() { |
| 2660 return (dart.notNull(this[_state]) & dart.notNull(_StreamController[_STA
TE_SUBSCRIBED])) != 0; | 2660 return (dart.notNull(this[_state]) & dart.notNull(_StreamController[_STA
TE_SUBSCRIBED])) != 0; |
| 2661 } | 2661 } |
| 2662 get [_isInitialState]() { | 2662 get [_isInitialState]() { |
| 2663 return (dart.notNull(this[_state]) & dart.notNull(_StreamController[_STA
TE_SUBSCRIPTION_MASK])) == _StreamController[_STATE_INITIAL]; | 2663 return (dart.notNull(this[_state]) & dart.notNull(_StreamController[_STA
TE_SUBSCRIPTION_MASK])) == _StreamController[_STATE_INITIAL]; |
| 2664 } | 2664 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2761 if (this.hasListener) { | 2761 if (this.hasListener) { |
| 2762 this[_sendDone](); | 2762 this[_sendDone](); |
| 2763 } else if (this[_isInitialState]) { | 2763 } else if (this[_isInitialState]) { |
| 2764 this[_ensurePendingEvents]().add(new _DelayedDone()); | 2764 this[_ensurePendingEvents]().add(new _DelayedDone()); |
| 2765 } | 2765 } |
| 2766 } | 2766 } |
| 2767 [_add](value) { | 2767 [_add](value) { |
| 2768 if (this.hasListener) { | 2768 if (this.hasListener) { |
| 2769 this[_sendData](value); | 2769 this[_sendData](value); |
| 2770 } else if (this[_isInitialState]) { | 2770 } else if (this[_isInitialState]) { |
| 2771 this[_ensurePendingEvents]().add(new _DelayedData(value)); | 2771 this[_ensurePendingEvents]().add(new (_DelayedData$(T))(value)); |
| 2772 } | 2772 } |
| 2773 } | 2773 } |
| 2774 [_addError](error, stackTrace) { | 2774 [_addError](error, stackTrace) { |
| 2775 if (this.hasListener) { | 2775 if (this.hasListener) { |
| 2776 this[_sendError](error, stackTrace); | 2776 this[_sendError](error, stackTrace); |
| 2777 } else if (this[_isInitialState]) { | 2777 } else if (this[_isInitialState]) { |
| 2778 this[_ensurePendingEvents]().add(new _DelayedError(error, stackTrace))
; | 2778 this[_ensurePendingEvents]().add(new _DelayedError(error, stackTrace))
; |
| 2779 } | 2779 } |
| 2780 } | 2780 } |
| 2781 [_close]() { | 2781 [_close]() { |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3339 let _AsBroadcastStream$ = dart.generic(function(T) { | 3339 let _AsBroadcastStream$ = dart.generic(function(T) { |
| 3340 class _AsBroadcastStream extends Stream$(T) { | 3340 class _AsBroadcastStream extends Stream$(T) { |
| 3341 _AsBroadcastStream(source$, onListenHandler, onCancelHandler) { | 3341 _AsBroadcastStream(source$, onListenHandler, onCancelHandler) { |
| 3342 this[_source] = source$; | 3342 this[_source] = source$; |
| 3343 this[_onListenHandler] = dart.closureWrap(Zone.current.registerUnaryCall
back(onListenHandler), "(StreamSubscription<dynamic>) → void"); | 3343 this[_onListenHandler] = dart.closureWrap(Zone.current.registerUnaryCall
back(onListenHandler), "(StreamSubscription<dynamic>) → void"); |
| 3344 this[_onCancelHandler] = dart.closureWrap(Zone.current.registerUnaryCall
back(onCancelHandler), "(StreamSubscription<dynamic>) → void"); | 3344 this[_onCancelHandler] = dart.closureWrap(Zone.current.registerUnaryCall
back(onCancelHandler), "(StreamSubscription<dynamic>) → void"); |
| 3345 this[_zone] = Zone.current; | 3345 this[_zone] = Zone.current; |
| 3346 this[_controller] = null; | 3346 this[_controller] = null; |
| 3347 this[_subscription] = null; | 3347 this[_subscription] = null; |
| 3348 super.Stream(); | 3348 super.Stream(); |
| 3349 this[_controller] = new _AsBroadcastStreamController(this[_onListen], th
is[_onCancel]); | 3349 this[_controller] = new (_AsBroadcastStreamController$(T))(this[_onListe
n], this[_onCancel]); |
| 3350 } | 3350 } |
| 3351 get isBroadcast() { | 3351 get isBroadcast() { |
| 3352 return true; | 3352 return true; |
| 3353 } | 3353 } |
| 3354 listen(onData, opts) { | 3354 listen(onData, opts) { |
| 3355 let onError = opts && 'onError' in opts ? opts.onError : null; | 3355 let onError = opts && 'onError' in opts ? opts.onError : null; |
| 3356 let onDone = opts && 'onDone' in opts ? opts.onDone : null; | 3356 let onDone = opts && 'onDone' in opts ? opts.onDone : null; |
| 3357 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError
: null; | 3357 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError
: null; |
| 3358 if (dart.notNull(this[_controller] == null) || dart.notNull(this[_contro
ller].isClosed)) { | 3358 if (dart.notNull(this[_controller] == null) || dart.notNull(this[_contro
ller].isClosed)) { |
| 3359 return new _DoneStreamSubscription(onDone); | 3359 return new (_DoneStreamSubscription$(T))(onDone); |
| 3360 } | 3360 } |
| 3361 if (this[_subscription] == null) { | 3361 if (this[_subscription] == null) { |
| 3362 this[_subscription] = this[_source].listen(this[_controller].add, {onE
rror: this[_controller].addError, onDone: this[_controller].close}); | 3362 this[_subscription] = this[_source].listen(this[_controller].add, {onE
rror: this[_controller].addError, onDone: this[_controller].close}); |
| 3363 } | 3363 } |
| 3364 cancelOnError = core.identical(true, cancelOnError); | 3364 cancelOnError = core.identical(true, cancelOnError); |
| 3365 return this[_controller]._subscribe(onData, onError, onDone, cancelOnErr
or); | 3365 return this[_controller]._subscribe(onData, onError, onDone, cancelOnErr
or); |
| 3366 } | 3366 } |
| 3367 [_onCancel]() { | 3367 [_onCancel]() { |
| 3368 let shutdown = dart.notNull(this[_controller] == null) || dart.notNull(t
his[_controller].isClosed); | 3368 let shutdown = dart.notNull(this[_controller] == null) || dart.notNull(t
his[_controller].isClosed); |
| 3369 if (this[_onCancelHandler] != null) { | 3369 if (this[_onCancelHandler] != null) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3463 this[_current] = null; | 3463 this[_current] = null; |
| 3464 this[_futureOrPrefetch] = null; | 3464 this[_futureOrPrefetch] = null; |
| 3465 this[_state] = _StreamIteratorImpl[_STATE_FOUND]; | 3465 this[_state] = _StreamIteratorImpl[_STATE_FOUND]; |
| 3466 this[_subscription] = stream.listen(this[_onData], {onError: this[_onErr
or], onDone: this[_onDone], cancelOnError: true}); | 3466 this[_subscription] = stream.listen(this[_onData], {onError: this[_onErr
or], onDone: this[_onDone], cancelOnError: true}); |
| 3467 } | 3467 } |
| 3468 get current() { | 3468 get current() { |
| 3469 return this[_current]; | 3469 return this[_current]; |
| 3470 } | 3470 } |
| 3471 moveNext() { | 3471 moveNext() { |
| 3472 if (this[_state] == _StreamIteratorImpl[_STATE_DONE]) { | 3472 if (this[_state] == _StreamIteratorImpl[_STATE_DONE]) { |
| 3473 return new _Future.immediate(false); | 3473 return new _Future$(core.bool).immediate(false); |
| 3474 } | 3474 } |
| 3475 if (this[_state] == _StreamIteratorImpl[_STATE_MOVING]) { | 3475 if (this[_state] == _StreamIteratorImpl[_STATE_MOVING]) { |
| 3476 throw new core.StateError("Already waiting for next."); | 3476 throw new core.StateError("Already waiting for next."); |
| 3477 } | 3477 } |
| 3478 if (this[_state] == _StreamIteratorImpl[_STATE_FOUND]) { | 3478 if (this[_state] == _StreamIteratorImpl[_STATE_FOUND]) { |
| 3479 this[_state] = _StreamIteratorImpl[_STATE_MOVING]; | 3479 this[_state] = _StreamIteratorImpl[_STATE_MOVING]; |
| 3480 this[_current] = null; | 3480 this[_current] = null; |
| 3481 this[_futureOrPrefetch] = new _Future(); | 3481 this[_futureOrPrefetch] = new (_Future$(core.bool))(); |
| 3482 return dart.as(this[_futureOrPrefetch], Future$(core.bool)); | 3482 return dart.as(this[_futureOrPrefetch], Future$(core.bool)); |
| 3483 } else { | 3483 } else { |
| 3484 dart.assert(dart.notNull(this[_state]) >= dart.notNull(_StreamIterator
Impl[_STATE_EXTRA_DATA])); | 3484 dart.assert(dart.notNull(this[_state]) >= dart.notNull(_StreamIterator
Impl[_STATE_EXTRA_DATA])); |
| 3485 switch (this[_state]) { | 3485 switch (this[_state]) { |
| 3486 case _StreamIteratorImpl[_STATE_EXTRA_DATA]: | 3486 case _StreamIteratorImpl[_STATE_EXTRA_DATA]: |
| 3487 { | 3487 { |
| 3488 this[_state] = _StreamIteratorImpl[_STATE_FOUND]; | 3488 this[_state] = _StreamIteratorImpl[_STATE_FOUND]; |
| 3489 this[_current] = dart.as(this[_futureOrPrefetch], T); | 3489 this[_current] = dart.as(this[_futureOrPrefetch], T); |
| 3490 this[_futureOrPrefetch] = null; | 3490 this[_futureOrPrefetch] = null; |
| 3491 this[_subscription].resume(); | 3491 this[_subscription].resume(); |
| 3492 return new _Future.immediate(true); | 3492 return new _Future$(core.bool).immediate(true); |
| 3493 } | 3493 } |
| 3494 case _StreamIteratorImpl[_STATE_EXTRA_ERROR]: | 3494 case _StreamIteratorImpl[_STATE_EXTRA_ERROR]: |
| 3495 { | 3495 { |
| 3496 let prefetch = dart.as(this[_futureOrPrefetch], AsyncError); | 3496 let prefetch = dart.as(this[_futureOrPrefetch], AsyncError); |
| 3497 this[_clear](); | 3497 this[_clear](); |
| 3498 return new _Future.immediateError(prefetch.error, prefetch.stackTr
ace); | 3498 return new _Future$(core.bool).immediateError(prefetch.error, pref
etch.stackTrace); |
| 3499 } | 3499 } |
| 3500 case _StreamIteratorImpl[_STATE_EXTRA_DONE]: | 3500 case _StreamIteratorImpl[_STATE_EXTRA_DONE]: |
| 3501 { | 3501 { |
| 3502 this[_clear](); | 3502 this[_clear](); |
| 3503 return new _Future.immediate(false); | 3503 return new _Future$(core.bool).immediate(false); |
| 3504 } | 3504 } |
| 3505 } | 3505 } |
| 3506 } | 3506 } |
| 3507 } | 3507 } |
| 3508 [_clear]() { | 3508 [_clear]() { |
| 3509 this[_subscription] = null; | 3509 this[_subscription] = null; |
| 3510 this[_futureOrPrefetch] = null; | 3510 this[_futureOrPrefetch] = null; |
| 3511 this[_current] = null; | 3511 this[_current] = null; |
| 3512 this[_state] = _StreamIteratorImpl[_STATE_DONE]; | 3512 this[_state] = _StreamIteratorImpl[_STATE_DONE]; |
| 3513 } | 3513 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3633 return this[_source].isBroadcast; | 3633 return this[_source].isBroadcast; |
| 3634 } | 3634 } |
| 3635 listen(onData, opts) { | 3635 listen(onData, opts) { |
| 3636 let onError = opts && 'onError' in opts ? opts.onError : null; | 3636 let onError = opts && 'onError' in opts ? opts.onError : null; |
| 3637 let onDone = opts && 'onDone' in opts ? opts.onDone : null; | 3637 let onDone = opts && 'onDone' in opts ? opts.onDone : null; |
| 3638 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError
: null; | 3638 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError
: null; |
| 3639 cancelOnError = core.identical(true, cancelOnError); | 3639 cancelOnError = core.identical(true, cancelOnError); |
| 3640 return this[_createSubscription](onData, onError, onDone, cancelOnError)
; | 3640 return this[_createSubscription](onData, onError, onDone, cancelOnError)
; |
| 3641 } | 3641 } |
| 3642 [_createSubscription](onData, onError, onDone, cancelOnError) { | 3642 [_createSubscription](onData, onError, onDone, cancelOnError) { |
| 3643 return new _ForwardingStreamSubscription(this, onData, onError, onDone,
cancelOnError); | 3643 return new (_ForwardingStreamSubscription$(S, T))(this, onData, onError,
onDone, cancelOnError); |
| 3644 } | 3644 } |
| 3645 [_handleData](data, sink) { | 3645 [_handleData](data, sink) { |
| 3646 let outputData = data; | 3646 let outputData = data; |
| 3647 sink._add(outputData); | 3647 sink._add(outputData); |
| 3648 } | 3648 } |
| 3649 [_handleError](error, stackTrace, sink) { | 3649 [_handleError](error, stackTrace, sink) { |
| 3650 sink._addError(error, stackTrace); | 3650 sink._addError(error, stackTrace); |
| 3651 } | 3651 } |
| 3652 [_handleDone](sink) { | 3652 [_handleDone](sink) { |
| 3653 sink._close(); | 3653 sink._close(); |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3989 }); | 3989 }); |
| 3990 let _EventSinkWrapper = _EventSinkWrapper$(dart.dynamic); | 3990 let _EventSinkWrapper = _EventSinkWrapper$(dart.dynamic); |
| 3991 let _transformerSink = Symbol('_transformerSink'); | 3991 let _transformerSink = Symbol('_transformerSink'); |
| 3992 let _isSubscribed = Symbol('_isSubscribed'); | 3992 let _isSubscribed = Symbol('_isSubscribed'); |
| 3993 let _SinkTransformerStreamSubscription$ = dart.generic(function(S, T) { | 3993 let _SinkTransformerStreamSubscription$ = dart.generic(function(S, T) { |
| 3994 class _SinkTransformerStreamSubscription extends _BufferingStreamSubscriptio
n$(T) { | 3994 class _SinkTransformerStreamSubscription extends _BufferingStreamSubscriptio
n$(T) { |
| 3995 _SinkTransformerStreamSubscription(source, mapper, onData, onError, onDone
, cancelOnError) { | 3995 _SinkTransformerStreamSubscription(source, mapper, onData, onError, onDone
, cancelOnError) { |
| 3996 this[_transformerSink] = null; | 3996 this[_transformerSink] = null; |
| 3997 this[_subscription] = null; | 3997 this[_subscription] = null; |
| 3998 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro
r); | 3998 super._BufferingStreamSubscription(onData, onError, onDone, cancelOnErro
r); |
| 3999 let eventSink = new _EventSinkWrapper(this); | 3999 let eventSink = new (_EventSinkWrapper$(T))(this); |
| 4000 this[_transformerSink] = mapper(eventSink); | 4000 this[_transformerSink] = mapper(eventSink); |
| 4001 this[_subscription] = source.listen(this[_handleData], {onError: this[_h
andleError], onDone: this[_handleDone]}); | 4001 this[_subscription] = source.listen(this[_handleData], {onError: this[_h
andleError], onDone: this[_handleDone]}); |
| 4002 } | 4002 } |
| 4003 get [_isSubscribed]() { | 4003 get [_isSubscribed]() { |
| 4004 return this[_subscription] != null; | 4004 return this[_subscription] != null; |
| 4005 } | 4005 } |
| 4006 [_add](data) { | 4006 [_add](data) { |
| 4007 if (this[_isClosed]) { | 4007 if (this[_isClosed]) { |
| 4008 throw new core.StateError("Stream is already closed"); | 4008 throw new core.StateError("Stream is already closed"); |
| 4009 } | 4009 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4075 return _SinkTransformerStreamSubscription; | 4075 return _SinkTransformerStreamSubscription; |
| 4076 }); | 4076 }); |
| 4077 let _SinkTransformerStreamSubscription = _SinkTransformerStreamSubscription$(d
art.dynamic, dart.dynamic); | 4077 let _SinkTransformerStreamSubscription = _SinkTransformerStreamSubscription$(d
art.dynamic, dart.dynamic); |
| 4078 let _sinkMapper = Symbol('_sinkMapper'); | 4078 let _sinkMapper = Symbol('_sinkMapper'); |
| 4079 let _StreamSinkTransformer$ = dart.generic(function(S, T) { | 4079 let _StreamSinkTransformer$ = dart.generic(function(S, T) { |
| 4080 class _StreamSinkTransformer extends core.Object { | 4080 class _StreamSinkTransformer extends core.Object { |
| 4081 _StreamSinkTransformer(sinkMapper) { | 4081 _StreamSinkTransformer(sinkMapper) { |
| 4082 this[_sinkMapper] = sinkMapper; | 4082 this[_sinkMapper] = sinkMapper; |
| 4083 } | 4083 } |
| 4084 bind(stream) { | 4084 bind(stream) { |
| 4085 return new _BoundSinkStream(stream, this[_sinkMapper]); | 4085 return new (_BoundSinkStream$(S, T))(stream, this[_sinkMapper]); |
| 4086 } | 4086 } |
| 4087 } | 4087 } |
| 4088 _StreamSinkTransformer[dart.implements] = () => [StreamTransformer$(S, T)]; | 4088 _StreamSinkTransformer[dart.implements] = () => [StreamTransformer$(S, T)]; |
| 4089 return _StreamSinkTransformer; | 4089 return _StreamSinkTransformer; |
| 4090 }); | 4090 }); |
| 4091 let _StreamSinkTransformer = _StreamSinkTransformer$(dart.dynamic, dart.dynami
c); | 4091 let _StreamSinkTransformer = _StreamSinkTransformer$(dart.dynamic, dart.dynami
c); |
| 4092 let _BoundSinkStream$ = dart.generic(function(S, T) { | 4092 let _BoundSinkStream$ = dart.generic(function(S, T) { |
| 4093 class _BoundSinkStream extends Stream$(T) { | 4093 class _BoundSinkStream extends Stream$(T) { |
| 4094 get isBroadcast() { | 4094 get isBroadcast() { |
| 4095 return this[_stream].isBroadcast; | 4095 return this[_stream].isBroadcast; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4144 let handleData = opts && 'handleData' in opts ? opts.handleData : null; | 4144 let handleData = opts && 'handleData' in opts ? opts.handleData : null; |
| 4145 let handleError = opts && 'handleError' in opts ? opts.handleError : nul
l; | 4145 let handleError = opts && 'handleError' in opts ? opts.handleError : nul
l; |
| 4146 let handleDone = opts && 'handleDone' in opts ? opts.handleDone : null; | 4146 let handleDone = opts && 'handleDone' in opts ? opts.handleDone : null; |
| 4147 super._StreamSinkTransformer(dart.closureWrap((outputSink) => { | 4147 super._StreamSinkTransformer(dart.closureWrap((outputSink) => { |
| 4148 if (handleData == null) | 4148 if (handleData == null) |
| 4149 handleData = dart.closureWrap(_StreamHandlerTransformer[_defaultHand
leData], "(S, EventSink<T>) → void"); | 4149 handleData = dart.closureWrap(_StreamHandlerTransformer[_defaultHand
leData], "(S, EventSink<T>) → void"); |
| 4150 if (handleError == null) | 4150 if (handleError == null) |
| 4151 handleError = dart.closureWrap(_StreamHandlerTransformer[_defaultHan
dleError], "(Object, StackTrace, EventSink<T>) → void"); | 4151 handleError = dart.closureWrap(_StreamHandlerTransformer[_defaultHan
dleError], "(Object, StackTrace, EventSink<T>) → void"); |
| 4152 if (handleDone == null) | 4152 if (handleDone == null) |
| 4153 handleDone = _StreamHandlerTransformer[_defaultHandleDone]; | 4153 handleDone = _StreamHandlerTransformer[_defaultHandleDone]; |
| 4154 return new _HandlerEventSink(handleData, handleError, handleDone, outp
utSink); | 4154 return new (_HandlerEventSink$(S, T))(handleData, handleError, handleD
one, outputSink); |
| 4155 }, "(EventSink<T>) → EventSink<S>")); | 4155 }, "(EventSink<T>) → EventSink<S>")); |
| 4156 } | 4156 } |
| 4157 bind(stream) { | 4157 bind(stream) { |
| 4158 return super.bind(stream); | 4158 return super.bind(stream); |
| 4159 } | 4159 } |
| 4160 static [_defaultHandleData](data, sink) { | 4160 static [_defaultHandleData](data, sink) { |
| 4161 sink.add(data); | 4161 sink.add(data); |
| 4162 } | 4162 } |
| 4163 static [_defaultHandleError](error, stackTrace, sink) { | 4163 static [_defaultHandleError](error, stackTrace, sink) { |
| 4164 sink.addError(error); | 4164 sink.addError(error); |
| 4165 } | 4165 } |
| 4166 static [_defaultHandleDone](sink) { | 4166 static [_defaultHandleDone](sink) { |
| 4167 sink.close(); | 4167 sink.close(); |
| 4168 } | 4168 } |
| 4169 } | 4169 } |
| 4170 return _StreamHandlerTransformer; | 4170 return _StreamHandlerTransformer; |
| 4171 }); | 4171 }); |
| 4172 let _StreamHandlerTransformer = _StreamHandlerTransformer$(dart.dynamic, dart.
dynamic); | 4172 let _StreamHandlerTransformer = _StreamHandlerTransformer$(dart.dynamic, dart.
dynamic); |
| 4173 let _transformer = Symbol('_transformer'); | 4173 let _transformer = Symbol('_transformer'); |
| 4174 let _StreamSubscriptionTransformer$ = dart.generic(function(S, T) { | 4174 let _StreamSubscriptionTransformer$ = dart.generic(function(S, T) { |
| 4175 class _StreamSubscriptionTransformer extends core.Object { | 4175 class _StreamSubscriptionTransformer extends core.Object { |
| 4176 _StreamSubscriptionTransformer(transformer$) { | 4176 _StreamSubscriptionTransformer(transformer$) { |
| 4177 this[_transformer] = transformer$; | 4177 this[_transformer] = transformer$; |
| 4178 } | 4178 } |
| 4179 bind(stream) { | 4179 bind(stream) { |
| 4180 return new _BoundSubscriptionStream(stream, this[_transformer]); | 4180 return new (_BoundSubscriptionStream$(S, T))(stream, this[_transformer])
; |
| 4181 } | 4181 } |
| 4182 } | 4182 } |
| 4183 _StreamSubscriptionTransformer[dart.implements] = () => [StreamTransformer$(
S, T)]; | 4183 _StreamSubscriptionTransformer[dart.implements] = () => [StreamTransformer$(
S, T)]; |
| 4184 return _StreamSubscriptionTransformer; | 4184 return _StreamSubscriptionTransformer; |
| 4185 }); | 4185 }); |
| 4186 let _StreamSubscriptionTransformer = _StreamSubscriptionTransformer$(dart.dyna
mic, dart.dynamic); | 4186 let _StreamSubscriptionTransformer = _StreamSubscriptionTransformer$(dart.dyna
mic, dart.dynamic); |
| 4187 let _BoundSubscriptionStream$ = dart.generic(function(S, T) { | 4187 let _BoundSubscriptionStream$ = dart.generic(function(S, T) { |
| 4188 class _BoundSubscriptionStream extends Stream$(T) { | 4188 class _BoundSubscriptionStream extends Stream$(T) { |
| 4189 _BoundSubscriptionStream(stream$, transformer$) { | 4189 _BoundSubscriptionStream(stream$, transformer$) { |
| 4190 this[_stream] = stream$; | 4190 this[_stream] = stream$; |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5012 exports.StreamIterator = StreamIterator; | 5012 exports.StreamIterator = StreamIterator; |
| 5013 exports.StreamIterator$ = StreamIterator$; | 5013 exports.StreamIterator$ = StreamIterator$; |
| 5014 exports.StreamController = StreamController; | 5014 exports.StreamController = StreamController; |
| 5015 exports.StreamController$ = StreamController$; | 5015 exports.StreamController$ = StreamController$; |
| 5016 exports.Timer = Timer; | 5016 exports.Timer = Timer; |
| 5017 exports.ZoneSpecification = ZoneSpecification; | 5017 exports.ZoneSpecification = ZoneSpecification; |
| 5018 exports.ZoneDelegate = ZoneDelegate; | 5018 exports.ZoneDelegate = ZoneDelegate; |
| 5019 exports.Zone = Zone; | 5019 exports.Zone = Zone; |
| 5020 exports.runZoned = runZoned; | 5020 exports.runZoned = runZoned; |
| 5021 })(async || (async = {})); | 5021 })(async || (async = {})); |
| OLD | NEW |