mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
* fix: fixed issue16583 + test * modified getBinding to getOwnBinding (same scope) * reverted babel-plugin-proposal-do-expressions back * refactor: moved fix from scope/index.ts to path/removal.ts * add fail test * fix * review * Update packages/babel-traverse/test/fixtures/scope/remove-nested-let-path/plugin.js Co-authored-by: Nicolò Ribaudo <[email protected]> * review * Update packages/babel-traverse/src/path/lib/removal-hooks.ts --------- Co-authored-by: Babel Bot <[email protected]> Co-authored-by: Nicolò Ribaudo <[email protected]>
18 lines
402 B
JavaScript
18 lines
402 B
JavaScript
module.exports = function ({ types }) {
|
|
return {
|
|
visitor: {
|
|
VariableDeclarator(path) {
|
|
const { value } = path.node.init;
|
|
|
|
if (value === 33) path.remove();
|
|
|
|
types.addComment(
|
|
path.scope.getProgramParent().path.node,
|
|
"trailing",
|
|
`// a is defined when visiting a=${value}? ${path.scope.hasBinding("a")}`
|
|
);
|
|
},
|
|
},
|
|
};
|
|
};
|