Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Unified Diff: tools/gn/command_format.cc

Issue 774753004: gn format: fix not indenting multiline continued correctly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-format-dont-break-if-will-never-fit
Patch Set: rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/gn/command_format_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/command_format.cc
diff --git a/tools/gn/command_format.cc b/tools/gn/command_format.cc
index 1ce072de194959c0eb26348ea40854fa548f2f80..0866f6f3aae594941e6a6da119146417943bce4c 100644
--- a/tools/gn/command_format.cc
+++ b/tools/gn/command_format.cc
@@ -471,8 +471,9 @@ int Printer::Expr(const ParseNode* root,
if (stack_.back().continuation_requires_indent)
indent_column += kIndentSize * 2;
- stack_.push_back(
- IndentState(indent_column, false, binop->op().value() == "||"));
+ stack_.push_back(IndentState(indent_column,
+ stack_.back().continuation_requires_indent,
+ binop->op().value() == "||"));
Printer sub_left;
InitializeSub(&sub_left);
sub_left.Expr(binop->left(),
@@ -709,9 +710,7 @@ int Printer::FunctionCall(const FunctionCallNode* func_call,
// Special case to make function calls of one arg taking a long list of
// boolean operators not indent.
bool continuation_requires_indent =
- list.size() != 1 || !list[0]->AsBinaryOp() ||
- (list[0]->AsBinaryOp()->op().value() != "||" &&
- list[0]->AsBinaryOp()->op().value() != "&&");
+ list.size() != 1 || !list[0]->AsBinaryOp();
// 1: Same line.
Printer sub1;
« no previous file with comments | « no previous file | tools/gn/command_format_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698