Mercurial > projects > ddmd
diff dmd/ClassDeclaration.d @ 130:60bb0fe4563e
dmdfe 2.037 first main iteration
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Thu, 09 Sep 2010 22:51:44 +0100 |
parents | 1765f3ef917d |
children | af1bebfd96a4 |
line wrap: on
line diff
--- a/dmd/ClassDeclaration.d Sun Sep 05 15:32:22 2010 +0400 +++ b/dmd/ClassDeclaration.d Thu Sep 09 22:51:44 2010 +0100 @@ -10,7 +10,7 @@ import dmd.CtorDeclaration; import dmd.TypeIdentifier; import dmd.STC; -import dmd.Argument; +import dmd.Parameter; import dmd.TypeTuple; import dmd.TY; import dmd.LINK; @@ -25,6 +25,7 @@ import dmd.ArrayTypes; import dmd.BaseClass; import dmd.ClassInfoDeclaration; +import dmd.TypeInfoClassDeclaration; import dmd.Loc; import dmd.Identifier; import dmd.Dsymbol; @@ -63,7 +64,7 @@ import std.string; version (DMDV2) { - enum CLASSINFO_SIZE = (0x3C+16+4); // value of ClassInfo.size + enum CLASSINFO_SIZE = (0x3C+12+4); // value of ClassInfo.size } else { enum CLASSINFO_SIZE = (0x3C+12+4); // value of ClassInfo.size } @@ -87,6 +88,10 @@ static __gshared ClassDeclaration classinfo; ClassDeclaration baseClass; // null only if this is Object +version(DMDV1) { + CtorDeclaration *ctor; + CtorDeclaration *defaultCtor; // default constructor +} FuncDeclaration staticCtor; FuncDeclaration staticDtor; Array vtbl; // Array of FuncDeclaration's making up the vtbl[] @@ -102,12 +107,14 @@ BaseClasses vtblInterfaces; // array of base interfaces that have // their own vtbl[] - ClassInfoDeclaration vclassinfo; // the ClassInfo object for this ClassDeclaration + TypeInfoClassDeclaration vclassinfo; // the ClassInfo object for this ClassDeclaration bool com; // true if this is a COM class (meaning // it derives from IUnknown) bool isauto; // true if this is an auto class bool isabstract; // true if abstract class - +version(DMDV1) { + int isnested; // !=0 if is nested +} int inuse; // to prevent recursive attempts this(Loc loc, Identifier id, BaseClasses baseclasses) @@ -261,7 +268,8 @@ object = this; } - if (id is Id.ClassInfo) +// if (id is Id.ClassInfo) + if (id is Id.TypeInfo_Class) { if (classinfo) classinfo.error("%s", msg); @@ -377,10 +385,10 @@ TypeTuple tup = cast(TypeTuple)tb; enum PROT protection = b.protection; baseclasses.remove(i); - size_t dim = Argument.dim(tup.arguments); + size_t dim = Parameter.dim(tup.arguments); for (size_t j = 0; j < dim; j++) { - Argument arg = Argument.getNth(tup.arguments, j); + auto arg = Parameter.getNth(tup.arguments, j); b = new BaseClass(arg.type, protection); baseclasses.insert(i + j, b); } @@ -1012,6 +1020,13 @@ } } +version(DMDV1) +{ + int isNested() + { + assert(false); + } +} bool isCOMclass() { return com; @@ -1278,7 +1293,7 @@ // Put out the TypeInfo type.getTypeInfo(null); - type.vtinfo.toObjFile(multiobj); + //type.vtinfo.toObjFile(multiobj); ////////////////////////////////////////////// @@ -1302,7 +1317,7 @@ OffsetTypeInfo[] offTi; void *defaultConstructor; const(MemberInfo[]) function(string) xgetMembers; // module getMembers() function - TypeInfo typeinfo; + //TypeInfo typeinfo; } */ dt_t* dt = null; @@ -1415,7 +1430,7 @@ dtdword(&dt, 0); // module getMembers() function } - dtxoff(&dt, type.vtinfo.toSymbol(), 0, TYnptr); // typeinfo + //dtxoff(&dt, type.vtinfo.toSymbol(), 0, TYnptr); // typeinfo //dtdword(&dt, 0); ////////////////////////////////////////////// @@ -1429,10 +1444,11 @@ ClassDeclaration id = b.base; /* The layout is: - * { + * struct Interface + * { * ClassInfo *interface; * void *[] vtbl; - * unsigned offset; + * ptrdiff_t offset; * } */ @@ -1473,8 +1489,6 @@ assert(id.vtbl.dim == b.vtbl.dim); for (; j < id.vtbl.dim; j++) { - FuncDeclaration fd; - assert(j < b.vtbl.dim); static if (false) { Object o = cast(Object)b.vtbl.data[j]; @@ -1486,7 +1500,7 @@ printf("s.kind() = '%s'\n", s.kind()); } } - fd = cast(FuncDeclaration)b.vtbl.data[j]; + auto fd = cast(FuncDeclaration)b.vtbl.data[j]; if (fd) dtxoff(&dt, fd.toThunkSymbol(b.offset), 0, TYnptr); else @@ -1635,7 +1649,7 @@ { TypeFunction tf = cast(TypeFunction)fd.type; if (tf.ty == Tfunction) - warning("%s%s is hidden by %s\n", fd.toPrettyChars(), Argument.argsTypesToChars(tf.parameters, tf.varargs), toChars()); + warning("%s%s is hidden by %s\n", fd.toPrettyChars(), Parameter.argsTypesToChars(tf.parameters, tf.varargs), toChars()); else warning("%s is hidden by %s\n", fd.toPrettyChars(), toChars()); }