mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 01:30:32 +00:00
94c120a6ea
This change removes kernel transformation which was used to desugar async/async*/sync* functions in the old implementation of async/async*/sync*. The useful part of the transformation is retained in pkg/vm/lib/transformations/for_in_lowering.dart. TEST=ci Issue: https://github.com/dart-lang/sdk/issues/48378 Change-Id: Ic70c1fb35162a31bcc22eac3a8f6488b61e945b4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249944 Reviewed-by: Slava Egorov <vegorov@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
35 lines
804 B
Dart
35 lines
804 B
Dart
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
//
|
|
// Test that sync* correctly iterates through nested iterators of both
|
|
// the internal sync* iterable and generic Iterable types.
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
Iterable<int> outerSyncStar() sync* {
|
|
yield 1;
|
|
// internal sync* iterable:
|
|
yield* innerSyncStar();
|
|
yield 4;
|
|
// Generic Iterable<int>:
|
|
yield* [5, 6];
|
|
//
|
|
yield* emptySyncStar();
|
|
yield 7;
|
|
}
|
|
|
|
Iterable<int> innerSyncStar() sync* {
|
|
yield 2;
|
|
yield* [];
|
|
yield* [3];
|
|
}
|
|
|
|
Iterable<int> emptySyncStar() sync* {
|
|
yield* [];
|
|
}
|
|
|
|
main() {
|
|
Expect.listEquals([1, 2, 3, 4, 5, 6, 7], [...outerSyncStar()]);
|
|
}
|