Mercurial > projects > ddmd
view dmd/ProtDeclaration.d @ 191:52188e7e3fb5
Fixed deprecated features, now compiles with DMD2.058
Also changed Array allocation policy:
Now doesn't reallocate but malloc's, followed by a memcpy (no free).
(this fixes a crash while compiling druntime. Same bug in dmd)
author | korDen@korDen-pc |
---|---|
date | Sun, 25 Mar 2012 03:11:12 +0400 |
parents | b0d41ff5e0df |
children |
line wrap: on
line source
module dmd.ProtDeclaration; import dmd.common; import dmd.AttribDeclaration; import dmd.PROT; import dmd.OutBuffer; import dmd.HdrGenState; import dmd.Scope; import dmd.Dsymbol; import dmd.Array; import dmd.DDMDExtensions; class ProtDeclaration : AttribDeclaration { mixin insertMemberExtension!(typeof(this)); PROT protection; this(PROT p, Dsymbols decl) { register(); super(decl); protection = p; //printf("decl = %p\n", decl); } override Dsymbol syntaxCopy(Dsymbol s) { ProtDeclaration pd; assert(!s); pd = new ProtDeclaration(protection, Dsymbol.arraySyntaxCopy(decl)); return pd; } override void importAll(Scope sc) { Scope newsc = sc; if (sc.protection != protection || sc.explicitProtection != 1) { // create new one for changes newsc = sc.clone(); newsc.flags &= ~SCOPE.SCOPEfree; newsc.protection = protection; newsc.explicitProtection = 1; } foreach (Dsymbol s; decl) s.importAll(newsc); if (newsc !is sc) newsc.pop(); } override void setScope(Scope sc) { if (decl) { setScopeNewSc(sc, sc.stc, sc.linkage, protection, 1, sc.structalign); } } override void semantic(Scope sc) { if (decl) { semanticNewSc(sc, sc.stc, sc.linkage, protection, 1, sc.structalign); } } override void toCBuffer(OutBuffer buf, HdrGenState* hgs) { assert(false); } static void protectionToCBuffer(OutBuffer buf, PROT protection) { assert(false); } }