Mercurial > projects > ddmd
comparison dmd/templates/Util.d @ 13:427f8aa74d28
On the road to make Phobos compilable
author | korDen |
---|---|
date | Mon, 12 Apr 2010 16:29:33 +0400 |
parents | 89cc05dbdae1 |
children | e28b18c23469 |
comparison
equal
deleted
inserted
replaced
12:832f71e6f96c | 13:427f8aa74d28 |
---|---|
1 module dmd.templates.Util; | 1 module dmd.templates.Util; |
2 | 2 |
3 import dmd.Dsymbol; | 3 import dmd.Dsymbol; |
4 import dmd.Type; | 4 import dmd.Type; |
5 import dmd.Expression; | 5 import dmd.Expression; |
6 import dmd.Loc; | |
7 import dmd.Scope; | |
8 import dmd.WANT; | |
6 | 9 |
7 version (DMDV2) { | 10 version (DMDV2) { |
8 Object objectSyntaxCopy(Object o) | 11 Object objectSyntaxCopy(Object o) |
9 { | 12 { |
10 if (!o) | 13 if (!o) |
19 return e.syntaxCopy(); | 22 return e.syntaxCopy(); |
20 | 23 |
21 return o; | 24 return o; |
22 } | 25 } |
23 } | 26 } |
27 | |
28 Object aliasParameterSemantic(Loc loc, Scope sc, Object o) | |
29 { | |
30 if (o) | |
31 { | |
32 Expression ea = isExpression(o); | |
33 Type ta = isType(o); | |
34 if (ta) | |
35 { | |
36 Dsymbol s = ta.toDsymbol(sc); | |
37 if (s) | |
38 o = s; | |
39 else | |
40 o = ta.semantic(loc, sc); | |
41 } | |
42 else if (ea) | |
43 { | |
44 ea = ea.semantic(sc); | |
45 o = ea.optimize(WANTvalue | WANTinterpret); | |
46 } | |
47 } | |
48 return o; | |
49 } |