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
Inline parameters #5751
base: master
Are you sure you want to change the base?
Inline parameters #5751
Conversation
Similar to what path.find does for ancestors, path.findChild finds the first match for a given type and an optional predicate function
Moves all the parameters to body in an arrayPattern initializer. Uses block scoping for the case of function declaration as a default argument.
@peey, thanks for your PR! By analyzing the history of the files in this pull request, we identified @hzoo, @existentialism and @boopathi to be potential reviewers. |
Codecov Report
@@ Coverage Diff @@
## 7.0 #5751 +/- ##
=========================================
+ Coverage 85.15% 85.25% +0.1%
=========================================
Files 284 285 +1
Lines 9953 10025 +72
Branches 2776 2789 +13
=========================================
+ Hits 8475 8547 +72
+ Misses 977 974 -3
- Partials 501 504 +3
Continue to review full report at Codecov.
|
5369574
to
104cef3
Compare
To be able to use the process variable in tests to ignore node versions without support for language features required by the test
@@ -0,0 +1,11 @@ | |||
if (parseInt(process.version.slice(1)) < 6) process.exit(); |
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.
Would be great if you can update to use the newly merged minNodeVersion
option and get rid of the node check & eval here and a few other tests in this PR.
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.
Thanks for adding that feature! I'll update my code asap :)
Why does this require an array destructuring? |
@jridgewell the idea is that instead of duplicating all destructing and rest/spread logic (in argument defaults) for parameters, we have a general function which would inline the parameters into the function body. Then the code to handle array destructing and rest/spread could do the further processing. |
@loganfsmyth need your thoughts on this if you still think this is a good idea. After this we can proceed on incorporating it into object-rest-spread and the parameters transform to solve a lot of issues. |
Add
path.inlineParameters()
for use ines2015-parameters
andobject-rest-spread
pluginsNot Added:
es2015-parameters
plugin, I think that's a better place for that logic.