erikdesjardins / babel-plugin-transform-dead-code-elimination

Babel 6 fork of babel-plugin-dead-code-elimination.
https://www.npmjs.com/package/babel-plugin-transform-dead-code-elimination
MIT License
8 stars 4 forks source link

don't dereference members that are null #24

Closed seeekr closed 8 years ago

seeekr commented 8 years ago

I don't have a specific test case to show that path.node or path.node.right can be null, but that has been happening in our parsing of valid JS code, and we're using this patch in production, so wanted to contribute it back. I couldn't think of a better commit message because I don't understand well enough what exactly is going on, what exactly the given properties being null means from a logical perspective -- so feel free to adjust the commit message, of course :)

Cheers!

erikdesjardins commented 8 years ago

Thanks!

I changed the check to t.isAssignmentExpression which should be at least as strict (if not more), but let me know if it doesn't work.

Will be released momentarily.

erikdesjardins commented 8 years ago

Released in 2.2.2 https://github.com/erikdesjardins/babel-plugin-transform-dead-code-elimination/releases/tag/v2.2.2

seeekr commented 8 years ago

Awesome, thanks! Will report with feedback!

seeekr commented 7 years ago

Changes are looking good, client says things are working well! Thanks again!

erikdesjardins commented 7 years ago

Great; not a problem!