registerGlobalVariables static method
Registers all global variables with the interpreter.
importPath is the package import path for library-scoped registration.
Collects all registration errors and throws a single exception
with all error details if any registrations fail.
Implementation
static void registerGlobalVariables(D4rt interpreter, String importPath) {
final errors = <String>[];
try {
interpreter.registerGlobalVariable(
'cliLibrary',
$tom_dcli_exec_2.cliLibrary,
importPath,
sourceUri: 'package:tom_dcli_exec/src/api/cli_bridge.dart',
);
} catch (e) {
errors.add('Failed to register variable "cliLibrary": $e');
}
try {
interpreter.registerGlobalVariable(
'cliGlobalHolder',
$tom_dcli_exec_2.cliGlobalHolder,
importPath,
sourceUri: 'package:tom_dcli_exec/src/api/cli_bridge.dart',
);
} catch (e) {
errors.add('Failed to register variable "cliGlobalHolder": $e');
}
interpreter.registerGlobalGetter(
'verificationFailures',
() => $tom_dcli_exec_8.verificationFailures,
importPath,
sourceUri: 'package:tom_dcli_exec/src/api/cli_test_utils.dart',
);
if (errors.isNotEmpty) {
throw StateError(
'Bridge registration errors (cli_api):\n${errors.join("\n")}',
);
}
}