mirror of
https://github.com/dlang-community/dfmt.git
synced 2025-04-25 21:00:03 +03:00
parent
47bf248e95
commit
c2b22b9e2b
3 changed files with 15 additions and 8 deletions
16
src/dfmt.d
16
src/dfmt.d
|
@ -311,13 +311,8 @@ private:
|
|||
break;
|
||||
case tok!"cast":
|
||||
writeToken();
|
||||
write(" ");
|
||||
writeParens(true);
|
||||
break;
|
||||
case tok!"mixin":
|
||||
writeToken();
|
||||
write(" ");
|
||||
break;
|
||||
default:
|
||||
if (index + 1 < tokens.length)
|
||||
{
|
||||
|
@ -627,7 +622,7 @@ private:
|
|||
else
|
||||
{
|
||||
// Silly hack to format enums better.
|
||||
if (peekBackIs(tok!"identifier"))
|
||||
if (peekBackIs(tok!"identifier") || peekBackIs(tok!","))
|
||||
newline();
|
||||
write("}");
|
||||
depth--;
|
||||
|
@ -702,11 +697,11 @@ private:
|
|||
}
|
||||
else if (current.type == tok!")")
|
||||
{
|
||||
if (peekIs(tok!"identifier"))
|
||||
if (peekIs(tok!"identifier") || peekIsBasicType())
|
||||
{
|
||||
writeToken();
|
||||
if (space_afterwards)
|
||||
write(" ");
|
||||
write(" ");
|
||||
}
|
||||
else if (index + 1 < tokens.length)
|
||||
{
|
||||
|
@ -740,6 +735,11 @@ private:
|
|||
linebreakHints = [];
|
||||
}
|
||||
|
||||
bool peekIsBasicType()
|
||||
{
|
||||
return index + 1 < tokens.length && isBasicType(tokens[index + 1].type);
|
||||
}
|
||||
|
||||
bool peekIsLabel()
|
||||
{
|
||||
return peekIs(tok!"identifier") && peek2Is(tok!":");
|
||||
|
|
6
tests/issue0026.d
Normal file
6
tests/issue0026.d
Normal file
|
@ -0,0 +1,6 @@
|
|||
extern
|
||||
(C++)
|
||||
int
|
||||
HtmlNamedEntity(
|
||||
const(char)* p, size_t length)
|
||||
;
|
1
tests/issue0026.d.ref
Normal file
1
tests/issue0026.d.ref
Normal file
|
@ -0,0 +1 @@
|
|||
extern(C++) int HtmlNamedEntity(const(char)* p, size_t length);
|
Loading…
Add table
Add a link
Reference in a new issue