Mercurial > projects > ddmd
diff dmd/InterfaceDeclaration.d @ 176:fa9a71a9f5a8
Moved all the mutable globals to Global
author | korDen |
---|---|
date | Sun, 10 Oct 2010 05:22:45 +0400 |
parents | d8565fbd755c |
children | e3afd1303184 |
line wrap: on
line diff
--- a/dmd/InterfaceDeclaration.d Sun Oct 10 03:48:06 2010 +0400 +++ b/dmd/InterfaceDeclaration.d Sun Oct 10 05:22:45 2010 +0400 @@ -40,14 +40,14 @@ this(Loc loc, Identifier id, BaseClasses baseclasses) { super(loc, id, baseclasses); - + if (id is Id.IUnknown) // IUnknown is the root of all COM interfaces { com = true; cpp = true; // IUnknown is also a C++ interface } } - + override Dsymbol syntaxCopy(Dsymbol s) { InterfaceDeclaration id; @@ -60,7 +60,7 @@ ClassDeclaration.syntaxCopy(id); return id; } - + override void semantic(Scope sc) { //printf("InterfaceDeclaration.semantic(%s), type = %p\n", toChars(), type); @@ -76,12 +76,12 @@ handle = type; if (!members) // if forward reference - { + { //printf("\tinterface '%s' is forward referenced\n", toChars()); return; } if (symtab) // if already done - { + { if (!scope_) return; } @@ -90,7 +90,7 @@ Scope scx = null; if (scope_) - { + { sc = scope_; scx = scope_; // save so we don't make redundant copies scope_ = null; @@ -103,7 +103,7 @@ // Expand any tuples in baseclasses[] for (size_t i = 0; i < baseclasses.dim; ) - { + { auto b = baseclasses[0]; b.type = b.type.semantic(loc, sc); Type tb = b.type.toBasetype(); @@ -128,7 +128,7 @@ // Check for errors, handle forward references for (size_t i = 0; i < baseclasses.dim; ) - { + { TypeClass tc; BaseClass b; Type tb; @@ -164,7 +164,7 @@ continue; } if (!b.base.symtab) - { + { // Try to resolve forward reference if (sc.mustsemantic && b.base.scope_) b.base.semantic(null); @@ -197,7 +197,7 @@ // Cat together the vtbl[]'s from base interfaces for (size_t i = 0; i < interfaces_dim; i++) - { + { BaseClass b = interfaces[i]; // Skip if b has already appeared @@ -252,7 +252,7 @@ sc.pop(); //printf("-InterfaceDeclaration.semantic(%s), type = %p\n", toChars(), type); } - + override bool isBaseOf(ClassDeclaration cd, int* poffset) { uint j; @@ -268,7 +268,7 @@ { //printf("\tfound at offset %d\n", b.offset); if (poffset) - { + { *poffset = b.offset; if (j && cd.isInterfaceDeclaration()) *poffset = OFFSET_RUNTIME; @@ -276,7 +276,7 @@ return true; } if (isBaseOf(b, poffset)) - { + { if (j && poffset && cd.isInterfaceDeclaration()) *poffset = OFFSET_RUNTIME; return true; @@ -290,7 +290,7 @@ *poffset = 0; return false; } - + bool isBaseOf(BaseClass bc, int* poffset) { //printf("%s.InterfaceDeclaration.isBaseOf(bc = '%s')\n", toChars(), bc.base.toChars()); @@ -301,7 +301,7 @@ if (this == b.base) { if (poffset) - { + { *poffset = b.offset; if (j && bc.base.isInterfaceDeclaration()) *poffset = OFFSET_RUNTIME; @@ -309,7 +309,7 @@ return true; } if (isBaseOf(b, poffset)) - { + { if (j && poffset && bc.base.isInterfaceDeclaration()) *poffset = OFFSET_RUNTIME; return true; @@ -319,12 +319,12 @@ *poffset = 0; return false; } - + override string kind() { assert(false); } - + /**************************************** * Determine if slot 0 of the vtbl[] is reserved for something else. * For class objects, yes, this is where the ClassInfo ptr goes. @@ -337,7 +337,7 @@ return 0; return 1; } - + version (DMDV2) { override bool isCPPinterface() { @@ -481,7 +481,7 @@ offset += vtblInterfaces.dim * (4 * PTRSIZE); foreach (b; vtblInterfaces) - { + { ClassDeclaration id = b.base; // ClassInfo @@ -516,10 +516,7 @@ { Symbol *s; - if (!scc) - scc = fake_classsym(Id.ClassInfo); - - s = toSymbolX("__Interface", SCextern, scc.Stype, "Z"); + s = toSymbolX("__Interface", SCextern, global.scc.Stype, "Z"); s.Sfl = FLextern; s.Sflags |= SFLnodebug; csym = s;