-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve argument names #1344
Preserve argument names #1344
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking pretty good to me, thanks for this! Can you also manually confirm that the names of the arguments for TypeScript are coming through as well?
I think it's reasonable to avoid naming arguments for closures since in general they don't have names, and shim_argument
can be safely ignored because it's largely just used for auxiliary internal purposes rather than public-facing-API purposes
@@ -106,6 +106,7 @@ macro_rules! shared_api { | |||
} | |||
|
|||
struct Function<'a> { | |||
arg_names: Vec<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible it'd be great to use &'a str
here to allow the encoder/decoder to be pretty lean and avoid the extra String
allocations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish! syn's Ident doesn't expose &str and only implements ToString.
Ok thanks for checking and clarifying about |
Part of #1129.
wasm-bindgen/crates/backend/src/codegen.rs
Line 426 in e075d04
wasm-bindgen/crates/cli-support/src/js/rust2js.rs
Line 95 in e075d04