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

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

Issue 977613002: Make int and double nullable by default (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: actually upload changes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 part of dart.async; 1 part of dart.async;
2 abstract class StreamController<T> implements StreamSink<T> {Stream<T> get stre am; 2 abstract class StreamController<T> implements StreamSink<T> {Stream<T> get stre am;
3 factory StreamController({ 3 factory StreamController({
4 void onListen(), void onPause(), void onResume(), onCancel(), bool sync : fals e} 4 void onListen(), void onPause(), void onResume(), onCancel(), bool sync : fals e}
5 ) { 5 ) {
6 if (onListen == null && onPause == null && onResume == null && onCancel == nul l) { 6 if (onListen == null && onPause == null && onResume == null && onCancel == nul l) {
7 return ((__x117) => DDC$RT.cast(__x117, DDC$RT.type((_StreamController<dynam ic> _) { 7 return ((__x106) => DDC$RT.cast(__x106, DDC$RT.type((_StreamController<dynam ic> _) {
8 } 8 }
9 ), DDC$RT.type((StreamController<T> _) { 9 ), DDC$RT.type((StreamController<T> _) {
10 } 10 }
11 ), "CastDynamic", """line 83, column 14 of dart:async/stream_controller.dart : """, __x117 is StreamController<T>, false))(sync ? new _NoCallbackSyncStreamCo ntroller() : new _NoCallbackAsyncStreamController()); 11 ), "CastDynamic", """line 83, column 14 of dart:async/stream_controller.dart : """, __x106 is StreamController<T>, false))(sync ? new _NoCallbackSyncStreamCo ntroller() : new _NoCallbackAsyncStreamController());
12 } 12 }
13 return sync ? new _SyncStreamController<T>(onListen, onPause, onResume, onCan cel) : new _AsyncStreamController<T>(onListen, onPause, onResume, onCancel); 13 return sync ? new _SyncStreamController<T>(onListen, onPause, onResume, onCan cel) : new _AsyncStreamController<T>(onListen, onPause, onResume, onCancel);
14 } 14 }
15 factory StreamController.broadcast({ 15 factory StreamController.broadcast({
16 void onListen(), void onCancel(), bool sync : false} 16 void onListen(), void onCancel(), bool sync : false}
17 ) { 17 ) {
18 return sync ? new _SyncBroadcastStreamController<T>(onListen, onCancel) : new _AsyncBroadcastStreamController<T>(onListen, onCancel); 18 return sync ? new _SyncBroadcastStreamController<T>(onListen, onCancel) : new _AsyncBroadcastStreamController<T>(onListen, onCancel);
19 } 19 }
20 StreamSink<T> get sink; 20 StreamSink<T> get sink;
21 bool get isClosed; 21 bool get isClosed;
(...skipping 18 matching lines...) Expand all
40 static const int _STATE_CLOSED = 4; 40 static const int _STATE_CLOSED = 4;
41 static const int _STATE_ADDSTREAM = 8; 41 static const int _STATE_ADDSTREAM = 8;
42 var _varData; 42 var _varData;
43 int _state = _STATE_INITIAL; 43 int _state = _STATE_INITIAL;
44 _Future _doneFuture; 44 _Future _doneFuture;
45 _StreamController(); 45 _StreamController();
46 _NotificationHandler get _onListen; 46 _NotificationHandler get _onListen;
47 _NotificationHandler get _onPause; 47 _NotificationHandler get _onPause;
48 _NotificationHandler get _onResume; 48 _NotificationHandler get _onResume;
49 _NotificationHandler get _onCancel; 49 _NotificationHandler get _onCancel;
50 Stream<T> get stream => ((__x118) => DDC$RT.cast(__x118, DDC$RT.type((_Controll erStream<dynamic> _) { 50 Stream<T> get stream => ((__x107) => DDC$RT.cast(__x107, DDC$RT.type((_Controll erStream<dynamic> _) {
51 } 51 }
52 ), DDC$RT.type((Stream<T> _) { 52 ), DDC$RT.type((Stream<T> _) {
53 } 53 }
54 ), "CastExact", """line 293, column 27 of dart:async/stream_controller.dart: """ , __x118 is Stream<T>, false))(new _ControllerStream(this)); 54 ), "CastExact", """line 293, column 27 of dart:async/stream_controller.dart: """ , __x107 is Stream<T>, false))(new _ControllerStream(this));
55 StreamSink<T> get sink => new _StreamSinkWrapper<T>(this); 55 StreamSink<T> get sink => new _StreamSinkWrapper<T>(this);
56 bool get _isCanceled => (_state & _STATE_CANCELED) != 0; 56 bool get _isCanceled => (_state & _STATE_CANCELED) != 0;
57 bool get hasListener => (_state & _STATE_SUBSCRIBED) != 0; 57 bool get hasListener => (_state & _STATE_SUBSCRIBED) != 0;
58 bool get _isInitialState => (_state & _STATE_SUBSCRIPTION_MASK) == _STATE_INITI AL; 58 bool get _isInitialState => (_state & _STATE_SUBSCRIPTION_MASK) == _STATE_INITI AL;
59 bool get isClosed => (_state & _STATE_CLOSED) != 0; 59 bool get isClosed => (_state & _STATE_CLOSED) != 0;
60 bool get isPaused => hasListener ? _subscription._isInputPaused : !_isCanceled; 60 bool get isPaused => hasListener ? _subscription._isInputPaused : !_isCanceled;
61 bool get _isAddingStream => (_state & _STATE_ADDSTREAM) != 0; 61 bool get _isAddingStream => (_state & _STATE_ADDSTREAM) != 0;
62 bool get _mayAddEvent => (_state < _STATE_CLOSED); 62 bool get _mayAddEvent => (_state < _STATE_CLOSED);
63 _PendingEvents get _pendingEvents { 63 _PendingEvents get _pendingEvents {
64 assert (_isInitialState); if (!_isAddingStream) { 64 assert (_isInitialState); if (!_isAddingStream) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 168 }
169 ), "CastGeneral", """line 482, column 48 of dart:async/stream_controller.dart: " "", _varData is _StreamControllerAddStreamState<dynamic>, true); 169 ), "CastGeneral", """line 482, column 48 of dart:async/stream_controller.dart: " "", _varData is _StreamControllerAddStreamState<dynamic>, true);
170 _varData = addState.varData; 170 _varData = addState.varData;
171 _state &= ~_STATE_ADDSTREAM; 171 _state &= ~_STATE_ADDSTREAM;
172 addState.complete(); 172 addState.complete();
173 } 173 }
174 StreamSubscription<T> _subscribe(void onData(T data), Function onError, void on Done(), bool cancelOnError) { 174 StreamSubscription<T> _subscribe(void onData(T data), Function onError, void on Done(), bool cancelOnError) {
175 if (!_isInitialState) { 175 if (!_isInitialState) {
176 throw new StateError("Stream has already been listened to."); 176 throw new StateError("Stream has already been listened to.");
177 } 177 }
178 _ControllerSubscription subscription = new _ControllerSubscription(this, DDC$RT .wrap((void f(T __u119)) { 178 _ControllerSubscription subscription = new _ControllerSubscription(this, DDC$RT .wrap((void f(T __u108)) {
179 void c(T x0) => f(DDC$RT.cast(x0, dynamic, T, "CastParam", """line 499, column 4 3 of dart:async/stream_controller.dart: """, x0 is T, false)); 179 void c(T x0) => f(DDC$RT.cast(x0, dynamic, T, "CastParam", """line 499, column 4 3 of dart:async/stream_controller.dart: """, x0 is T, false));
180 return f == null ? null : c; 180 return f == null ? null : c;
181 } 181 }
182 , onData, DDC$RT.type((__t122<T> _) { 182 , onData, DDC$RT.type((__t111<T> _) {
183 } 183 }
184 ), __t120, "Wrap", """line 499, column 43 of dart:async/stream_controller.dart: """, onData is __t120), onError, onDone, cancelOnError); 184 ), __t109, "Wrap", """line 499, column 43 of dart:async/stream_controller.dart: """, onData is __t109), onError, onDone, cancelOnError);
185 _PendingEvents pendingEvents = _pendingEvents; 185 _PendingEvents pendingEvents = _pendingEvents;
186 _state |= _STATE_SUBSCRIBED; 186 _state |= _STATE_SUBSCRIBED;
187 if (_isAddingStream) { 187 if (_isAddingStream) {
188 _StreamControllerAddStreamState addState = DDC$RT.cast(_varData, dynamic, DDC$RT .type((_StreamControllerAddStreamState<dynamic> _) { 188 _StreamControllerAddStreamState addState = DDC$RT.cast(_varData, dynamic, DDC$RT .type((_StreamControllerAddStreamState<dynamic> _) {
189 } 189 }
190 ), "CastGeneral", """line 505, column 50 of dart:async/stream_controller.dart: " "", _varData is _StreamControllerAddStreamState<dynamic>, true); 190 ), "CastGeneral", """line 505, column 50 of dart:async/stream_controller.dart: " "", _varData is _StreamControllerAddStreamState<dynamic>, true);
191 addState.varData = subscription; 191 addState.varData = subscription;
192 addState.resume(); 192 addState.resume();
193 } 193 }
194 else { 194 else {
(...skipping 16 matching lines...) Expand all
211 _StreamControllerAddStreamState addState = DDC$RT.cast(_varData, dynamic, DDC$RT .type((_StreamControllerAddStreamState<dynamic> _) { 211 _StreamControllerAddStreamState addState = DDC$RT.cast(_varData, dynamic, DDC$RT .type((_StreamControllerAddStreamState<dynamic> _) {
212 } 212 }
213 ), "CastGeneral", """line 530, column 50 of dart:async/stream_controller.dart: " "", _varData is _StreamControllerAddStreamState<dynamic>, true); 213 ), "CastGeneral", """line 530, column 50 of dart:async/stream_controller.dart: " "", _varData is _StreamControllerAddStreamState<dynamic>, true);
214 result = addState.cancel(); 214 result = addState.cancel();
215 } 215 }
216 _varData = null; 216 _varData = null;
217 _state = (_state & ~(_STATE_SUBSCRIBED | _STATE_ADDSTREAM)) | _STATE_CANCELED; 217 _state = (_state & ~(_STATE_SUBSCRIBED | _STATE_ADDSTREAM)) | _STATE_CANCELED;
218 if (_onCancel != null) { 218 if (_onCancel != null) {
219 if (result == null) { 219 if (result == null) {
220 try { 220 try {
221 result = ((__x124) => DDC$RT.cast(__x124, dynamic, DDC$RT.type((Future<dynam ic> _) { 221 result = ((__x113) => DDC$RT.cast(__x113, dynamic, DDC$RT.type((Future<dynam ic> _) {
222 } 222 }
223 ), "CastGeneral", """line 542, column 20 of dart:async/stream_controller.dar t: """, __x124 is Future<dynamic>, true))(_onCancel()); 223 ), "CastGeneral", """line 542, column 20 of dart:async/stream_controller.dar t: """, __x113 is Future<dynamic>, true))(_onCancel());
224 } 224 }
225 catch (e, s) { 225 catch (e, s) {
226 result = new _Future().._asyncCompleteError(e, s); 226 result = new _Future().._asyncCompleteError(e, s);
227 } 227 }
228 } 228 }
229 else { 229 else {
230 result = result.whenComplete(_onCancel); 230 result = result.whenComplete(_onCancel);
231 } 231 }
232 } 232 }
233 void complete() { 233 void complete() {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 _target.addError(error, stackTrace); 349 _target.addError(error, stackTrace);
350 } 350 }
351 Future close() => _target.close(); 351 Future close() => _target.close();
352 Future addStream(Stream<T> source, { 352 Future addStream(Stream<T> source, {
353 bool cancelOnError : true} 353 bool cancelOnError : true}
354 ) => _target.addStream(source, cancelOnError: cancelOnError); 354 ) => _target.addStream(source, cancelOnError: cancelOnError);
355 Future get done => _target.done; 355 Future get done => _target.done;
356 } 356 }
357 class _AddStreamState<T> {final _Future addStreamFuture; 357 class _AddStreamState<T> {final _Future addStreamFuture;
358 final StreamSubscription addSubscription; 358 final StreamSubscription addSubscription;
359 _AddStreamState(_EventSink<T> controller, Stream source, bool cancelOnError) : addStreamFuture = new _Future(), addSubscription = source.listen(DDC$RT.wrap((vo id f(T __u125)) { 359 _AddStreamState(_EventSink<T> controller, Stream source, bool cancelOnError) : addStreamFuture = new _Future(), addSubscription = source.listen(DDC$RT.wrap((vo id f(T __u114)) {
360 void c(T x0) => f(DDC$RT.cast(x0, dynamic, T, "CastParam", """line 745, column 4 1 of dart:async/stream_controller.dart: """, x0 is T, false)); 360 void c(T x0) => f(DDC$RT.cast(x0, dynamic, T, "CastParam", """line 745, column 4 1 of dart:async/stream_controller.dart: """, x0 is T, false));
361 return f == null ? null : c; 361 return f == null ? null : c;
362 } 362 }
363 , controller._add, DDC$RT.type((__t126<T> _) { 363 , controller._add, DDC$RT.type((__t115<T> _) {
364 } 364 }
365 ), __t120, "Wrap", """line 745, column 41 of dart:async/stream_controller.dart: """, controller._add is __t120), onError: ((__x128) => DDC$RT.cast(__x128, dynam ic, Function, "CastGeneral", """line 746, column 50 of dart:async/stream_control ler.dart: """, __x128 is Function, true))(cancelOnError ? makeErrorHandler(contr oller) : controller._addError), onDone: controller._close, cancelOnError: cancel OnError); 365 ), __t109, "Wrap", """line 745, column 41 of dart:async/stream_controller.dart: """, controller._add is __t109), onError: ((__x117) => DDC$RT.cast(__x117, dynam ic, Function, "CastGeneral", """line 746, column 50 of dart:async/stream_control ler.dart: """, __x117 is Function, true))(cancelOnError ? makeErrorHandler(contr oller) : controller._addError), onDone: controller._close, cancelOnError: cancel OnError);
366 static makeErrorHandler(_EventSink controller) => (e, StackTrace s) { 366 static makeErrorHandler(_EventSink controller) => (e, StackTrace s) {
367 controller._addError(e, s); 367 controller._addError(e, s);
368 controller._close(); 368 controller._close();
369 } 369 }
370 ; 370 ;
371 void pause() { 371 void pause() {
372 addSubscription.pause(); 372 addSubscription.pause();
373 } 373 }
374 void resume() { 374 void resume() {
375 addSubscription.resume(); 375 addSubscription.resume();
(...skipping 17 matching lines...) Expand all
393 _StreamControllerAddStreamState(_StreamController controller, this.varData, Str eam source, bool cancelOnError) : super(DDC$RT.cast(controller, DDC$RT.type((_St reamController<dynamic> _) { 393 _StreamControllerAddStreamState(_StreamController controller, this.varData, Str eam source, bool cancelOnError) : super(DDC$RT.cast(controller, DDC$RT.type((_St reamController<dynamic> _) {
394 } 394 }
395 ), DDC$RT.type((_EventSink<T> _) { 395 ), DDC$RT.type((_EventSink<T> _) {
396 } 396 }
397 ), "CastDynamic", """line 798, column 15 of dart:async/stream_controller.dart: " "", controller is _EventSink<T>, false), source, cancelOnError) { 397 ), "CastDynamic", """line 798, column 15 of dart:async/stream_controller.dart: " "", controller is _EventSink<T>, false), source, cancelOnError) {
398 if (controller.isPaused) { 398 if (controller.isPaused) {
399 addSubscription.pause(); 399 addSubscription.pause();
400 } 400 }
401 } 401 }
402 } 402 }
403 typedef void __t120(dynamic __u121); 403 typedef void __t109(dynamic __u110);
404 typedef void __t122<T>(T __u123); 404 typedef void __t111<T>(T __u112);
405 typedef void __t126<T>(T __u127); 405 typedef void __t115<T>(T __u116);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698