From 069e5f485818eb127ae1944b6759b29dbce3437a Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Tue, 20 May 2014 11:14:57 +0000 Subject: clang-format: [JS] Understand top-level function literals properly. llvm-svn: 209205 --- clang/lib/Format/UnwrappedLineParser.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/Format') 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)) { -- cgit v1.2.3