This is an archive of the discontinued LLVM Phabricator instance.

AlignConsecutiveDeclarations not working for 'const' keyword in JavsScript
ClosedPublic

Authored by MyDeveloperDay on Dec 18 2021, 7:19 AM.

Details

Summary

https://github.com/llvm/llvm-project/issues/49846

Fixes #49846

AlignConsecutiveDeclarations is not working for "let" and "const" in JavaScript

let letVariable = 5;
const constVariable = 10;

Diff Detail

Event Timeline

MyDeveloperDay requested review of this revision.Dec 18 2021, 7:19 AM
MyDeveloperDay created this revision.
MyDeveloperDay edited the summary of this revision. (Show Details)

Double check the interaction with the AlignConsecutiveAssignments

clang-format the file

curdeius accepted this revision.Dec 19 2021, 9:53 AM

LGTM! Optional nit comment.

clang/lib/Format/TokenAnnotator.cpp
1876

Nit.

This revision is now accepted and ready to land.Dec 19 2021, 9:53 AM
owenpan added inline comments.Dec 19 2021, 10:13 PM
clang/lib/Format/TokenAnnotator.cpp
1840

Remove braces.

1876

+1

MyDeveloperDay added inline comments.Dec 20 2021, 3:10 AM
clang/lib/Format/TokenAnnotator.cpp
1876

I WILL make the change, but just my 2c worth, when a complex expression is on the last line (as was before), it's a bu***er to debug! I personally use this style so I can just drop a breakpoint on the return and I know its being hit for that case, in clang-format where these functions are called over and over again that's super important... (that's my defend your honour!)

owenpan accepted this revision.Dec 20 2021, 2:43 PM
owenpan added inline comments.
clang/lib/Format/TokenAnnotator.cpp
1876

Alright! I withdraw my +1 then. :)

curdeius added inline comments.Dec 20 2021, 10:51 PM
clang/lib/Format/TokenAnnotator.cpp
1876

@MyDeveloperDay, it's up to you whether to change it or not.

MyDeveloperDay marked 5 inline comments as done.Dec 21 2021, 5:58 AM
This revision was landed with ongoing or failed builds.Dec 21 2021, 5:58 AM
This revision was automatically updated to reflect the committed changes.