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

If..Else preserve vars from the removed Block #52

Merged
merged 2 commits into from
Jul 23, 2016
Merged

Conversation

boopathi
Copy link
Member

This somehow makes one test case fail due to some indentation issue.

I'm doing path.skip() the paths that are removed - is that safe to do ?

+ (Close #48)
+ dead-code-elimination
node.alternate = null;
node.test = t.unaryExpression("!", test, true);
consequent.replaceWith(alternate.node);
alternate.skip();
Copy link
Member Author

Choose a reason for hiding this comment

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

here, is it safe to skip this, as the node will be inserted in consequent and will go through other plugins and the alternate node removed will be skipped. Should there be a test case for this ?

Copy link
Member

Choose a reason for hiding this comment

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

Sure, can you please add a test for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done 👍

Copy link
Member

Choose a reason for hiding this comment

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

FYI: babel-traverse marks it as shouldSkip when .remove

@kangax
Copy link
Member

kangax commented Jul 22, 2016

LGTM

A test case to verify that optimizations are applied when an empty
consequent block statement is replaced with the alternate statement.
@boopathi
Copy link
Member Author

Now there are 2 failing test cases because of indentation issues, help!

@kangax
Copy link
Member

kangax commented Jul 23, 2016

Ok, I'll merge and check tests locally

@kangax kangax merged commit 008ddca into master Jul 23, 2016
@kangax kangax deleted the if-else-preserve-vars branch July 23, 2016 19:49
@amasad
Copy link
Member

amasad commented Jul 31, 2016

This introduced some regressions, looking at it now. You can see the failing tests here: https://travis-ci.com/amasad/babel-minify/jobs/46513934

@boopathi boopathi mentioned this pull request Sep 29, 2016
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.

3 participants