forked from OSchip/llvm-project
clang-format: [JS] handle object literals with casts.
Summary: E.g. `{a: 1} as b`. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D23714 llvm-svn: 279250
This commit is contained in:
parent
66dd6797e8
commit
e1e12a73d7
|
@ -364,7 +364,8 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) {
|
|||
// We exclude + and - as they can be ObjC visibility modifiers.
|
||||
ProbablyBracedList =
|
||||
(Style.Language == FormatStyle::LK_JavaScript &&
|
||||
NextTok->isOneOf(Keywords.kw_of, Keywords.kw_in)) ||
|
||||
NextTok->isOneOf(Keywords.kw_of, Keywords.kw_in,
|
||||
Keywords.kw_as)) ||
|
||||
NextTok->isOneOf(tok::comma, tok::period, tok::colon,
|
||||
tok::r_paren, tok::r_square, tok::l_brace,
|
||||
tok::l_square, tok::l_paren, tok::ellipsis) ||
|
||||
|
|
|
@ -1218,6 +1218,7 @@ TEST_F(FormatTestJS, CastSyntax) {
|
|||
" 1, //\n"
|
||||
" 2\n"
|
||||
"];");
|
||||
verifyFormat("var x = [{x: 1} as type];");
|
||||
}
|
||||
|
||||
TEST_F(FormatTestJS, TypeArguments) {
|
||||
|
|
Loading…
Reference in New Issue