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

Ensure binding exists #244

Merged
merged 1 commit into from
Nov 3, 2016
Merged

Ensure binding exists #244

merged 1 commit into from
Nov 3, 2016

Conversation

kangax
Copy link
Member

@kangax kangax commented Nov 2, 2016

I ran into this with one of our files. Don't have an easily reproducible testcase but maybe someone can think of something?

@@ -840,7 +840,7 @@ module.exports = ({ types: t, traverse }) => {
const binding = scope.getBinding(id.name);

// Check if shadowed or is not referenced.
if (binding.path.node !== node || !binding.referenced) {
if (binding && (binding.path.node !== node || !binding.referenced)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for a function/class expression ... weird that there is no binding but an id exists.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anyway this check is harmless, will merge it, can we just add a TODO: comment just above this line ... This function is affected when fixing this bug too afaik - #226

@boopathi boopathi added the Tag: Bug Fix Pull Request fixes a bug label Nov 2, 2016
@kangax
Copy link
Member Author

kangax commented Nov 3, 2016

@boopathi so... you want me to add a comment that reads "This function is affected when fixing this bug too afaik - #226" Or something else? Sorry, I didn't understand.

@boopathi
Copy link
Member

boopathi commented Nov 3, 2016

I was essentially re-writing this function to fix #226 ... Never mind .. I'll just keep this in mind ..

@boopathi boopathi merged commit 0f3fc78 into master Nov 3, 2016
@boopathi boopathi deleted the binding branch November 3, 2016 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tag: Bug Fix Pull Request fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants