72
|
1 module dmd.DotExp;
|
|
2
|
114
|
3 import dmd.common;
|
72
|
4 import dmd.Expression;
|
|
5 import dmd.Loc;
|
|
6 import dmd.Scope;
|
129
|
7 import dmd.ScopeExp;
|
|
8 import dmd.TemplateDeclaration;
|
|
9 import dmd.DotTemplateExp;
|
72
|
10 import dmd.BinExp;
|
|
11 import dmd.TOK;
|
|
12
|
0
|
13 class DotExp : BinExp
|
|
14 {
|
|
15 this(Loc loc, Expression e1, Expression e2)
|
|
16 {
|
129
|
17 super(loc, TOKdotexp, DotExp.sizeof, e1, e2);
|
0
|
18 }
|
|
19
|
72
|
20 override Expression semantic(Scope sc)
|
0
|
21 {
|
129
|
22 version (LOGSEMANTIC) {
|
|
23 printf("DotExp.semantic('%s')\n", toChars());
|
|
24 if (type) printf("\ttype = %s\n", type.toChars());
|
|
25 }
|
|
26 e1 = e1.semantic(sc);
|
|
27 e2 = e2.semantic(sc);
|
|
28 if (e2.op == TOKimport)
|
|
29 {
|
|
30 ScopeExp se = cast(ScopeExp)e2;
|
|
31 TemplateDeclaration td = se.sds.isTemplateDeclaration();
|
|
32 if (td)
|
|
33 {
|
|
34 Expression e = new DotTemplateExp(loc, e1, td);
|
|
35 e = e.semantic(sc);
|
|
36 return e;
|
|
37 }
|
|
38 }
|
|
39 if (!type)
|
|
40 type = e2.type;
|
|
41 return this;
|
0
|
42 }
|
|
43 }
|
|
44
|