Changeset 824
- Timestamp:
- 12/28/10 01:59:22 (14 years ago)
- Files:
-
- branches/dmd-1.x/src/e2ir.c (modified) (1 diff)
- trunk/src/e2ir.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dmd-1.x/src/e2ir.c
r768 r824 3123 3123 directcall = 1; 3124 3124 3125 3125 if (!func->isThis()) 3126 3126 error("delegates are only for non-static functions"); 3127 3127 3128 3128 if (!func->isVirtual() || 3129 3129 directcall || 3130 3130 func->isFinal()) 3131 3131 { 3132 3132 ep = el_ptr(sfunc); 3133 3133 } 3134 3134 else 3135 3135 { 3136 3136 // Get pointer to function out of virtual table 3137 3137 unsigned vindex; 3138 3138 3139 3139 assert(ethis); 3140 3140 ep = el_same(ðis); 3141 3141 ep = el_una(OPind, TYnptr, ep); 3142 3142 vindex = func->vtblIndex; 3143 3144 if ((int)vindex < 0) 3145 error("Internal compiler error: malformed delegate. See Bugzilla 4860"); 3143 3146 3144 3147 // Build *(ep + vindex * 4) 3145 3148 ep = el_bin(OPadd,TYnptr,ep,el_long(TYsize_t, vindex * PTRSIZE)); 3146 3149 ep = el_una(OPind,TYnptr,ep); 3147 3150 } 3148 3151 3149 3152 // if (func->tintro) 3150 3153 // func->error(loc, "cannot form delegate due to covariant return type"); 3151 3154 } 3152 3155 if (ethis->Eoper == OPcomma) 3153 3156 { 3154 3157 ethis->E2 = el_pair(TYdarray, ethis->E2, ep); 3155 3158 ethis->Ety = TYdarray; 3156 3159 e = ethis; 3157 3160 } 3158 3161 else 3159 3162 e = el_pair(TYdarray, ethis, ep); 3160 3163 el_setLoc(e,loc); 3161 3164 return e; 3162 3165 } trunk/src/e2ir.c
r812 r824 3327 3327 directcall = 1; 3328 3328 3329 3329 if (!func->isThis()) 3330 3330 error("delegates are only for non-static functions"); 3331 3331 3332 3332 if (!func->isVirtual() || 3333 3333 directcall || 3334 3334 func->isFinal()) 3335 3335 { 3336 3336 ep = el_ptr(sfunc); 3337 3337 } 3338 3338 else 3339 3339 { 3340 3340 // Get pointer to function out of virtual table 3341 3341 unsigned vindex; 3342 3342 3343 3343 assert(ethis); 3344 3344 ep = el_same(ðis); 3345 3345 ep = el_una(OPind, TYnptr, ep); 3346 3346 vindex = func->vtblIndex; 3347 3348 if ((int)vindex < 0) 3349 error("Internal compiler error: malformed delegate. See Bugzilla 4860"); 3347 3350 3348 3351 // Build *(ep + vindex * 4) 3349 3352 ep = el_bin(OPadd,TYnptr,ep,el_long(TYsize_t, vindex * PTRSIZE)); 3350 3353 ep = el_una(OPind,TYnptr,ep); 3351 3354 } 3352 3355 3353 3356 // if (func->tintro) 3354 3357 // func->error(loc, "cannot form delegate due to covariant return type"); 3355 3358 } 3356 3359 if (ethis->Eoper == OPcomma) 3357 3360 { 3358 3361 ethis->E2 = el_pair(TYdelegate, ethis->E2, ep); 3359 3362 ethis->Ety = TYdelegate; 3360 3363 e = ethis; 3361 3364 } 3362 3365 else 3363 3366 e = el_pair(TYdelegate, ethis, ep); 3364 3367 el_setLoc(e,loc); 3365 3368 return e; 3366 3369 }
