Mercurial > projects > ddmd
comparison dmd/SliceExp.d @ 12:832f71e6f96c
*Exp and *AssignExp arrayOp implementation added (might be a bit incomplete)
Some unittest-specific functions implemented
author | korDen |
---|---|
date | Mon, 12 Apr 2010 15:13:00 +0400 |
parents | 10317f0c89a5 |
children | a8b50ff7f201 |
comparison
equal
deleted
inserted
replaced
11:3356c90e9aac | 12:832f71e6f96c |
---|---|
1 module dmd.SliceExp; | 1 module dmd.SliceExp; |
2 | 2 |
3 import dmd.Expression; | 3 import dmd.Expression; |
4 import dmd.backend.elem; | 4 import dmd.backend.elem; |
5 import dmd.UnaExp; | 5 import dmd.UnaExp; |
6 import dmd.Identifier; | |
7 import dmd.IdentifierExp; | |
8 import dmd.ArrayExp; | |
9 import dmd.STC; | |
6 import dmd.InterState; | 10 import dmd.InterState; |
7 import dmd.ScopeDsymbol; | 11 import dmd.ScopeDsymbol; |
8 import dmd.WANT; | 12 import dmd.WANT; |
9 import dmd.ArrayScopeSymbol; | 13 import dmd.ArrayScopeSymbol; |
10 import dmd.CallExp; | 14 import dmd.CallExp; |
442 assert(false); | 446 assert(false); |
443 } | 447 } |
444 | 448 |
445 void buildArrayIdent(OutBuffer buf, Expressions arguments) | 449 void buildArrayIdent(OutBuffer buf, Expressions arguments) |
446 { | 450 { |
447 assert(false); | 451 buf.writestring("Slice"); |
452 arguments.shift(cast(void*)this); | |
448 } | 453 } |
449 | 454 |
450 Expression buildArrayLoop(Arguments fparams) | 455 Expression buildArrayLoop(Arguments fparams) |
451 { | 456 { |
452 assert(false); | 457 Identifier id = Identifier.generateId("p", fparams.dim); |
458 Argument param = new Argument(STCconst, type, id, null); | |
459 fparams.shift(cast(void*)param); | |
460 Expression e = new IdentifierExp(Loc(0), id); | |
461 Expressions arguments = new Expressions(); | |
462 Expression index = new IdentifierExp(Loc(0), Id.p); | |
463 arguments.push(cast(void*)index); | |
464 e = new ArrayExp(Loc(0), e, arguments); | |
465 return e; | |
453 } | 466 } |
454 | 467 |
455 int inlineCost(InlineCostState* ics) | 468 int inlineCost(InlineCostState* ics) |
456 { | 469 { |
457 int cost = 1 + e1.inlineCost(ics); | 470 int cost = 1 + e1.inlineCost(ics); |