Skip to content
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

@babel/types: getBindingIdentifiers: add Property to support estree s… #9258

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

coderaiser
Copy link
Contributor

@coderaiser coderaiser commented Dec 29, 2018

…tandard

Q                       A
Fixed Issues? fixes ability to identify variables when estree plugin used (#8879)
Patch: Bug Fix? Yes
Major: Breaking Change? No
Minor: New Feature? Yes
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

Add ability to use @babel/traverse using estree plugin, also fixes https://github.com/cherow/cherow/issues/273:

const babel = require('@babel/parser');
const traverse = require('@babel/traverse').default;

const source = `
    const t = ({a}) => a
`;

const babelAST = babel.parse(source, {
    plugins: [
       'estree', // with estree plugin @babel/traverse doesn't define variables
    ]
});

traverse(babelAST, {
    Identifier(path) {
        console.log('babel:', path.scope.hasBinding('a'));
        //outputs
        false
    }
});

@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/9676/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants