diff options
-rw-r--r-- | src/codegen/mod.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index b1612c70..ac68c20b 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -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); } } |