mirror of
https://github.com/fluencelabs/wasmer
synced 2025-05-04 14:52:14 +00:00
Fixed typed func implementation
This commit is contained in:
parent
44d1a0d1f9
commit
b7c3cc09d1
@ -138,9 +138,9 @@ impl<A: WasmExternType> WasmTypeList for (A,) {
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
unsafe fn call<Rets: WasmTypeList>(self, f: *const (), ctx: *mut Ctx) -> Rets {
|
||||
let f: extern "C" fn(A, *mut Ctx) -> Rets = mem::transmute(f);
|
||||
let f: extern "C" fn(*mut Ctx, A) -> Rets = mem::transmute(f);
|
||||
let (a,) = self;
|
||||
f(a, ctx)
|
||||
f(ctx, a)
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,10 +175,10 @@ macro_rules! impl_traits {
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
unsafe fn call<Rets: WasmTypeList>(self, f: *const (), ctx: *mut Ctx) -> Rets {
|
||||
let f: extern fn( $( $x, )* *mut Ctx) -> Rets::CStruct = mem::transmute(f);
|
||||
let f: extern fn(*mut Ctx $( ,$x )*) -> Rets::CStruct = mem::transmute(f);
|
||||
#[allow(unused_parens)]
|
||||
let ( $( $x ),* ) = self;
|
||||
let c_struct = f( $( $x, )* ctx);
|
||||
let c_struct = f(ctx $( ,$x )*);
|
||||
Rets::from_c_struct(c_struct)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user