-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
Add default parameter support #988
Conversation
default parameters use default arguments when explicitly passing undefined run rustfmt
3ecc73a
to
6c7f95f
Compare
Codecov Report
@@ Coverage Diff @@
## master #988 +/- ##
=======================================
Coverage 59.67% 59.67%
=======================================
Files 166 166
Lines 10813 10823 +10
=======================================
+ Hits 6453 6459 +6
- Misses 4360 4364 +4
Continue to review full report at Codecov.
|
Need to handle scope correctly (function body has a separate scope if default parameters are used: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters#Scope_Effects) but can't really test this due to #989. |
If I understand this correctly, this is blocked on #989, right? |
Yeah. I have a commit that sets up the right scopes in theory, but it doesn't work correctly due to issues caused by #989 (the second scope effects example given on the MDN page is a good showcase of the bug) so I can't fully finish this and add tests. |
Hello @0x7D2B is there any progress on this? |
I should probably restart this one from scratch. |
Modern JavaScript has support for default parameters in functions. Boa has support for the syntax but currently default parameters are ignored. For example, this code:
Result produced by current Boa master:
Expected result:
This PR implements support for this feature.