view dmd/DotTypeExp.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.DotTypeExp;

import dmd.common;
import dmd.Expression;
import dmd.backend.elem;
import dmd.UnaExp;
import dmd.OutBuffer;
import dmd.Loc;
import dmd.Scope;
import dmd.IRState;
import dmd.HdrGenState;
import dmd.Dsymbol;
import dmd.TOK;
import dmd.PREC;
import dmd.expression.Util;

import dmd.backend.Util;

import dmd.DDMDExtensions;

class DotTypeExp : UnaExp
{
	mixin insertMemberExtension!(typeof(this));

	Dsymbol sym;

	this(Loc loc, Expression e, Dsymbol s)
	{
		register();
		super(loc, TOK.TOKdottype, DotTypeExp.sizeof, e);
		this.sym = s;
		this.type = s.getType();
	}

	override Expression semantic(Scope sc)
	{
	version (LOGSEMANTIC) {
		printf("DotTypeExp.semantic('%s')\n", toChars());
	}
		UnaExp.semantic(sc);
		return this;
	}

	override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
	{
		expToCBuffer(buf, hgs, e1, PREC.PREC_primary);
		buf.writeByte('.');
		buf.writestring(sym.toChars());
	}

	override elem* toElem(IRState* irs)
	{
		// Just a pass-thru to e1
		elem *e;

		//printf("DotTypeExp.toElem() %s\n", toChars());
		e = e1.toElem(irs);
		el_setLoc(e,loc);
		return e;
	}
}