This commit is contained in:
Hackerpilot 2015-09-17 03:01:29 -07:00
parent d771955ad3
commit 0ecdc7f3d1
12 changed files with 25 additions and 33 deletions

View File

@ -671,15 +671,21 @@ private:
currentLineLength = 0;
justAddedExtraNewline = true;
}
if (config.dfmt_brace_style != BraceStyle.allman && currentIs(tok!"else"))
write(" ");
if (!peekIs(tok!",") && !peekIs(tok!")") && !peekIs(tok!";") && !peekIs(tok!"{"))
if (config.dfmt_brace_style == BraceStyle.otbs && peekIs(tok!"else"))
{
write(" ");
index++;
newline();
}
else
index++;
{
if (!peekIs(tok!",") && !peekIs(tok!")") && !peekIs(tok!";") && !peekIs(tok!"{"))
{
index++;
newline();
}
else
index++;
}
}
}

View File

@ -6,8 +6,7 @@ void fun() {
doStuff();
else
morestuff();
}
else
} else
doStuff();
cast(structalign_t) 1;

View File

@ -1,7 +1,6 @@
void f() {
if (a) {
}
else // wat
} else // wat
{
if (!is_temp_arg_ref) {
if (global.params.isOSX)

View File

@ -1,6 +1,4 @@
static if (a) {
}
else static if (b) {
}
else {
} else static if (b) {
} else {
}

View File

@ -1,4 +1,3 @@
version (all) {
}
else version (none) {
} else version (none) {
}

View File

@ -1,10 +1,8 @@
unittest {
if (0)
if (0) {
}
else if (0) {
}
else {
} else if (0) {
} else {
}
doSomething();
}

View File

@ -12,8 +12,7 @@ void indent() {
foreach (i; 0 .. indentLevel + tempIndent) {
currentLineLength += config.tabSize;
output.put("\t");
}
else
} else
foreach (i; 0 .. indentLevel + tempIndent)
foreach (j; 0 .. config.indentSize) {
output.put(" ");

View File

@ -1,8 +1,7 @@
unittest {
if (x) {
version (none) {
}
else {
} else {
}
}
}

View File

@ -8,7 +8,6 @@ version (Windows) {
}
version (Windows) {
void func();
}
else {
} else {
void func();
}

View File

@ -9,8 +9,7 @@ unittest {
else {
excessivelyLongFunctionName(false);
}
}
else
} else
a();
}
}

View File

@ -3,8 +3,7 @@ unittest {
if (true) // comment
{
}
else {
} else {
}
}

View File

@ -12,12 +12,10 @@ void main() {
return true;
}()) {
}
else {
} else {
}
}
else {
} else {
}
}