comparison dmd/TraitsExp.d @ 158:80f4806ffa13

overloadApply fixes
author korDen
date Sun, 19 Sep 2010 06:54:31 +0400
parents af1bebfd96a4
children e3afd1303184
comparison
equal deleted inserted replaced
157:b7b61140701d 158:80f4806ffa13
44 44
45 struct Pvirtuals 45 struct Pvirtuals
46 { 46 {
47 Expression e1; 47 Expression e1;
48 Expressions exps; 48 Expressions exps;
49 int fpvirtuals(void* param, FuncDeclaration f) 49
50 { Pvirtuals p = *cast(Pvirtuals*)param; 50 bool visit(FuncDeclaration f)
51 {
52 Pvirtuals* p = &this;
51 53
52 if (f.isVirtual()) 54 if (f.isVirtual())
53 { Expression e; 55 {
54 56 Expression e;
55 if (p.e1.op == TOK.TOKdotvar) 57
56 { DotVarExp dve = cast(DotVarExp)p.e1; 58 if (p.e1.op == TOKdotvar)
59 {
60 DotVarExp dve = cast(DotVarExp)p.e1;
57 e = new DotVarExp(Loc(0), dve.e1, f); 61 e = new DotVarExp(Loc(0), dve.e1, f);
58 } 62 }
59 else 63 else
60 e = new DsymbolExp(Loc(0), f); 64 e = new DsymbolExp(Loc(0), f);
61 p.exps.push(e); 65 p.exps.push(e);
62 } 66 }
63 return 0; 67 return false;
64 } 68 }
65 } 69 }
66 70
67 71
68 72
258 */ 262 */
259 //e.dump(0); 263 //e.dump(0);
260 Expressions exps = new Expressions(); 264 Expressions exps = new Expressions();
261 FuncDeclaration f_; 265 FuncDeclaration f_;
262 if (e.op == TOKvar) 266 if (e.op == TOKvar)
263 { VarExp ve = cast(VarExp)e; 267 {
268 VarExp ve = cast(VarExp)e;
264 f_ = ve.var.isFuncDeclaration(); 269 f_ = ve.var.isFuncDeclaration();
265 } 270 }
266 else if (e.op == TOKdotvar) 271 else if (e.op == TOKdotvar)
267 { DotVarExp dve = cast(DotVarExp)e; 272 {
273 DotVarExp dve = cast(DotVarExp)e;
268 f_ = dve.var.isFuncDeclaration(); 274 f_ = dve.var.isFuncDeclaration();
269 } 275 }
270 else 276 else
271 f_ = null; 277 f_ = null;
278
272 Pvirtuals p; 279 Pvirtuals p;
273 p.exps = exps; 280 p.exps = exps;
274 p.e1 = e; 281 p.e1 = e;
275 overloadApply(f_, &p.fpvirtuals, &p); 282 overloadApply(f_, p);
276 283
277 TupleExp tup = new TupleExp(loc, exps); 284 TupleExp tup = new TupleExp(loc, exps);
278 return tup.semantic(sc); 285 return tup.semantic(sc);
279 } 286 }
280 else 287 else