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 {
|
178
|
17 register();
|
129
|
18 super(loc, TOKdotexp, DotExp.sizeof, e1, e2);
|
0
|
19 }
|
|
20
|
72
|
21 override Expression semantic(Scope sc)
|
0
|
22 {
|
129
|
23 version (LOGSEMANTIC) {
|
|
24 printf("DotExp.semantic('%s')\n", toChars());
|
|
25 if (type) printf("\ttype = %s\n", type.toChars());
|
|
26 }
|
|
27 e1 = e1.semantic(sc);
|
|
28 e2 = e2.semantic(sc);
|
|
29 if (e2.op == TOKimport)
|
|
30 {
|
|
31 ScopeExp se = cast(ScopeExp)e2;
|
|
32 TemplateDeclaration td = se.sds.isTemplateDeclaration();
|
|
33 if (td)
|
|
34 {
|
|
35 Expression e = new DotTemplateExp(loc, e1, td);
|
|
36 e = e.semantic(sc);
|
|
37 return e;
|
|
38 }
|
|
39 }
|
|
40 if (!type)
|
|
41 type = e2.type;
|
|
42 return this;
|
0
|
43 }
|
|
44 }
|
|
45
|