Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

DI Generation Improvements #928

Closed
wants to merge 187 commits into from

2 participants

Adam Wilson Hara Kenji
Adam Wilson

This pull request attempt to improve the automatic generation of DI files by DMD.

All function implementations are removed from DI files except for those inside templates and functions with auto return values.
Proper indenting for DI files.

There were some changes to OutBuffer::write() to fix an OutOfMemory error I was getting on Windows (x64).

If anybody has any questions/comments/rants/raves or finds anything broken let me know. I would love to hear feedback.

NOTE: I apologize in advance for the spurious commits, I was apparently misinformed as to how to properly update my git branch (fetch/merge instead of the proper rebasing).

LightBender and others added some commits
Adam Wilson LightBender Initial commit for DI generation improvements 4aa8895
Adam Wilson LightBender Fixed handling of const types 5ceef9f
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' ce590c0
Adam Wilson LightBender All privates now included. Templates class/functions retain implement…
…ation. Immutable variables now keep initializer.
dc6772b
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 52ea71a
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' b62e855
Adam Wilson LightBender Fixed bug that would cause immutables inside template function implem…
…entions to lose their initializers.
bb539fe
Adam Wilson LightBender Fixed bug that would cause manifest constants to lose their initializ…
…ers.
e8f065c
Adam Wilson LightBender Fixed bug that would cause all function level variables to lose their…
… initializers.
390d2f4
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' c92a39c
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 49e7c1f
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 24e7dd1
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 293b46d
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 035dbb2
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 2767224
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' f7faf00
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 4b7f660
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 30ca882
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 15599e9
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' b4da79a
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 528c456
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' d318588
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' e2d62a2
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 3b8e2f7
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 57bfe04
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' ea8b2f3
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' b85ff89
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 1ea04d5
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' fcc235a
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 848c4a7
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 59ec5c6
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' cba7380
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 429aa77
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 8664080
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' ed98a4c
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' d7b8065
Adam Wilson LightBender Initial indent tracking commit, work not finished. a012440
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 17fe8dd
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' e2768af
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' d0c7a86
Adam Wilson LightBender Initial indent tracking commit, work not finished. 5d6f9d9
Adam Wilson LightBender Fixed a merge conflict in statement.c function UnrolledLoopStatement:…
…:toCBuffer
ba922c7
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' dd61ab6
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 8311847
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' b69e0de
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 887b425
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' e192b34
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 82c2071
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 0f31090
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 9416fdd
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' b69c06a
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 45832cf
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' bd3c1e8
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' a16dea1
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' a78e8ed
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 0d8dc6d
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' f0c77b2
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 51626a6
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 8f2aef8
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' e711de4
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 6e46382
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' c6fa330
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 40d00de
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 9237ccc
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 98532ed
Adam Wilson LightBender switched all indenting code to use buf->level 0476a0e
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' c7e5cc5
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 7c74078
Adam Wilson LightBender updated to exclude types that non longer need indenting. 2fd2c06
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' cc75458
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 7a1ca85
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 8febdc6
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 3d98f2e
Adam Wilson LightBender testing changes to debug a DMD assert error. 2e25dea
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' e39b6ef
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 1bbe905
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 995bfe9
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' bdf1e5c
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 0b21c38
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 2a8ddb2
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 1c978e7
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 127865a
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 3f81329
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' abeba48
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 1acce22
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 7a9825e
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' b9c9020
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' becbf13
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 591d005
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' ecf3e2a
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' af4662b
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' fd60d7e
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 993371e
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 9351cf9
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 54fcb78
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 923ca68
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' ff73c40
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 017deee
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' cd6107d
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' a9c6c8f
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 798c188
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 0c06fb6
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 0b439a3
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' b62435d
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 645791c
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 1985a37
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 33ad892
Adam Wilson LightBender Fixed merge errors with DMD HEAD 36ab5df
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' fcf5016
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' fb2633e
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 154fa60
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 058484b
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 0145ef1
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 7302ee8
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 7147d3d
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' fdd2030
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 6ae406d
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 2084998
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 02517d7
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' eacaf5f
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' d97b4ce
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' bf328e4
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 44e96eb
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 474f1fd
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' cfa40b3
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' dca4387
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 416e528
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' a780047
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' f7d6baa
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' be3fcda
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 2e5ef5c
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 4589790
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' d5427a8
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' a9b705b
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' d6a16cc
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' e949ec0
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 1609c73
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 8be3d56
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 019a960
unknown Merge remote-tracking branch 'upstream/master' 200afe6
unknown Merge remote-tracking branch 'upstream/master' 9be6981
unknown Merge remote-tracking branch 'upstream/master' d4b2996
unknown Merge remote-tracking branch 'upstream/master' 0d82e7e
unknown Merge remote-tracking branch 'upstream/master' b2678de
unknown Merge remote-tracking branch 'upstream/master' 2aa5796
unknown Merge remote-tracking branch 'upstream/master' aa44359
unknown Merge remote-tracking branch 'upstream/master' ea12018
unknown Merge remote-tracking branch 'upstream/master' bc4acb5
unknown Merge remote-tracking branch 'upstream/master' ad3667c
unknown Merge remote-tracking branch 'upstream/master' c931f7e
unknown Merge remote-tracking branch 'upstream/master' 40f7049
unknown Merge remote-tracking branch 'upstream/master' 13be385
unknown Merge remote-tracking branch 'upstream/master' 305f5f4
unknown Merge remote-tracking branch 'upstream/master' a072aed
unknown Updated to account for Issue 7754 5ec8e39
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 1c4a55e
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' a32b529
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' f37f3b2
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 9e867ce
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 3549a55
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' d08b438
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 69199ec
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' de166c2
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 0a5dbe7
Adam Wilson LightBender Fix merge conflict on cond.c 5bc0639
Adam Wilson LightBender Fixed collisions in class.c and struct.c d4c06b0
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' db3bfc8
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' cd638be
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' b551742
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' ecee9ca
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 8c551d6
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 1e7e39a
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 0549056
Adam Wilson LightBender Variables now keep their initializers. Changed assert null check in m…
…type.c at line 5222 to if() null check to fix spurious assert.
0355522
Adam Wilson LightBender Cleaned up some dead code in prepartion for the pending pull request. 3d23ee1
Adam Wilson LightBender Replaced tabs with spaces per style requirements. d7aaa69
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 24152fc
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' a366de9
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' f75f205
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 7f1f7f9
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' b93a698
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' f26612a
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' ede62e7
Adam Wilson LightBender Merge remote-tracking branch 'upstream/master' 156bb5c
Adam Wilson LightBender Functions with auto return values must keep their implemenations for DMD
to perform type deduction. (Fixes posix build error)
Fixed delegates in template constraints not keeping their implementions.
(Fixes Windows build error)
2587414
Adam Wilson LightBender Removed tabs to conform to style guidelines. 35470c0
Adam Wilson LightBender Removed an extraneous function that was only used for testing. da7cbe9
Hara Kenji
Collaborator

