[dyn_modules] Expose flag in dart2bytecode to enable dcalls

This change introduces flags to allow the use of dynamic calls now that
they have their corresponding validation and runtime check. This will
enable us to add end-to-end tests next.

TEST=none yet - will be added in subsequent CL (see CL chain)

Bug: b/448095881
Change-Id: I82448824e94dd940ce5346f79554d34847ecb610
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498320
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Sigmund Cherem
2026-05-13 10:36:05 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent a2be5f37b9
commit 782c4555b4
+21
View File
@@ -142,6 +142,17 @@ final ArgParser _argParser = ArgParser(allowTrailingOptions: true)
'prefix-library-uris',
help: 'Slash-separated prefix to add to all library uris',
defaultsTo: '',
)
..addFlag(
'allow-dynamic-calls-in-dynamic-modules',
help: 'Allow dynamic calls in dynamic modules',
defaultsTo: false,
)
..addMultiOption(
'extra-selectors-allowed-in-dynamic-calls',
help:
'Selector names that weren\'t exposed by the host, but are allowed in '
'dynamic calls within the dynamic module',
);
final String _usage =
@@ -196,6 +207,10 @@ Future<int> runCompilerWithCommandLineArguments(List<String> arguments) async {
final bool trackCreationLocations = options['track-creation-locations'];
final List<String>? bytecodeGeneratorOptions = options['bytecode-options'];
final String libraryUrisPrefix = options['prefix-library-uris']!;
final bool allowDynamicCallsInDynamicModules =
options['allow-dynamic-calls-in-dynamic-modules'];
final List<String> dynamicCallsSelectorAllowList =
options['extra-selectors-allowed-in-dynamic-calls'];
return await runCompilerWithOptions(
input: input,
@@ -217,6 +232,8 @@ Future<int> runCompilerWithCommandLineArguments(List<String> arguments) async {
depfile: depfile,
depfileTarget: depfileTarget,
libraryUrisPrefix: libraryUrisPrefix,
allowDynamicCallsInDynamicModules: allowDynamicCallsInDynamicModules,
dynamicCallsSelectorAllowList: dynamicCallsSelectorAllowList,
);
}
@@ -243,6 +260,8 @@ Future<int> runCompilerWithOptions({
String? depfile,
String? depfileTarget,
required String libraryUrisPrefix,
bool allowDynamicCallsInDynamicModules = false,
List<String> dynamicCallsSelectorAllowList = const [],
}) async {
final fileSystem = createFrontEndFileSystem(
fileSystemScheme,
@@ -282,6 +301,8 @@ Future<int> runCompilerWithOptions({
..additionalDillModules = additionalDillModules
..packagesFileUri = packagesUri
..dynamicInterfaceSpecificationUri = dynamicInterfaceSpecificationUri
..allowDynamicCallsInDynamicModules = allowDynamicCallsInDynamicModules
..dynamicCallsSelectorAllowList = dynamicCallsSelectorAllowList
..explicitExperimentalFlags = parseExperimentalFlags(
parseExperimentalArguments(experimentalFlags),
onError: printMessage,