[PATCH] D23714: clang-format: [JS] handle object literals with casts.
Martin Probst via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 19 07:43:08 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279250: clang-format: [JS] handle object literals with casts. (authored by mprobst).
Changed prior to commit:
https://reviews.llvm.org/D23714?vs=68686&id=68688#toc
Repository:
rL LLVM
https://reviews.llvm.org/D23714
Files:
cfe/trunk/lib/Format/UnwrappedLineParser.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp
Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
===================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp
@@ -364,7 +364,8 @@
// 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) ||
Index: cfe/trunk/unittests/Format/FormatTestJS.cpp
===================================================================
--- cfe/trunk/unittests/Format/FormatTestJS.cpp
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp
@@ -1218,6 +1218,7 @@
" 1, //\n"
" 2\n"
"];");
+ verifyFormat("var x = [{x: 1} as type];");
}
TEST_F(FormatTestJS, TypeArguments) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23714.68688.patch
Type: text/x-patch
Size: 1222 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160819/ceb0016d/attachment.bin>
More information about the cfe-commits
mailing list