Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 779

Show
Ignore:
Timestamp:
12/05/10 07:48:25 (14 years ago)
Author:
walter
Message:

bugzilla 5182 ICE(expression.c): calling unittest from a function

Files:

Legend:

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

    r755 r779  
    21412141                return e; 
    21422142            } 
    21432143        } 
    21442144        e = new VarExp(loc, v); 
    21452145        e->type = type; 
    21462146        e = e->semantic(sc); 
    21472147        return e->deref(); 
    21482148    } 
    21492149    fld = s->isFuncLiteralDeclaration(); 
    21502150    if (fld) 
    21512151    {   //printf("'%s' is a function literal\n", fld->toChars()); 
    21522152        e = new FuncExp(loc, fld); 
    21532153        return e->semantic(sc); 
    21542154    } 
    21552155    f = s->isFuncDeclaration(); 
    21562156    if (f) 
    21572157    {   //printf("'%s' is a function\n", f->toChars()); 
    21582158 
    21592159        if (!f->originalType && f->scope)       // semantic not yet run 
    21602160            f->semantic(f->scope); 
     2161        if (f->isUnitTestDeclaration()) 
     2162        { 
     2163            error("cannot call unittest function %s", toChars()); 
     2164            return new ErrorExp(); 
     2165        } 
    21612166        if (!f->type->deco) 
    21622167        { 
    21632168            error("forward reference to %s", toChars()); 
    21642169            return new ErrorExp(); 
    21652170        } 
    21662171        return new VarExp(loc, f); 
    21672172    } 
    21682173    cd = s->isClassDeclaration(); 
    21692174    if (cd && thiscd && cd->isBaseOf(thiscd, NULL) && sc->func->needThis()) 
    21702175    { 
    21712176        // We need to add an implicit 'this' if cd is this class or a base class. 
    21722177        DotTypeExp *dte; 
    21732178 
    21742179        dte = new DotTypeExp(loc, new ThisExp(loc), s); 
    21752180        return dte->semantic(sc); 
    21762181    } 
    21772182    imp = s->isImport(); 
    21782183    if (imp) 
    21792184    { 
    21802185        if (!imp->pkg) 
  • trunk/src/expression.c

    r769 r779  
    23092309            return e; 
    23102310        } 
    23112311 
    23122312        e = new VarExp(loc, v); 
    23132313        e->type = type; 
    23142314        e = e->semantic(sc); 
    23152315        return e->deref(); 
    23162316    } 
    23172317    fld = s->isFuncLiteralDeclaration(); 
    23182318    if (fld) 
    23192319    {   //printf("'%s' is a function literal\n", fld->toChars()); 
    23202320        e = new FuncExp(loc, fld); 
    23212321        return e->semantic(sc); 
    23222322    } 
    23232323    f = s->isFuncDeclaration(); 
    23242324    if (f) 
    23252325    {   //printf("'%s' is a function\n", f->toChars()); 
    23262326 
    23272327        if (!f->originalType && f->scope)       // semantic not yet run 
    23282328            f->semantic(f->scope); 
     2329        if (f->isUnitTestDeclaration()) 
     2330        { 
     2331            error("cannot call unittest function %s", toChars()); 
     2332            return new ErrorExp(); 
     2333        } 
    23292334        if (!f->type->deco) 
    23302335        { 
    23312336            error("forward reference to %s", toChars()); 
    23322337            return new ErrorExp(); 
    23332338        } 
    23342339        return new VarExp(loc, f, hasOverloads); 
    23352340    } 
    23362341    o = s->isOverloadSet(); 
    23372342    if (o) 
    23382343    {   //printf("'%s' is an overload set\n", o->toChars()); 
    23392344        return new OverExp(o); 
    23402345    } 
    23412346    cd = s->isClassDeclaration(); 
    23422347    if (cd && thiscd && cd->isBaseOf(thiscd, NULL) && sc->func->needThis()) 
    23432348    { 
    23442349        // We need to add an implicit 'this' if cd is this class or a base class. 
    23452350        DotTypeExp *dte; 
    23462351 
    23472352        dte = new DotTypeExp(loc, new ThisExp(loc), s); 
    23482353        return dte->semantic(sc);