comparison dmd/TupleDeclaration.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 e3afd1303184
comparison
equal deleted inserted replaced
129:010eb8f0e18d 130:60bb0fe4563e
1 module dmd.TupleDeclaration; 1 module dmd.TupleDeclaration;
2 2
3 import dmd.common; 3 import dmd.common;
4 import dmd.Declaration; 4 import dmd.Declaration;
5 import dmd.Argument; 5 import dmd.Parameter;
6 import dmd.ArrayTypes; 6 import dmd.ArrayTypes;
7 import dmd.TypeTuple; 7 import dmd.TypeTuple;
8 import dmd.Loc; 8 import dmd.Loc;
9 import dmd.STC; 9 import dmd.STC;
10 import dmd.TOK; 10 import dmd.TOK;
52 return null; 52 return null;
53 if (!tupletype) 53 if (!tupletype)
54 { 54 {
55 /* It's only a type tuple if all the Object's are types 55 /* It's only a type tuple if all the Object's are types
56 */ 56 */
57 for (size_t i = 0; i < objects.dim; i++) 57 foreach (o; objects)
58 { 58 {
59 Object o = objects[i];
60
61 if (cast(Type)o is null) 59 if (cast(Type)o is null)
62 { 60 {
63 //printf("\tnot[%d], %p, %d\n", i, o, o->dyncast()); 61 //printf("\tnot[%d], %p, %d\n", i, o, o->dyncast());
64 return null; 62 return null;
65 } 63 }
66 } 64 }
67 65
68 /* We know it's a type tuple, so build the TypeTuple 66 /* We know it's a type tuple, so build the TypeTuple
69 */ 67 */
70 Arguments args = new Arguments(); 68 auto args = new Parameters();
71 args.setDim(objects.dim); 69 args.setDim(objects.dim);
72 OutBuffer buf = new OutBuffer(); 70 OutBuffer buf = new OutBuffer();
73 bool hasdeco = 1; 71 bool hasdeco = 1;
74 for (size_t i = 0; i < objects.dim; i++) 72 for (size_t i = 0; i < objects.dim; i++)
75 { Type t = cast(Type)objects[i]; 73 { Type t = cast(Type)objects[i];
78 static if (false) 76 static if (false)
79 { 77 {
80 buf.printf("_%s_%d", ident.toChars(), i); 78 buf.printf("_%s_%d", ident.toChars(), i);
81 char *name = cast(char *)buf.extractData(); 79 char *name = cast(char *)buf.extractData();
82 Identifier id = new Identifier(name, TOKidentifier); 80 Identifier id = new Identifier(name, TOKidentifier);
83 auto arg = new Argument(STCin, t, id, null); 81 auto arg = new Parameter(STCin, t, id, null);
84 } else { 82 } else {
85 auto arg = new Argument(STCundefined, t, null, null); 83 auto arg = new Parameter(STCundefined, t, null, null);
86 } 84 }
87 args[i] = arg; 85 args[i] = arg;
88 if (!t.deco) 86 if (!t.deco)
89 hasdeco = false; 87 hasdeco = false;
90 } 88 }