Replace run with runLinked, allow modules that don't export functions

This commit is contained in:
Andrew Morris
2023-03-28 16:56:01 +11:00
parent c199d3bb8e
commit 8d7fe133f3
6 changed files with 36 additions and 93 deletions

View File

@@ -22,4 +22,4 @@ mod vs_pointer;
mod vs_value;
pub use virtual_machine::VirtualMachine;
pub use vs_value::ValTrait;
pub use vs_value::{LoadFunctionResult, ValTrait};

View File

@@ -97,4 +97,13 @@ impl VirtualMachine {
Err(exception)
}
pub fn read_default_export(bytecode: &Rc<Vec<u8>>) -> Val {
let mut bd = BytecodeDecoder {
data: bytecode.clone(),
pos: 0,
};
bd.decode_val(&Vec::new())
}
}