comparison dmd2/declaration.c @ 1577:e4f7b5d9c68a

DMD 2.032 Merge.
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 08 Sep 2009 10:07:56 +0100
parents 54b3c1394d62
children
comparison
equal deleted inserted replaced
1576:4551475bc6b6 1577:e4f7b5d9c68a
139 { 139 {
140 const char *p = NULL; 140 const char *p = NULL;
141 if (isConst()) 141 if (isConst())
142 p = "const"; 142 p = "const";
143 else if (isInvariant()) 143 else if (isInvariant())
144 p = "mutable"; 144 p = "immutable";
145 else if (storage_class & STCmanifest) 145 else if (storage_class & STCmanifest)
146 p = "enum"; 146 p = "enum";
147 else if (!t->isAssignable()) 147 else if (!t->isAssignable())
148 p = "struct with immutable members"; 148 p = "struct with immutable members";
149 if (p) 149 if (p)
637 ctorinit = 0; 637 ctorinit = 0;
638 aliassym = NULL; 638 aliassym = NULL;
639 onstack = 0; 639 onstack = 0;
640 canassign = 0; 640 canassign = 0;
641 value = NULL; 641 value = NULL;
642 rundtor = NULL;
642 #if IN_LLVM 643 #if IN_LLVM
643 aggrIndex = 0; 644 aggrIndex = 0;
644 645
645 // LDC 646 // LDC
646 anonDecl = NULL; 647 anonDecl = NULL;
954 */ 955 */
955 Expression *e = new IntegerExp(loc, 0, Type::tint32); 956 Expression *e = new IntegerExp(loc, 0, Type::tint32);
956 Expression *e1; 957 Expression *e1;
957 e1 = new VarExp(loc, this); 958 e1 = new VarExp(loc, this);
958 e = new AssignExp(loc, e1, e); 959 e = new AssignExp(loc, e1, e);
959 #if DMDV2
960 e->op = TOKconstruct; 960 e->op = TOKconstruct;
961 #endif
962 e->type = e1->type; // don't type check this, it would fail 961 e->type = e1->type; // don't type check this, it would fail
963 init = new ExpInitializer(loc, e); 962 init = new ExpInitializer(loc, e);
964 return; 963 return;
965 } 964 }
966 else if (type->ty == Ttypedef) 965 else if (type->ty == Ttypedef)
977 } 976 }
978 else 977 else
979 { 978 {
980 init = getExpInitializer(); 979 init = getExpInitializer();
981 } 980 }
982 #if DMDV2
983 // Default initializer is always a blit 981 // Default initializer is always a blit
984 op = TOKblit; 982 op = TOKblit;
985 #endif
986 } 983 }
987 984
988 if (init) 985 if (init)
989 { 986 {
990 sc = sc->push(); 987 sc = sc->push();
1037 } 1034 }
1038 1035
1039 Expression *e1 = new VarExp(loc, this); 1036 Expression *e1 = new VarExp(loc, this);
1040 1037
1041 Type *t = type->toBasetype(); 1038 Type *t = type->toBasetype();
1042 if (t->ty == Tsarray) 1039 if (t->ty == Tsarray && !(storage_class & (STCref | STCout)))
1043 { 1040 {
1044 ei->exp = ei->exp->semantic(sc); 1041 ei->exp = ei->exp->semantic(sc);
1045 if (!ei->exp->implicitConvTo(type)) 1042 if (!ei->exp->implicitConvTo(type))
1046 { 1043 {
1047 int dim = ((TypeSArray *)t)->dim->toInteger(); 1044 int dim = ((TypeSArray *)t)->dim->toInteger();
1165 /* static const/invariant does CTFE 1162 /* static const/invariant does CTFE
1166 */ 1163 */
1167 e = e->optimize(WANTvalue | WANTinterpret); 1164 e = e->optimize(WANTvalue | WANTinterpret);
1168 else 1165 else
1169 e = e->optimize(WANTvalue); 1166 e = e->optimize(WANTvalue);
1170 if (e->op == TOKint64 || e->op == TOKstring) 1167 if (e->op == TOKint64 || e->op == TOKstring || e->op == TOKfloat64)
1171 { 1168 {
1172 ei->exp = e; // no errors, keep result 1169 ei->exp = e; // no errors, keep result
1173 } 1170 }
1174 #if DMDV2 1171 #if DMDV2
1175 else 1172 else