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.
Paths
| Differential D10350
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
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 Timelinemprobst retitled this revision from to clang-format: [JS] Only special case top level object literal assignments as enums.. mprobst updated this object. Comment ActionsThis 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 :-) This revision is now accepted and ready to land.Jun 10 2015, 2:25 AM
Revision Contents
Diff 27416 lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTestJS.cpp
|