Changeset 651
- Timestamp:
- 08/30/10 14:41:24 (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)
- branches/dmd-1.x/src/parse.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)
- trunk/src/parse.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dmd-1.x/src/e2ir.c
r640 r651 3069 3069 switch (ex->op) 3070 3070 { 3071 case TOKsuper: // super (args) ctor calls3071 case TOKsuper: // super.member() calls directly 3072 3072 case TOKdottype: // type.member() calls directly 3073 3073 directcall = 1; branches/dmd-1.x/src/expression.c
r640 r651 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)6188 6187 */ 6189 6188 if (e1->op == TOKdot) … … 6224 6223 e1 = new IdentifierExp(dotid->loc, dotid->ident); 6225 6224 #endif 6226 }6227 else if (e1ty == Tclass && dotid->e1->op == TOKsuper)6228 {6229 // rewrite super.id into this.baseclass.id6230 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);6240 6225 } 6241 6226 } … … 6511 6496 else if (e1->op == TOKsuper) 6512 6497 { 6513 // TODO: rewrite this to lower super(...) to baseclass(...) ?6514 6498 // Base class constructor call 6515 6499 ClassDeclaration *cd = NULL; branches/dmd-1.x/src/inline.c
r640 r651 282 282 int CallExp::inlineCost(InlineCostState *ics) 283 283 { 284 // Bugzilla 3500: super.func() calls must be devirtualized, and the inliner 285 // can't handle that at present. 286 if (e1->op == TOKdotvar && ((DotVarExp *)e1)->e1->op == TOKsuper) 287 return COST_MAX; 288 284 289 return 1 + e1->inlineCost(ics) + arrayInlineCost(ics, arguments); 285 290 } branches/dmd-1.x/src/parse.c
r633 r651 5500 5500 precedence[TOKdotti] = PREC_primary; 5501 5501 precedence[TOKdot] = PREC_primary; 5502 precedence[TOKdottd] = PREC_primary; 5502 5503 // precedence[TOKarrow] = PREC_primary; 5503 5504 precedence[TOKplusplus] = PREC_primary; trunk/src/e2ir.c
r640 r651 3363 3363 switch (ex->op) 3364 3364 { 3365 case TOKsuper: // super (args) ctor calls3365 case TOKsuper: // super.member() calls directly 3366 3366 case TOKdottype: // type.member() calls directly 3367 3367 directcall = 1; trunk/src/expression.c
r646 r651 6532 6532 * array.id(args) into .id(array,args) 6533 6533 * aa.remove(arg) into delete aa[arg] 6534 * super.id(args) into parent.id(args)6535 6534 */ 6536 6535 if (e1->op == TOKdot) … … 6579 6578 e1 = new IdentifierExp(dotid->loc, dotid->ident); 6580 6579 #endif 6581 }6582 else if (e1ty == Tclass && dotid->e1->op == TOKsuper)6583 {6584 // rewrite super.id into this.baseclass.id6585 6586 FuncDeclaration *fd = hasThis(sc);6587 6588 Dsymbol *s = fd->toParent();6589 while (s && s->isTemplateInstance())6590 s = s->toParent();6591 6592 ClassDeclaration *cd = s->isClassDeclaration();6593 Expression *dte = new DotTypeExp(dotid->loc, new ThisExp(dotid->loc), cd->baseClass);6594 e1 = new DotIdExp(dotid->loc, dte, dotid->ident);6595 6580 } 6596 6581 … … 6962 6947 else if (e1->op == TOKsuper) 6963 6948 { 6964 // TODO: rewrite this to lower super(...) to baseclass(...) ?6965 6949 // Base class constructor call 6966 6950 ClassDeclaration *cd = NULL; trunk/src/inline.c
r640 r651 283 283 int CallExp::inlineCost(InlineCostState *ics) 284 284 { 285 // Bugzilla 3500: super.func() calls must be devirtualized, and the inliner 286 // can't handle that at present. 287 if (e1->op == TOKdotvar && ((DotVarExp *)e1)->e1->op == TOKsuper) 288 return COST_MAX; 289 285 290 return 1 + e1->inlineCost(ics) + arrayInlineCost(ics, arguments); 286 291 } trunk/src/parse.c
r644 r651 6290 6290 precedence[TOKdotti] = PREC_primary; 6291 6291 precedence[TOKdot] = PREC_primary; 6292 precedence[TOKdottd] = PREC_primary; 6292 6293 // precedence[TOKarrow] = PREC_primary; 6293 6294 precedence[TOKplusplus] = PREC_primary;
