Mercurial > projects > ldc
comparison dmd/statement.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 | 17268b0a3ab0 |
children | def7a1d494fd |
comparison
equal
deleted
inserted
replaced
1529:ad7f2f1862d6 | 1530:05c235309d6f |
---|---|
331 DeclarationExp *de = (DeclarationExp *)(exp); | 331 DeclarationExp *de = (DeclarationExp *)(exp); |
332 VarDeclaration *v = de->declaration->isVarDeclaration(); | 332 VarDeclaration *v = de->declaration->isVarDeclaration(); |
333 if (v) | 333 if (v) |
334 { Expression *e; | 334 { Expression *e; |
335 | 335 |
336 e = v->callAutoDtor(); | 336 e = v->callScopeDtor(); |
337 if (e) | 337 if (e) |
338 { | 338 { |
339 //printf("dtor is: "); e->print(); | 339 //printf("dtor is: "); e->print(); |
340 *sfinally = new ExpStatement(loc, e); | 340 *sfinally = new ExpStatement(loc, e); |
341 } | 341 } |
1588 // Need a variable to hold value from any return statements in body. | 1588 // Need a variable to hold value from any return statements in body. |
1589 if (!sc->func->vresult && tret && tret != Type::tvoid) | 1589 if (!sc->func->vresult && tret && tret != Type::tvoid) |
1590 { VarDeclaration *v; | 1590 { VarDeclaration *v; |
1591 | 1591 |
1592 v = new VarDeclaration(loc, tret, Id::result, NULL); | 1592 v = new VarDeclaration(loc, tret, Id::result, NULL); |
1593 v->noauto = 1; | 1593 v->noscope = 1; |
1594 v->semantic(sc); | 1594 v->semantic(sc); |
1595 if (!sc->insert(v)) | 1595 if (!sc->insert(v)) |
1596 assert(0); | 1596 assert(0); |
1597 v->parent = sc->func; | 1597 v->parent = sc->func; |
1598 sc->func->vresult = v; | 1598 sc->func->vresult = v; |
1959 sym->parent = sc->scopesym; | 1959 sym->parent = sc->scopesym; |
1960 scd = sc->push(sym); | 1960 scd = sc->push(sym); |
1961 | 1961 |
1962 Type *t = arg->type ? arg->type : condition->type; | 1962 Type *t = arg->type ? arg->type : condition->type; |
1963 match = new VarDeclaration(loc, t, arg->ident, NULL); | 1963 match = new VarDeclaration(loc, t, arg->ident, NULL); |
1964 match->noauto = 1; | 1964 match->noscope = 1; |
1965 match->semantic(scd); | 1965 match->semantic(scd); |
1966 if (!scd->insert(match)) | 1966 if (!scd->insert(match)) |
1967 assert(0); | 1967 assert(0); |
1968 match->parent = sc->func; | 1968 match->parent = sc->func; |
1969 | 1969 |
2929 { | 2929 { |
2930 // Construct: return vresult; | 2930 // Construct: return vresult; |
2931 if (!fd->vresult) | 2931 if (!fd->vresult) |
2932 { // Declare vresult | 2932 { // Declare vresult |
2933 VarDeclaration *v = new VarDeclaration(loc, tret, Id::result, NULL); | 2933 VarDeclaration *v = new VarDeclaration(loc, tret, Id::result, NULL); |
2934 v->noauto = 1; | 2934 v->noscope = 1; |
2935 v->semantic(scx); | 2935 v->semantic(scx); |
2936 if (!scx->insert(v)) | 2936 if (!scx->insert(v)) |
2937 assert(0); | 2937 assert(0); |
2938 v->parent = fd; | 2938 v->parent = fd; |
2939 fd->vresult = v; | 2939 fd->vresult = v; |