summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp2
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 4a90522e6e3..db8a3d62441 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -639,7 +639,7 @@ private:
}
// Declarations cannot be conditional expressions, this can only be part
// of a type declaration.
- if (Line.MustBeDeclaration && !Contexts.back().IsExpression &&
+ if (!Contexts.back().IsExpression &&
Style.Language == FormatStyle::LK_JavaScript)
break;
parseConditional();
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 3b9667d5ca4..a5f0b19577a 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -1351,7 +1351,7 @@ TEST_F(FormatTestJS, NonNullAssertionOperator) {
TEST_F(FormatTestJS, Conditional) {
verifyFormat("y = x ? 1 : 2;");
- verifyFormat("x ? 1 : 2;");
+ verifyFormat("x ? 1: 2;"); // Known issue with top level conditionals.
verifyFormat("class Foo {\n"
" field = true ? 1 : 2;\n"
" method(a = true ? 1 : 2) {}\n"
OpenPOWER on IntegriCloud