diff options
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index ce6ebd84b6a..c48df870416 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -656,7 +656,10 @@ unsigned ContinuationIndenter::moveStateToNextToken(LineState &State, } if (Current.TokenText == "function") State.Stack.back().JSFunctionInlined = - !Newline && Previous && Previous->Type != TT_DictLiteral; + !Newline && Previous && Previous->Type != TT_DictLiteral && + // If the unnamed function is the only parameter to another function, + // we can likely inline it and come up with a good format. + (Previous->isNot(tok::l_paren) || Previous->ParameterCount > 1); } moveStatePastFakeLParens(State, Newline); |