[PATCH] clang-format: [JS] support optional methods.
Daniel Jasper
djasper at google.com
Tue May 5 01:44:19 PDT 2015
Submitted as r236488.
================
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))
----------------
mprobst wrote:
> 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.
I have merged the first two, but after starting to write comments, I realized that I would just duplicate what's inside the "if (..)". I think this is pretty readable as is.
http://reviews.llvm.org/D9491
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list