Skip to content
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

Fix multiword exports #424

Merged
merged 2 commits into from
Jul 11, 2023
Merged

Fix multiword exports #424

merged 2 commits into from
Jul 11, 2023

Conversation

jeffcharles
Copy link
Collaborator

Fixes #420.

We translate the kebab-cased identifiers in the WIT file to camel-cased identifiers in the JavaScript and retain the kebab-cased identifiers for the name of the Wasm function exports since the WIT describes the export names for the Wasm.

pub js: String,
}

pub fn determine_js_exports(js: &JS, wit: &Path, wit_world: &str) -> Result<Vec<Export>> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some documentation here or rename this function to something that indicates that we are renaming and searching the relevant exports (e.g process_exports)? At a first glance it was not evident, at least to me, that here's where all the casing is happening.

Copy link
Collaborator Author

@jeffcharles jeffcharles Jul 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking with determine_js_exports was it was getting a list of WIT exports and determining which JS export corresponded to each of them. There isn't any renaming going on, the data structure that gets sent back is essentially (wit_export, js_export). Maybe that counts a rename? I didn't think about it that way. That said, I'll use a different name given the current one seems to not be clear. process_exports seems fine to me so I'll update to use that.

@saulecabrera saulecabrera enabled auto-merge (squash) July 11, 2023 13:56
@saulecabrera saulecabrera merged commit f83174e into main Jul 11, 2023
6 checks passed
@saulecabrera saulecabrera deleted the jc.fix-multiword-exports branch July 11, 2023 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support function exports with multiple words
2 participants