Mercurial > projects > ddmd
diff dmd/StaticCtorDeclaration.d @ 98:5c859d5fbe27
and more
author | Trass3r |
---|---|
date | Tue, 31 Aug 2010 03:53:49 +0200 |
parents | 43073c7c7769 |
children | e28b18c23469 |
line wrap: on
line diff
--- a/dmd/StaticCtorDeclaration.d Tue Aug 31 02:12:15 2010 +0200 +++ b/dmd/StaticCtorDeclaration.d Tue Aug 31 03:53:49 2010 +0200 @@ -30,17 +30,19 @@ class StaticCtorDeclaration : FuncDeclaration { - this(Loc loc, Loc endloc) + this(Loc loc, Loc endloc) { super(loc, endloc, Identifier.generateId("_staticCtor"), STCstatic, null); } - override Dsymbol syntaxCopy(Dsymbol) + override Dsymbol syntaxCopy(Dsymbol s) { - assert(false); + assert(!s); + StaticCtorDeclaration scd = new StaticCtorDeclaration(loc, endloc); + return FuncDeclaration.syntaxCopy(scd); } - override void semantic(Scope sc) + override void semantic(Scope sc) { //printf("StaticCtorDeclaration.semantic()\n"); @@ -84,45 +86,51 @@ if (m) { m.needmoduleinfo = 1; + // writef("module1 %s needs moduleinfo\n", m.toChars()); version (IN_GCC) { m.strictlyneedmoduleinfo = 1; } } } - override AggregateDeclaration isThis() + override AggregateDeclaration isThis() { return null; } - override bool isStaticConstructor() + override bool isStaticConstructor() { return true; } - override bool isVirtual() + override bool isVirtual() { return false; } - override bool addPreInvariant() + override bool addPreInvariant() + { + return false; + } + + override bool addPostInvariant() { return false; } - override bool addPostInvariant() + override void emitComment(Scope sc) { - return false; } - override void emitComment(Scope sc) + override void toCBuffer(OutBuffer buf, HdrGenState* hgs) { - assert(false); - } - - override void toCBuffer(OutBuffer buf, HdrGenState* hgs) - { - assert(false); + if (hgs.hdrgen) + { + buf.writestring("static this();\n"); + return; + } + buf.writestring("static this()"); + bodyToCBuffer(buf, hgs); } override void toJsonBuffer(OutBuffer buf)