Mercurial > projects > ldc
comparison dmd/mtype.c @ 1530:05c235309d6f
Make the auto storage class never have the same meaning as scope.
This changes the meaning of
auto class MyClass {} and
auto MyClass ident;
Both have been made an error to prevent accidents.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 12 Jul 2009 16:15:21 +0200 |
parents | df11cdec45a2 |
children | def7a1d494fd |
comparison
equal
deleted
inserted
replaced
1529:ad7f2f1862d6 | 1530:05c235309d6f |
---|---|
546 ClassDeclaration *Type::isClassHandle() | 546 ClassDeclaration *Type::isClassHandle() |
547 { | 547 { |
548 return NULL; | 548 return NULL; |
549 } | 549 } |
550 | 550 |
551 int Type::isauto() | 551 int Type::isscope() |
552 { | 552 { |
553 return FALSE; | 553 return FALSE; |
554 } | 554 } |
555 | 555 |
556 int Type::isString() | 556 int Type::isString() |
1994 case Tnone: | 1994 case Tnone: |
1995 error(loc, "can't have array of %s", tbn->toChars()); | 1995 error(loc, "can't have array of %s", tbn->toChars()); |
1996 tbn = next = tint32; | 1996 tbn = next = tint32; |
1997 break; | 1997 break; |
1998 } | 1998 } |
1999 if (tbn->isauto()) | 1999 if (tbn->isscope()) |
2000 error(loc, "cannot have array of auto %s", tbn->toChars()); | 2000 error(loc, "cannot have array of scope %s", tbn->toChars()); |
2001 return merge(); | 2001 return merge(); |
2002 } | 2002 } |
2003 | 2003 |
2004 void TypeSArray::toDecoBuffer(OutBuffer *buf, bool mangle) | 2004 void TypeSArray::toDecoBuffer(OutBuffer *buf, bool mangle) |
2005 { | 2005 { |
2157 case Ttuple: | 2157 case Ttuple: |
2158 error(loc, "can't have array of %s", tbn->toChars()); | 2158 error(loc, "can't have array of %s", tbn->toChars()); |
2159 tn = next = tint32; | 2159 tn = next = tint32; |
2160 break; | 2160 break; |
2161 } | 2161 } |
2162 if (tn->isauto()) | 2162 if (tn->isscope()) |
2163 error(loc, "cannot have array of auto %s", tn->toChars()); | 2163 error(loc, "cannot have array of scope %s", tn->toChars()); |
2164 if (next != tn) | 2164 if (next != tn) |
2165 //deco = NULL; // redo | 2165 //deco = NULL; // redo |
2166 return tn->arrayOf(); | 2166 return tn->arrayOf(); |
2167 return merge(); | 2167 return merge(); |
2168 } | 2168 } |
2356 case Tfunction: | 2356 case Tfunction: |
2357 case Tnone: | 2357 case Tnone: |
2358 error(loc, "can't have associative array of %s", next->toChars()); | 2358 error(loc, "can't have associative array of %s", next->toChars()); |
2359 break; | 2359 break; |
2360 } | 2360 } |
2361 if (next->isauto()) | 2361 if (next->isscope()) |
2362 error(loc, "cannot have array of auto %s", next->toChars()); | 2362 error(loc, "cannot have array of scope %s", next->toChars()); |
2363 | 2363 |
2364 return merge(); | 2364 return merge(); |
2365 } | 2365 } |
2366 | 2366 |
2367 void TypeAArray::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps) | 2367 void TypeAArray::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps) |
2994 } | 2994 } |
2995 if (tf->next->toBasetype()->ty == Ttuple) | 2995 if (tf->next->toBasetype()->ty == Ttuple) |
2996 { error(loc, "functions cannot return a tuple"); | 2996 { error(loc, "functions cannot return a tuple"); |
2997 tf->next = Type::terror; | 2997 tf->next = Type::terror; |
2998 } | 2998 } |
2999 if (tf->next->isauto() && !(sc->flags & SCOPEctor)) | 2999 if (tf->next->isscope() && !(sc->flags & SCOPEctor)) |
3000 error(loc, "functions cannot return auto %s", tf->next->toChars()); | 3000 error(loc, "functions cannot return scope %s", tf->next->toChars()); |
3001 | 3001 |
3002 if (tf->parameters) | 3002 if (tf->parameters) |
3003 { size_t dim = Argument::dim(tf->parameters); | 3003 { size_t dim = Argument::dim(tf->parameters); |
3004 | 3004 |
3005 for (size_t i = 0; i < dim; i++) | 3005 for (size_t i = 0; i < dim; i++) |
5066 ClassDeclaration *TypeClass::isClassHandle() | 5066 ClassDeclaration *TypeClass::isClassHandle() |
5067 { | 5067 { |
5068 return sym; | 5068 return sym; |
5069 } | 5069 } |
5070 | 5070 |
5071 int TypeClass::isauto() | 5071 int TypeClass::isscope() |
5072 { | 5072 { |
5073 return sym->isauto; | 5073 return sym->isscope; |
5074 } | 5074 } |
5075 | 5075 |
5076 int TypeClass::isBaseOf(Type *t, int *poffset) | 5076 int TypeClass::isBaseOf(Type *t, int *poffset) |
5077 { | 5077 { |
5078 if (t->ty == Tclass) | 5078 if (t->ty == Tclass) |