| Index: sdk/lib/async/stream_impl.dart
|
| diff --git a/sdk/lib/async/stream_impl.dart b/sdk/lib/async/stream_impl.dart
|
| index bf7c8f015c9a51ddf3ba7a3f3a4775fb85237adc..e7cceadf7b0940ace0eb539bb6f4eb679a0c4e84 100644
|
| --- a/sdk/lib/async/stream_impl.dart
|
| +++ b/sdk/lib/async/stream_impl.dart
|
| @@ -488,6 +488,7 @@ typedef _PendingEvents _EventGenerator();
|
| /** Stream that generates its own events. */
|
| class _GeneratedStreamImpl<T> extends _StreamImpl<T> {
|
| final _EventGenerator _pending;
|
| + bool _isUsed = false;
|
| /**
|
| * Initializes the stream to have only the events provided by a
|
| * [_PendingEvents].
|
| @@ -497,6 +498,8 @@ class _GeneratedStreamImpl<T> extends _StreamImpl<T> {
|
| _GeneratedStreamImpl(this._pending);
|
|
|
| StreamSubscription _createSubscription(bool cancelOnError) {
|
| + if (_isUsed) throw new StateError("Stream has already been listened to.");
|
| + _isUsed = true;
|
| _BufferingStreamSubscription<T> subscription =
|
| new _BufferingStreamSubscription(cancelOnError);
|
| subscription._setPendingEvents(_pending());
|
|
|