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

Only generate Js values for string enums if used #4193

Merged
merged 3 commits into from
Oct 13, 2024

Conversation

RunDevelopment
Copy link
Contributor

This fixes the issue we talked about here. Basically, in #4147 I changed the bindings of string enums to use a variable storing an array (point 3). However, this array was always generated regardless of whether it was actually used or not.

This PR fixes the issue by marking which enums are used as the bindings are generated. Since we always generate the bindings of function that can use string enums before the variable of a string enum, this works out. I used the same expose_* pattern for the function that is commonly used for this type of task.

Copy link
Collaborator

@daxpedda daxpedda left a comment

Choose a reason for hiding this comment

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

Thank you, this is great!

@daxpedda daxpedda merged commit 5e98a17 into rustwasm:main Oct 13, 2024
41 checks passed
@RunDevelopment RunDevelopment deleted the rm-unused-string-enum-arrays branch October 13, 2024 20:37
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.

2 participants