@@ -815,7 +815,7 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
815815 return Tok.is (tok::l_paren) && Tok.ParameterCount > 0 && Tok.Previous &&
816816 Tok.Previous ->is (tok::identifier);
817817 };
818- const auto IsInTemplateString = [this ](const FormatToken &Tok) {
818+ auto IsInTemplateString = [this ](const FormatToken &Tok) {
819819 if (!Style.isJavaScript ())
820820 return false ;
821821 for (const auto *Prev = &Tok; Prev; Prev = Prev->Previous ) {
@@ -827,7 +827,10 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
827827 return false ;
828828 };
829829 // Identifies simple (no expression) one-argument function calls.
830- const auto IsSimpleFunction = [&](const FormatToken &Tok) {
830+ auto StartsSimpleOneArgList = [&](const FormatToken &TokAfterLParen) {
831+ assert (TokAfterLParen.isNot (tok::comment) || TokAfterLParen.Next );
832+ const auto &Tok =
833+ TokAfterLParen.is (tok::comment) ? *TokAfterLParen.Next : TokAfterLParen;
831834 if (!Tok.FakeLParens .empty () && Tok.FakeLParens .back () > prec::Unknown)
832835 return false ;
833836 // Nested calls that involve `new` expressions also look like simple
@@ -836,6 +839,11 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
836839 // - foo(::new Bar())
837840 if (Tok.is (tok::kw_new) || Tok.startsSequence (tok::coloncolon, tok::kw_new))
838841 return true ;
842+ if (Tok.is (TT_UnaryOperator) ||
843+ (Style.isJavaScript () &&
844+ Tok.isOneOf (tok::ellipsis, Keywords.kw_await ))) {
845+ return true ;
846+ }
839847 const auto *Previous = Tok.Previous ;
840848 if (!Previous || (!Previous->isOneOf (TT_FunctionDeclarationLParen,
841849 TT_LambdaDefinitionLParen) &&
@@ -861,7 +869,7 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
861869 // or
862870 // caaaaaaaaaaaaaaaaaaaaal(
863871 // new SomethingElseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee());
864- !IsSimpleFunction (Current)) {
872+ !StartsSimpleOneArgList (Current)) {
865873 CurrentState.NoLineBreak = true ;
866874 }
867875
0 commit comments