Changeset 213

Show
Ignore:
Timestamp:
10/14/09 17:09:50 (11 months ago)
Author:
walter
Message:

1.050 and 2.035

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/mtype.c

    r202 r213  
    68636863 
    68646864    buf->printf("[%s .. ", lwr->toChars()); 
    68656865    buf->printf("%s]", upr->toChars()); 
    68666866} 
    68676867 
     6868/***************************** TypeNewArray *****************************/ 
     6869 
     6870/* T[new] 
     6871 */ 
     6872 
     6873TypeNewArray::TypeNewArray(Type *next) 
     6874    : TypeNext(Tnarray, next) 
     6875{ 
     6876    //printf("TypeNewArray\n"); 
     6877} 
     6878 
     6879void TypeNewArray::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod) 
     6880{ 
     6881    if (mod != this->mod) 
     6882    {   toCBuffer3(buf, hgs, mod); 
     6883    return; 
     6884    } 
     6885    next->toCBuffer2(buf, hgs, this->mod); 
     6886    buf->writestring("[new]"); 
     6887} 
     6888 
    68686889/***************************** Argument *****************************/ 
    68696890 
    68706891Argument::Argument(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg) 
    68716892{ 
    68726893    this->type = type; 
  • trunk/src/mtype.h

    r199 r213  
    796796    Type *semantic(Loc loc, Scope *sc); 
    797797    void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); 
    798798    void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); 
    799799}; 
    800800 
     801struct TypeNewArray : TypeNext 
     802{ 
     803    TypeNewArray(Type *next); 
     804    void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); 
     805}; 
     806 
    801807/**************************************************************/ 
    802808 
    803809//enum InOut { None, In, Out, InOut, Lazy }; 
    804810 
    805811struct Argument : Object 
  • trunk/src/parse.c

    r208 r213  
    22212221        if (token.value == TOKrbracket) 
    22222222        { 
    22232223            t = new TypeDArray(t);          // [] 
    22242224            nextToken(); 
    22252225        } 
     2226        else if (token.value == TOKnew && peekNext() == TOKrbracket) 
     2227        { 
     2228            t = new TypeNewArray(t);            // [new] 
     2229            nextToken(); 
     2230            nextToken(); 
     2231        } 
    22262232        else if (isDeclaration(&token, 0, TOKrbracket, NULL)) 
    22272233        {   // It's an associative array declaration 
    22282234 
    22292235            //printf("it's an associative array\n"); 
    22302236            Type *index = parseType();      // [ type ] 
     
    23412347        TypeNext *ta; 
    23422348        nextToken(); 
    23432349        if (token.value == TOKrbracket) 
    23442350        {   // It's a dynamic array 
    23452351            ta = new TypeDArray(t);     // [] 
     2352            nextToken(); 
     2353        } 
     2354        else if (token.value == TOKnew && peekNext() == TOKrbracket) 
     2355        { 
     2356            t = new TypeNewArray(t);        // [new] 
     2357            nextToken(); 
    23462358            nextToken(); 
    23472359        } 
    23482360        else if (isDeclaration(&token, 0, TOKrbracket, NULL)) 
    23492361        {   // It's an associative array 
    23502362 
     
    42634275 
    42644276        case TOKlbracket: 
    42654277        t = peek(t); 
    42664278        if (t->value == TOKrbracket) 
    42674279        { 
     4280            t = peek(t); 
     4281        } 
     4282        else if (t->value == TOKnew && peek(t)->value == TOKrbracket) 
     4283        { 
     4284            t = peek(t); 
    42684285            t = peek(t); 
    42694286        } 
    42704287        else if (isDeclaration(t, 0, TOKrbracket, &t)) 
    42714288        {   // It's an associative array declaration 
    42724289            t = peek(t);