Author: djasper Date: Thu May 19 02:18:07 2016 New Revision: 270029 URL: http://llvm.org/viewvc/llvm-project?rev=270029&view=rev Log: clang-format: [JS] Fix spacing in destructuring assignments.
Before: const[a, b, c] = [1, 2, 3]; After: const [a, b, c] = [1, 2, 3]; 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=270029&r1=270028&r2=270029&view=diff ============================================================================== --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original) +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Thu May 19 02:18:07 2016 @@ -2083,7 +2083,7 @@ bool TokenAnnotator::spaceRequiredBefore Left.isOneOf(Keywords.kw_function, Keywords.kw_yield)) return false; if (Left.isOneOf(Keywords.kw_let, Keywords.kw_var, Keywords.kw_in, - Keywords.kw_of) && + Keywords.kw_of, tok::kw_const) && (!Left.Previous || !Left.Previous->is(tok::period))) return true; if (Left.is(tok::kw_default) && Left.Previous && Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=270029&r1=270028&r2=270029&view=diff ============================================================================== --- cfe/trunk/unittests/Format/FormatTestJS.cpp (original) +++ cfe/trunk/unittests/Format/FormatTestJS.cpp Thu May 19 02:18:07 2016 @@ -148,6 +148,7 @@ TEST_F(FormatTestJS, CppKeywords) { TEST_F(FormatTestJS, ES6DestructuringAssignment) { verifyFormat("var [a, b, c] = [1, 2, 3];"); + verifyFormat("const [a, b, c] = [1, 2, 3];"); verifyFormat("let [a, b, c] = [1, 2, 3];"); verifyFormat("var {a, b} = {a: 1, b: 2};"); verifyFormat("let {a, b} = {a: 1, b: 2};"); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits