[PATCH] D77311: clang-format: [JS] detect C++ keywords.

Martin Probst via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 3 05:20:37 PDT 2020


mprobst marked 2 inline comments as done.
mprobst added inline comments.


================
Comment at: clang/lib/Format/FormatToken.h:913
   bool IsJavaScriptIdentifier(const FormatToken &Tok) const {
-    return Tok.is(tok::identifier) &&
-           JsExtraKeywords.find(Tok.Tok.getIdentifierInfo()) ==
-               JsExtraKeywords.end();
+    switch (Tok.Tok.getKind()) {
+    case tok::kw_break:
----------------
krasimir wrote:
> nit: may be worth adding a comment linking to:
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords
Done, though I used the TS list of keywords (as it's a superset of the JS keywords).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77311/new/

https://reviews.llvm.org/D77311





More information about the cfe-commits mailing list