mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 02:00:51 +00:00
Fix a few more mistakes from slices
This commit is contained in:
parent
0970fa2998
commit
9e7a4e7e60
@ -1031,7 +1031,7 @@ impl<'a, 'b> SubContext<'a, 'b> {
|
||||
", i = i, func = func, arg = name));
|
||||
pass(&format!("ptr{}", i));
|
||||
pass(&format!("len{}", i));
|
||||
if ty.owned {
|
||||
if !ty.owned {
|
||||
destructors.push_str(&format!("\n\
|
||||
wasm.__wbindgen_free(ptr{i}, len{i});\n\
|
||||
", i = i));
|
||||
|
@ -148,7 +148,7 @@ fn bindgen_export(export: &ast::Export, into: &mut Tokens) {
|
||||
let ptr = syn::Ident::from(format!("arg{}_ptr", i));
|
||||
let len = syn::Ident::from(format!("arg{}_len", i));
|
||||
let abi_ty = ty.abi_element();
|
||||
args.push(my_quote! { #ptr: *const #abi_ty });
|
||||
args.push(my_quote! { #ptr: *mut #abi_ty });
|
||||
args.push(my_quote! { #len: usize });
|
||||
if owned {
|
||||
arg_conversions.push(my_quote! {
|
||||
@ -159,7 +159,7 @@ fn bindgen_export(export: &ast::Export, into: &mut Tokens) {
|
||||
} else {
|
||||
arg_conversions.push(my_quote! {
|
||||
let #ident = unsafe {
|
||||
::std::slice::from_raw_parts(#ptr, #len)
|
||||
::std::slice::from_raw_parts(#ptr as *const #abi_ty, #len)
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ pub const TYPE_SLICE_F64: char = '\u{71}';
|
||||
pub const TYPE_JS_OWNED: char = '\u{72}';
|
||||
pub const TYPE_JS_REF: char = '\u{73}';
|
||||
|
||||
pub const TYPE_CUSTOM_START: u32 = 0x64;
|
||||
pub const TYPE_CUSTOM_START: u32 = 0x74;
|
||||
pub const TYPE_CUSTOM_REF_FLAG: u32 = 1;
|
||||
|
||||
pub fn name_to_descriptor(name: &str) -> char {
|
||||
|
Loading…
x
Reference in New Issue
Block a user