r272668 - clang-format: [JS] Fix failing format with TypeScript casts.
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 9 13:41:34 PST 2016
This apparently caused https://llvm.org/bugs/show_bug.cgi?id=30527
On Tue, Jun 14, 2016 at 9:54 AM, Daniel Jasper via cfe-commits <
cfe-commits at lists.llvm.org> wrote:
> Author: djasper
> Date: Tue Jun 14 08:54:38 2016
> New Revision: 272668
>
> URL: http://llvm.org/viewvc/llvm-project?rev=272668&view=rev
> Log:
> clang-format: [JS] Fix failing format with TypeScript casts.
>
> Before, this could be formatted at all (with BracketAlignmentStyle
> AlwaysBreak):
>
> foo = <Bar[]>[
> 1, /* */
> 2
> ];
>
> 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=272668&r1=272667&r2=272668&view=diff
> ============================================================
> ==================
> --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
> +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Tue Jun 14 08:54:38 2016
> @@ -319,9 +319,9 @@ private:
> Left->Type = TT_JsComputedPropertyName;
> } else if (Style.Language == FormatStyle::LK_Proto ||
> (Parent &&
> - Parent->isOneOf(TT_BinaryOperator, tok::at, tok::comma,
> - tok::l_paren, tok::l_square,
> tok::question,
> - tok::colon, tok::kw_return,
> + Parent->isOneOf(TT_BinaryOperator, TT_TemplateCloser,
> tok::at,
> + tok::comma, tok::l_paren, tok::l_square,
> + tok::question, tok::colon,
> tok::kw_return,
> // Should only be relevant to
> JavaScript:
> tok::kw_default))) {
> Left->Type = TT_ArrayInitializerLSquare;
>
> Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/
> Format/FormatTestJS.cpp?rev=272668&r1=272667&r2=272668&view=diff
> ============================================================
> ==================
> --- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
> +++ cfe/trunk/unittests/Format/FormatTestJS.cpp Tue Jun 14 08:54:38 2016
> @@ -1205,6 +1205,10 @@ TEST_F(FormatTestJS, TemplateStrings) {
> TEST_F(FormatTestJS, CastSyntax) {
> verifyFormat("var x = <type>foo;");
> verifyFormat("var x = foo as type;");
> + verifyFormat("foo = <Bar[]>[\n"
> + " 1, //\n"
> + " 2\n"
> + "];");
> }
>
> TEST_F(FormatTestJS, TypeArguments) {
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161109/ed98a059/attachment.html>
More information about the cfe-commits
mailing list