clang-format: [JS] Fix spacing in destructuring assignments.

Before:
  const[a, b, c] = [1, 2, 3];

After:
  const [a, b, c] = [1, 2, 3];

llvm-svn: 270029
This commit is contained in:
Daniel Jasper 2016-05-19 07:18:07 +00:00
parent 451544ab57
commit 5dbcd3bd07
2 changed files with 2 additions and 1 deletions

View File

@ -2083,7 +2083,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
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 &&

View File

@ -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};");