This is an archive of the discontinued LLVM Phabricator instance.

clang-format: [JS] Only special case top level object literal assignments as enums.
ClosedPublic

Authored by mprobst on Jun 9 2015, 5:09 PM.

Details

Reviewers
djasper
Summary

Top level object literals are treated as enums, and their k/v pairs are put on separate lines:

X.Y = {
  A: 1,
  B: 2
};

However assignments within blocks should not be affected:

function x() {
  y = {a:1, b:2};
}

This change fixes the second case.

Diff Detail

Event Timeline

mprobst updated this revision to Diff 27416.Jun 9 2015, 5:09 PM
mprobst retitled this revision from to clang-format: [JS] Only special case top level object literal assignments as enums..
mprobst updated this object.
mprobst edited the test plan for this revision. (Show Details)
mprobst added a reviewer: djasper.
mprobst added subscribers: Unknown Object (MLST), klimek.

This is somewhat in "I have no idea what I'm doing territory", but seems to do what I want and I have tests to prove it. Please advise :-)

djasper accepted this revision.Jun 10 2015, 2:25 AM
djasper edited edge metadata.

Looks good. Submitted as r239462.

This revision is now accepted and ready to land.Jun 10 2015, 2:25 AM
djasper closed this revision.Jun 10 2015, 2:25 AM