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

import dmd.common;
import dmd.Expression;
import dmd.Loc;
import dmd.Scope;
import dmd.ScopeExp;
import dmd.TemplateDeclaration;
import dmd.DotTemplateExp;
import dmd.BinExp;
import dmd.TOK;

import dmd.DDMDExtensions;

class DotExp : BinExp
{
	mixin insertMemberExtension!(typeof(this));

	this(Loc loc, Expression e1, Expression e2)
	{
		register();
		super(loc, TOKdotexp, DotExp.sizeof, e1, e2);
	}

	override Expression semantic(Scope sc)
	{
version (LOGSEMANTIC) {
		printf("DotExp.semantic('%s')\n", toChars());
		if (type) printf("\ttype = %s\n", type.toChars());
}
		e1 = e1.semantic(sc);
		e2 = e2.semantic(sc);
		if (e2.op == TOKimport)
		{
			ScopeExp se = cast(ScopeExp)e2;
			TemplateDeclaration td = se.sds.isTemplateDeclaration();
			if (td)
			{   
				Expression e = new DotTemplateExp(loc, e1, td);
				e = e.semantic(sc);
				return e;
			}
		}
		if (!type)
			type = e2.type;
		return this;
	}
}