From: Daniel Jasper Date: Tue, 2 Jun 2015 15:31:37 +0000 (+0000) Subject: clang-format: Don't try to detect C++ lambdas in other languages. X-Git-Tag: llvmorg-3.7.0-rc1~3197 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1feab0f95ea0202f95a555a86f5dd60db4a8a5c8;p=platform%2Fupstream%2Fllvm.git clang-format: Don't try to detect C++ lambdas in other languages. llvm-svn: 238845 --- diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 83cbe76..826b40d 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -911,6 +911,10 @@ void UnwrappedLineParser::parseStructuralElement() { } bool UnwrappedLineParser::tryToParseLambda() { + if (Style.Language != FormatStyle::LK_Cpp) { + nextToken(); + return false; + } // FIXME: This is a dirty way to access the previous token. Find a better // solution. if (!Line->Tokens.empty() && diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index a18d35b..6550863 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -266,6 +266,8 @@ TEST_F(FormatTestJS, ArrayLiterals) { " bbbbbbbbbbbbbbbbbbbbbbbbbbb,\n" " ccccccccccccccccccccccccccc\n" "]);"); + + verifyFormat("someFunction([], {a: a});"); } TEST_F(FormatTestJS, FunctionLiterals) {