[babel 8] Remove methods starting with _ in @babel/traverse#16504
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/56919 |
| @@ -249,13 +247,11 @@ const methods = { | |||
| _guessExecutionStatusRelativeTo: | |||
There was a problem hiding this comment.
It has a reference externally.
| this._resyncParent(); | ||
| this._resyncList(); | ||
| this._resyncKey(); | ||
| _resyncParent.call(this); |
There was a problem hiding this comment.
What do you think of changing all these "private methods" to accept the NodePath as the first parameter instead of this, so that we can do _resyncParent(this) instead of _resyncParent.call(this)?
Then, in index.ts we have to do
Object.assign(NodePath_Final.prototype, {
...
_resyncParent: thisify(NodePath_context._resyncParent)
...where thisify is
function thisify(fn) {
return function() {
return fn(this, ...arguments);
}
}in practice those thisified functions will never be called anyway, since they are only called internally by @babel/traverse.
There was a problem hiding this comment.
Maybe we can do this after Babel 8 is more stable and avoid us needing to expose certain methods.
JLHwung
left a comment
There was a problem hiding this comment.
I am good with this change. We should include this change in the migration documents: these methods are meant to be private so there is no real migration approach. But if your plugin / build is broken by this change, feel free to open an issue and tell us how you use these methods and we can see what we can do after Babel 8 is released.
Uh oh!
There was an error while loading. Please reload this page.