Mercurial > projects > ddmd
comparison dmd/IndexExp.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 | 010eb8f0e18d |
children | e3afd1303184 |
comparison
equal
deleted
inserted
replaced
129:010eb8f0e18d | 130:60bb0fe4563e |
---|---|
23 import dmd.HdrGenState; | 23 import dmd.HdrGenState; |
24 import dmd.TOK; | 24 import dmd.TOK; |
25 import dmd.WANT; | 25 import dmd.WANT; |
26 import dmd.TupleExp; | 26 import dmd.TupleExp; |
27 import dmd.TypeTuple; | 27 import dmd.TypeTuple; |
28 import dmd.Argument; | 28 import dmd.Parameter; |
29 import dmd.TypeExp; | 29 import dmd.TypeExp; |
30 import dmd.VarExp; | 30 import dmd.VarExp; |
31 import dmd.STC; | 31 import dmd.STC; |
32 import dmd.GlobalExpressions; | 32 import dmd.GlobalExpressions; |
33 import dmd.ExpInitializer; | 33 import dmd.ExpInitializer; |
157 length = te.exps.dim; | 157 length = te.exps.dim; |
158 } | 158 } |
159 else if (e1.op == TOKtype) | 159 else if (e1.op == TOKtype) |
160 { | 160 { |
161 tup = cast(TypeTuple)t1; | 161 tup = cast(TypeTuple)t1; |
162 length = Argument.dim(tup.arguments); | 162 length = Parameter.dim(tup.arguments); |
163 } | 163 } |
164 else | 164 else |
165 assert(0); | 165 assert(0); |
166 | 166 |
167 if (index < length) | 167 if (index < length) |
168 { | 168 { |
169 if (e1.op == TOKtuple) | 169 if (e1.op == TOKtuple) |
170 e = te.exps[cast(size_t)index]; | 170 e = te.exps[cast(size_t)index]; |
171 else | 171 else |
172 e = new TypeExp(e1.loc, Argument.getNth(tup.arguments, cast(size_t)index).type); | 172 e = new TypeExp(e1.loc, Parameter.getNth(tup.arguments, cast(size_t)index).type); |
173 } | 173 } |
174 else | 174 else |
175 { | 175 { |
176 error("array index [%ju] is outside array bounds [0 .. %zu]", index, length); | 176 error("array index [%ju] is outside array bounds [0 .. %zu]", index, length); |
177 e = e1; | 177 e = e1; |
381 //printf("keyti:\n"); | 381 //printf("keyti:\n"); |
382 //elem_print(keyti); | 382 //elem_print(keyti); |
383 ep = el_params(n2, valuesize, keyti, n1, null); | 383 ep = el_params(n2, valuesize, keyti, n1, null); |
384 e = el_bin(OPcall, TYnptr, el_var(s), ep); | 384 e = el_bin(OPcall, TYnptr, el_var(s), ep); |
385 | 385 |
386 if (global.params.useArrayBounds) | 386 if (irs.arrayBoundsCheck()) |
387 { | 387 { |
388 elem* ea; | 388 elem* ea; |
389 | 389 |
390 elem* n = el_same(&e); | 390 elem* n = el_same(&e); |
391 | 391 |
404 else | 404 else |
405 { | 405 { |
406 elem* einit = resolveLengthVar(lengthVar, &n1, t1); | 406 elem* einit = resolveLengthVar(lengthVar, &n1, t1); |
407 elem* n2 = e2.toElem(irs); | 407 elem* n2 = e2.toElem(irs); |
408 | 408 |
409 if (global.params.useArrayBounds) | 409 if (irs.arrayBoundsCheck()) |
410 { | 410 { |
411 elem* elength; | 411 elem* elength; |
412 elem* n2x; | 412 elem* n2x; |
413 elem* ea; | 413 elem* ea; |
414 | 414 |