Author: mprobst Date: Tue Sep 6 13:55:34 2016 New Revision: 280731 URL: http://llvm.org/viewvc/llvm-project?rev=280731&view=rev Log: clang-format: [JS] whitespace required between ! and as.
Summary: Before: x!as string After: x! as string Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D24272 Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp cfe/trunk/unittests/Format/FormatTestJS.cpp Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=280731&r1=280730&r2=280731&view=diff ============================================================================== --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original) +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Tue Sep 6 13:55:34 2016 @@ -2158,6 +2158,8 @@ bool TokenAnnotator::spaceRequiredBefore tok::r_square, tok::r_brace) || Left.Tok.isLiteral())) return false; + if (Left.is(tok::exclaim) && Right.is(Keywords.kw_as)) + return true; // "x! as string" } else if (Style.Language == FormatStyle::LK_Java) { if (Left.is(tok::r_square) && Right.is(tok::l_brace)) return true; Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=280731&r1=280730&r2=280731&view=diff ============================================================================== --- cfe/trunk/unittests/Format/FormatTestJS.cpp (original) +++ cfe/trunk/unittests/Format/FormatTestJS.cpp Tue Sep 6 13:55:34 2016 @@ -1236,6 +1236,7 @@ TEST_F(FormatTestJS, CastSyntax) { verifyFormat("x = x as [a, b];"); verifyFormat("x = x as {a: string};"); verifyFormat("x = x as (string);"); + verifyFormat("x = x! as (string);"); } TEST_F(FormatTestJS, TypeArguments) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits