Mercurial > projects > ddmd
comparison dmd/SliceExp.d @ 84:be2ab491772e
Expressions -> Vector!Expression
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Mon, 30 Aug 2010 16:12:19 +0100 |
parents | 2e2a5c3f943a |
children | e28b18c23469 |
comparison
equal
deleted
inserted
replaced
83:ee670dd808a8 | 84:be2ab491772e |
---|---|
209 size_t j1 = cast(size_t) i1; | 209 size_t j1 = cast(size_t) i1; |
210 size_t j2 = cast(size_t) i2; | 210 size_t j2 = cast(size_t) i2; |
211 | 211 |
212 if (e1.op == TOKtuple) | 212 if (e1.op == TOKtuple) |
213 { | 213 { |
214 Expressions exps = new Expressions; | 214 auto exps = new Expressions; |
215 exps.setDim(j2 - j1); | 215 exps.setDim(j2 - j1); |
216 for (size_t i = 0; i < j2 - j1; i++) | 216 for (size_t i = 0; i < j2 - j1; i++) |
217 { | 217 { |
218 Expression e2 = cast(Expression)te.exps.data[j1 + i]; | 218 auto e2 = te.exps[j1 + i]; |
219 exps.data[i] = cast(void*)e2; | 219 exps[i] = e2; |
220 } | 220 } |
221 e = new TupleExp(loc, exps); | 221 e = new TupleExp(loc, exps); |
222 } | 222 } |
223 else | 223 else |
224 { | 224 { |
503 } | 503 } |
504 | 504 |
505 override void buildArrayIdent(OutBuffer buf, Expressions arguments) | 505 override void buildArrayIdent(OutBuffer buf, Expressions arguments) |
506 { | 506 { |
507 buf.writestring("Slice"); | 507 buf.writestring("Slice"); |
508 arguments.shift(cast(void*)this); | 508 arguments.shift(this); |
509 } | 509 } |
510 | 510 |
511 override Expression buildArrayLoop(Arguments fparams) | 511 override Expression buildArrayLoop(Arguments fparams) |
512 { | 512 { |
513 Identifier id = Identifier.generateId("p", fparams.dim); | 513 Identifier id = Identifier.generateId("p", fparams.dim); |
514 Argument param = new Argument(STCconst, type, id, null); | 514 Argument param = new Argument(STCconst, type, id, null); |
515 fparams.shift(cast(void*)param); | 515 fparams.shift(cast(void*)param); |
516 Expression e = new IdentifierExp(Loc(0), id); | 516 Expression e = new IdentifierExp(Loc(0), id); |
517 Expressions arguments = new Expressions(); | 517 Expressions arguments = new Expressions(); |
518 Expression index = new IdentifierExp(Loc(0), Id.p); | 518 Expression index = new IdentifierExp(Loc(0), Id.p); |
519 arguments.push(cast(void*)index); | 519 arguments.push(index); |
520 e = new ArrayExp(Loc(0), e, arguments); | 520 e = new ArrayExp(Loc(0), e, arguments); |
521 return e; | 521 return e; |
522 } | 522 } |
523 | 523 |
524 override int inlineCost(InlineCostState* ics) | 524 override int inlineCost(InlineCostState* ics) |