summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
authorMartin Probst <martin@probst.io>2017-08-01 17:19:32 +0000
committerMartin Probst <martin@probst.io>2017-08-01 17:19:32 +0000
commitec36326d85c7ba2332e508f7dc55fdbb1757c576 (patch)
tree7d30c9a9336b65856323b5c29e3e7ac71dc6af63 /clang/lib/Format/TokenAnnotator.cpp
parent2a5bba73255f54338f0d6862bf5bf3a6de6cbd8d (diff)
downloadbcm5719-llvm-ec36326d85c7ba2332e508f7dc55fdbb1757c576.tar.gz
bcm5719-llvm-ec36326d85c7ba2332e508f7dc55fdbb1757c576.zip
clang-format: [JS] handle union types in arrow functions.
Summary: clang-format would previously fail to detect that an arrow functions parameter block is not an expression, and thus insert whitespace around the `|` and `&` type operators in it. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36147 llvm-svn: 309707
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index e7a50aa4329..559a547f214 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -533,6 +533,7 @@ private:
Contexts.back().ContextKind == tok::l_square || // array type
(Contexts.size() == 1 &&
Line.MustBeDeclaration)) { // method/property declaration
+ Contexts.back().IsExpression = false;
Tok->Type = TT_JsTypeColon;
break;
}
OpenPOWER on IntegriCloud