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

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

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

Powered by Google App Engine
This is Rietveld 408576698