Skip to content

odd format with if-return (no braces) if return expression is long #45

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

Closed
sigmundch opened this issue Nov 18, 2014 · 1 comment
Closed

Comments

@sigmundch
Copy link
Member

I'm not sure we can do anything better here, but I'm just creating this bug in case there is something I'm missing.

This program

foo() {
  if (xxxxxxxxxxxxxxxx || xxxxxxxxxxxxxxxxxxxxx)
    return xxxxxxxxxxxxxx ? xxxxxxxxxxxxxxxxxxxx : xxxxxxxxxxxxxxxxxxxxxxxxxx;
}

is generated as:

foo() {
  if (xxxxxxxxxxxxxxxx || xxxxxxxxxxxxxxxxxxxxx) return xxxxxxxxxxxxxx ?
      xxxxxxxxxxxxxxxxxxxx : xxxxxxxxxxxxxxxxxxxxxxxxxx;
}

can we do better?

@munificent
Copy link
Member

If you have a wrapped line on a single-line if, your code is bad and you should feel bad. This is basically what I expect it to do here.

Added a regression test: https://chromiumcodereview.appspot.com/791113002/

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

No branches or pull requests

2 participants