Mercurial > projects > ddmd
comparison dmd/FileInitExp.d @ 23:460959608115
Branch merge.
author | Robert Clipsham <robert@octarineparrot.com> |
---|---|
date | Mon, 12 Apr 2010 17:00:08 +0100 |
parents | 427f8aa74d28 ddae60498573 |
children | 8c2c7b7579f8 |
comparison
equal
deleted
inserted
replaced
13:427f8aa74d28 | 23:460959608115 |
---|---|
2 | 2 |
3 import dmd.Expression; | 3 import dmd.Expression; |
4 import dmd.Loc; | 4 import dmd.Loc; |
5 import dmd.Scope; | 5 import dmd.Scope; |
6 import dmd.DefaultInitExp; | 6 import dmd.DefaultInitExp; |
7 import dmd.StringExp; | |
7 import dmd.TOK; | 8 import dmd.TOK; |
9 import dmd.Util; | |
10 import dmd.Type; | |
8 | 11 |
9 class FileInitExp : DefaultInitExp | 12 class FileInitExp : DefaultInitExp |
10 { | 13 { |
11 this(Loc loc) | 14 this(Loc loc) |
12 { | 15 { |
13 super(loc, TOKfile, FileInitExp.sizeof); | 16 super(loc, TOK.TOKfile, this.sizeof); |
14 } | 17 } |
15 | 18 |
16 Expression semantic(Scope sc) | 19 Expression semantic(Scope sc) |
17 { | 20 { |
18 assert(false); | 21 type = Type.tchar.invariantOf().arrayOf(); |
22 return this; | |
19 } | 23 } |
20 | 24 |
21 Expression resolve(Loc loc, Scope sc) | 25 Expression resolve(Loc loc, Scope sc) |
22 { | 26 { |
23 assert(false); | 27 //printf("FileInitExp::resolve() %s\n", toChars()); |
28 string s = loc.filename ? loc.filename : sc.module_.ident.toChars(); | |
29 Expression e = new StringExp(loc, s); | |
30 e = e.semantic(sc); | |
31 e = e.castTo(sc, type); | |
32 return e; | |
24 } | 33 } |
25 } | 34 } |
26 |