summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Probst <martin@probst.io>2016-06-24 17:45:13 +0000
committerMartin Probst <martin@probst.io>2016-06-24 17:45:13 +0000
commit94153940daa554f0c0aff54cf8e6ad9f248a2d3b (patch)
tree129814ce1edfb3adff3bee688dc42629af8dae1a
parent07509dfa9efc989ea5d8cfc2e6d6c6332d583abd (diff)
clang-format: [JS] Fix build breakage.
Checking Line.MustBeDeclaration does actually break the field and param initializer use case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273694 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Format/TokenAnnotator.cpp2
-rw-r--r--unittests/Format/FormatTestJS.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 4a90522e6e..db8a3d6244 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/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/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp
index 3b9667d5ca..a5f0b19577 100644
--- a/unittests/Format/FormatTestJS.cpp
+++ b/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"