summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-05-20 11:14:57 +0000
committerDaniel Jasper <djasper@google.com>2014-05-20 11:14:57 +0000
commit069e5f485818eb127ae1944b6759b29dbce3437a (patch)
tree570cb9836e6197258c6b4b0b89dda0fe9938e0ac /clang/lib/Format
parente7fa2314af4b04c54925f2c7b5f310a69183c106 (diff)
downloadbcm5719-llvm-069e5f485818eb127ae1944b6759b29dbce3437a.tar.gz
bcm5719-llvm-069e5f485818eb127ae1944b6759b29dbce3437a.zip
clang-format: [JS] Understand top-level function literals properly.
llvm-svn: 209205
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index e2613fbc171..5af743bba5a 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -763,6 +763,10 @@ void UnwrappedLineParser::parseStructuralElement() {
return;
case tok::identifier: {
StringRef Text = FormatTok->TokenText;
+ if (Style.Language == FormatStyle::LK_JavaScript && Text == "function") {
+ tryToParseJSFunction();
+ break;
+ }
nextToken();
if (Line->Tokens.size() == 1) {
if (FormatTok->Tok.is(tok::colon)) {
OpenPOWER on IntegriCloud