comparison dmd/VarExp.d @ 72:2e2a5c3f943a

reduced warnings by adding override to the methods think this also normalizes different line endings used all over the place
author Trass3r
date Sat, 28 Aug 2010 16:19:48 +0200
parents 4290d870944a
children ef02e2e203c2
comparison
equal deleted inserted replaced
71:8e24ef1dd139 72:2e2a5c3f943a
33 //printf("VarExp(this = %p, '%s', loc = %s)\n", this, var.toChars(), loc.toChars()); 33 //printf("VarExp(this = %p, '%s', loc = %s)\n", this, var.toChars(), loc.toChars());
34 //if (strcmp(var.ident.toChars(), "func") == 0) halt(); 34 //if (strcmp(var.ident.toChars(), "func") == 0) halt();
35 this.type = var.type; 35 this.type = var.type;
36 } 36 }
37 37
38 bool equals(Object o) 38 override bool equals(Object o)
39 { 39 {
40 assert(false); 40 assert(false);
41 } 41 }
42 42
43 Expression semantic(Scope sc) 43 override Expression semantic(Scope sc)
44 { 44 {
45 FuncLiteralDeclaration fd; 45 FuncLiteralDeclaration fd;
46 46
47 version (LOGSEMANTIC) { 47 version (LOGSEMANTIC) {
48 printf("VarExp.semantic(%s)\n", toChars()); 48 printf("VarExp.semantic(%s)\n", toChars());
141 } 141 }
142 142
143 return this; 143 return this;
144 } 144 }
145 145
146 Expression optimize(int result) 146 override Expression optimize(int result)
147 { 147 {
148 return fromConstInitializer(result, this); 148 return fromConstInitializer(result, this);
149 } 149 }
150 150
151 Expression interpret(InterState istate) 151 override Expression interpret(InterState istate)
152 { 152 {
153 version (LOG) { 153 version (LOG) {
154 printf("VarExp.interpret() %.*s\n", toChars()); 154 printf("VarExp.interpret() %.*s\n", toChars());
155 } 155 }
156 return getVarExp(loc, istate, var); 156 return getVarExp(loc, istate, var);
157 } 157 }
158 158
159 void dump(int indent) 159 override void dump(int indent)
160 { 160 {
161 assert(false); 161 assert(false);
162 } 162 }
163 163
164 string toChars() 164 override string toChars()
165 { 165 {
166 return var.toChars(); 166 return var.toChars();
167 } 167 }
168 168
169 void toCBuffer(OutBuffer buf, HdrGenState* hgs) 169 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
170 { 170 {
171 buf.writestring(var.toChars()); 171 buf.writestring(var.toChars());
172 } 172 }
173 173
174 void checkEscape() 174 override void checkEscape()
175 { 175 {
176 VarDeclaration v = var.isVarDeclaration(); 176 VarDeclaration v = var.isVarDeclaration();
177 if (v) 177 if (v)
178 { 178 {
179 Type tb = v.type.toBasetype(); 179 Type tb = v.type.toBasetype();
187 } 187 }
188 } 188 }
189 } 189 }
190 190
191 version (DMDV2) { 191 version (DMDV2) {
192 int isLvalue() 192 override int isLvalue()
193 { 193 {
194 if (var.storage_class & STClazy) 194 if (var.storage_class & STClazy)
195 return 0; 195 return 0;
196 return 1; 196 return 1;
197 } 197 }
198 } 198 }
199 Expression toLvalue(Scope sc, Expression e) 199 override Expression toLvalue(Scope sc, Expression e)
200 { 200 {
201 static if (false) { 201 static if (false) {
202 tym = tybasic(e1.ET.Tty); 202 tym = tybasic(e1.ET.Tty);
203 if (!(tyscalar(tym) || 203 if (!(tyscalar(tym) ||
204 tym == TYM.TYstruct || 204 tym == TYM.TYstruct ||
211 error("lazy variables cannot be lvalues"); 211 error("lazy variables cannot be lvalues");
212 212
213 return this; 213 return this;
214 } 214 }
215 215
216 Expression modifiableLvalue(Scope sc, Expression e) 216 override Expression modifiableLvalue(Scope sc, Expression e)
217 { 217 {
218 //printf("VarExp::modifiableLvalue('%s')\n", var.toChars()); 218 //printf("VarExp::modifiableLvalue('%s')\n", var.toChars());
219 if (type && type.toBasetype().ty == TY.Tsarray) 219 if (type && type.toBasetype().ty == TY.Tsarray)
220 error("cannot change reference to static array '%s'", var.toChars()); 220 error("cannot change reference to static array '%s'", var.toChars());
221 221
223 223
224 // See if this expression is a modifiable lvalue (i.e. not const) 224 // See if this expression is a modifiable lvalue (i.e. not const)
225 return toLvalue(sc, e); 225 return toLvalue(sc, e);
226 } 226 }
227 227
228 dt_t** toDt(dt_t** pdt) 228 override dt_t** toDt(dt_t** pdt)
229 { 229 {
230 assert(false); 230 assert(false);
231 } 231 }
232 232
233 void scanForNestedRef(Scope sc) 233 override void scanForNestedRef(Scope sc)
234 { 234 {
235 //printf("VarExp.scanForNestedRef(%s)\n", toChars()); 235 //printf("VarExp.scanForNestedRef(%s)\n", toChars());
236 VarDeclaration v = var.isVarDeclaration(); 236 VarDeclaration v = var.isVarDeclaration();
237 if (v) 237 if (v)
238 v.checkNestedReference(sc, Loc(0)); 238 v.checkNestedReference(sc, Loc(0));
239 } 239 }
240 240
241 int inlineCost(InlineCostState* ics) 241 override int inlineCost(InlineCostState* ics)
242 { 242 {
243 //printf("VarExp.inlineCost() %s\n", toChars()); 243 //printf("VarExp.inlineCost() %s\n", toChars());
244 return 1; 244 return 1;
245 } 245 }
246 246
247 Expression doInline(InlineDoState ids) 247 override Expression doInline(InlineDoState ids)
248 { 248 {
249 int i; 249 int i;
250 250
251 //printf("VarExp.doInline(%s)\n", toChars()); 251 //printf("VarExp.doInline(%s)\n", toChars());
252 for (i = 0; i < ids.from.dim; i++) 252 for (i = 0; i < ids.from.dim; i++)