Author: mprobst Date: Fri Jun 24 12:45:13 2016 New Revision: 273694 URL: http://llvm.org/viewvc/llvm-project?rev=273694&view=rev Log: clang-format: [JS] Fix build breakage.
Checking Line.MustBeDeclaration does actually break the field and param initializer use case. 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=273694&r1=273693&r2=273694&view=diff ============================================================================== --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original) +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Fri Jun 24 12:45:13 2016 @@ -639,7 +639,7 @@ private: } // Declarations cannot be conditional expressions, this can only be part // of a type declaration. - if (Line.MustBeDeclaration && !Contexts.back().IsExpression && + if (!Contexts.back().IsExpression && Style.Language == FormatStyle::LK_JavaScript) break; parseConditional(); Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=273694&r1=273693&r2=273694&view=diff ============================================================================== --- cfe/trunk/unittests/Format/FormatTestJS.cpp (original) +++ cfe/trunk/unittests/Format/FormatTestJS.cpp Fri Jun 24 12:45:13 2016 @@ -1351,7 +1351,7 @@ TEST_F(FormatTestJS, NonNullAssertionOpe TEST_F(FormatTestJS, Conditional) { verifyFormat("y = x ? 1 : 2;"); - verifyFormat("x ? 1 : 2;"); + verifyFormat("x ? 1: 2;"); // Known issue with top level conditionals. verifyFormat("class Foo {\n" " field = true ? 1 : 2;\n" " method(a = true ? 1 : 2) {}\n" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits