Changeset 213
- Timestamp:
- 10/14/09 17:09:50 (11 months ago)
- Files:
-
- trunk/src/mtype.c (modified) (1 diff)
- trunk/src/mtype.h (modified) (1 diff)
- trunk/src/parse.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/mtype.c
r202 r213 6863 6863 6864 6864 buf->printf("[%s .. ", lwr->toChars()); 6865 6865 buf->printf("%s]", upr->toChars()); 6866 6866 } 6867 6867 6868 /***************************** TypeNewArray *****************************/ 6869 6870 /* T[new] 6871 */ 6872 6873 TypeNewArray::TypeNewArray(Type *next) 6874 : TypeNext(Tnarray, next) 6875 { 6876 //printf("TypeNewArray\n"); 6877 } 6878 6879 void 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 6868 6889 /***************************** Argument *****************************/ 6869 6890 6870 6891 Argument::Argument(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg) 6871 6892 { 6872 6893 this->type = type; trunk/src/mtype.h
r199 r213 796 796 Type *semantic(Loc loc, Scope *sc); 797 797 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); 798 798 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); 799 799 }; 800 800 801 struct TypeNewArray : TypeNext 802 { 803 TypeNewArray(Type *next); 804 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); 805 }; 806 801 807 /**************************************************************/ 802 808 803 809 //enum InOut { None, In, Out, InOut, Lazy }; 804 810 805 811 struct Argument : Object trunk/src/parse.c
r208 r213 2221 2221 if (token.value == TOKrbracket) 2222 2222 { 2223 2223 t = new TypeDArray(t); // [] 2224 2224 nextToken(); 2225 2225 } 2226 else if (token.value == TOKnew && peekNext() == TOKrbracket) 2227 { 2228 t = new TypeNewArray(t); // [new] 2229 nextToken(); 2230 nextToken(); 2231 } 2226 2232 else if (isDeclaration(&token, 0, TOKrbracket, NULL)) 2227 2233 { // It's an associative array declaration 2228 2234 2229 2235 //printf("it's an associative array\n"); 2230 2236 Type *index = parseType(); // [ type ] … … 2341 2347 TypeNext *ta; 2342 2348 nextToken(); 2343 2349 if (token.value == TOKrbracket) 2344 2350 { // It's a dynamic array 2345 2351 ta = new TypeDArray(t); // [] 2352 nextToken(); 2353 } 2354 else if (token.value == TOKnew && peekNext() == TOKrbracket) 2355 { 2356 t = new TypeNewArray(t); // [new] 2357 nextToken(); 2346 2358 nextToken(); 2347 2359 } 2348 2360 else if (isDeclaration(&token, 0, TOKrbracket, NULL)) 2349 2361 { // It's an associative array 2350 2362 … … 4263 4275 4264 4276 case TOKlbracket: 4265 4277 t = peek(t); 4266 4278 if (t->value == TOKrbracket) 4267 4279 { 4280 t = peek(t); 4281 } 4282 else if (t->value == TOKnew && peek(t)->value == TOKrbracket) 4283 { 4284 t = peek(t); 4268 4285 t = peek(t); 4269 4286 } 4270 4287 else if (isDeclaration(t, 0, TOKrbracket, &t)) 4271 4288 { // It's an associative array declaration 4272 4289 t = peek(t);
