Remove some NodePath methods#16655
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/57498 |
NodePath methodsNodePath methods
|
|
||
| Object.assign(NodePath_Final.prototype, { | ||
| // @ts-expect-error Babel 7 only | ||
| has: NodePath_introspection[String("has")], |
There was a problem hiding this comment.
What is String(...) for?
There was a problem hiding this comment.
This is for rollup, otherwise it will show that the export cannot be found.
There was a problem hiding this comment.
Can you add a comment? :)
There was a problem hiding this comment.
There is a comment here and it seems the location is a bit far away. :)
| * referencing it. | ||
| */ | ||
| // eslint-disable-next-line no-restricted-globals | ||
| exports.hoist = function hoist<T extends t.Node>( |
There was a problem hiding this comment.
Out of curiosity, what was this ever used for?
There was a problem hiding this comment.
It seems to be used by babel-plugin-transform-react-constant-elements, I'm not sure, it has no use now.
JLHwung
left a comment
There was a problem hiding this comment.
I think we should provide specific migration docs for the NodePath introspection methods, as they can be replaced by queries on path.node. Removing them incurs more impact than the other methods.
24fb6ff to
c68e961
Compare
c68e961 to
324ddd4
Compare
324ddd4 to
439b708
Compare
|
There is no reasoning here why the change is needed, can someone enlighten the rest of us? To me this just starts looking more complicated and unidiomatic code now, for example: - path.resync();
+ resync.call(path);It looks like functional programming is trying to take over and making it unreadable. |
|
@kungfooman This is to make them private and users won't be able to call them. We may avoid passing |
|
Yeah, in the future that will just become |
Uh oh!
There was an error while loading. Please reload this page.