Mercurial > projects > ddmd
view dmd/TypeExp.d @ 191:52188e7e3fb5
Fixed deprecated features, now compiles with DMD2.058
Also changed Array allocation policy:
Now doesn't reallocate but malloc's, followed by a memcpy (no free).
(this fixes a crash while compiling druntime. Same bug in dmd)
author | korDen@korDen-pc |
---|---|
date | Sun, 25 Mar 2012 03:11:12 +0400 |
parents | b0d41ff5e0df |
children |
line wrap: on
line source
module dmd.TypeExp; import dmd.common; import dmd.Expression; import dmd.backend.TYM; import dmd.backend.Util; import dmd.backend.elem; import dmd.Type; import dmd.OutBuffer; import dmd.Loc; import dmd.Scope; import dmd.IRState; import dmd.HdrGenState; import dmd.TOK; import dmd.DDMDExtensions; class TypeExp : Expression { mixin insertMemberExtension!(typeof(this)); this(Loc loc, Type type) { register(); super(loc, TOK.TOKtype, TypeExp.sizeof); //printf("TypeExp::TypeExp(%s)\n", type->toChars()); this.type = type; } override Expression syntaxCopy() { //printf("TypeExp.syntaxCopy()\n"); return new TypeExp(loc, type.syntaxCopy()); } override Expression semantic(Scope sc) { //printf("TypeExp::semantic(%s)\n", type->toChars()); type = type.semantic(loc, sc); return this; } override void rvalue() { error("type %s has no value", toChars()); } override void toCBuffer(OutBuffer buf, HdrGenState* hgs) { type.toCBuffer(buf, null, hgs); } override Expression optimize(int result) { return this; } override elem* toElem(IRState* irs) { debug writef("TypeExp.toElem()\n"); error("type %s is not an expression", toChars()); return el_long(TYint, 0); } }