mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:47:13 +00:00
cfecec5eec
All for-in loops became synchronous ones when mixed in. This is obviously wrong. Fixes https://github.com/dart-lang/sdk/issues/34877 Change-Id: I26f71724ea68f37ce4813790ae003b51479874fc Reviewed-on: https://dart-review.googlesource.com/c/81277 Auto-Submit: Kevin Millikin <kmillikin@google.com> Commit-Queue: Kevin Millikin <kmillikin@google.com> Commit-Queue: Vyacheslav Egorov <vegorov@google.com> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
25 lines
656 B
Dart
25 lines
656 B
Dart
// Copyright (c) 2018, 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.
|
|
|
|
// Regression test: ensure that async for loops remain async for loops when
|
|
// mixed in.
|
|
|
|
import 'dart:async';
|
|
|
|
abstract class _Mixin {
|
|
Future<int> stuff(Stream<int> values) async {
|
|
var total = 0;
|
|
await for (var value in values) {
|
|
total += value;
|
|
}
|
|
return total;
|
|
}
|
|
}
|
|
|
|
class Implementation extends Object with _Mixin {}
|
|
|
|
void main() async {
|
|
print(await Implementation().stuff(Stream.fromIterable([1, 2, 3])));
|
|
}
|