Mercurial > projects > ddmd
comparison dmd/InExp.d @ 67:f708f0452e81
some of the backend/codegen stuff implemented
author | korDen |
---|---|
date | Mon, 23 Aug 2010 21:21:05 +0400 |
parents | 6557375aff35 |
children | 2e2a5c3f943a |
comparison
equal
deleted
inserted
replaced
66:efb1e5bdf63c | 67:f708f0452e81 |
---|---|
13 import dmd.TypeAArray; | 13 import dmd.TypeAArray; |
14 | 14 |
15 import dmd.expression.util.arrayTypeCompatible; | 15 import dmd.expression.util.arrayTypeCompatible; |
16 | 16 |
17 import dmd.backend.elem; | 17 import dmd.backend.elem; |
18 import dmd.backend.TYM; | |
19 import dmd.backend.mTY; | |
20 import dmd.backend.OPER; | |
21 import dmd.backend.Symbol; | |
22 import dmd.backend.Util; | |
18 | 23 |
19 class InExp : BinExp | 24 class InExp : BinExp |
20 { | 25 { |
21 this(Loc loc, Expression e1, Expression e2) | 26 this(Loc loc, Expression e1, Expression e2) |
22 { | 27 { |
73 return Id.opIn_r; | 78 return Id.opIn_r; |
74 } | 79 } |
75 | 80 |
76 elem* toElem(IRState* irs) | 81 elem* toElem(IRState* irs) |
77 { | 82 { |
78 assert(false); | 83 elem* e; |
84 elem* key = e1.toElem(irs); | |
85 elem* aa = e2.toElem(irs); | |
86 elem* ep; | |
87 elem* keyti; | |
88 TypeAArray taa = cast(TypeAArray)e2.type.toBasetype(); | |
89 | |
90 | |
91 // set to: | |
92 // aaIn(aa, keyti, key); | |
93 | |
94 if (tybasic(key.Ety) == TYstruct) | |
95 { | |
96 key = el_una(OPstrpar, TYstruct, key); | |
97 key.Enumbytes = key.E1.Enumbytes; | |
98 assert(key.Enumbytes); | |
99 } | |
100 | |
101 Symbol* s = taa.aaGetSymbol("In", 0); | |
102 keyti = taa.index.getInternalTypeInfo(null).toElem(irs); | |
103 ep = el_params(key, keyti, aa, null); | |
104 e = el_bin(OPcall, type.totym(), el_var(s), ep); | |
105 | |
106 el_setLoc(e,loc); | |
107 return e; | |
79 } | 108 } |
80 } | 109 } |
81 | 110 |