I think correct di generation should run AFTER semantic analysis. When it is necessary to keep original code (e.g. template declaration), we can save AST with syntaxCopy before semantic analysis, and use it after.

Hara Kenji
Collaborator

I think this pull is terrible. You should create new branch for the pull request, instead of using master. And sometimes you can rebase the branch and push -f to your repo to track dmd head.

Adam Wilson

Walter put a big comment mars.c about how DI generation should never be done after semantic analysis. I was merely following his advice.

I think what I may have to do close this one and recreate my fork by hand. I was not well instructed in the proper procedures for DMD work when I started this project.

Adam Wilson

Closing to clean up.

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.
29 src/attrib.c
View
@@ -26,6 +26,7 @@
#include "module.h"
#include "parse.h"
#include "template.h"
+#include "hdrgen.h"
#if TARGET_NET
#include "frontend.net/pragma.h"
#endif
@@ -348,7 +349,6 @@ void AttribDeclaration::addLocalClass(ClassDeclarations *aclasses)
}
}
-
void AttribDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
if (decl)
@@ -362,13 +362,13 @@ void AttribDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
- for (size_t i = 0; i < decl->dim; i++)
+ buf->level++;
+ for (unsigned i = 0; i < decl->dim; i++)
{
Dsymbol *s = (*decl)[i];
-
- buf->writestring(" ");
s->toCBuffer(buf, hgs);
}
+ buf->level--;
buf->writeByte('}');
}
}
@@ -868,18 +868,21 @@ void AnonDeclaration::setFieldOffset(AggregateDeclaration *ad, unsigned *poffset
void AnonDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
buf->printf(isunion ? "union" : "struct");
- buf->writestring("\n{\n");
+ buf->writenl();
+ buf->writestring("{");
+ 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->writestring("}\n");
+ buf->level--;
+ buf->writestring("}");
+ buf->writenl();
}
const char *AnonDeclaration::kind()
@@ -1309,16 +1312,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)
{
@@ -1327,13 +1330,13 @@ void ConditionalDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
- for (size_t i = 0; i < elsedecl->dim; i++)
+ buf->level++;
+ for (unsigned i = 0; i < elsedecl->dim; i++)
{
Dsymbol *s = (*elsedecl)[i];
-
- buf->writestring(" ");
s->toCBuffer(buf, hgs);
}
+ buf->level--;
buf->writeByte('}');
}
}
5 src/class.c
View
@@ -26,6 +26,7 @@
#include "module.h"
#include "expression.h"
#include "statement.h"
+#include "hdrgen.h"
/********************************* ClassDeclaration ****************************/
@@ -819,13 +820,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
1  src/cond.c
View
@@ -22,6 +22,7 @@
#include "lexer.h"
#include "mtype.h"
#include "scope.h"
+#include "hdrgen.h"
#include "arraytypes.h"
int findCondition(Strings *ids, Identifier *ident)
7 src/declaration.c
View
@@ -1725,10 +1725,15 @@ void VarDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
/* If changing, be sure and fix CompoundDeclarationStatement::toCBuffer()
* too.
*/
+
+ int ism = 0;
if (type)
+ {
type->toCBuffer(buf, ident, hgs);
+ }
else
- buf->writestring(ident->toChars());
+ buf->writestring(ident->toChars());
+
if (init)
{ buf->writestring(" = ");
#if DMDV2
1  src/dsymbol.c
View
@@ -31,6 +31,7 @@
#include "import.h"
#include "template.h"
#include "attrib.h"
+#include "hdrgen.h"
/****************************** Dsymbol ******************************/
4 src/enum.c
View
@@ -18,6 +18,7 @@
#include "expression.h"
#include "module.h"
#include "declaration.h"
+#include "hdrgen.h"
/********************************* EnumDeclaration ****************************/
@@ -345,16 +346,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();
}
40 src/func.c
View
@@ -1683,7 +1683,22 @@ void FuncDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
StorageClassDeclaration::stcToCBuffer(buf, storage_class);
type->toCBuffer(buf, ident, hgs);
- bodyToCBuffer(buf, hgs);
+ if(hgs->hdrgen == 1)
+ {
+ if(storage_class & STCauto)
+ {
+ hgs->autoMember++;
+ bodyToCBuffer(buf, hgs);
+ hgs->autoMember--;
+ }
+ else if(hgs->tpltMember == 0)
+ buf->writestring(";");
+ else
+ bodyToCBuffer(buf, hgs);
+ }
+ else
+ bodyToCBuffer(buf, hgs);
+ buf->writenl();
}
VarDeclaration *FuncDeclaration::declareThis(Scope *sc, AggregateDeclaration *ad)
@@ -1778,21 +1793,21 @@ int FuncDeclaration::equals(Object *o)
void FuncDeclaration::bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
- if (fbody &&
- (!hgs->hdrgen || hgs->tpltMember || canInline(1,1,1))
- )
+ if (fbody && (!hgs->hdrgen || hgs->autoMember || hgs->tpltMember))
{ buf->writenl();
// in{}
if (frequire)
- { buf->writestring("in");
+ {
+ buf->writestring("in");
buf->writenl();
frequire->toCBuffer(buf, hgs);
}
// out{}
if (fensure)
- { buf->writestring("out");
+ {
+ buf->writestring("out");
if (outId)
{ buf->writebyte('(');
buf->writestring(outId->toChars());
@@ -1803,18 +1818,22 @@ void FuncDeclaration::bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs)
}
if (frequire || fensure)
- { buf->writestring("body");
+ {
+ buf->writestring("body");
buf->writenl();
}
buf->writebyte('{');
buf->writenl();
+ buf->level++;
fbody->toCBuffer(buf, hgs);
+ buf->level--;
buf->writebyte('}');
buf->writenl();
}
else
- { buf->writeByte(';');
+ {
+ buf->writeByte(';');
buf->writenl();
}
}
@@ -3305,7 +3324,9 @@ void FuncLiteralDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writestring(kind());
buf->writeByte(' ');
type->toCBuffer(buf, NULL, hgs);
+ hgs->tpltMember++;
bodyToCBuffer(buf, hgs);
+ hgs->tpltMember--;
}
@@ -3711,7 +3732,8 @@ int StaticCtorDeclaration::addPostInvariant()
void StaticCtorDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
if (hgs->hdrgen && !hgs->tpltMember)
- { buf->writestring("static this();");
+ {
+ buf->writestring("static this();");
buf->writenl();
return;
}
1  src/hdrgen.c
View
@@ -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();
6 src/hdrgen.h
View
@@ -22,6 +22,8 @@ struct HdrGenState
int inBinExp;
int inArrExp;
int emitInst;
+ int autoMember; // Non-zero if function is an auto type
+
struct
{
int init;
@@ -29,6 +31,4 @@ struct HdrGenState
} FLinit;
HdrGenState() { memset(this, 0, sizeof(HdrGenState)); }
-};
-
-
+};
1  src/init.c
View
@@ -914,6 +914,7 @@ Expression *ExpInitializer::toExpression()
void ExpInitializer::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
+
exp->toCBuffer(buf, hgs);
}
6 src/mtype.c
View
@@ -1645,7 +1645,7 @@ Type *Type::merge()
//if (next)
//next = next->merge();
- toDecoBuffer(&buf);
+ this->toDecoBuffer(&buf);
sv = stringtable.update((char *)buf.data, buf.offset);
if (sv->ptrvalue)
{ t = (Type *) sv->ptrvalue;
@@ -5219,8 +5219,8 @@ void TypeFunction::toDecoBuffer(OutBuffer *buf, int flag)
Parameter::argsToDecoBuffer(buf, parameters);
//if (buf->data[buf->offset - 1] == '@') halt();
buf->writeByte('Z' - varargs); // mark end of arg list
- assert(next);
- next->toDecoBuffer(buf);
+ //assert(next);
+ if(next != NULL) next->toDecoBuffer(buf);
inuse--;
}
84 src/root/root.c
View
@@ -1543,6 +1543,10 @@ OutBuffer::OutBuffer()
data = NULL;
offset = 0;
size = 0;
+
+ doindent = 0;
+ level = 0;
+ linehead = 1;
}
OutBuffer::~OutBuffer()
@@ -1588,7 +1592,33 @@ void OutBuffer::setsize(unsigned size)
void OutBuffer::write(const void *data, unsigned nbytes)
{
- reserve(nbytes);
+ //if (doindent && linehead)
+ //{
+ // if (level)
+ // {
+ // reserve(level);
+ // for (size_t i=0; i<level; i++)
+ // {
+ // this->data[offset] = '\t';
+ // offset++;
+ // }
+ // }
+ // linehead = 0;
+ //}
+ 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;
}
@@ -1652,10 +1682,26 @@ void OutBuffer::writenl()
writeByte('\n');
#endif
#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++;
@@ -1730,6 +1776,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;
@@ -1755,6 +1819,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;
2  src/root/root.h
View
@@ -271,6 +271,8 @@ struct OutBuffer : Object
unsigned offset;
unsigned size;
+ int doindent, level, linehead;
+
OutBuffer();
~OutBuffer();
char *extractData();
73 src/statement.c
View
@@ -860,15 +860,16 @@ 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;
-
+ {
+ Statement *s;
s = (*statements)[i];
if (s)
s->toCBuffer(buf, hgs);
}
-
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
@@ -1021,10 +1022,13 @@ 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();
}
@@ -1484,7 +1488,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();
}
@@ -2351,8 +2357,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();
}
@@ -2580,8 +2588,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();
}
@@ -2733,12 +2743,21 @@ 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->writestring("else");
buf->writenl();
+ if (!elsebody->isScopeStatement())
+ buf->level++;
elsebody->toCBuffer(buf, hgs);
- }
+ if (!elsebody->isScopeStatement())
+ buf->level--;
+ }
}
/******************************** ConditionalStatement ***************************/
@@ -2829,9 +2848,11 @@ void ConditionalStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
condition->toCBuffer(buf, hgs);
buf->writenl();
buf->writeByte('{');
+ buf->level++;
buf->writenl();
if (ifbody)
ifbody->toCBuffer(buf, hgs);
+ buf->level--;
buf->writeByte('}');
buf->writenl();
if (elsebody)
@@ -2840,7 +2861,9 @@ void ConditionalStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
buf->writenl();
buf->writeByte('{');
buf->writenl();
+ buf->level++;
elsebody->toCBuffer(buf, hgs);
+ buf->level--;
buf->writeByte('}');
buf->writenl();
}
@@ -2993,9 +3016,9 @@ 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();
}
@@ -3227,9 +3250,12 @@ void SwitchStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
if (body)
{
if (!body->isScopeStatement())
- { buf->writebyte('{');
+ {
+ buf->writebyte('{');
buf->writenl();
+ buf->level++;
body->toCBuffer(buf, hgs);
+ buf->level--;
buf->writebyte('}');
buf->writenl();
}
@@ -3512,7 +3538,8 @@ int DefaultStatement::comeFrom()
void DefaultStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
- buf->writestring("default:\n");
+ buf->writestring("default:");
+ buf->writenl();
statement->toCBuffer(buf, hgs);
}
@@ -3546,7 +3573,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 ***************************/
@@ -4427,7 +4455,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);
}
@@ -4650,8 +4679,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();
}
@@ -4695,10 +4726,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();
}
@@ -5176,6 +5219,7 @@ int AsmStatement::blockExit(bool mustNotThrow)
void AsmStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
buf->writestring("asm { ");
+ buf->level++;
Token *t = tokens;
while (t)
{
@@ -5197,6 +5241,7 @@ void AsmStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
}
t = t->next;
}
+ buf->level--;
buf->writestring("; }");
buf->writenl();
}
5 src/struct.c
View
@@ -20,6 +20,7 @@
#include "id.h"
#include "statement.h"
#include "template.h"
+#include "hdrgen.h"
FuncDeclaration *StructDeclaration::xerreq; // object.xopEquals
@@ -705,13 +706,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();
}
2  src/template.c
View
@@ -2181,11 +2181,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--;
1  src/version.c
View
@@ -17,6 +17,7 @@
#include "cond.h"
#include "version.h"
#include "module.h"
+#include "hdrgen.h"
/* ================================================== */
663 test/compilable/extra-files/header.di
View
@@ -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,269 +158,269 @@ 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)
+ {
+ }
+ }
}
48 test/compilable/extra-files/xheader.di
View
@@ -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.