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

Side by Side Diff: sdk/lib/async/broadcast_stream_controller.dart

Issue 1576153005: Initialize _BroadcastSubscription._eventState to permit inference of non-null value (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.async; 5 part of dart.async;
6 6
7 class _BroadcastStream<T> extends _ControllerStream<T> { 7 class _BroadcastStream<T> extends _ControllerStream<T> {
8 _BroadcastStream(_StreamControllerLifecycle controller) : super(controller); 8 _BroadcastStream(_StreamControllerLifecycle controller) : super(controller);
9 9
10 bool get isBroadcast => true; 10 bool get isBroadcast => true;
11 } 11 }
12 12
13 abstract class _BroadcastSubscriptionLink { 13 abstract class _BroadcastSubscriptionLink {
14 _BroadcastSubscriptionLink _next; 14 _BroadcastSubscriptionLink _next;
15 _BroadcastSubscriptionLink _previous; 15 _BroadcastSubscriptionLink _previous;
16 } 16 }
17 17
18 class _BroadcastSubscription<T> extends _ControllerSubscription<T> 18 class _BroadcastSubscription<T> extends _ControllerSubscription<T>
19 implements _BroadcastSubscriptionLink { 19 implements _BroadcastSubscriptionLink {
20 static const int _STATE_EVENT_ID = 1; 20 static const int _STATE_EVENT_ID = 1;
21 static const int _STATE_FIRING = 2; 21 static const int _STATE_FIRING = 2;
22 static const int _STATE_REMOVE_AFTER_FIRING = 4; 22 static const int _STATE_REMOVE_AFTER_FIRING = 4;
23 // TODO(lrn): Use the _state field on _ControllerSubscription to 23 // TODO(lrn): Use the _state field on _ControllerSubscription to
24 // also store this state. Requires that the subscription implementation 24 // also store this state. Requires that the subscription implementation
25 // does not assume that it's use of the state integer is the only use. 25 // does not assume that it's use of the state integer is the only use.
26 int _eventState; 26 int _eventState = 0; // Initialized to help dart2js type inference.
27 27
28 _BroadcastSubscriptionLink _next; 28 _BroadcastSubscriptionLink _next;
29 _BroadcastSubscriptionLink _previous; 29 _BroadcastSubscriptionLink _previous;
30 30
31 _BroadcastSubscription(_StreamControllerLifecycle controller, 31 _BroadcastSubscription(_StreamControllerLifecycle controller,
32 void onData(T data), 32 void onData(T data),
33 Function onError, 33 Function onError,
34 void onDone(), 34 void onDone(),
35 bool cancelOnError) 35 bool cancelOnError)
36 : super(controller, onData, onError, onDone, cancelOnError) { 36 : super(controller, onData, onError, onDone, cancelOnError) {
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 _pauseCount++; 533 _pauseCount++;
534 } 534 }
535 void resume() { _resume(null); } 535 void resume() { _resume(null); }
536 void _resume(_) { 536 void _resume(_) {
537 if (_pauseCount > 0) _pauseCount--; 537 if (_pauseCount > 0) _pauseCount--;
538 } 538 }
539 Future cancel() { return new _Future.immediate(null); } 539 Future cancel() { return new _Future.immediate(null); }
540 bool get isPaused => _pauseCount > 0; 540 bool get isPaused => _pauseCount > 0;
541 Future asFuture([Object value]) => new _Future(); 541 Future asFuture([Object value]) => new _Future();
542 } 542 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698