mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-11 06:36:05 +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));
|
", i = i, func = func, arg = name));
|
||||||
pass(&format!("ptr{}", i));
|
pass(&format!("ptr{}", i));
|
||||||
pass(&format!("len{}", i));
|
pass(&format!("len{}", i));
|
||||||
if ty.owned {
|
if !ty.owned {
|
||||||
destructors.push_str(&format!("\n\
|
destructors.push_str(&format!("\n\
|
||||||
wasm.__wbindgen_free(ptr{i}, len{i});\n\
|
wasm.__wbindgen_free(ptr{i}, len{i});\n\
|
||||||
", i = i));
|
", 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 ptr = syn::Ident::from(format!("arg{}_ptr", i));
|
||||||
let len = syn::Ident::from(format!("arg{}_len", i));
|
let len = syn::Ident::from(format!("arg{}_len", i));
|
||||||
let abi_ty = ty.abi_element();
|
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 });
|
args.push(my_quote! { #len: usize });
|
||||||
if owned {
|
if owned {
|
||||||
arg_conversions.push(my_quote! {
|
arg_conversions.push(my_quote! {
|
||||||
@ -159,7 +159,7 @@ fn bindgen_export(export: &ast::Export, into: &mut Tokens) {
|
|||||||
} else {
|
} else {
|
||||||
arg_conversions.push(my_quote! {
|
arg_conversions.push(my_quote! {
|
||||||
let #ident = unsafe {
|
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_OWNED: char = '\u{72}';
|
||||||
pub const TYPE_JS_REF: char = '\u{73}';
|
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 const TYPE_CUSTOM_REF_FLAG: u32 = 1;
|
||||||
|
|
||||||
pub fn name_to_descriptor(name: &str) -> char {
|
pub fn name_to_descriptor(name: &str) -> char {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user