[PATCH] D21658: clang-format: [JS] handle conditionals in fields, default params.

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 23 14:24:15 PDT 2016


djasper added inline comments.

================
Comment at: lib/Format/TokenAnnotator.cpp:1001
@@ -1000,3 +1000,3 @@
       if (Style.Language == FormatStyle::LK_JavaScript &&
-          Line.MustBeDeclaration) {
+          !Contexts.back().IsExpression) {
         // In JavaScript, `interface X { foo?(): bar; }` is an optional method
----------------
Well, if you keep the Line.MustBeDeclaration here, then the test case does not regress. I believe that the test in itself probably doesn't make much sense, but at least then we aren't regressing it. At any rate, it seems bad to keep the Line.MustBeDeclaration above and remove it here.


http://reviews.llvm.org/D21658





More information about the cfe-commits mailing list