mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-06-12 06:21:40 +00:00
Host modules now ImportResolvers
This commit is contained in:
@ -44,6 +44,30 @@ impl fmt::Debug for FuncInstance {
|
||||
}
|
||||
|
||||
impl FuncInstance {
|
||||
pub fn alloc_internal(
|
||||
module: Rc<ModuleInstance>,
|
||||
func_type: Rc<FunctionType>,
|
||||
body: FuncBody,
|
||||
) -> Rc<Self> {
|
||||
let func = FuncInstance::Internal {
|
||||
func_type,
|
||||
module: module,
|
||||
body: Rc::new(body),
|
||||
};
|
||||
Rc::new(func)
|
||||
}
|
||||
|
||||
pub fn alloc_host(
|
||||
func_type: Rc<FunctionType>,
|
||||
host_func: Rc<AnyFunc>,
|
||||
) -> Rc<Self> {
|
||||
let func = FuncInstance::Host {
|
||||
func_type,
|
||||
host_func,
|
||||
};
|
||||
Rc::new(func)
|
||||
}
|
||||
|
||||
pub fn func_type(&self) -> Rc<FunctionType> {
|
||||
match *self {
|
||||
FuncInstance::Internal { ref func_type, .. } |
|
||||
@ -57,9 +81,7 @@ impl FuncInstance {
|
||||
FuncInstance::Host { .. } => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FuncInstance {
|
||||
pub fn invoke<St: 'static>(
|
||||
func: Rc<FuncInstance>,
|
||||
args: Vec<RuntimeValue>,
|
||||
|
Reference in New Issue
Block a user