[PATCH] clang-format: [JS] support optional methods.

Martin Probst martinprobst at google.com
Mon May 4 17:00:10 PDT 2015


================
Comment at: lib/Format/TokenAnnotator.cpp:1870
@@ -1856,7 +1869,3 @@
     return false;
-  if (Right.is(tok::colon))
-    return !Line.First->isOneOf(tok::kw_case, tok::kw_default) &&
-           Right.getNextNonComment() && Right.isNot(TT_ObjCMethodExpr) &&
-           !Left.is(tok::question) &&
-           !(Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon)) &&
-           (Right.isNot(TT_DictLiteral) || Style.SpacesInContainerLiterals);
+  if (Right.is(tok::colon)) {
+    if (Line.First->isOneOf(tok::kw_case, tok::kw_default))
----------------
Note that this change is unrelated, I just stumbled across this code and found it hard to read with all those boolean clauses. Might be useful to go over this and add comments explaining the individual parts at some point.

http://reviews.llvm.org/D9491

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list