In JavaScript, duplicated commas have semantic meaning.
x = [a,,b];
The statement above creates an array with three entries, the middle being undefined. Because clang-format should not change semantics, disable this cleanup in JS.
Paths
| Differential D33641
clang-format: [JS] do not clean up duplicated commas. ClosedPublic Authored by mprobst on May 29 2017, 1:26 AM.
Details Summary In JavaScript, duplicated commas have semantic meaning. x = [a,,b]; The statement above creates an array with three entries, the middle being undefined. Because clang-format should not change semantics, disable this cleanup in JS.
Diff Detail
Event Timeline
This revision is now accepted and ready to land.May 29 2017, 1:40 AM Closed by commit rL304141: clang-format: [JS] do not clean up duplicated commas. (authored by mprobst). · Explain WhyMay 29 2017, 1:41 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 100595 lib/Format/Format.cpp
unittests/Format/CleanupTest.cpp
|
As all the cleanups that aren't comma clean ups are cleanups for constructor initializers, I think we should just completely opt out of cleans for JavaScript for now?