Mercurial > projects > ddmd
view dmd/ProtDeclaration.d @ 87:b17640f0e4e8
Fixed a bug with a Scope.this(Scope enclosing) being called instead of Scope.clone() method (as a copy ctor replacement)
author | korDen |
---|---|
date | Mon, 30 Aug 2010 19:56:27 +0400 |
parents | 43073c7c7769 |
children | 23280d154c5b |
line wrap: on
line source
module dmd.ProtDeclaration; import dmd.AttribDeclaration; import dmd.PROT; import dmd.OutBuffer; import dmd.HdrGenState; import dmd.Scope; import dmd.Dsymbol; import dmd.Array; class ProtDeclaration : AttribDeclaration { PROT protection; this(PROT p, Dsymbols decl) { 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); } }