b083c9ac87
When const constructor is exposed through a dynamic interface, dynamic module can create constants with that const constructor and it can reference everything used in that constructor including default values of parameters and field initializers. So dynamic interface annotator should visit bodies of const constructors and add all references to implicit uses. Annotator should also visit initializers of instance fields of classes which can be used in a constant (as they participate in the constant evaluation too). Kernel trim tool should not remove such field initializers. TEST=pkg/dynamic_modules/test/data/const_constructor Fixes b/418928636 Change-Id: Ie216f3a4257fe5a905b83af8c60dfe8a5b774ecf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430002 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com> Reviewed-by: Slava Egorov <vegorov@google.com>
16 lines
587 B
Dart
16 lines
587 B
Dart
// Copyright (c) 2025, 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.
|
|
|
|
import '../../common/testing.dart' as helper;
|
|
import 'package:expect/expect.dart';
|
|
|
|
import 'shared/shared.dart'; // ignore: unused_import
|
|
|
|
/// Verify that default values of const constructor parameters are retained.
|
|
void main() async {
|
|
final result = (await helper.load('entry1.dart')) as String;
|
|
Expect.equals("Foo1:41 Foo2:42 Foo3:43", result);
|
|
helper.done();
|
|
}
|