comparison dmd/expression.c @ 468:45a67b6f1310

Removed the 'needsstorage' thing from Dsymbol. Arguments are not always given storage when applicable. This is not longer treat specially in this regard. Code for accessing nested variables and contexts rewritten. Probably more. Fairly well tested.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Mon, 04 Aug 2008 02:59:34 +0200
parents 1c65b5477eaa
children e19e20103119
comparison
equal deleted inserted replaced
467:261b05cf4d1c 468:45a67b6f1310
3626 type = var->type->pointerTo(); 3626 type = var->type->pointerTo();
3627 VarDeclaration *v = var->isVarDeclaration(); 3627 VarDeclaration *v = var->isVarDeclaration();
3628 if (v) 3628 if (v)
3629 { 3629 {
3630 v->checkNestedReference(sc, loc); 3630 v->checkNestedReference(sc, loc);
3631 v->needsStorage = true;
3632 } 3631 }
3633 return this; 3632 return this;
3634 } 3633 }
3635 3634
3636 int SymOffExp::isBool(int result) 3635 int SymOffExp::isBool(int result)
3775 3774
3776 VarDeclaration *v = var->isVarDeclaration(); 3775 VarDeclaration *v = var->isVarDeclaration();
3777 if (v && v->canassign == 0 && 3776 if (v && v->canassign == 0 &&
3778 (var->isConst() || (global.params.Dversion > 1 && var->isFinal()))) 3777 (var->isConst() || (global.params.Dversion > 1 && var->isFinal())))
3779 error("cannot modify final variable '%s'", var->toChars()); 3778 error("cannot modify final variable '%s'", var->toChars());
3780 v->needsStorage = true;
3781 3779
3782 if (var->isCtorinit()) 3780 if (var->isCtorinit())
3783 { // It's only modifiable if inside the right constructor 3781 { // It's only modifiable if inside the right constructor
3784 Dsymbol *s = sc->func; 3782 Dsymbol *s = sc->func;
3785 while (1) 3783 while (1)
5989 5987
5990 e = new DelegateExp(loc, e1, f); 5988 e = new DelegateExp(loc, e1, f);
5991 e = e->semantic(sc); 5989 e = e->semantic(sc);
5992 return e; 5990 return e;
5993 } 5991 }
5994 else if (v)
5995 {
5996 v->needsStorage = true;
5997 }
5998 } 5992 }
5999 else if (e1->op == TOKarray) 5993 else if (e1->op == TOKarray)
6000 { 5994 {
6001 if (e1->type->toBasetype()->ty == Tbit) 5995 if (e1->type->toBasetype()->ty == Tbit)
6002 error("cannot take address of bit in array"); 5996 error("cannot take address of bit in array");