mirror of https://github.com/microsoft/clang.git
clang-format: [JS] Make AllowShortFunctionsOnASingle line value "Empty"
work properly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253674 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
53b1a37ee0
commit
92bd16fea4
|
@ -2104,6 +2104,7 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line,
|
|||
!Left.Children.empty())
|
||||
// Support AllowShortFunctionsOnASingleLine for JavaScript.
|
||||
return Style.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_None ||
|
||||
Style.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_Empty ||
|
||||
(Left.NestingLevel == 0 && Line.Level == 0 &&
|
||||
Style.AllowShortFunctionsOnASingleLine ==
|
||||
FormatStyle::SFS_Inline);
|
||||
|
|
|
@ -448,6 +448,12 @@ TEST_F(FormatTestJS, InliningFunctionLiterals) {
|
|||
" }\n"
|
||||
"}",
|
||||
Style);
|
||||
|
||||
Style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty;
|
||||
verifyFormat("var func = function() {\n"
|
||||
" return 1;\n"
|
||||
"};",
|
||||
Style);
|
||||
}
|
||||
|
||||
TEST_F(FormatTestJS, MultipleFunctionLiterals) {
|
||||
|
|
Loading…
Reference in New Issue