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

Support JS function calls with up to 7 arguments in Embedded Swift #281

Merged
merged 2 commits into from
Jan 16, 2025

Conversation

ole
Copy link
Contributor

@ole ole commented Jan 15, 2025

This fixes #279.

Notes:

  • The choice up to how many aguments to support before we can replace everything with a single varadic generics funtion is arbitrary. I chose to go up to 7 arguments because JSFunction.new already had some overloads with up to 7 arguments, so this seemed the most consistent.

  • I used a different code style for the new overloads where each generic parameter is put on its own line. I'm aware that this doesn't follow the project's code style, but I found the alternative (the full function signature on a single line) pretty much unreadable. Please let me know if you want me to change this.

  • I didn't add any tests for the new functionality because the existing test suite isn't built/executed in Embedded Swift mode anyway, so the new code wouldn't even be built. I did a quick test locally to ensure the overloads work. I hope this is OK, but please let me know if you want more. If so, we have to integrate an Embedded Swift build into the testing process.

ole added 2 commits January 15, 2025 19:52
This is the only of many overloads that does *not* remove the external argument label for one of its parameters. Looks like a copy/paste error.
Copy link
Member

@kateinoigakukun kateinoigakukun left a comment

Choose a reason for hiding this comment

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

Seems good to me

@kateinoigakukun kateinoigakukun merged commit 9135044 into swiftwasm:main Jan 16, 2025
14 checks passed
@ole ole deleted the embedded-function-call-overloads branch January 16, 2025 09:26
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.

Unable to call JS functions with more than 2 arguments in Embedded Swift
2 participants