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

Fix spacing in binary expression when right is a binary expression and has a unary on the left #3121

Merged
merged 2 commits into from
Dec 1, 2015

Conversation

amasad
Copy link
Member

@amasad amasad commented Dec 1, 2015

@@ -2,3 +2,5 @@
1 && 1;
1 + +1;
x + ++y;
(a+(+b)*2);
a + + b * 2 * 2 * 2;
Copy link
Member

Choose a reason for hiding this comment

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

Seems like we should get some - cases in here too.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

@codecov-io
Copy link

Current coverage is 84.86%

Merging #3121 into master will increase coverage by +0.01% as of afa9174

@@            master   #3121   diff @@
======================================
  Files          214     214       
  Stmts        15547   15551     +4
  Branches      3314    3315     +1
  Methods          0       0       
======================================
+ Hit          13193   13197     +4
  Partial        676     676       
  Missed        1678    1678       

Review entire Coverage Diff as of afa9174

Powered by Codecov. Updated on successful CI builds.

amasad added a commit that referenced this pull request Dec 1, 2015
Fix spacing in binary expression when right is a binary expression and has a unary on the left
@amasad amasad merged commit 27252b2 into babel:master Dec 1, 2015
@amasad amasad deleted the fix-T6736 branch December 1, 2015 18:50
@sophiebits
Copy link
Contributor

👍 looks good.

@phantom10111
Copy link
Contributor

@amasad This fixes the issue, but for example input a+(+b<<2) produces output a+ (+b<<2), with an unnecessary space. Not sure if you care about saving that one byte, but just letting you know.

@amasad
Copy link
Member Author

amasad commented Dec 1, 2015

I do care. Thanks for pointing that out. I'll look into taking prenthesized
expressions into account.

On Tuesday, December 1, 2015, phantom10111 [email protected] wrote:

@amasad https://github.com/amasad This fixes the issue, but for example
input a+(+b<<2) produces output a+ (+b<<2), with an unnecessary space.
Not sure if you care about saving that one byte, but just letting you know.


Reply to this email directly or view it on GitHub
#3121 (comment).

@mariusk
Copy link

mariusk commented Dec 1, 2015

@amasad Yes, I can confirm it works as expected now. Thanks!

@hzoo
Copy link
Member

hzoo commented Dec 1, 2015

Can add && !(node.right.extra && node.right.extra.parenthesized) for the parenthesized check - can do a pr later if you don't. Nvm it's pretty simple #3122

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 8, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants