Mercurial > projects > ddmd
diff dmd/StructDeclaration.d @ 176:fa9a71a9f5a8
Moved all the mutable globals to Global
author | korDen |
---|---|
date | Sun, 10 Oct 2010 05:22:45 +0400 |
parents | e7769d53e750 |
children | e3afd1303184 |
line wrap: on
line diff
--- a/dmd/StructDeclaration.d Sun Oct 10 03:48:06 2010 +0400 +++ b/dmd/StructDeclaration.d Sun Oct 10 05:22:45 2010 +0400 @@ -70,7 +70,7 @@ class StructDeclaration : AggregateDeclaration { bool zeroInit; // true if initialize with 0 fill - + version (DMDV2) { int hasIdentityAssign; // !=0 if has identity opAssign FuncDeclaration cpctor; // generated copy-constructor, if any @@ -86,10 +86,10 @@ // For forward references type = new TypeStruct(this); - + postblits = new FuncDeclarations(); /// } - + override Dsymbol syntaxCopy(Dsymbol s) { StructDeclaration sd; @@ -101,7 +101,7 @@ ScopeDsymbol.syntaxCopy(sd); return sd; } - + override void semantic(Scope sc) { Scope sc2; @@ -183,17 +183,17 @@ if (ad) t = ad.handle; else if (fd) - { + { AggregateDeclaration add = fd.isMember2(); if (add) t = add.handle; else - t = Type.tvoidptr; + t = global.tvoidptr; } else assert(0); if (t.ty == TY.Tstruct) - t = Type.tvoidptr; // t should not be a ref type + t = global.tvoidptr; // t should not be a ref type assert(!vthis); vthis = new ThisDeclaration(loc, t); //vthis.storage_class |= STC.STCref; @@ -240,7 +240,7 @@ } } if (auto d = s.isDeclaration()) - { + { if (auto t = d.type) { if (t.toBasetype().ty == TY.Tstruct) { auto ad = t.toDsymbol(sc).isThis(); @@ -431,7 +431,7 @@ semantic3(sc); } } - + override Dsymbol search(Loc loc, Identifier ident, int flags) { //printf("%s.StructDeclaration::search('%s')\n", toChars(), ident->toChars()); @@ -452,13 +452,13 @@ { assert(false); } - + override string mangle() { //printf("StructDeclaration.mangle() '%s'\n", toChars()); return Dsymbol.mangle(); } - + override string kind() { assert(false); @@ -522,7 +522,7 @@ } return true; } - + /******************************************* * We need an opEquals for the struct if * any fields has an opEquals. @@ -562,7 +562,7 @@ static if (X) printf("\tneed\n"); return true; } - + /****************************************** * Build opAssign for struct. * S* opAssign(S s) { ... } @@ -617,7 +617,7 @@ } else { e2 = new PtrExp(Loc(0), new ThisExp(Loc(0))); } - + ec = new AssignExp(Loc(0), e2, new IdentifierExp(Loc(0), Id.p)); ec.op = TOK.TOKblit; e = Expression.combine(e, ec); @@ -669,7 +669,7 @@ return fop; } - + /****************************************** * Build opEquals for struct. * const bool opEquals(const ref S s) { ... } @@ -767,11 +767,11 @@ StructDeclaration sd = ts.sym; if (sd.postblit) { Expression ex; - + // this.v ex = new ThisExp(Loc(0)); ex = new DotVarExp(Loc(0), ex, v, 0); - + if (dim == 1) { // this.v.postblit() ex = new DotVarExp(Loc(0), ex, sd.postblit, 0); @@ -782,10 +782,10 @@ // Typeinfo.postblit(cast(void*)&this.v); Expression ea = new AddrExp(Loc(0), ex); ea = new CastExp(Loc(0), ea, Type.tvoid.pointerTo()); - + Expression et = v.type.getTypeInfo(sc); et = new DotIdExp(Loc(0), et, Id._postblit); - + ex = new CallExp(Loc(0), et, ea); } e = Expression.combine(e, ex); // combine in forward order @@ -899,7 +899,7 @@ { assert(false); } - + override PROT getAccess(Dsymbol smember) // determine access to smember { assert(false); @@ -910,7 +910,7 @@ //printf("StructDeclaration.toObjFile('%s')\n", toChars()); if (multiobj) - { + { obj_append(this); return; } @@ -982,7 +982,7 @@ member.toObjFile(0); } } - + void toDt(dt_t** pdt) { uint offset; @@ -1010,7 +1010,7 @@ sz = cast(uint)v.type.size(); Initializer init = v.init; if (init) - { + { //printf("\t\thas initializer %s\n", init.toChars()); ExpInitializer ei = init.isExpInitializer(); Type tb = v.type.toBasetype(); @@ -1041,7 +1041,7 @@ dt_optimize(*pdt); } - + void toDebug() // to symbolic debug info { assert(false);