Mercurial > projects > ddmd
diff dmd/BinExp.d @ 135:af1bebfd96a4 dmd2037
dmd 2.038
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Mon, 13 Sep 2010 22:19:42 +0100 |
parents | 60bb0fe4563e |
children | 14feb7ae01a6 |
line wrap: on
line diff
--- a/dmd/BinExp.d Sat Sep 11 13:03:39 2010 +0100 +++ b/dmd/BinExp.d Mon Sep 13 22:19:42 2010 +0100 @@ -552,6 +552,7 @@ case TOK.TOKandass: case TOK.TOKorass: case TOK.TOKxorass: + case TOK.TOKpowass: case TOK.TOKin: case TOK.TOKremove: return true; @@ -803,7 +804,7 @@ } else if (v && v.value && (v.value.op==TOKindex || v.value.op == TOKdotvar)) { - // It is no longer be a TOKvar, eg when a[4] is passed by ref. + // It is no longer a TOKvar, eg when a[4] is passed by ref. e1 = v.value; } } @@ -826,13 +827,13 @@ VarExp ve = cast(VarExp)e1; VarDeclaration v = ve.var.isVarDeclaration(); assert(v); - if (v && v.isDataseg()) + if (v && !v.isCTFE()) { // Can't modify global or static data error("%s cannot be modified at compile time", v.toChars()); return EXP_CANT_INTERPRET; } - if (v && !v.isDataseg()) + if (v && v.isCTFE()) { Expression ev = v.value; if (fp && !ev) @@ -848,7 +849,7 @@ */ if (v.type.toBasetype().ty == Tstruct && e2.op == TOKint64) { - e2 = v.type.defaultInit(Loc(0)); + e2 = v.type.defaultInitLiteral(Loc(0)); } e2 = Cast(v.type, v.type, e2); } @@ -872,7 +873,7 @@ { VarDeclaration v = (cast(VarExp)aggregate).var.isVarDeclaration(); - if (v.isDataseg()) + if (!v.isCTFE()) { // Can't modify global or static data error("%s cannot be modified at compile time", v.toChars()); @@ -949,7 +950,7 @@ SymOffExp soe = cast(SymOffExp)(cast(PtrExp)e1).e1; VarDeclaration v = soe.var.isVarDeclaration(); - if (v.isDataseg()) + if (!v.isCTFE()) { error("%s cannot be modified at compile time", v.toChars()); return EXP_CANT_INTERPRET; @@ -997,7 +998,7 @@ IndexExp ie = cast(IndexExp)e1; VarExp ve = cast(VarExp)ie.e1; VarDeclaration v = ve.var.isVarDeclaration(); - if (!v || v.isDataseg()) + if (!v || !v.isCTFE()) { error("%s cannot be modified at compile time", v ? v.toChars(): "void"); return EXP_CANT_INTERPRET; @@ -1165,7 +1166,7 @@ IndexExp ie = cast(IndexExp)aggregate; VarExp ve = cast(VarExp)(ie.e1); VarDeclaration v = ve.var.isVarDeclaration(); - if (!v || v.isDataseg()) + if (!v || !v.isCTFE()) { error("%s cannot be modified at compile time", v ? v.toChars(): "void"); return EXP_CANT_INTERPRET; @@ -1188,8 +1189,7 @@ if (telem.ty != Tstruct) { return EXP_CANT_INTERPRET; } // Create a default struct literal... - StructDeclaration sym = (cast(TypeStruct)telem).sym; - StructLiteralExp structinit = createDefaultInitStructLiteral(v.loc, sym); + Expression structinit = telem.defaultInitLiteral(v.loc); // ... and use to create a blank array literal size_t dim = cast(size_t)(cast(TypeSArray)t2).dim.toInteger(); @@ -1257,7 +1257,7 @@ SliceExp sexp = cast(SliceExp)e1; VarExp ve = cast(VarExp)(sexp.e1); VarDeclaration v = ve.var.isVarDeclaration(); - if (!v || v.isDataseg()) + if (!v || !v.isCTFE()) { error("%s cannot be modified at compile time", v.toChars()); return EXP_CANT_INTERPRET;