[PATCH] D24257: clang-format: [JS] ignore comments when wrapping returns.

Martin Probst via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 6 08:25:17 PDT 2016

mprobst added inline comments.

Comment at: lib/Format/TokenAnnotator.cpp:2384
@@ -2383,2 +2383,3 @@
   } else if (Style.Language == FormatStyle::LK_JavaScript) {
-    if (Left.is(tok::kw_return))
+    const FormatToken *NonComment = Right.getPreviousNonComment();
+    if (Left.isOneOf(tok::kw_return, tok::kw_continue, tok::kw_break,
Should the entire method generally consider the previous non-comment, instead of just the previous token? Not sure if that makes sense in all cases, and I don't think we always have a previous non-comment token either.


More information about the cfe-commits mailing list