Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Issue 1427 - Generated .di files look ugly and are hard to read #538

Merged
merged 1 commit into from

4 participants

@9rnsr
Collaborator

http://d.puremagic.com/issues/show_bug.cgi?id=1427

Use hard tab '\t' for indentation.

@LightBender

I'm working on bringing the DI generation output up to community expectations. Can this be merged? I'd hate to duplicate work.

@LightBender

I did some more more work on this and I can verify that under DMD on Windows when calling the void OutBuffer::write(const void *data, unsigned nbytes) function that DMD throws an Out of Memory exception while compiling Phobos. Also I added a bunch more buf->level changes in addition to what Kenji put in.

My guess is that given the size of Phobos, the number of memory reallocations this code produces that something went wrong somewhere. I removed the second reallocation from this function and everything seems to work as expected.

Note: This is under Windows x64.

The new function is as follows:

void OutBuffer::write(const void *data, unsigned nbytes)
{
char t = '\t';
reserve(nbytes + level);
if (doindent && linehead)
{
if (level)
{
for (size_t i=0; i<level; i++)
{
memcpy(this->data + offset, &t, sizeof(t));
offset++;
}
}
linehead = 0;
}
memcpy(this->data + offset, data, nbytes);
offset += nbytes;
}

@andralex
Owner

LGTM. Please let's review this and merge it in. @LightBender, how does it (a|e)ffect your work?

@LightBender

@andralex I actually used parts of this merge in my pull. So I will have to re-merge it and fix the errors that crop-up... But this one does not affect output beyond formatting. Also, I have been unable to locate the cause of the phobos test failure in my pull either...

@braddr braddr referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@WalterBright WalterBright merged commit 0c93ce2 into D-Programming-Language:master

1 check was pending

