Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't allow null as argument to StreamIterator constructor.
Change-Id: I10c8de2cd12660876908f719ee562006cd3f2c07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98001
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
  • Loading branch information
lrhn authored and commit-bot@chromium.org committed Apr 30, 2019
1 parent 9cf5e51 commit 1dd0f88
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,11 @@


### Core library changes ### Core library changes


#### `dart:async`
* BREAKING CHANGE:
Fixes bug in `StreamIterator` which allowed constructor argument to be `null`.
Also allowed `await for` on a `null` stream. This is now a runtime error.

#### `dart:core` #### `dart:core`


* **Breaking change**: The `RegExp` interface has been extended with two new * **Breaking change**: The `RegExp` interface has been extended with two new
Expand All @@ -27,6 +32,11 @@
This change only affects implementers of the `RegExp` interface; current This change only affects implementers of the `RegExp` interface; current
code using Dart regular expressions will not be affected. code using Dart regular expressions will not be affected.


#### `dart:isolate`

* BREAKING CHANGE: The `await for` allowed `null` as a stream due to a bug
in `StreamIterator` class. This bug has now been fixed.

## 2.3.0 ## 2.3.0


The focus in this release is on the new "UI-as-code" language features which The focus in this release is on the new "UI-as-code" language features which
Expand Down
1 change: 1 addition & 0 deletions pkg/front_end/testcases/legacy.status
Expand Up @@ -20,6 +20,7 @@ incomplete_field_formal_parameter: Fail # Fasta doesn't recover well
inference/bug31436: RuntimeError # Test exercises Dart 2.0 semantics inference/bug31436: RuntimeError # Test exercises Dart 2.0 semantics
inference/constructors_too_many_positional_arguments: Fail inference/constructors_too_many_positional_arguments: Fail
inference/downwards_inference_annotations_locals: Fail # Issue #30031 inference/downwards_inference_annotations_locals: Fail # Issue #30031
inference/downwards_inference_for_each: RuntimeError # Issue #36382
inference/future_then_explicit_future: RuntimeError inference/future_then_explicit_future: RuntimeError
inference/generic_methods_infer_js_builtin: RuntimeError # Test attempts to access platform-private library leading to NSM. inference/generic_methods_infer_js_builtin: RuntimeError # Test attempts to access platform-private library leading to NSM.
inference/infer_assign_to_index: Fail inference/infer_assign_to_index: Fail
Expand Down
1 change: 1 addition & 0 deletions pkg/front_end/testcases/strong.status
Expand Up @@ -33,6 +33,7 @@ inference/constructors_infer_from_arguments_argument_not_assignable: TypeCheckEr
inference/constructors_too_many_positional_arguments: InstrumentationMismatch # Issue #30040 inference/constructors_too_many_positional_arguments: InstrumentationMismatch # Issue #30040
inference/do_not_infer_overridden_fields_that_explicitly_say_dynamic_infer: TypeCheckError inference/do_not_infer_overridden_fields_that_explicitly_say_dynamic_infer: TypeCheckError
inference/downwards_inference_annotations_type_variable: InstrumentationMismatch # Issue 28981 inference/downwards_inference_annotations_type_variable: InstrumentationMismatch # Issue 28981
inference/downwards_inference_for_each: RuntimeError # Issue #36382
inference/downwards_inference_on_function_of_t_using_the_t: InstrumentationMismatch # Issue #29798 inference/downwards_inference_on_function_of_t_using_the_t: InstrumentationMismatch # Issue #29798
inference/downwards_inference_on_list_literals_infer_downwards: RuntimeError inference/downwards_inference_on_list_literals_infer_downwards: RuntimeError
inference/future_then_explicit_future: InstrumentationMismatch # Issue #30040 inference/future_then_explicit_future: InstrumentationMismatch # Issue #30040
Expand Down
3 changes: 2 additions & 1 deletion sdk/lib/async/stream_impl.dart
Expand Up @@ -967,7 +967,8 @@ class _StreamIterator<T> implements StreamIterator<T> {
/// completed. /// completed.
bool _isPaused = false; bool _isPaused = false;


_StreamIterator(final Stream<T> stream) : _stateData = stream; _StreamIterator(final Stream<T> stream)
: _stateData = stream ?? (throw ArgumentError.notNull("stream"));


T get current { T get current {
if (_subscription != null && _isPaused) { if (_subscription != null && _isPaused) {
Expand Down

0 comments on commit 1dd0f88

Please sign in to comment.