Mercurial > projects > ddmd
view dmd/DotExp.d @ 187:b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
author | Abscissa |
---|---|
date | Tue, 07 Jun 2011 23:37:34 -0400 |
parents | e3afd1303184 |
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; } }