Details default Pending: 9
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
16 src/attrib.c
@@ -363,13 +363,13 @@ void AttribDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
+ buf->level++;
for (size_t i = 0; i < decl->dim; i++)
{
Dsymbol *s = (*decl)[i];
-
- buf->writestring(" ");
s->toCBuffer(buf, hgs);
}
+ buf->level--;
buf->writeByte('}');
}
}
@@ -911,16 +911,16 @@ void AnonDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
buf->printf(isunion ? "union" : "struct");
buf->writestring("\n{\n");
+ buf->level++;
if (decl)
{
for (size_t i = 0; i < decl->dim; i++)
{
Dsymbol *s = (*decl)[i];
-
- //buf->writestring(" ");
s->toCBuffer(buf, hgs);
}
}
+ buf->level--;
buf->writestring("}\n");
}
@@ -1355,16 +1355,16 @@ void ConditionalDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
+ buf->level++;
if (decl)
{
for (size_t i = 0; i < decl->dim; i++)
{
Dsymbol *s = (*decl)[i];
-
- buf->writestring(" ");
s->toCBuffer(buf, hgs);
}
}
+ buf->level--;
buf->writeByte('}');
if (elsedecl)
{
@@ -1373,13 +1373,13 @@ void ConditionalDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
+ buf->level++;
for (size_t i = 0; i < elsedecl->dim; i++)
{
Dsymbol *s = (*elsedecl)[i];
-
- buf->writestring(" ");
s->toCBuffer(buf, hgs);
}
+ buf->level--;
buf->writeByte('}');
}
}
View
4 src/class.c
@@ -847,13 +847,13 @@ void ClassDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
+ buf->level++;
for (size_t i = 0; i < members->dim; i++)
{
Dsymbol *s = (*members)[i];
-
- buf->writestring(" ");
s->toCBuffer(buf, hgs);
}
+ buf->level--;
buf->writestring("}");
}
else
View
3  src/enum.c
@@ -347,16 +347,17 @@ void EnumDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
+ buf->level++;
for (size_t i = 0; i < members->dim; i++)
{
EnumMember *em = (*members)[i]->isEnumMember();
if (!em)
continue;
- //buf->writestring(" ");
em->toCBuffer(buf, hgs);
buf->writeByte(',');
buf->writenl();
}
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
View
2  src/func.c
@@ -1814,7 +1814,9 @@ void FuncDeclaration::bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writebyte('{');
buf->writenl();
+ buf->level++;
fbody->toCBuffer(buf, hgs);
+ buf->level--;
buf->writebyte('}');
buf->writenl();
}
View
1  src/hdrgen.c
@@ -51,6 +51,7 @@ void argsToCBuffer(OutBuffer *buf, Expressions *arguments, HdrGenState *hgs);
void Module::genhdrfile()
{
OutBuffer hdrbufr;
+ hdrbufr.doindent = 1;
hdrbufr.printf("// D import file generated from '%s'", srcfile->toChars());
hdrbufr.writenl();
View
69 src/root/root.c
@@ -1456,6 +1456,10 @@ OutBuffer::OutBuffer()
data = NULL;
offset = 0;
size = 0;
+
+ doindent = 0;
+ level = 0;
+ linehead = 1;
}
OutBuffer::~OutBuffer()
@@ -1501,6 +1505,19 @@ void OutBuffer::setsize(unsigned size)
void OutBuffer::write(const void *data, unsigned nbytes)
{
+ if (doindent && linehead)
+ {
+ if (level)
+ {
+ reserve(level);
+ for (size_t i=0; i<level; i++)
+ {
+ this->data[offset] = '\t';
+ offset++;
+ }
+ }
+ linehead = 0;
+ }
reserve(nbytes);
memcpy(this->data + offset, data, nbytes);
offset += nbytes;
@@ -1533,10 +1550,26 @@ void OutBuffer::writenl()
#else
writeByte('\n');
#endif
+ if (doindent)
+ linehead = 1;
}
void OutBuffer::writeByte(unsigned b)
{
+ if (doindent && linehead
+ && b != '\n')
+ {
+ if (level)
+ {
+ reserve(level);
+ for (size_t i=0; i<level; i++)
+ {
+ this->data[offset] = '\t';
+ offset++;
+ }
+ }
+ linehead = 0;
+ }
reserve(1);
this->data[offset] = (unsigned char)b;
offset++;
@@ -1604,6 +1637,24 @@ void OutBuffer::prependbyte(unsigned b)
void OutBuffer::writeword(unsigned w)
{
+ if (doindent && linehead
+#if _WIN32
+ && w != 0x0A0D)
+#else
+ && w != '\n')
+#endif
+ {
+ if (level)
+ {
+ reserve(level);
+ for (size_t i=0; i<level; i++)
+ {
+ this->data[offset] = '\t';
+ offset++;
+ }
+ }
+ linehead = 0;
+ }
reserve(2);
*(unsigned short *)(this->data + offset) = (unsigned short)w;
offset += 2;
@@ -1629,6 +1680,24 @@ void OutBuffer::writeUTF16(unsigned w)
void OutBuffer::write4(unsigned w)
{
+ if (doindent && linehead
+#if _WIN32
+ && w != 0x000A000D)
+#else
+ )
+#endif
+ {
+ if (level)
+ {
+ reserve(level);
+ for (size_t i=0; i<level; i++)
+ {
+ this->data[offset] = '\t';
+ offset++;
+ }
+ }
+ linehead = 0;
+ }
reserve(4);
*(unsigned *)(this->data + offset) = w;
offset += 4;
View
2  src/root/root.h
@@ -234,6 +234,8 @@ struct OutBuffer : Object
unsigned offset;
unsigned size;
+ int doindent, level, linehead;
+
OutBuffer();
~OutBuffer();
char *extractData();
View
54 src/statement.c
@@ -889,6 +889,7 @@ void UnrolledLoopStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
buf->writestring("unrolled {");
buf->writenl();
+ buf->level++;
for (size_t i = 0; i < statements->dim; i++)
{ Statement *s;
@@ -898,6 +899,7 @@ void UnrolledLoopStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
s->toCBuffer(buf, hgs);
}
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
@@ -1050,10 +1052,12 @@ void ScopeStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
buf->writeByte('{');
buf->writenl();
+ buf->level++;
if (statement)
statement->toCBuffer(buf, hgs);
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
@@ -1235,6 +1239,7 @@ void DoStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writestring("while (");
condition->toCBuffer(buf, hgs);
buf->writestring(");");
+ buf->writenl();
}
/******************************** ForStatement ***************************/
@@ -1513,7 +1518,9 @@ void ForStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writebyte('{');
buf->writenl();
+ buf->level++;
body->toCBuffer(buf, hgs);
+ buf->level--;
buf->writebyte('}');
buf->writenl();
}
@@ -2426,8 +2433,10 @@ void ForeachStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writebyte('{');
buf->writenl();
+ buf->level++;
if (body)
body->toCBuffer(buf, hgs);
+ buf->level--;
buf->writebyte('}');
buf->writenl();
}
@@ -2684,8 +2693,10 @@ void ForeachRangeStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writebyte('{');
buf->writenl();
+ buf->level++;
if (body)
body->toCBuffer(buf, hgs);
+ buf->level--;
buf->writebyte('}');
buf->writenl();
}
@@ -2837,11 +2848,19 @@ void IfStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
condition->toCBuffer(buf, hgs);
buf->writebyte(')');
buf->writenl();
+ if (!ifbody->isScopeStatement())
+ buf->level++;
ifbody->toCBuffer(buf, hgs);
+ if (!ifbody->isScopeStatement())
+ buf->level--;
if (elsebody)
{ buf->writestring("else");
buf->writenl();
+ if (!elsebody->isScopeStatement())
+ buf->level++;
elsebody->toCBuffer(buf, hgs);
+ if (!elsebody->isScopeStatement())
+ buf->level--;
}
}
@@ -2934,8 +2953,10 @@ void ConditionalStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
+ buf->level++;
if (ifbody)
ifbody->toCBuffer(buf, hgs);
+ buf->level--;
buf->writeByte('}');
buf->writenl();
if (elsebody)
@@ -2943,8 +2964,10 @@ void ConditionalStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writestring("else");
buf->writenl();
buf->writeByte('{');
+ buf->level++;
buf->writenl();
elsebody->toCBuffer(buf, hgs);
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
@@ -3100,9 +3123,11 @@ void PragmaStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
+ buf->level++;
body->toCBuffer(buf, hgs);
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
@@ -3340,7 +3365,9 @@ void SwitchStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
if (!body->isScopeStatement())
{ buf->writebyte('{');
buf->writenl();
+ buf->level++;
body->toCBuffer(buf, hgs);
+ buf->level--;
buf->writebyte('}');
buf->writenl();
}
@@ -3625,7 +3652,8 @@ int DefaultStatement::comeFrom()
void DefaultStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
- buf->writestring("default:\n");
+ buf->writestring("default:");
+ buf->writenl();
statement->toCBuffer(buf, hgs);
}
@@ -3659,7 +3687,8 @@ int GotoDefaultStatement::blockExit(bool mustNotThrow)
void GotoDefaultStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
- buf->writestring("goto default;\n");
+ buf->writestring("goto default;");
+ buf->writenl();
}
/******************************** GotoCaseStatement ***************************/
@@ -4552,7 +4581,8 @@ void WithStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
buf->writestring("with (");
exp->toCBuffer(buf, hgs);
- buf->writestring(")\n");
+ buf->writestring(")");
+ buf->writenl();
if (body)
body->toCBuffer(buf, hgs);
}
@@ -4775,8 +4805,10 @@ void Catch::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writebyte('{');
buf->writenl();
+ buf->level++;
if (handler)
handler->toCBuffer(buf, hgs);
+ buf->level--;
buf->writebyte('}');
buf->writenl();
}
@@ -4820,10 +4852,22 @@ Statement *TryFinallyStatement::semantic(Scope *sc)
void TryFinallyStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
- buf->printf("try\n{\n");
+ buf->writestring("try");
+ buf->writenl();
+ buf->writebyte('{');
+ buf->writenl();
+ buf->level++;
body->toCBuffer(buf, hgs);
- buf->printf("}\nfinally\n{\n");
+ buf->level--;
+ buf->writebyte('}');
+ buf->writenl();
+ buf->writestring("finally");
+ buf->writenl();
+ buf->writebyte('{');
+ buf->writenl();
+ buf->level++;
finalbody->toCBuffer(buf, hgs);
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
View
4 src/struct.c
@@ -795,13 +795,13 @@ void StructDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
+ buf->level++;
for (size_t i = 0; i < members->dim; i++)
{
Dsymbol *s = (*members)[i];
-
- buf->writestring(" ");
s->toCBuffer(buf, hgs);
}
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
View
2  src/template.c
@@ -2322,11 +2322,13 @@ void TemplateDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writebyte('{');
buf->writenl();
+ buf->level++;
for (size_t i = 0; i < members->dim; i++)
{
Dsymbol *s = (*members)[i];
s->toCBuffer(buf, hgs);
}
+ buf->level--;
buf->writebyte('}');
buf->writenl();
hgs->tpltMember--;
View
671 test/compilable/extra-files/header.di
@@ -7,146 +7,147 @@ typedef double mydbl = 10;
int main()
in
{
-assert(1 + (2 + 3) == -(1 - 2 * 3));
+ assert(1 + (2 + 3) == -(1 - 2 * 3));
}
out(result)
{
-assert(result == 0);
+ assert(result == 0);
}
body
{
-float f = (float).infinity;
-int i = cast(int)f;
-writeln((i , 1), 2);
-writeln(cast(int)(float).max);
-assert(i == cast(int)(float).max);
-assert(i == 2147483648u);
-return 0;
+ float f = (float).infinity;
+ int i = cast(int)f;
+ writeln((i , 1), 2);
+ writeln(cast(int)(float).max);
+ assert(i == cast(int)(float).max);
+ assert(i == 2147483648u);
+ return 0;
}
template Foo(T, int V)
{
-int bar(double d, int x)
-{
-if (d)
-{
-d++;
-}
-else
-d--;
-asm { naked; }
-asm { mov EAX,3; }
-for (;;)
-{
-{
-d = d + 1;
-}
-}
-{
-for (int i = 0;
- i < 10; i++)
-{
-{
-d = i ? d + 1 : 5;
-}
-}
-}
-char[] s;
-foreach (char c; s)
-{
-d *= 2;
-if (d)
-break;
-else
-continue;
-}
-switch (V)
-{
-case 1:
-{
-}
-case 2:
-{
-break;
-}
-case 3:
-{
-goto case 1;
-}
-case 4:
-{
-goto default;
-}
-default:
-{
-d /= 8;
-break;
-}
-}
-enum Label
-{
-A,
-B,
-C,
-}
-;
-void fswitch(Label l)
-{
-final switch (l)
-{
-case A:
-{
-break;
-}
-case B:
-{
-break;
-}
-case C:
-{
-break;
-}
-}
-}
-loop:
-while (x)
-{
-x--;
-if (x)
-break loop;
-else
-continue loop;
-}
-do
-{
-x++;
-}
-while (x < 10);try
-{
-try
-{
-bar(1, 2);
-}
-catch(Object o)
-{
-x++;
-}
-}
-finally
-{
-x--;
-}
-Object o;
-synchronized(o) {
-x = ~x;
-}
-synchronized {
-x = x < 3;
-}
-with (o)
-{
-toString();
-}
-}
+ int bar(double d, int x)
+ {
+ if (d)
+ {
+ d++;
+ }
+ else
+ d--;
+ asm { naked; }
+ asm { mov EAX,3; }
+ for (;;)
+ {
+ {
+ d = d + 1;
+ }
+ }
+ {
+ for (int i = 0;
+ i < 10; i++)
+ {
+ {
+ d = i ? d + 1 : 5;
+ }
+ }
+ }
+ char[] s;
+ foreach (char c; s)
+ {
+ d *= 2;
+ if (d)
+ break;
+ else
+ continue;
+ }
+ switch (V)
+ {
+ case 1:
+ {
+ }
+ case 2:
+ {
+ break;
+ }
+ case 3:
+ {
+ goto case 1;
+ }
+ case 4:
+ {
+ goto default;
+ }
+ default:
+ {
+ d /= 8;
+ break;
+ }
+ }
+ enum Label
+ {
+ A,
+ B,
+ C,
+ }
+ ;
+ void fswitch(Label l)
+ {
+ final switch (l)
+ {
+ case A:
+ {
+ break;
+ }
+ case B:
+ {
+ break;
+ }
+ case C:
+ {
+ break;
+ }
+ }
+ }
+ loop:
+ while (x)
+ {
+ x--;
+ if (x)
+ break loop;
+ else
+ continue loop;
+ }
+ do
+ {
+ x++;
+ }
+ while (x < 10);
+ try
+ {
+ try
+ {
+ bar(1, 2);
+ }
+ catch(Object o)
+ {
+ x++;
+ }
+ }
+ finally
+ {
+ x--;
+ }
+ Object o;
+ synchronized(o) {
+ x = ~x;
+ }
+ synchronized {
+ x = x < 3;
+ }
+ with (o)
+ {
+ toString();
+ }
+ }
}
static this();
interface iFoo
@@ -157,277 +158,277 @@ class xFoo : iFoo
}
class Foo3
{
- this(int a, ...);
- this(int* a)
-{
-}
+ this(int a, ...);
+ this(int* a)
+ {
+ }
}
alias int myint;
static notquit = 1;
class Test
{
- void a()
-{
-}
- void b()
-{
-}
- void c()
-{
-}
- void d()
-{
-}
- void e()
-{
-}
- void f()
-{
-}
- void g()
-{
-}
- void h()
-{
-}
- void i()
-{
-}
- void j()
-{
-}
- void k()
-{
-}
- void l()
-{
-}
- void m()
-{
-}
- void n()
-{
-}
- void o()
-{
-}
- void p()
-{
-}
- void q()
-{
-}
- void r()
-{
-}
- void s()
-{
-}
- void t()
-{
-}
- void u()
-{
-}
- void v()
-{
-}
- void w()
-{
-}
- void x()
-{
-}
- void y()
-{
-}
- void z()
-{
-}
- void aa()
-{
-}
- void bb()
-{
-}
- void cc()
-{
-}
- void dd()
-{
-}
- void ee()
-{
-}
- template A(T)
-{
-}
- alias A!(uint) getHUint;
- alias A!(int) getHInt;
- alias A!(float) getHFloat;
- alias A!(ulong) getHUlong;
- alias A!(long) getHLong;
- alias A!(double) getHDouble;
- alias A!(byte) getHByte;
- alias A!(ubyte) getHUbyte;
- alias A!(short) getHShort;
- alias A!(ushort) getHUShort;
- alias A!(real) getHReal;
+ void a()
+ {
+ }
+ void b()
+ {
+ }
+ void c()
+ {
+ }
+ void d()
+ {
+ }
+ void e()
+ {
+ }
+ void f()
+ {
+ }
+ void g()
+ {
+ }
+ void h()
+ {
+ }
+ void i()
+ {
+ }
+ void j()
+ {
+ }
+ void k()
+ {
+ }
+ void l()
+ {
+ }
+ void m()
+ {
+ }
+ void n()
+ {
+ }
+ void o()
+ {
+ }
+ void p()
+ {
+ }
+ void q()
+ {
+ }
+ void r()
+ {
+ }
+ void s()
+ {
+ }
+ void t()
+ {
+ }
+ void u()
+ {
+ }
+ void v()
+ {
+ }
+ void w()
+ {
+ }
+ void x()
+ {
+ }
+ void y()
+ {
+ }
+ void z()
+ {
+ }
+ void aa()
+ {
+ }
+ void bb()
+ {
+ }
+ void cc()
+ {
+ }
+ void dd()
+ {
+ }
+ void ee()
+ {
+ }
+ template A(T)
+ {
+ }
+ alias A!(uint) getHUint;
+ alias A!(int) getHInt;
+ alias A!(float) getHFloat;
+ alias A!(ulong) getHUlong;
+ alias A!(long) getHLong;
+ alias A!(double) getHDouble;
+ alias A!(byte) getHByte;
+ alias A!(ubyte) getHUbyte;
+ alias A!(short) getHShort;
+ alias A!(ushort) getHUShort;
+ alias A!(real) getHReal;
}
template templ(T)
{
-void templ(T val)
-{
-pragma (msg, "Invalid destination type.");
-}
+ void templ(T val)
+ {
+ pragma (msg, "Invalid destination type.");
+ }
}
static char[] charArray = ['"','\''];
class Point
{
- auto x = 10;
- uint y = 20;
+ auto x = 10;
+ uint y = 20;
}
template Foo2(bool bar)
{
-void test()
-{
-static if(bar)
-{
-int i;
-}
-else
-{
-}
+ void test()
+ {
+ static if(bar)
+ {
+ int i;
+ }
+ else
+ {
+ }
-static if(!bar)
-{
-}
-else
-{
-}
+ static if(!bar)
+ {
+ }
+ else
+ {
+ }
-}
+ }
}
template Foo4()
{
-void bar()
-{
-}
+ void bar()
+ {
+ }
}
class Baz4
{
- mixin Foo4!() foo;
- alias foo.bar baz;
+ mixin Foo4!() foo;
+ alias foo.bar baz;
}
template test(T)
{
-int test(T t)
-{
-if (auto o = cast(Object)t)
-return 1;
-return 0;
-}
+ int test(T t)
+ {
+ if (auto o = cast(Object)t)
+ return 1;
+ return 0;
+ }
}
enum x6 = 1;
bool foo6(int a, int b, int c, int d)
{
-return (a < b) != (c < d);
+ return (a < b) != (c < d);
}
auto foo7(int x)
{
-return 5;
+ return 5;
}
class D8
{
}
void func8()
{
-scope a = new D8;
+ scope a = new D8;
}
template func9(T)
{
-T func9()
-{
-T i;
-scope(exit) i = 1;
-scope(success) i = 2;
-scope(failure) i = 3;
-return i;
-}
+ T func9()
+ {
+ T i;
+ scope(exit) i = 1;
+ scope(success) i = 2;
+ scope(failure) i = 3;
+ return i;
+ }
}
template V10(T)
{
-void func()
-{
-{
-for (int i,j = 4; i < 3; i++)
-{
-{
-}
-}
-}
-}
+ void func()
+ {
+ {
+ for (int i,j = 4; i < 3; i++)
+ {
+ {
+ }
+ }
+ }
+ }
}
int foo11(int function() fn)
{
-return fn();
+ return fn();
}
template bar11(T)
{
-int bar11()
-{
-return foo11(function int()
-{
-return 0;
-}
-);
-}
+ int bar11()
+ {
+ return foo11(function int()
+ {
+ return 0;
+ }
+ );
+ }
}
struct S6360
{
- @property const pure nothrow long weeks1()
-{
-return 0;
-}
+ @property const pure nothrow long weeks1()
+ {
+ return 0;
+ }
- const nothrow pure @property long weeks2()
-{
-return 0;
-}
+ const nothrow pure @property long weeks2()
+ {
+ return 0;
+ }
}
struct S12
{
- nothrow this(int n)
-{
-}
- nothrow this(string s)
-{
-}
+ nothrow this(int n)
+ {
+ }
+ nothrow this(string s)
+ {
+ }
}
struct T12
{
- template __ctor()
-{
-immutable this(int args)
-{
-}
-}
- immutable template __ctor(A...)
-{
-this(A args)
-{
-}
-}
+ template __ctor()
+ {
+ immutable this(int args)
+ {
+ }
+ }
+ immutable template __ctor(A...)
+ {
+ this(A args)
+ {
+ }
+ }
}
import std.stdio : writeln, F = File;
template foo6591()
{
-void foo6591()
-{
-import std.stdio : writeln, F = File;
-}
+ void foo6591()
+ {
+ import std.stdio : writeln, F = File;
+ }
}
View
18 test/compilable/extra-files/test7754.di
@@ -1,12 +1,12 @@
template Foo(T)
{
-struct Foo
-{
- shared static this()
-{
-}
- static this()
-{
-}
-}
+ struct Foo
+ {
+ shared static this()
+ {
+ }
+ static this()
+ {
+ }
+ }
}
View
48 test/compilable/extra-files/xheader.di
@@ -12,41 +12,41 @@ class C2;
void foo2(const C2 c);
struct Foo3
{
- int k;
- ~this()
-{
-k = 1;
-}
- this(this)
-{
-k = 2;
-}
+ int k;
+ ~this()
+ {
+ k = 1;
+ }
+ this(this)
+ {
+ k = 2;
+ }
}
class C3
{
- @property int get()
-{
-return 0;
-}
+ @property int get()
+ {
+ return 0;
+ }
}
template foo3(T)
{
-T foo3()
-{
-}
+ T foo3()
+ {
+ }
}
template Foo4(T)
{
-struct Foo4
-{
- T x;
-}
+ struct Foo4
+ {
+ T x;
+ }
}
template C4(T)
{
-class C4
-{
- T x;
-}
+ class C4
+ {
+ T x;
+ }
}
Something went wrong with that request. Please try again.