This is an archive of the discontinued LLVM Phabricator instance.

clang-format: [JS] do not wrap after `asserts`
ClosedPublic

Authored by mprobst on Apr 21 2021, 6:45 AM.

Details

Summary

asserts is a pseudo keyword in TypeScript used in return types.
Wrapping after it triggers automatic semicolon insertion, which
breaks the code semantics/syntax.

asserts is different from other pseudo keywords in that it is
specific to TS and only carries meaning in a very specific location.
Thus introducing a token type is probably overkill.

Diff Detail

Event Timeline

mprobst requested review of this revision.Apr 21 2021, 6:45 AM
mprobst created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2021, 6:45 AM
h-joo accepted this revision.Apr 21 2021, 7:25 AM
h-joo added inline comments.
clang/lib/Format/TokenAnnotator.cpp
3856

Not for this PR : The JS specific part of the code is growing, please consider splitting it

This revision is now accepted and ready to land.Apr 21 2021, 7:25 AM
h-joo added inline comments.Apr 21 2021, 7:26 AM
clang/lib/Format/TokenAnnotator.cpp
3856

(..into a function)

This revision was automatically updated to reflect the committed changes.