mirror of
https://gitee.com/openharmony/third_party_rust_bindgen
synced 2024-12-13 18:27:14 +00:00
codegen: Minor cleanup after #1691.
This commit is contained in:
parent
560354e4f1
commit
b3c3980d23
@ -3612,22 +3612,21 @@ impl CodeGenerator for Function {
|
||||
}
|
||||
|
||||
// Unfortunately this can't piggyback on the `attributes` list because
|
||||
// the #[link(wasm_import_module)] needs to happen before the `extern "C"` block.
|
||||
// it doesn't get picked up properly otherwise
|
||||
// the #[link(wasm_import_module)] needs to happen before the `extern
|
||||
// "C"` block. It doesn't get picked up properly otherwise
|
||||
let wasm_link_attribute =
|
||||
ctx.options().wasm_import_module_name.as_ref().map(|name| {
|
||||
quote! {
|
||||
#[link(wasm_import_module = #name)]
|
||||
}
|
||||
quote! { #[link(wasm_import_module = #name)] }
|
||||
});
|
||||
|
||||
let ident = ctx.rust_ident(canonical_name);
|
||||
let tokens = quote!(
|
||||
let tokens = quote! {
|
||||
#wasm_link_attribute
|
||||
extern #abi {
|
||||
#(#attributes)*
|
||||
pub fn #ident ( #( #args ),* ) #ret;
|
||||
});
|
||||
}
|
||||
};
|
||||
result.push(tokens);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user