1b75e2701c
This CL adds support for promotion of certain private final instance variables along with anonymous methods. The promotions do not differ from the ones which are already available in Dart without anonymous methods, but it requires some generalizations to handle the changing value of `this` which is made possible by anonymous methods. Change-Id: I720a5fa6d29a8a7d19bb2e167dc135f97492b525 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498840 Reviewed-by: Paul Berry <paulberry@google.com>
14 lines
462 B
Dart
14 lines
462 B
Dart
// Copyright (c) 2026, 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.
|
|
|
|
// SharedOptions=--enable-experiment=anonymous-methods
|
|
|
|
import 'package:expect/expect.dart';
|
|
|
|
void main() {
|
|
final int? x = 2;
|
|
Expect.isTrue((x != null).=> this ? x.isEven : false);
|
|
Expect.isTrue((x != null).(b) => b ? x.isEven : false);
|
|
}
|