This commit is contained in:
Hackerpilot 2016-01-18 15:32:49 -08:00
parent 7a9a895f64
commit ca49180a95
4 changed files with 30 additions and 8 deletions

View File

@ -387,7 +387,8 @@ private:
break; break;
else if (t == tok!"import" && !currentIs(tok!"import") else if (t == tok!"import" && !currentIs(tok!"import")
&& !currentIs(tok!"}") && !(currentIs(tok!"public") && !currentIs(tok!"}") && !(currentIs(tok!"public")
&& peekIs(tok!"import"))) && peekIs(tok!"import"))
&& !indents.topIsOneOf(tok!"if", tok!"debug", tok!"version"))
{ {
simpleNewline(); simpleNewline();
currentLineLength = 0; currentLineLength = 0;
@ -481,7 +482,8 @@ private:
if (parenDepth == 0) if (parenDepth == 0)
indents.popWrapIndents(); indents.popWrapIndents();
if (parenDepth == 0 && (peekIs(tok!"is") || peekIs(tok!"in") || peekIs(tok!"out") || peekIs(tok!"body"))) if (parenDepth == 0 && (peekIs(tok!"is") || peekIs(tok!"in")
|| peekIs(tok!"out") || peekIs(tok!"body")))
writeToken(); writeToken();
else if (peekIsLiteralOrIdent() || peekIsBasicType()) else if (peekIsLiteralOrIdent() || peekIsBasicType())
{ {
@ -489,7 +491,8 @@ private:
if (spaceAfterParens || parenDepth > 0) if (spaceAfterParens || parenDepth > 0)
write(" "); write(" ");
} }
else if ((peekIsKeyword() || peekIs(tok!"@")) && spaceAfterParens && !peekIs(tok!"in") && !peekIs(tok!"is")) else if ((peekIsKeyword() || peekIs(tok!"@")) && spaceAfterParens
&& !peekIs(tok!"in") && !peekIs(tok!"is"))
{ {
writeToken(); writeToken();
write(" "); write(" ");
@ -762,7 +765,8 @@ private:
|| astInformation.conditionalWithElseLocations.canFindIndex(current.index); || astInformation.conditionalWithElseLocations.canFindIndex(current.index);
immutable bool c = b immutable bool c = b
|| astInformation.conditionalStatementLocations.canFindIndex(current.index); || astInformation.conditionalStatementLocations.canFindIndex(current.index);
immutable bool shouldPushIndent = c && !(currentIs(tok!"if") && indents.topIsWrap()); immutable bool shouldPushIndent = (c || peekBackIs(tok!"else"))
&& !(currentIs(tok!"if") && indents.topIsWrap());
if (currentIs(tok!"out") && !peekBackIs(tok!"}")) if (currentIs(tok!"out") && !peekBackIs(tok!"}"))
newline(); newline();
if (shouldPushIndent) if (shouldPushIndent)
@ -863,8 +867,8 @@ private:
write(" "); write(" ");
break; break;
case tok!"is": case tok!"is":
if (!peekBackIsOneOf(false, tok!"!", tok!"(", if (!peekBackIsOneOf(false, tok!"!", tok!"(", tok!",",
tok!",", tok!"}", tok!"=", tok!"&&", tok!"||") && !peekBackIsKeyword()) tok!"}", tok!"=", tok!"&&", tok!"||") && !peekBackIsKeyword())
write(" "); write(" ");
writeToken(); writeToken();
if (!currentIs(tok!"(") && !currentIs(tok!"{")) if (!currentIs(tok!"(") && !currentIs(tok!"{"))
@ -1223,8 +1227,8 @@ private:
} }
immutable l = indents.indentToMostRecent(tok!"switch"); immutable l = indents.indentToMostRecent(tok!"switch");
if (l != -1) if (l != -1)
indentLevel = config.dfmt_align_switch_statements == OptionalBoolean.t indentLevel = config.dfmt_align_switch_statements
? l : indents.indentLevel; == OptionalBoolean.t ? l : indents.indentLevel;
} }
else if (currentIs(tok!"{")) else if (currentIs(tok!"{"))
{ {

View File

@ -0,0 +1,6 @@
version (linux)
import core.sys.linux.elf;
else version (FreeBSD)
import core.sys.freebsd.sys.elf;
else version (Solaris)
import core.sys.solaris.elf;

6
tests/issue0213.d Normal file
View File

@ -0,0 +1,6 @@
version (linux)
import core.sys.linux.elf;
else version (FreeBSD)
import core.sys.freebsd.sys.elf;
else version (Solaris)
import core.sys.solaris.elf;

View File

@ -0,0 +1,6 @@
version (linux)
import core.sys.linux.elf;
else version (FreeBSD)
import core.sys.freebsd.sys.elf;
else version (Solaris)
import core.sys.solaris.elf;