85cb56dd20
This changes the pattern matching lowering to avoid using late final variables (or lowerings thereof) and instead inline the initializer where used. This avoids generating closures that are hard for backends to reason about and optimize. Closes #52805 Closes #53804 Change-Id: Ia887446dd4d4475d05cf852c812bfe4b851de261 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338860 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Jens Johansen <jensj@google.com>
22 lines
480 B
Dart
22 lines
480 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.
|
|
|
|
class A {
|
|
int? f1;
|
|
double? f2;
|
|
|
|
@pragma('vm:never-inline')
|
|
String foo() {
|
|
return switch ((this.f1, this.f2)) {
|
|
(final f1, _) => '$f1',
|
|
(null, final f2) => '$f2',
|
|
(null, null) => '?',
|
|
};
|
|
}
|
|
}
|
|
|
|
void main() {
|
|
print(A().foo());
|
|
}
|