mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 15:01:30 +00:00
8218ee0840
The `Finalizable` visitor was visiting for-in loops in AST order: (1) variable, (2) iterable, (3) body. This caused the `variable` to be fenced in the `iterable` expression. The `variable` should only be fenced in the `body`. TEST=tests/ffi/regress_51538_test.dart TEST=pkg/vm/test/transformations/ffi_test.dart with pkg/vm/testcases/transformations/ffi/regress_51538.dart Closes: https://github.com/dart-lang/sdk/issues/51538 Change-Id: Idacf87b6de3ee0d2d5c6c5046060c55135593fed Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286182 Auto-Submit: Daco Harkes <dacoharkes@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Slava Egorov <vegorov@google.com>
17 lines
441 B
Dart
17 lines
441 B
Dart
// Copyright (c) 2023, 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.
|
|
|
|
// SharedObjects=ffi_test_functions
|
|
|
|
import 'dart:ffi';
|
|
|
|
class Foo implements Finalizable {}
|
|
|
|
Future<Foo> bar() => Future.value(Foo());
|
|
|
|
void main() async {
|
|
for (final element in [await bar()]) {
|
|
print(element);
|
|
}
|
|
}
|