Mercurial > projects > ddmd
view dmd/DtorDeclaration.d @ 79:43073c7c7769
updated to 2.035
also implemented a few missing functions
still crashes in Import.importAll though
author | Trass3r |
---|---|
date | Mon, 30 Aug 2010 03:57:51 +0200 |
parents | 7e0d548de9e6 |
children | 5c859d5fbe27 |
line wrap: on
line source
module dmd.DtorDeclaration; import dmd.FuncDeclaration; import dmd.Loc; import dmd.Global; import dmd.Identifier; import dmd.Dsymbol; import dmd.Scope; import dmd.LINK; import dmd.AggregateDeclaration; import dmd.TypeFunction; import dmd.Type; import dmd.OutBuffer; import dmd.HdrGenState; import dmd.STC; import dmd.Id; class DtorDeclaration : FuncDeclaration { this(Loc loc, Loc endloc) { super(loc, endloc, Id.dtor, STCundefined, null); } this(Loc loc, Loc endloc, Identifier id) { assert(false); super(loc, endloc, null, STC.init, null); } override Dsymbol syntaxCopy(Dsymbol) { assert(false); } override void semantic(Scope sc) { //printf("DtorDeclaration::semantic() %s\n", toChars()); //printf("ident: %s, %s, %p, %p\n", ident.toChars(), Id::dtor.toChars(), ident, Id::dtor); parent = sc.parent; Dsymbol parent = toParent(); AggregateDeclaration ad = parent.isAggregateDeclaration(); if (!ad) { error("destructors are only for class/struct/union definitions, not %s %s", parent.kind(), parent.toChars()); } else if (ident == Id.dtor) ad.dtors.push(this); type = new TypeFunction(null, Type.tvoid, false, LINK.LINKd); sc = sc.push(); sc.stc &= ~STCstatic; // not a static destructor sc.linkage = LINK.LINKd; FuncDeclaration.semantic(sc); sc.pop(); } override void toCBuffer(OutBuffer buf, HdrGenState* hgs) { assert(false); } override void toJsonBuffer(OutBuffer buf) { } override string kind() { assert(false); } override string toChars() { return "~this"; } override bool isVirtual() { /* This should be FALSE so that dtor's don't get put into the vtbl[], * but doing so will require recompiling everything. */ version (BREAKABI) { return false; } else { return FuncDeclaration.isVirtual(); } } override bool addPreInvariant() { return (isThis() && vthis && global.params.useInvariants); } override bool addPostInvariant() { return false; } override bool overloadInsert(Dsymbol s) { assert(false); } override void emitComment(Scope sc) { assert(false); } override DtorDeclaration isDtorDeclaration() { return this; } }