This is an archive of the discontinued LLVM Phabricator instance.

clang-format: [JS] do not insert semicolons after wrapped annotations.
ClosedPublic

Authored by mprobst on Apr 10 2016, 7:32 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

mprobst updated this revision to Diff 53178.Apr 10 2016, 7:32 AM
mprobst retitled this revision from to clang-format: [JS] do not insert semicolons after wrapped annotations..
mprobst updated this object.
mprobst added a reviewer: djasper.
djasper added inline comments.Apr 10 2016, 10:20 PM
lib/Format/UnwrappedLineParser.cpp
708 ↗(On Diff #53178)

How about:

  • Moving this down a bit
  • Checking this only if PreviousMustBeValue
  • return directly

Like this, it is a bit hard to understand all the combinations of what's going on.

mprobst updated this revision to Diff 53190.Apr 10 2016, 10:23 PM
  • simplify conditions
mprobst marked an inline comment as done.Apr 10 2016, 10:24 PM
mprobst added inline comments.
lib/Format/UnwrappedLineParser.cpp
708 ↗(On Diff #53178)

Good point. I was under the impression initially that I had to check the token before getting the next here.

djasper accepted this revision.Apr 10 2016, 10:28 PM
djasper edited edge metadata.

Looks good.

unittests/Format/FormatTestJS.cpp
689 ↗(On Diff #53190)

Are there any other valid use cases of "@" in JS? If so, should we add a test for at least one of those?

This revision is now accepted and ready to land.Apr 10 2016, 10:28 PM
mprobst marked 2 inline comments as done.Apr 10 2016, 10:43 PM
mprobst added inline comments.
unittests/Format/FormatTestJS.cpp
689 ↗(On Diff #53190)

@ can only be used for annotations. Those can appear on classes, fields, methods, and parameters. I'll send another review to add tests for those, they are currently formatted properly (inheriting the Java support for them).

This revision was automatically updated to reflect the committed changes.
mprobst marked an inline comment as done.