loadBytecode method

dynamic loadBytecode({
  1. required Uint8List bytes,
  2. required String moduleName,
  3. bool globallyImport = false,
  4. String? invokeFunc,
  5. List positionalArgs = const [],
  6. Map<String, dynamic> namedArgs = const {},
  7. List<HTType> typeArgs = const [],
})

Load a bytecode module and immediately run a function in it.

Implementation

dynamic loadBytecode(
    {required Uint8List bytes,
    required String moduleName,
    bool globallyImport = false,
    String? invokeFunc,
    List<dynamic> positionalArgs = const [],
    Map<String, dynamic> namedArgs = const {},
    List<HTType> typeArgs = const []}) {
  final result = interpreter.loadBytecode(
    bytes: bytes,
    moduleName: moduleName,
    globallyImport: globallyImport,
    invokeFunc: invokeFunc,
    positionalArgs: positionalArgs,
    namedArgs: namedArgs,
    typeArgs: typeArgs,
    printPerformanceStatistics: config.printPerformanceStatistics,
  );
  if (config.doStaticAnalysis &&
      interpreter.currentBytecodeModule.namespaces.isNotEmpty) {
    analyzer.globalNamespace.import(
        interpreter.currentBytecodeModule.namespaces.values.last,
        idOnly: true);
  }
  return result;
}