Mercurial > projects > ddmd
annotate dmd/FileInitExp.d @ 192:eb38fdcb3e62 default tip
updated to compile with dmd2.062
author | korDen |
---|---|
date | Sat, 02 Mar 2013 01:25:52 -0800 |
parents | b0d41ff5e0df |
children |
rev | line source |
---|---|
72 | 1 module dmd.FileInitExp; |
2 | |
114 | 3 import dmd.common; |
72 | 4 import dmd.Expression; |
5 import dmd.Loc; | |
6 import dmd.Scope; | |
7 import dmd.DefaultInitExp; | |
8 import dmd.StringExp; | |
9 import dmd.TOK; | |
10 import dmd.Util; | |
11 import dmd.Type; | |
12 | |
187
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
13 import dmd.DDMDExtensions; |
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
14 |
72 | 15 class FileInitExp : DefaultInitExp |
16 { | |
187
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
17 mixin insertMemberExtension!(typeof(this)); |
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
18 |
72 | 19 this(Loc loc) |
20 { | |
178 | 21 register(); |
72 | 22 super(loc, TOK.TOKfile, this.sizeof); |
23 } | |
24 | |
25 override Expression semantic(Scope sc) | |
26 { | |
27 type = Type.tchar.invariantOf().arrayOf(); | |
28 return this; | |
29 } | |
30 | |
130
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
114
diff
changeset
|
31 override Expression resolveLoc(Loc loc, Scope sc) |
72 | 32 { |
33 //printf("FileInitExp::resolve() %.*s\n", toChars()); | |
34 string s = loc.filename ? loc.filename : sc.module_.ident.toChars(); | |
35 Expression e = new StringExp(loc, s); | |
36 e = e.semantic(sc); | |
37 e = e.castTo(sc, type); | |
38 return e; | |
39 } | |
40 } |