Mercurial > projects > ddmd
annotate dmd/TypeInfoTupleDeclaration.d @ 130:60bb0fe4563e
dmdfe 2.037 first main iteration
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Thu, 09 Sep 2010 22:51:44 +0100 |
parents | 1765f3ef917d |
children | af724d3510d7 |
rev | line source |
---|---|
63 | 1 module dmd.TypeInfoTupleDeclaration; |
2 | |
114 | 3 import dmd.common; |
63 | 4 import dmd.Type; |
5 import dmd.TypeInfoDeclaration; | |
67 | 6 import dmd.WANT; |
7 import dmd.TypeTuple; | |
130
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
126
diff
changeset
|
8 import dmd.Parameter; |
67 | 9 import dmd.Expression; |
10 import dmd.TY; | |
11 import dmd.backend.TYM; | |
12 import dmd.backend.Symbol; | |
63 | 13 import dmd.backend.dt_t; |
67 | 14 import dmd.backend.Util; |
15 import dmd.codegen.Util; | |
63 | 16 |
17 class TypeInfoTupleDeclaration : TypeInfoDeclaration | |
18 { | |
19 this(Type tinfo) | |
20 { | |
21 super(tinfo, 0); | |
73 | 22 type = Type.typeinfotypelist.type; |
63 | 23 } |
24 | |
72 | 25 override void toDt(dt_t **pdt) |
63 | 26 { |
67 | 27 //printf("TypeInfoTupleDeclaration.toDt() %s\n", tinfo.toChars()); |
28 dtxoff(pdt, Type.typeinfotypelist.toVtblSymbol(), 0, TYnptr); // vtbl for TypeInfoInterface | |
29 dtdword(pdt, 0); // monitor | |
30 | |
31 assert(tinfo.ty == Ttuple); | |
32 | |
126
1765f3ef917d
ClassDeclarations, Arguments -> Vector
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
114
diff
changeset
|
33 auto tu = cast(TypeTuple)tinfo; |
67 | 34 |
35 size_t dim = tu.arguments.dim; | |
36 dtdword(pdt, dim); // elements.length | |
37 | |
38 dt_t* d = null; | |
39 for (size_t i = 0; i < dim; i++) | |
40 { | |
126
1765f3ef917d
ClassDeclarations, Arguments -> Vector
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
114
diff
changeset
|
41 auto arg = tu.arguments[i]; |
67 | 42 Expression e = arg.type.getTypeInfo(null); |
43 e = e.optimize(WANTvalue); | |
44 e.toDt(&d); | |
45 } | |
46 | |
47 Symbol *s; | |
48 s = static_sym(); | |
49 s.Sdt = d; | |
50 outdata(s); | |
51 | |
52 dtxoff(pdt, s, 0, TYnptr); // elements.ptr | |
63 | 53 } |
72 | 54 } |