view dmd/TypeExp.d @ 32:81796b717a39

A few bad cast fixed. TODO: either get rid of dyncast(), or derive all objects from intermediate supertype.
author korDen
date Tue, 18 May 2010 17:51:46 +0400
parents 5c9b78899f5d
children 2e2a5c3f943a
line wrap: on
line source

module dmd.TypeExp;

import dmd.Expression;
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;

class TypeExp : Expression
{
	this(Loc loc, Type type)
	{
		super(loc, TOK.TOKtype, TypeExp.sizeof);
		//printf("TypeExp::TypeExp(%s)\n", type->toChars());
		this.type = type;
	}

version (DumbClone) {
} else {
	Type clone()
	{
		assert(false);
	}
}
	Expression syntaxCopy()
	{
		//printf("TypeExp.syntaxCopy()\n");
		return new TypeExp(loc, type.syntaxCopy());
	}

	Expression semantic(Scope sc)
	{
		//printf("TypeExp::semantic(%s)\n", type->toChars());
		type = type.semantic(loc, sc);
		return this;
	}

	void rvalue()
	{
		assert(false);
	}

	void toCBuffer(OutBuffer buf, HdrGenState* hgs)
	{
		type.toCBuffer(buf, null, hgs);
	}

	Expression optimize(int result)
	{
		return this;
	}

	elem* toElem(IRState* irs)
	{
		assert(false);
	}
}