Page MenuHomePhabricator

clang-format: [JS] handle pseudo-keywords.

Authored by mprobst on Apr 6 2020, 6:32 AM.



The previous change in attempted to
detect more C++ keywords. However it also precisely detected all
JavaScript keywords. That's generally correct, but many JavaScripy
keywords, e.g. get, are so-called pseudo-keywords. They can be used in
positions where a keyword would never be legal, e.g. in a dotted

x.type;  // type is a pseudo-keyword, but can be used here.
x.get;   // same for get etc.

This change introduces an additional parameter to
IsJavaScriptIdentifier, allowing clients to toggle whether they want
to allow IdentifierName tokens, i.e. pseudo-keywords.

Diff Detail

Event Timeline

mprobst created this revision.Apr 6 2020, 6:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 6 2020, 6:32 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
krasimir accepted this revision.Apr 6 2020, 7:38 AM

Looks good! The linter suggests a few formatting fixes.

This revision is now accepted and ready to land.Apr 6 2020, 7:38 AM
This revision was automatically updated to reflect the committed changes.