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
getBindingIdentifiers
should return params for private methods
#13723
getBindingIdentifiers
should return params for private methods
#13723
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/48478/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 5bfc350:
|
@@ -5,7 +5,6 @@ import type { TraverseOptions } from "../index"; | |||
import Binding from "./binding"; | |||
import globals from "globals"; | |||
import { | |||
FOR_INIT_KEYS, |
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.
nice refactor here!
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.
The FOR_INIT_KEYS
is only used here. After this PR we may even remove it in Babel 8 if nobody else is using.
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.
👍
5ab190d
to
5bfc350
Compare
getBindingIdentifiers
should return params for private methods
t.getBindingIdentifiers
does not return parameter bindings for private class methodsAlso include minor tweaks around scope tracking.
Performant issue
The
getBindingIdentifiers
is generally slow due to heavy dynamics: it even allows monkey-patching its visitor keys:getBindingIdentifiers.keys
can be modified by external plugins. In my local perf test, droppinggetBindingIdentifiers.keys
can achieves 10x performance boost:current
is new implementation inlining visitor keys,current2
is a new implementation based oncurrent
which returns bindings in tail-first order: so we can avoid unnecessary memcpy introduced byarray.shift
inbabel/packages/babel-types/src/retrievers/getBindingIdentifiers.ts
Line 43 in 804a94f
we should reconsider whether we are going to support
getBindingIdentifiers.keys
in Babel 8.