mirror of
https://github.com/dart-lang/sdk
synced 2024-07-08 20:16:39 +00:00
[dart2wasm] Port VM fix for #52083 (sync*)
dart2wasm's sync* runtime library was mostly copied from VM, but we
didn't get the fix for #52083 in 9cf26fc
. This ports the fix to
dart2wasm.
This currently doesn't fix any tests as there are other issues with
dart2wasm's sync* implementation, which we are fixing in
https://dart-review.googlesource.com/c/sdk/+/366663.
Change-Id: I9d82d1bbb4c96ccb9bf411a385f4b7ff395a1c19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366671
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
This commit is contained in:
parent
4ab652b38f
commit
e7dde8377e
|
@ -139,17 +139,22 @@ class _SyncStarIterator<T> implements Iterator<T> {
|
||||||
// Case: yield* some_iterator.
|
// Case: yield* some_iterator.
|
||||||
final iterable = _yieldStarIterable;
|
final iterable = _yieldStarIterable;
|
||||||
if (iterable != null) {
|
if (iterable != null) {
|
||||||
|
_yieldStarIterable = null;
|
||||||
|
_current = null;
|
||||||
if (iterable is _SyncStarIterable<T>) {
|
if (iterable is _SyncStarIterable<T>) {
|
||||||
// We got a recursive yield* of sync* function. Instead of creating
|
// We got a recursive yield* of sync* function. Instead of creating
|
||||||
// a new iterator we replace our current _state (remembering the
|
// a new iterator we replace our current _state (remembering the
|
||||||
// current _state for later resumption).
|
// current _state for later resumption).
|
||||||
_state = _SuspendState(iterable, _state).._iterator = this;
|
_state = _SuspendState(iterable, _state).._iterator = this;
|
||||||
} else {
|
} else {
|
||||||
_yieldStarIterator = iterable.iterator;
|
try {
|
||||||
|
_yieldStarIterator = iterable.iterator;
|
||||||
|
} catch (exception, stackTrace) {
|
||||||
|
pendingException = exception;
|
||||||
|
pendingStackTrace = stackTrace;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_yieldStarIterable = null;
|
// Fetch the next item or continue with exception.
|
||||||
_current = null;
|
|
||||||
// Fetch the next item.
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user