Skip to content

Commit

Permalink
[3.0 alpha] Remove deprecated BidirectionalIterator.
Browse files Browse the repository at this point in the history
Requires releasing `package:quiver` 3.2.0 so Flutter can upgrade to that.


Change-Id: Ibd9acc5fa11a67ca50d06172dfe0f9175b240522
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276741
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
  • Loading branch information
lrhn authored and Commit Queue committed Jan 2, 2023
1 parent e42bb83 commit 81b137d
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 29 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
ways instead, possibly with a StackOverflowError.
- Removed the deprecated [`NoSuchMethodError`][] default constructor.
Use the [`NoSuchMethodError.withInvocation`][] named constructor instead.
- Removed the deprecated [`BidirectionalIterator`][] class.
Existing bidirectional iterators can still work, they just don't have
a shared supertype locking them to a specific name for moving backwards.

[#49529]: https://github.com/dart-lang/sdk/issues/49529
[`List.filled`]: https://api.dart.dev/stable/2.18.6/dart-core/List/List.filled.html
Expand All @@ -54,6 +57,7 @@
[`NullThrownError`]: https://api.dart.dev/dev/2.19.0-430.0.dev/dart-core/NullThrownError-class.html
[`AbstractClassInstantiationError`]: https://api.dart.dev/stable/2.18.3/dart-core/AbstractClassInstantiationError-class.html
[`CyclicInitializationError`]: https://api.dart.dev/dev/2.19.0-430.0.dev/dart-core/CyclicInitializationError-class.html
[`BidirectionalIterator`]: https://api.dart.dev/dev/2.19.0-430.0.dev/dart-core/BidirectionalIterator-class.html

#### `dart:async`

Expand All @@ -68,7 +72,7 @@
#### `dart:developer`

- **Breaking change** [#49529][]:
- Removed the deprecated [`MAX_USER_TAGS`][] constant.
- Removed the deprecated [`MAX_USER_TAGS`][] constant.
Use [`maxUserTags`][] instead.
- Callbacks passed to `registerExtension` will be run in the zone from which
they are registered.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ additionalExports = (core::Deprecated,
core::int,
core::Invocation,
core::Iterable,
core::BidirectionalIterator,
core::Iterator,
core::List,
core::Map,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ additionalExports = (core::Deprecated,
core::int,
core::Invocation,
core::Iterable,
core::BidirectionalIterator,
core::Iterator,
core::List,
core::Map,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ additionalExports = (core::Deprecated,
core::int,
core::Invocation,
core::Iterable,
core::BidirectionalIterator,
core::Iterator,
core::List,
core::Map,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ additionalExports = (core::Deprecated,
core::int,
core::Invocation,
core::Iterable,
core::BidirectionalIterator,
core::Iterator,
core::List,
core::Map,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ additionalExports = (core::Deprecated,
core::int,
core::Invocation,
core::Iterable,
core::BidirectionalIterator,
core::Iterator,
core::List,
core::Map,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ additionalExports = (asy::Future,
core::Comparator,
core::ArgumentError,
core::AssertionError,
core::BidirectionalIterator,
core::BigInt,
core::Comparable,
core::ConcurrentModificationError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ additionalExports = (asy::Future,
core::Comparator,
core::ArgumentError,
core::AssertionError,
core::BidirectionalIterator,
core::BigInt,
core::Comparable,
core::ConcurrentModificationError,
Expand Down
1 change: 0 additions & 1 deletion runtime/tools/dartfuzz/gen_type_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,6 @@ void visitCompilationUnit(
(classElement.name == 'StackTrace') ||
(classElement.name == 'NoSuchMethodError') ||
(classElement.name == 'Comparable') ||
(classElement.name == 'BidirectionalIterator') ||
(classElement.name == 'Iterator') ||
(classElement.name == 'Stopwatch') ||
(classElement.name == 'Finalizer') ||
Expand Down
19 changes: 0 additions & 19 deletions sdk/lib/core/iterable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -822,22 +822,3 @@ class _GeneratorIterable<E> extends ListIterable<E> {
/// Helper function used as default _generator function.
static int _id(int n) => n;
}

/// An [Iterator] that allows moving backwards as well as forwards.
///
/// Deprecation note: This interface has turned out to not be
/// valuable as a general reusable interface. There is still only
/// one class implementing it, [RuneIterator], and at least one other
/// bidirectional iterator preferred a different name than `movePrevious`
/// for the other direction.
/// As such, this interface does not carry its own weight, and will be
/// removed in a later release.
@Deprecated("Use the implementing class directly")
abstract class BidirectionalIterator<E> implements Iterator<E> {
/// Move back to the previous element.
///
/// Returns true and updates [current] if successful. Returns false
/// and updates [current] to an implementation defined state if there is no
/// previous element
bool movePrevious();
}
10 changes: 9 additions & 1 deletion sdk/lib/core/string.dart
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ int _combineSurrogatePair(int start, int end) {
}

/// [Iterator] for reading runes (integer Unicode code points) of a Dart string.
class RuneIterator implements BidirectionalIterator<int> {
class RuneIterator implements Iterator<int> {
/// String being iterated.
final String string;

Expand Down Expand Up @@ -906,6 +906,10 @@ class RuneIterator implements BidirectionalIterator<int> {
return string.substring(_position, _nextPosition);
}

/// Move to the next code point.
///
/// Returns `true` and updates [current] if there is a next code point.
/// Returns `false` otherwise, and then there is no current code point.
bool moveNext() {
_position = _nextPosition;
if (_position == string.length) {
Expand All @@ -927,6 +931,10 @@ class RuneIterator implements BidirectionalIterator<int> {
return true;
}

/// Move back to the previous code point.
///
/// Returns `true` and updates [current] if there is a previous code point.
/// Returns `false` otherwise, and then there is no current code point.
bool movePrevious() {
_nextPosition = _position;
if (_position == 0) {
Expand Down

0 comments on commit 81b137d

Please sign in to comment.