forked from OSchip/llvm-project
clang-format: [JS] Properly add a space after "in" in for loops.
llvm-svn: 253672
This commit is contained in:
parent
09840efd92
commit
f95b1f4546
|
@ -1955,7 +1955,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
|
|||
Left.isOneOf(Keywords.kw_returns, Keywords.kw_option))
|
||||
return true;
|
||||
} else if (Style.Language == FormatStyle::LK_JavaScript) {
|
||||
if (Left.isOneOf(Keywords.kw_let, Keywords.kw_var, TT_JsFatArrow))
|
||||
if (Left.isOneOf(Keywords.kw_let, Keywords.kw_var, TT_JsFatArrow,
|
||||
Keywords.kw_in))
|
||||
return true;
|
||||
if (Right.isOneOf(TT_JsTypeColon, TT_JsTypeOptionalQuestion))
|
||||
return false;
|
||||
|
|
|
@ -545,6 +545,11 @@ TEST_F(FormatTestJS, ReturnStatements) {
|
|||
"}");
|
||||
}
|
||||
|
||||
TEST_F(FormatTestJS, ForLoops) {
|
||||
verifyFormat("for (var i in [2, 3]) {\n"
|
||||
"}");
|
||||
}
|
||||
|
||||
TEST_F(FormatTestJS, AutomaticSemicolonInsertion) {
|
||||
// The following statements must not wrap, as otherwise the program meaning
|
||||
// would change due to automatic semicolon insertion.
|
||||
|
|
Loading…
Reference in New Issue