This is an archive of the discontinued LLVM Phabricator instance.

clang-format: [JS] disable ASI on decorators.
ClosedPublic

Authored by mprobst on Nov 24 2017, 2:29 AM.

Details

Summary

Automatic Semicolon Insertion in clang-format tries to guess if a line
wrap should insert an implicit semicolong. The previous heuristic would
not trigger ASI if a token was immediately preceded by an @ sign:

function foo(@Bar  // <-- does not trigger due to preceding @
            baz) {}

However decorators can have arbitrary parameters:

function foo(@Bar(param, param, param)  // <-- precending @ missed
            baz) {}

While it would be possible to precisely find the matching @, just
conversatively disabling ASI for the entire line is simpler, while also
not regressing ASI substatially.

Diff Detail

Repository
rL LLVM

Event Timeline

mprobst created this revision.Nov 24 2017, 2:29 AM
This revision was automatically updated to reflect the committed changes.