This is an archive of the discontinued LLVM Phabricator instance.

clang-format: [JS] Handle keyword-named methods.
ClosedPublic

Authored by mprobst on Jan 16 2020, 2:52 AM.

Details

Summary

Including do, for, and while, in addition to the previously
handled fields. The unit test explicitly uses methods, but this code
path handles both fields and methods.

Diff Detail

Event Timeline

mprobst created this revision.Jan 16 2020, 2:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 16 2020, 2:52 AM
Eugene.Zelenko added a project: Restricted Project.
krasimir accepted this revision.Jan 16 2020, 6:19 AM

How about if and try? Is there a list somewhere for all such valid identifiers?

This revision is now accepted and ready to land.Jan 16 2020, 6:19 AM
MyDeveloperDay accepted this revision.Jan 16 2020, 6:21 AM

LGTM thanks for the patch

How about if and try? Is there a list somewhere for all such valid identifiers?

This is a bit annoying - generally speaking, we should parse all keywords in declaration locations as simple names. However UnwrappedLineParser isn't really structured to support that, nor is it precise enough to reliably detect these situations :-/ So I think the best we can do is incrementally detect these issues and fix as they come up.

I've added tests and a fix for try/catch and if/else.

This revision was automatically updated to reflect the committed changes.