|
@@ -786,6 +786,9 @@ private:
|
|
Current.Type = TT_StartOfName;
|
|
Current.Type = TT_StartOfName;
|
|
} else if (Current.is(tok::kw_auto)) {
|
|
} else if (Current.is(tok::kw_auto)) {
|
|
AutoFound = true;
|
|
AutoFound = true;
|
|
|
|
+ } else if (Current.is(tok::arrow) &&
|
|
|
|
+ Style.Language == FormatStyle::LK_Java) {
|
|
|
|
+ Current.Type = TT_LambdaArrow;
|
|
} else if (Current.is(tok::arrow) && AutoFound &&
|
|
} else if (Current.is(tok::arrow) && AutoFound &&
|
|
Line.MustBeDeclaration && Current.NestingLevel == 0) {
|
|
Line.MustBeDeclaration && Current.NestingLevel == 0) {
|
|
Current.Type = TT_TrailingReturnArrow;
|
|
Current.Type = TT_TrailingReturnArrow;
|
|
@@ -1167,6 +1170,8 @@ private:
|
|
else if (NextNonComment && NextNonComment->is(tok::colon) &&
|
|
else if (NextNonComment && NextNonComment->is(tok::colon) &&
|
|
NextNonComment->Type == TT_DictLiteral)
|
|
NextNonComment->Type == TT_DictLiteral)
|
|
return prec::Comma;
|
|
return prec::Comma;
|
|
|
|
+ else if (Current->is(TT_LambdaArrow))
|
|
|
|
+ return prec::Comma;
|
|
else if (Current->is(tok::semi) || Current->Type == TT_InlineASMColon ||
|
|
else if (Current->is(tok::semi) || Current->Type == TT_InlineASMColon ||
|
|
Current->Type == TT_SelectorName ||
|
|
Current->Type == TT_SelectorName ||
|
|
(Current->is(tok::comment) && NextNonComment &&
|
|
(Current->is(tok::comment) && NextNonComment &&
|
|
@@ -1701,6 +1706,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
|
|
if (Left.is(Keywords.kw_var))
|
|
if (Left.is(Keywords.kw_var))
|
|
return true;
|
|
return true;
|
|
} else if (Style.Language == FormatStyle::LK_Java) {
|
|
} else if (Style.Language == FormatStyle::LK_Java) {
|
|
|
|
+ if (Left.is(TT_LambdaArrow) || Right.is(TT_LambdaArrow))
|
|
|
|
+ return true;
|
|
if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren))
|
|
if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren))
|
|
return Style.SpaceBeforeParens != FormatStyle::SBPO_Never;
|
|
return Style.SpaceBeforeParens != FormatStyle::SBPO_Never;
|
|
if (Left.isOneOf(tok::kw_static, tok::kw_public, tok::kw_private,
|
|
if (Left.isOneOf(tok::kw_static, tok::kw_public, tok::kw_private,
|