loadBytecode method

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

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

Implementation

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