codegen: Minor cleanup after #1691.

This commit is contained in:
Emilio Cobos Álvarez 2019-12-11 03:14:19 +01:00
parent 560354e4f1
commit b3c3980d23
No known key found for this signature in database
GPG Key ID: E1152D0994E4BF8A

View File

@ -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);
}
}