mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-27 03:48:33 +00:00
clang-format: Fix incorrect indentation.
Before (JavaScript example, but can extend to other languages): return { a: 'E', b: function() { return function() { f(); // This is wrong. }; } }; After: return { a: 'E', b: function() { return function() { f(); // This is better. }; } }; llvm-svn: 210334
This commit is contained in:
parent
9c8274254a
commit
58cb2edd69
@ -1164,7 +1164,8 @@ private:
|
||||
return true;
|
||||
|
||||
if (NewLine) {
|
||||
int AdditionalIndent = 0;
|
||||
int AdditionalIndent =
|
||||
State.FirstIndent - State.Line->Level * Style.IndentWidth;
|
||||
if (State.Stack.size() < 2 ||
|
||||
!State.Stack[State.Stack.size() - 2].JSFunctionInlined) {
|
||||
AdditionalIndent = State.Stack.back().Indent -
|
||||
|
@ -137,6 +137,14 @@ TEST_F(FormatTestJS, Closures) {
|
||||
" foo();\n"
|
||||
" bar();\n"
|
||||
"}, this);");
|
||||
verifyFormat("return {\n"
|
||||
" a: 'E',\n"
|
||||
" b: function() {\n"
|
||||
" return function() {\n"
|
||||
" f(); //\n"
|
||||
" };\n"
|
||||
" }\n"
|
||||
"};");
|
||||
|
||||
verifyFormat("var x = {a: function() { return 1; }};",
|
||||
getGoogleJSStyleWithColumns(38));
|
||||
|
Loading…
x
Reference in New Issue
Block a user