annotate dmd/TypeSArray.d @ 187:b0d41ff5e0df

Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
author Abscissa
date Tue, 07 Jun 2011 23:37:34 -0400
parents e3afd1303184
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.TypeSArray;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
114
e28b18c23469 added a module dmd.common for commonly used stuff
Trass3r
parents: 113
diff changeset
3 import dmd.common;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.TypeArray;
64
4290d870944a More fixes
korDen
parents: 51
diff changeset
5 import dmd.TypeInfoStaticArrayDeclaration;
51
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
6 import dmd.TypeAArray;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.MOD;
162
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 154
diff changeset
8 import dmd.ArrayExp;
130
60bb0fe4563e dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 126
diff changeset
9 import dmd.Parameter;
51
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
10 import dmd.TypeIdentifier;
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
11 import dmd.TemplateParameter;
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
12 import dmd.TemplateValueParameter;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 import dmd.TypeStruct;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 import dmd.TypeTuple;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 import dmd.VarExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 import dmd.IntegerExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 import dmd.Expression;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 import dmd.Type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 import dmd.TupleDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 import dmd.TOK;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 import dmd.Loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 import dmd.STC;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 import dmd.Scope;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24 import dmd.Dsymbol;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 import dmd.OutBuffer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 import dmd.HdrGenState;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27 import dmd.Identifier;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28 import dmd.MATCH;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29 import dmd.TypeDArray;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30 import dmd.TypePointer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 import dmd.ArrayTypes;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32 import dmd.WANT;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 import dmd.TypeInfoDeclaration;
41
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
34 import dmd.ScopeDsymbol;
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
35 import dmd.ArrayScopeSymbol;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36 import dmd.TY;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
37 import dmd.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 import dmd.Id;
41
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
39 import dmd.IndexExp;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
40
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41 import dmd.type.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43 import dmd.backend.dt_t;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
44 import dmd.backend.TYPE;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45 import dmd.backend.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46 import dmd.backend.TYM;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 import dmd.backend.DT;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48
187
b0d41ff5e0df Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents: 178
diff changeset
49 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
50
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
51 // Static array, one with a fixed dimension
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 class TypeSArray : TypeArray
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53 {
187
b0d41ff5e0df Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents: 178
diff changeset
54 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
55
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56 Expression dim;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 this(Type t, Expression dim)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59 {
178
e3afd1303184 Many small bugs fixed
korDen
parents: 162
diff changeset
60 register();
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61 super(TY.Tsarray, t);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 //printf("TypeSArray(%s)\n", dim.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 this.dim = dim;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
65
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
66 override Type syntaxCopy()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
67 {
41
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
68 Type t = next.syntaxCopy();
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
69 Expression e = dim.syntaxCopy();
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
70 t = new TypeSArray(t, e);
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
71 t.mod = mod;
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
72 return t;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
75 override ulong size(Loc loc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
76 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
77 if (!dim)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
78 return Type.size(loc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
79
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
80 long sz = dim.toInteger();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
81
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
82 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
83 long n, n2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
84 n = next.size();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
85 n2 = n * sz;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
86 if (n && (n2 / n) != sz)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
87 goto Loverflow;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
88
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
89 sz = n2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
90 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
91 return sz;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
92
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
93 Loverflow:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
94 error(loc, "index %jd overflow for static array", sz);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
95 return 1;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
96 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
97
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
98 override uint alignsize()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
99 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
100 return next.alignsize();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
101 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
102
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
103 override Type semantic(Loc loc, Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
104 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
105 //printf("TypeSArray.semantic() %s\n", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
106
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
107 Type t;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
108 Expression e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
109 Dsymbol s;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
110 next.resolve(loc, sc, &e, &t, &s);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
111 if (dim && s && s.isTupleDeclaration())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
112 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
113 TupleDeclaration sd = s.isTupleDeclaration();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
114
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
115 dim = semanticLength(sc, sd, dim);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
116 dim = dim.optimize(WANT.WANTvalue | WANT.WANTinterpret);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
117 ulong d = dim.toUInteger();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
118
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
119 if (d >= sd.objects.dim)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
120 { error(loc, "tuple index %ju exceeds %u", d, sd.objects.dim);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
121 return Type.terror;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
122 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
123 ///Object o = cast(Object)sd.objects.data[(size_t)d];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
124 ///if (o.dyncast() != DYNCAST_TYPE)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
125 ///{
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
126 /// error(loc, "%s is not a type", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
127 /// return Type.terror;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
128 ///}
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
129 ///t = cast(Type)o;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
130
113
3482c73a991b More cleanup for arrays
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 110
diff changeset
131 t = cast(Type)sd.objects[cast(size_t)d];
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
132 if (t is null) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
133 error(loc, "%s is not a type", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
134 return Type.terror;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
135 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
136 return t;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
137 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
138
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
139 next = next.semantic(loc,sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
140 transitive();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
141
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
142 Type tbn = next.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
143
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
144 if (dim)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
145 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
146 long n, n2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
147
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
148 dim = semanticLength(sc, tbn, dim);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
149
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
150 dim = dim.optimize(WANT.WANTvalue | WANT.WANTinterpret);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
151 if (sc && sc.parameterSpecialization && dim.op == TOK.TOKvar &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
152 (cast(VarExp)dim).var.storage_class & STC.STCtemplateparameter)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
153 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
154 /* It could be a template parameter N which has no value yet:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
155 * template Foo(T : T[N], size_t N);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
156 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
157 return this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
158 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
159 long d1 = dim.toInteger();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
160 dim = dim.castTo(sc, tsize_t);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
161 dim = dim.optimize(WANT.WANTvalue);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
162 long d2 = dim.toInteger();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
163
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
164 if (d1 != d2)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
165 goto Loverflow;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
166
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
167 if (tbn.isintegral() ||
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
168 tbn.isfloating() ||
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
169 tbn.ty == TY.Tpointer ||
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
170 tbn.ty == TY.Tarray ||
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
171 tbn.ty == TY.Tsarray ||
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
172 tbn.ty == TY.Taarray ||
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
173 tbn.ty == TY.Tclass)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
174 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
175 /* Only do this for types that don't need to have semantic()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
176 * run on them for the size, since they may be forward referenced.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
177 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
178 n = tbn.size(loc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
179 n2 = n * d2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
180 if (cast(int)n2 < 0)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
181 goto Loverflow;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
182 if (n2 >= 0x1000000) // put a 'reasonable' limit on it
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
183 goto Loverflow;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
184 if (n && n2 / n != d2)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
185 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
186 Loverflow:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
187 error(loc, "index %jd overflow for static array", d1);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
188 dim = new IntegerExp(Loc(0), 1, tsize_t);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
189 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
190 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
191 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
192 switch (tbn.ty)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
193 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
194 case TY.Ttuple:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
195 { // Index the tuple to get the type
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
196 assert(dim);
126
1765f3ef917d ClassDeclarations, Arguments -> Vector
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 121
diff changeset
197 auto tt = cast(TypeTuple)tbn;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
198 ulong d = dim.toUInteger();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
199
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
200 if (d >= tt.arguments.dim)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
201 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
202 error(loc, "tuple index %ju exceeds %u", d, tt.arguments.dim);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
203 return Type.terror;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
204 }
126
1765f3ef917d ClassDeclarations, Arguments -> Vector
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 121
diff changeset
205 auto arg = tt.arguments[cast(size_t)d];
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
206 return arg.type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
207 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
208 case TY.Tstruct:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
209 { TypeStruct ts = cast(TypeStruct)tbn;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
210 if (ts.sym.isnested)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
211 error(loc, "cannot have array of inner structs %s", ts.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
212 break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
213 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
214 case TY.Tfunction:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
215 case TY.Tnone:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
216 error(loc, "can't have array of %s", tbn.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
217 tbn = next = tint32;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
218 break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
219 default: ///
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
220 break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
221 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
222 if (tbn.isauto())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
223 error(loc, "cannot have array of auto %s", tbn.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
224 return merge();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
225 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
226
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
227 override void resolve(Loc loc, Scope sc, Expression* pe, Type* pt, Dsymbol* ps)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
228 {
41
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
229 //printf("TypeSArray.resolve() %s\n", toChars());
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
230 next.resolve(loc, sc, pe, pt, ps);
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
231 //printf("s = %p, e = %p, t = %p\n", *ps, *pe, *pt);
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
232 if (*pe)
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
233 {
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
234 // It's really an index expression
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
235 Expression e = new IndexExp(loc, *pe, dim);
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
236 *pe = e;
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
237 }
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
238 else if (*ps)
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
239 {
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
240 Dsymbol s = *ps;
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
241 TupleDeclaration td = s.isTupleDeclaration();
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
242 if (td)
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
243 {
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
244 ScopeDsymbol sym = new ArrayScopeSymbol(sc, td);
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
245 sym.parent = sc.scopesym;
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
246 sc = sc.push(sym);
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
247
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
248 dim = dim.semantic(sc);
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
249 dim = dim.optimize(WANTvalue | WANTinterpret);
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
250 ulong d = dim.toUInteger();
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
251
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
252 sc = sc.pop();
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
253
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
254 if (d >= td.objects.dim)
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
255 {
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
256 error(loc, "tuple index %ju exceeds %u", d, td.objects.dim);
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
257 goto Ldefault;
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
258 }
113
3482c73a991b More cleanup for arrays
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 110
diff changeset
259 Object o = td.objects[cast(size_t)d];
41
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
260 if ((*ps = isDsymbol(o)) !is null) /// !
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
261 {
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
262 return;
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
263 }
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
264 if ((*pe = isExpression(o)) !is null) /// !
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
265 {
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
266 return;
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
267 }
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
268
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
269 /* Create a new TupleDeclaration which
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
270 * is a slice [d..d+1] out of the old one.
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
271 * Do it this way because TemplateInstance.semanticTiargs()
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
272 * can handle unresolved Objects this way.
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
273 */
94
3a0b150c9841 Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
274 auto objects = new Objects;
41
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
275 objects.setDim(1);
94
3a0b150c9841 Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
276 objects[0] = o;
41
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
277
94
3a0b150c9841 Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
278 auto tds = new TupleDeclaration(loc, td.ident, objects);
41
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
279 *ps = tds;
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
280 }
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
281 else
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
282 goto Ldefault;
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
283 }
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
284 else
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
285 {
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
286 Ldefault:
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
287 Type.resolve(loc, sc, pe, pt, ps);
f23312cb6f2e TypeSArray.syntaxCopy & TypeSArray.resolve implemented
korDen
parents: 12
diff changeset
288 }
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
289 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
290
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
291 override void toDecoBuffer(OutBuffer buf, int flag)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
292 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
293 Type.toDecoBuffer(buf, flag);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
294 if (dim)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
295 //buf.printf("%ju", dim.toInteger()); ///
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
296 buf.printf("%s", dim.toInteger());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
297 if (next)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
298 /* Note that static arrays are value types, so
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
299 * for a parameter, propagate the 0x100 to the next
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
300 * level, since for T[4][3], any const should apply to the T,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
301 * not the [4].
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
302 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
303 next.toDecoBuffer(buf, (flag & 0x100) ? flag : mod);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
304 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
305
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
306 override void toCBuffer2(OutBuffer buf, HdrGenState* hgs, MOD mod)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
307 {
67
f708f0452e81 some of the backend/codegen stuff implemented
korDen
parents: 64
diff changeset
308 if (mod != this.mod)
f708f0452e81 some of the backend/codegen stuff implemented
korDen
parents: 64
diff changeset
309 {
f708f0452e81 some of the backend/codegen stuff implemented
korDen
parents: 64
diff changeset
310 toCBuffer3(buf, hgs, mod);
f708f0452e81 some of the backend/codegen stuff implemented
korDen
parents: 64
diff changeset
311 return;
f708f0452e81 some of the backend/codegen stuff implemented
korDen
parents: 64
diff changeset
312 }
f708f0452e81 some of the backend/codegen stuff implemented
korDen
parents: 64
diff changeset
313 next.toCBuffer2(buf, hgs, this.mod);
f708f0452e81 some of the backend/codegen stuff implemented
korDen
parents: 64
diff changeset
314 buf.printf("[%s]", dim.toChars());
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
315 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
316
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
317 override Expression dotExp(Scope sc, Expression e, Identifier ident)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
318 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
319 version (LOGDOTEXP) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
320 printf("TypeSArray.dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
321 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
322 if (ident == Id.length)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
323 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
324 e = dim;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
325 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
326 else if (ident == Id.ptr)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
327 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
328 e = e.castTo(sc, next.pointerTo());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
329 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
330 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
331 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
332 e = TypeArray.dotExp(sc, e, ident);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
333 }
130
60bb0fe4563e dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 126
diff changeset
334 e = e.semantic(sc);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
335 return e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
336 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
337
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
338 override bool isString()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
339 {
64
4290d870944a More fixes
korDen
parents: 51
diff changeset
340 TY nty = next.toBasetype().ty;
4290d870944a More fixes
korDen
parents: 51
diff changeset
341 return nty == Tchar || nty == Twchar || nty == Tdchar;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
342 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
343
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
344 override bool isZeroInit(Loc loc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
345 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
346 return next.isZeroInit(loc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
347 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
348
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
349 override uint memalign(uint salign)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
350 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
351 return next.memalign(salign);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
352 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
353
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
354 override MATCH constConv(Type to)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
355 {
154
14feb7ae01a6 * changed the build system to build a release version if the debug one compiles
trass3r
parents: 135
diff changeset
356 if (to.ty == Tsarray)
14feb7ae01a6 * changed the build system to build a release version if the debug one compiles
trass3r
parents: 135
diff changeset
357 {
14feb7ae01a6 * changed the build system to build a release version if the debug one compiles
trass3r
parents: 135
diff changeset
358 TypeSArray tsa = cast(TypeSArray)to;
14feb7ae01a6 * changed the build system to build a release version if the debug one compiles
trass3r
parents: 135
diff changeset
359 if (!dim.equals(tsa.dim))
14feb7ae01a6 * changed the build system to build a release version if the debug one compiles
trass3r
parents: 135
diff changeset
360 return MATCHnomatch;
14feb7ae01a6 * changed the build system to build a release version if the debug one compiles
trass3r
parents: 135
diff changeset
361 }
14feb7ae01a6 * changed the build system to build a release version if the debug one compiles
trass3r
parents: 135
diff changeset
362 return super.constConv(to);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
363 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
364
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
365 override MATCH implicitConvTo(Type to)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
366 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
367 //printf("TypeSArray.implicitConvTo(to = %s) this = %s\n", to.toChars(), toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
368
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
369 // Allow implicit conversion of static array to pointer or dynamic array
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
370 if (IMPLICIT_ARRAY_TO_PTR && to.ty == Tpointer)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
371 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
372 TypePointer tp = cast(TypePointer)to;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
373
135
af1bebfd96a4 dmd 2.038
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 130
diff changeset
374 if (!MODimplicitConv(next.mod, tp.next.mod))
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
375 return MATCHnomatch;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
376
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
377 if (tp.next.ty == Tvoid || next.constConv(tp.next) != MATCHnomatch)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
378 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
379 return MATCHconvert;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
380 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
381 return MATCHnomatch;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
382 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
383 if (to.ty == Tarray)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
384 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
385 int offset = 0;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
386 TypeDArray ta = cast(TypeDArray)to;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
387
135
af1bebfd96a4 dmd 2.038
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 130
diff changeset
388 if (!MODimplicitConv(next.mod, ta.next.mod))
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
389 return MATCHnomatch;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
390
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
391 if (next.equals(ta.next) ||
135
af1bebfd96a4 dmd 2.038
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 130
diff changeset
392 // next.implicitConvTo(ta.next) >= MATCHconst ||
af1bebfd96a4 dmd 2.038
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 130
diff changeset
393 next.constConv(ta.next) != MATCHnomatch ||
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
394 (ta.next.isBaseOf(next, &offset) && offset == 0) ||
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
395 ta.next.ty == Tvoid
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
396 )
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
397 return MATCHconvert;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
398
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
399 return MATCHnomatch;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
400 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
401 if (to.ty == Tsarray)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
402 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
403 if (this == to)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
404 return MATCHexact;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
405
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
406 TypeSArray tsa = cast(TypeSArray)to;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
407
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
408 if (dim.equals(tsa.dim))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
409 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
410 /* Since static arrays are value types, allow
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
411 * conversions from const elements to non-const
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
412 * ones, just like we allow conversion from const int
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
413 * to int.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
414 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
415 MATCH m = next.implicitConvTo(tsa.next);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
416 if (m >= MATCHconst)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
417 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
418 if (mod != to.mod)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
419 m = MATCHconst;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
420 return m;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
421 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
422 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
423 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
424 return MATCHnomatch;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
425 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
426
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
427 override Expression defaultInit(Loc loc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
428 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
429 version (LOGDEFAULTINIT) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
430 printf("TypeSArray.defaultInit() '%s'\n", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
431 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
432 return next.defaultInit(loc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
433 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
434
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
435 override dt_t** toDt(dt_t** pdt)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
436 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
437 return toDtElem(pdt, null);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
438 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
439
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
440 dt_t** toDtElem(dt_t** pdt, Expression e)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
441 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
442 int i;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
443
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
444 //printf("TypeSArray::toDtElem()\n");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
445 uint len = cast(uint)dim.toInteger();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
446 if (len)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
447 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
448 while (*pdt)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
449 pdt = &((*pdt).DTnext);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
450 Type tnext = next;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
451 Type tbn = tnext.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
452 while (tbn.ty == Tsarray)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
453 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
454 TypeSArray tsa = cast(TypeSArray)tbn;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
455
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
456 len *= tsa.dim.toInteger();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
457 tnext = tbn.nextOf();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
458 tbn = tnext.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
459 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
460 if (!e) // if not already supplied
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
461 e = tnext.defaultInit(Loc(0)); // use default initializer
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
462 if (tbn.ty == Tstruct)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
463 tnext.toDt(pdt);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
464 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
465 e.toDt(pdt);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
466 dt_optimize(*pdt);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
467 if ((*pdt).dt == DT_azeros && !(*pdt).DTnext)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
468 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
469 (*pdt).DTazeros *= len;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
470 pdt = &((*pdt).DTnext);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
471 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
472 else if ((*pdt).dt == DT_1byte && (*pdt).DTonebyte == 0 && !(*pdt).DTnext)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
473 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
474 (*pdt).dt = DT_azeros;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
475 (*pdt).DTazeros = len;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
476 pdt = &((*pdt).DTnext);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
477 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
478 else if (e.op != TOKstring)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
479 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
480 for (i = 1; i < len; i++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
481 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
482 if (tbn.ty == Tstruct)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
483 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
484 pdt = tnext.toDt(pdt);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
485 while (*pdt)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
486 pdt = &((*pdt).DTnext);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
487 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
488 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
489 pdt = e.toDt(pdt);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
490 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
491 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
492 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
493 return pdt;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
494 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
495
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
496 override MATCH deduceType(Scope sc, Type tparam, TemplateParameters parameters, Objects dedtypes)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
497 {
51
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
498 static if (false) {
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
499 printf("TypeSArray.deduceType()\n");
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
500 printf("\tthis = %d, ", ty); print();
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
501 printf("\ttparam = %d, ", tparam.ty); tparam.print();
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
502 }
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
503
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
504 // Extra check that array dimensions must match
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
505 if (tparam)
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
506 {
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
507 if (tparam.ty == Tsarray)
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
508 {
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
509 TypeSArray tp = cast(TypeSArray)tparam;
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
510
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
511 if (tp.dim.op == TOKvar && (cast(VarExp)tp.dim).var.storage_class & STCtemplateparameter)
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
512 {
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
513 int i = templateIdentifierLookup((cast(VarExp)tp.dim).var.ident, parameters);
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
514 // This code matches code in TypeInstance.deduceType()
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
515 if (i == -1)
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
516 goto Lnomatch;
121
347de076ad34 TemplateParameters -> Vector
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 114
diff changeset
517 auto tp2 = parameters[i];
51
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
518 TemplateValueParameter tvp = tp2.isTemplateValueParameter();
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
519 if (!tvp)
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
520 goto Lnomatch;
113
3482c73a991b More cleanup for arrays
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 110
diff changeset
521 Expression e = cast(Expression)dedtypes[i];
51
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
522 if (e)
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
523 {
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
524 if (!dim.equals(e))
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
525 goto Lnomatch;
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
526 }
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
527 else
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
528 {
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
529 Type vt = tvp.valType.semantic(Loc(0), sc);
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
530 MATCH m = cast(MATCH)dim.implicitConvTo(vt);
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
531 if (!m)
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
532 goto Lnomatch;
94
3a0b150c9841 Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
533 dedtypes[i] = dim;
51
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
534 }
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
535 }
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
536 else if (dim.toInteger() != tp.dim.toInteger())
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
537 return MATCHnomatch;
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
538 }
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
539 else if (tparam.ty == Taarray)
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
540 {
94
3a0b150c9841 Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
541 auto tp = cast(TypeAArray)tparam;
51
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
542 if (tp.index.ty == Tident)
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
543 {
94
3a0b150c9841 Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
544 auto tident = cast(TypeIdentifier)tp.index;
51
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
545
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
546 if (tident.idents.dim == 0)
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
547 {
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
548 Identifier id = tident.ident;
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
549
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
550 for (size_t i = 0; i < parameters.dim; i++)
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
551 {
121
347de076ad34 TemplateParameters -> Vector
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 114
diff changeset
552 auto tp2 = parameters[i];
51
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
553
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
554 if (tp2.ident.equals(id))
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
555 {
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
556 // Found the corresponding template parameter
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
557 TemplateValueParameter tvp = tp2.isTemplateValueParameter();
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
558 if (!tvp || !tvp.valType.isintegral())
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
559 goto Lnomatch;
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
560
113
3482c73a991b More cleanup for arrays
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 110
diff changeset
561 if (dedtypes[i])
51
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
562 {
113
3482c73a991b More cleanup for arrays
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 110
diff changeset
563 if (!dim.equals(dedtypes[i]))
51
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
564 goto Lnomatch;
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
565 }
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
566 else
94
3a0b150c9841 Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
567 { dedtypes[i] = dim;
51
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
568 }
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
569 return next.deduceType(sc, tparam.nextOf(), parameters, dedtypes);
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
570 }
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
571 }
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
572 }
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
573 }
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
574 }
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
575 else if (tparam.ty == Tarray)
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
576 {
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
577 MATCH m;
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
578
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
579 m = next.deduceType(sc, tparam.nextOf(), parameters, dedtypes);
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
580 if (m == MATCHexact)
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
581 m = MATCHconvert;
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
582 return m;
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
583 }
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
584 }
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
585 return Type.deduceType(sc, tparam, parameters, dedtypes);
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
586
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
587 Lnomatch:
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 41
diff changeset
588 return MATCHnomatch;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
589 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
590
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
591 override TypeInfoDeclaration getTypeInfoDeclaration()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
592 {
64
4290d870944a More fixes
korDen
parents: 51
diff changeset
593 return new TypeInfoStaticArrayDeclaration(this);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
594 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
595
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
596 override Expression toExpression()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
597 {
162
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 154
diff changeset
598 Expression e = next.toExpression();
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 154
diff changeset
599 if (e)
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 154
diff changeset
600 {
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 154
diff changeset
601 Expressions arguments = new Expressions();
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 154
diff changeset
602 arguments.push(dim);
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 154
diff changeset
603 e = new ArrayExp(dim.loc, e, arguments);
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 154
diff changeset
604 }
438eaa11eed4 updated build script to use dmd2.039
korDen
parents: 154
diff changeset
605 return e;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
606 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
607
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
608 override bool hasPointers()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
609 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
610 return next.hasPointers();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
611 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
612
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
613 version (CPP_MANGLE) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
614 void toCppMangle(OutBuffer buf, CppMangleState* cms)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
615 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
616 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
617 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
618 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
619
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
620 override type* toCtype()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
621 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
622 if (!ctype)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
623 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
624 type* tn = next.toCtype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
625 ctype = type_allocn(TYarray, tn);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
626 ctype.Tdim = cast(uint)dim.toInteger();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
627 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
628
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
629 return ctype;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
630 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
631
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
632 override type* toCParamtype()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
633 {
96
acd69f84627e further work
Trass3r
parents: 72
diff changeset
634 version(SARRAYVALUE)
acd69f84627e further work
Trass3r
parents: 72
diff changeset
635 {
acd69f84627e further work
Trass3r
parents: 72
diff changeset
636 return toCtype();
acd69f84627e further work
Trass3r
parents: 72
diff changeset
637 }
acd69f84627e further work
Trass3r
parents: 72
diff changeset
638 else
acd69f84627e further work
Trass3r
parents: 72
diff changeset
639 {
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
640 // arrays are passed as pointers
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
641 return next.pointerTo().toCtype();
96
acd69f84627e further work
Trass3r
parents: 72
diff changeset
642 }
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
643 }
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 67
diff changeset
644 }