Changeset 651

Show
Ignore:
Timestamp:
08/30/10 14:41:24 (1 year ago)
Author:
walter
Message:

fail_compilation/fail345.d asserts in expression.c

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dmd-1.x/src/e2ir.c

    r640 r651  
    30693069            switch (ex->op) 
    30703070            { 
    3071                 case TOKsuper:          // super(args) ctor calls 
     3071                case TOKsuper:          // super.member() calls directly 
    30723072                case TOKdottype:        // type.member() calls directly 
    30733073                    directcall = 1; 
  • branches/dmd-1.x/src/expression.c

    r640 r651  
    61856185     *  array.id(args) into id(array,args) 
    61866186     *  aa.remove(arg) into delete aa[arg] 
    6187      *  super.id(args) into parent.id(args) 
    61886187     */ 
    61896188    if (e1->op == TOKdot) 
     
    62246223                e1 = new IdentifierExp(dotid->loc, dotid->ident); 
    62256224#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); 
    62406225            } 
    62416226        } 
     
    65116496    else if (e1->op == TOKsuper) 
    65126497    { 
    6513         // TODO: rewrite this to lower super(...) to baseclass(...) ? 
    65146498        // Base class constructor call 
    65156499        ClassDeclaration *cd = NULL; 
  • branches/dmd-1.x/src/inline.c

    r640 r651  
    282282int CallExp::inlineCost(InlineCostState *ics) 
    283283{ 
     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 
    284289    return 1 + e1->inlineCost(ics) + arrayInlineCost(ics, arguments); 
    285290} 
  • branches/dmd-1.x/src/parse.c

    r633 r651  
    55005500    precedence[TOKdotti] = PREC_primary; 
    55015501    precedence[TOKdot] = PREC_primary; 
     5502    precedence[TOKdottd] = PREC_primary; 
    55025503//  precedence[TOKarrow] = PREC_primary; 
    55035504    precedence[TOKplusplus] = PREC_primary; 
  • trunk/src/e2ir.c

    r640 r651  
    33633363            switch (ex->op) 
    33643364            { 
    3365                 case TOKsuper:          // super(args) ctor calls 
     3365                case TOKsuper:          // super.member() calls directly 
    33663366                case TOKdottype:        // type.member() calls directly 
    33673367                    directcall = 1; 
  • trunk/src/expression.c

    r646 r651  
    65326532     *  array.id(args) into .id(array,args) 
    65336533     *  aa.remove(arg) into delete aa[arg] 
    6534      *  super.id(args) into parent.id(args) 
    65356534     */ 
    65366535    if (e1->op == TOKdot) 
     
    65796578                e1 = new IdentifierExp(dotid->loc, dotid->ident); 
    65806579#endif 
    6581             } 
    6582             else if (e1ty == Tclass && dotid->e1->op == TOKsuper) 
    6583             { 
    6584                 // rewrite super.id into this.baseclass.id 
    6585  
    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); 
    65956580            } 
    65966581 
     
    69626947    else if (e1->op == TOKsuper) 
    69636948    { 
    6964         // TODO: rewrite this to lower super(...) to baseclass(...) ? 
    69656949        // Base class constructor call 
    69666950        ClassDeclaration *cd = NULL; 
  • trunk/src/inline.c

    r640 r651  
    283283int CallExp::inlineCost(InlineCostState *ics) 
    284284{ 
     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 
    285290    return 1 + e1->inlineCost(ics) + arrayInlineCost(ics, arguments); 
    286291} 
  • trunk/src/parse.c

    r644 r651  
    62906290    precedence[TOKdotti] = PREC_primary; 
    62916291    precedence[TOKdot] = PREC_primary; 
     6292    precedence[TOKdottd] = PREC_primary; 
    62926293//  precedence[TOKarrow] = PREC_primary; 
    62936294    precedence[TOKplusplus] = PREC_primary;