Changeset 640
- Timestamp:
- 08/28/10 15:24:44 (1 year ago)
- Files:
-
- branches/dmd-1.x/src/e2ir.c (modified) (1 diff)
- branches/dmd-1.x/src/expression.c (modified) (3 diffs)
- branches/dmd-1.x/src/inline.c (modified) (1 diff)
- trunk/src/e2ir.c (modified) (1 diff)
- trunk/src/expression.c (modified) (3 diffs)
- trunk/src/inline.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dmd-1.x/src/e2ir.c
r621 r640 3069 3069 switch (ex->op) 3070 3070 { 3071 case TOKsuper: // super .member() calls directly3071 case TOKsuper: // super(args) ctor calls 3072 3072 case TOKdottype: // type.member() calls directly 3073 3073 directcall = 1; branches/dmd-1.x/src/expression.c
r639 r640 6185 6185 * array.id(args) into id(array,args) 6186 6186 * aa.remove(arg) into delete aa[arg] 6187 * super.id(args) into parent.id(args) 6187 6188 */ 6188 6189 if (e1->op == TOKdot) … … 6223 6224 e1 = new IdentifierExp(dotid->loc, dotid->ident); 6224 6225 #endif 6226 } 6227 else if (e1ty == Tclass && dotid->e1->op == TOKsuper) 6228 { 6229 // rewrite super.id into this.baseclass.id 6230 6231 FuncDeclaration *fd = hasThis(sc); 6232 6233 Dsymbol *s = fd->toParent(); 6234 while (s && s->isTemplateInstance()) 6235 s = s->toParent(); 6236 6237 ClassDeclaration *cd = s->isClassDeclaration(); 6238 Expression *dte = new DotTypeExp(dotid->loc, new ThisExp(dotid->loc), cd->baseClass); 6239 e1 = new DotIdExp(dotid->loc, dte, dotid->ident); 6225 6240 } 6226 6241 } … … 6496 6511 else if (e1->op == TOKsuper) 6497 6512 { 6513 // TODO: rewrite this to lower super(...) to baseclass(...) ? 6498 6514 // Base class constructor call 6499 6515 ClassDeclaration *cd = NULL; branches/dmd-1.x/src/inline.c
r505 r640 282 282 int CallExp::inlineCost(InlineCostState *ics) 283 283 { 284 // Bugzilla 3500: super.func() calls must be devirtualized, and the inliner285 // can't handle that at present.286 if (e1->op == TOKdotvar && ((DotVarExp *)e1)->e1->op == TOKsuper)287 return COST_MAX;288 289 284 return 1 + e1->inlineCost(ics) + arrayInlineCost(ics, arguments); 290 285 } trunk/src/e2ir.c
r621 r640 3363 3363 switch (ex->op) 3364 3364 { 3365 case TOKsuper: // super .member() calls directly3365 case TOKsuper: // super(args) ctor calls 3366 3366 case TOKdottype: // type.member() calls directly 3367 3367 directcall = 1; trunk/src/expression.c
r639 r640 6526 6526 * array.id(args) into .id(array,args) 6527 6527 * aa.remove(arg) into delete aa[arg] 6528 * super.id(args) into parent.id(args) 6528 6529 */ 6529 6530 if (e1->op == TOKdot) … … 6573 6574 #endif 6574 6575 } 6576 else if (e1ty == Tclass && dotid->e1->op == TOKsuper) 6577 { 6578 // rewrite super.id into this.baseclass.id 6579 6580 FuncDeclaration *fd = hasThis(sc); 6581 6582 Dsymbol *s = fd->toParent(); 6583 while (s && s->isTemplateInstance()) 6584 s = s->toParent(); 6585 6586 ClassDeclaration *cd = s->isClassDeclaration(); 6587 Expression *dte = new DotTypeExp(dotid->loc, new ThisExp(dotid->loc), cd->baseClass); 6588 e1 = new DotIdExp(dotid->loc, dte, dotid->ident); 6589 } 6590 6575 6591 L2: 6576 6592 ; … … 6940 6956 else if (e1->op == TOKsuper) 6941 6957 { 6958 // TODO: rewrite this to lower super(...) to baseclass(...) ? 6942 6959 // Base class constructor call 6943 6960 ClassDeclaration *cd = NULL; trunk/src/inline.c
r520 r640 283 283 int CallExp::inlineCost(InlineCostState *ics) 284 284 { 285 // Bugzilla 3500: super.func() calls must be devirtualized, and the inliner286 // can't handle that at present.287 if (e1->op == TOKdotvar && ((DotVarExp *)e1)->e1->op == TOKsuper)288 return COST_MAX;289 290 285 return 1 + e1->inlineCost(ics) + arrayInlineCost(ics, arguments); 291 286 }
