Mercurial > projects > ddmd
comparison dmd/AssignExp.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 | 39648eb578f6 |
comparison
equal
deleted
inserted
replaced
83:ee670dd808a8 | 84:be2ab491772e |
---|---|
105 L1: | 105 L1: |
106 // Rewrite (a[i] = value) to (a.opIndexAssign(value, i)) | 106 // Rewrite (a[i] = value) to (a.opIndexAssign(value, i)) |
107 if (search_function(ad, Id.indexass)) | 107 if (search_function(ad, Id.indexass)) |
108 { | 108 { |
109 Expression e = new DotIdExp(loc, ae.e1, Id.indexass); | 109 Expression e = new DotIdExp(loc, ae.e1, Id.indexass); |
110 Expressions a = cast(Expressions)ae.arguments.copy(); | 110 auto a = ae.arguments.copy(); |
111 | 111 |
112 a.insert(0, cast(void*)e2); | 112 a.insert(0, e2); |
113 e = new CallExp(loc, e, a); | 113 e = new CallExp(loc, e, a); |
114 e = e.semantic(sc); | 114 e = e.semantic(sc); |
115 return e; | 115 return e; |
116 } | 116 } |
117 else | 117 else |
158 if (search_function(ad, Id.sliceass)) | 158 if (search_function(ad, Id.sliceass)) |
159 { | 159 { |
160 Expression e = new DotIdExp(loc, ae.e1, Id.sliceass); | 160 Expression e = new DotIdExp(loc, ae.e1, Id.sliceass); |
161 Expressions a = new Expressions(); | 161 Expressions a = new Expressions(); |
162 | 162 |
163 a.push(cast(void*)e2); | 163 a.push(e2); |
164 if (ae.lwr) | 164 if (ae.lwr) |
165 { | 165 { |
166 a.push(cast(void*)ae.lwr); | 166 a.push(ae.lwr); |
167 assert(ae.upr); | 167 assert(ae.upr); |
168 a.push(cast(void*)ae.upr); | 168 a.push(ae.upr); |
169 } | 169 } |
170 else | 170 else |
171 assert(!ae.upr); | 171 assert(!ae.upr); |
172 | 172 |
173 e = new CallExp(loc, e, a); | 173 e = new CallExp(loc, e, a); |
201 { | 201 { |
202 error("mismatched tuple lengths, %d and %d", cast(int)dim, cast(int)tup2.exps.dim); | 202 error("mismatched tuple lengths, %d and %d", cast(int)dim, cast(int)tup2.exps.dim); |
203 } | 203 } |
204 else | 204 else |
205 { | 205 { |
206 Expressions exps = new Expressions; | 206 auto exps = new Expressions; |
207 exps.setDim(dim); | 207 exps.setDim(dim); |
208 | 208 |
209 for (int i = 0; i < dim; i++) | 209 for (int i = 0; i < dim; i++) |
210 { | 210 { |
211 Expression ex1 = cast(Expression)tup1.exps.data[i]; | 211 auto ex1 = tup1.exps[i]; |
212 Expression ex2 = cast(Expression)tup2.exps.data[i]; | 212 auto ex2 = tup2.exps[i]; |
213 exps.data[i] = cast(void*) new AssignExp(loc, ex1, ex2); | 213 exps[i] = new AssignExp(loc, ex1, ex2); |
214 } | 214 } |
215 Expression e = new TupleExp(loc, exps); | 215 Expression e = new TupleExp(loc, exps); |
216 e = e.semantic(sc); | 216 e = e.semantic(sc); |
217 return e; | 217 return e; |
218 } | 218 } |