mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-14 21:41:23 +00:00
Allow renaming exported functions into JS (#525)
Support the `js_name` attribute on exports as well as imports to allow exporting types as camelCase instead of snake_case, for example. Closes #221
This commit is contained in:
@ -20,6 +20,7 @@ pub struct Export {
|
||||
pub constructor: Option<String>,
|
||||
pub function: Function,
|
||||
pub comments: Vec<String>,
|
||||
pub rust_name: Ident,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "extra-traits", derive(Debug, PartialEq, Eq))]
|
||||
|
@ -297,7 +297,7 @@ impl ToTokens for ast::Export {
|
||||
0
|
||||
};
|
||||
|
||||
let name = &self.function.name;
|
||||
let name = &self.rust_name;
|
||||
let receiver = match self.method_self {
|
||||
Some(ast::MethodSelf::ByValue) => {
|
||||
let class = self.class.as_ref().unwrap();
|
||||
|
Reference in New Issue
Block a user