Mercurial > projects > ddmd
annotate dmd/RemoveExp.d @ 114:e28b18c23469
added a module dmd.common for commonly used stuff
it currently holds code for consistency checking of predefined versions
also added a VisualD project file
author | Trass3r |
---|---|
date | Wed, 01 Sep 2010 18:21:58 +0200 |
parents | 6da99741178e |
children | e3afd1303184 |
rev | line source |
---|---|
72 | 1 module dmd.RemoveExp; |
2 | |
114 | 3 import dmd.common; |
72 | 4 import dmd.Expression; |
5 import dmd.backend.elem; | |
6 import dmd.Loc; | |
7 import dmd.IRState; | |
8 import dmd.BinExp; | |
0 | 9 import dmd.TOK; |
10 import dmd.Type; | |
11 import dmd.TypeAArray; | |
12 import dmd.TY; | |
13 | |
14 import dmd.backend.Util; | |
15 import dmd.backend.OPER; | |
16 import dmd.backend.Symbol; | |
17 import dmd.backend.TYM; | |
72 | 18 import dmd.backend.mTY; |
0 | 19 |
20 /* This deletes the key e1 from the associative array e2 | |
21 */ | |
72 | 22 |
0 | 23 class RemoveExp : BinExp |
24 { | |
25 this(Loc loc, Expression e1, Expression e2) | |
26 { | |
27 super(loc, TOKremove, RemoveExp.sizeof, e1, e2); | |
28 type = Type.tvoid; | |
29 } | |
30 | |
72 | 31 override elem* toElem(IRState* irs) |
0 | 32 { |
33 elem* e; | |
34 Type tb = e1.type.toBasetype(); | |
35 assert(tb.ty == Taarray); | |
36 TypeAArray taa = cast(TypeAArray)tb; | |
37 elem* ea = e1.toElem(irs); | |
38 elem* ekey = e2.toElem(irs); | |
39 elem* ep; | |
40 elem* keyti; | |
41 | |
108
6da99741178e
e2ir.c changes, mainly accounts for static arrays being value types now
Trass3r
parents:
72
diff
changeset
|
42 if (tybasic(ekey.Ety) == TYstruct || tybasic(ekey.Ety) == TYarray) |
0 | 43 { |
44 ekey = el_una(OPstrpar, TYstruct, ekey); | |
45 ekey.Enumbytes = ekey.E1.Enumbytes; | |
46 assert(ekey.Enumbytes); | |
47 } | |
48 | |
49 Symbol* s = taa.aaGetSymbol("Del", 0); | |
50 keyti = taa.index.getInternalTypeInfo(null).toElem(irs); | |
51 ep = el_params(ekey, keyti, ea, null); | |
52 e = el_bin(OPcall, TYnptr, el_var(s), ep); | |
53 | |
54 el_setLoc(e,loc); | |
55 return e; | |
56 } | |
57 } | |
58 |