Summary: A closing parenthesis followed by a declaration or statement should always terminate the current statement.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D36491
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310482
91177308-0d34-0410-b5e6-
96231b3b80d8
Previous->isOneOf(tok::r_square, tok::r_paren, tok::plusplus,
tok::minusminus)))
return addUnwrappedLine();
- if (PreviousMustBeValue && isJSDeclOrStmt(Keywords, Next))
+ if ((PreviousMustBeValue || Previous->is(tok::r_paren)) &&
+ isJSDeclOrStmt(Keywords, Next))
return addUnwrappedLine();
}
" readonly ratherLongField = 1;\n"
"}",
getGoogleJSStyleWithColumns(20));
+ verifyFormat("const x = (5 + 9)\n"
+ "const y = 3\n",
+ "const x = ( 5 + 9)\n"
+ "const y = 3\n");
}
TEST_F(FormatTestJS, AutomaticSemicolonInsertionHeuristic) {