comparison dmd/interpret/Util.d @ 148:fe2e1b93e88f

phobos compiles now: * fixed upgrade mistake in interpret.Util + implemented missing methods in RealExp,VarExp
author Trass3r
date Wed, 15 Sep 2010 03:58:55 +0200
parents af1bebfd96a4
children cd48cb899aee
comparison
equal deleted inserted replaced
147:9a2a1ae6c8e5 148:fe2e1b93e88f
142 ///version (DMDV2) { 142 ///version (DMDV2) {
143 if ((v.isConst() || v.isImmutable() || v.storage_class & STCmanifest) && v.init && !v.value) 143 if ((v.isConst() || v.isImmutable() || v.storage_class & STCmanifest) && v.init && !v.value)
144 ///} else { 144 ///} else {
145 /// if (v.isConst() && v.init) 145 /// if (v.isConst() && v.init)
146 ///} 146 ///}
147 { 147 {
148 e = v.init.toExpression(); 148 e = v.init.toExpression();
149 if (e && !e.type) 149 if (e && !e.type)
150 e.type = v.type; 150 e.type = v.type;
151 } 151 }
152 else 152 else
153 { 153 {
154 e = v.value; 154 e = v.value;
155 if (v.isCTFE()) 155 if (!v.isCTFE())
156 { 156 {
157 error(loc, "static variable %s cannot be read at compile time", v.toChars()); 157 error(loc, "static variable %s cannot be read at compile time", v.toChars());
158 e = EXP_CANT_INTERPRET; 158 e = EXP_CANT_INTERPRET;
159 } 159 }
160 else if (!e) 160 else if (!e)
161 error(loc, "variable %s is used before initialization", v.toChars()); 161 error(loc, "variable %s is used before initialization", v.toChars());
166 e = EXP_CANT_INTERPRET; 166 e = EXP_CANT_INTERPRET;
167 } 167 }
168 else if (s) 168 else if (s)
169 { 169 {
170 if (s.dsym.toInitializer() == s.sym) 170 if (s.dsym.toInitializer() == s.sym)
171 { 171 {
172 Expressions exps = new Expressions(); 172 Expressions exps = new Expressions();
173 e = new StructLiteralExp(Loc(0), s.dsym, exps); 173 e = new StructLiteralExp(Loc(0), s.dsym, exps);
174 e = e.semantic(null); 174 e = e.semantic(null);
175 } 175 }
176 } 176 }