Mercurial > projects > ddmd
comparison dmd/CastExp.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 | cab4c37afb89 |
children | ef02e2e203c2 |
comparison
equal
deleted
inserted
replaced
71:8e24ef1dd139 | 72:2e2a5c3f943a |
---|---|
59 super(loc, TOK.TOKcast, CastExp.sizeof, e); | 59 super(loc, TOK.TOKcast, CastExp.sizeof, e); |
60 to = null; | 60 to = null; |
61 this.mod = mod; | 61 this.mod = mod; |
62 } | 62 } |
63 | 63 |
64 Expression syntaxCopy() | 64 override Expression syntaxCopy() |
65 { | 65 { |
66 return to ? new CastExp(loc, e1.syntaxCopy(), to.syntaxCopy()) | 66 return to ? new CastExp(loc, e1.syntaxCopy(), to.syntaxCopy()) |
67 : new CastExp(loc, e1.syntaxCopy(), mod); | 67 : new CastExp(loc, e1.syntaxCopy(), mod); |
68 } | 68 } |
69 | 69 |
70 Expression semantic(Scope sc) | 70 override Expression semantic(Scope sc) |
71 { | 71 { |
72 Expression e; | 72 Expression e; |
73 BinExp b; | 73 BinExp b; |
74 UnaExp u; | 74 UnaExp u; |
75 | 75 |
170 | 170 |
171 e = e1.castTo(sc, to); | 171 e = e1.castTo(sc, to); |
172 return e; | 172 return e; |
173 } | 173 } |
174 | 174 |
175 MATCH implicitConvTo(Type t) | 175 override MATCH implicitConvTo(Type t) |
176 { | 176 { |
177 static if (false) { | 177 static if (false) { |
178 printf("CastExp::implicitConvTo(this=%s, type=%s, t=%s)\n", toChars(), type.toChars(), t.toChars()); | 178 printf("CastExp::implicitConvTo(this=%s, type=%s, t=%s)\n", toChars(), type.toChars(), t.toChars()); |
179 } | 179 } |
180 MATCH result = type.implicitConvTo(t); | 180 MATCH result = type.implicitConvTo(t); |
189 result = Expression.implicitConvTo(t); | 189 result = Expression.implicitConvTo(t); |
190 } | 190 } |
191 return result; | 191 return result; |
192 } | 192 } |
193 | 193 |
194 IntRange getIntRange() | 194 override IntRange getIntRange() |
195 { | 195 { |
196 IntRange ir; | 196 IntRange ir; |
197 ir = e1.getIntRange(); | 197 ir = e1.getIntRange(); |
198 // Do sign extension | 198 // Do sign extension |
199 switch (e1.type.toBasetype().ty) | 199 switch (e1.type.toBasetype().ty) |
216 ir.imax &= type.sizemask(); | 216 ir.imax &= type.sizemask(); |
217 //printf("CastExp: imin = x%llx, imax = x%llx\n", ir.imin, ir.imax); | 217 //printf("CastExp: imin = x%llx, imax = x%llx\n", ir.imin, ir.imax); |
218 return ir; | 218 return ir; |
219 } | 219 } |
220 | 220 |
221 Expression optimize(int result) | 221 override Expression optimize(int result) |
222 { | 222 { |
223 //printf("CastExp.optimize(result = %d) %s\n", result, toChars()); | 223 //printf("CastExp.optimize(result = %d) %s\n", result, toChars()); |
224 //printf("from %s to %s\n", type.toChars(), to.toChars()); | 224 //printf("from %s to %s\n", type.toChars(), to.toChars()); |
225 //printf("from %s\n", type.toChars()); | 225 //printf("from %s\n", type.toChars()); |
226 //printf("e1.type %s\n", e1.type.toChars()); | 226 //printf("e1.type %s\n", e1.type.toChars()); |
334 printf(" returning6 %s\n", e.toChars()); | 334 printf(" returning6 %s\n", e.toChars()); |
335 } | 335 } |
336 return e; | 336 return e; |
337 } | 337 } |
338 | 338 |
339 Expression interpret(InterState istate) | 339 override Expression interpret(InterState istate) |
340 { | 340 { |
341 assert(false); | 341 assert(false); |
342 } | 342 } |
343 | 343 |
344 bool checkSideEffect(int flag) | 344 override bool checkSideEffect(int flag) |
345 { | 345 { |
346 assert(false); | 346 assert(false); |
347 } | 347 } |
348 | 348 |
349 void checkEscape() | 349 override void checkEscape() |
350 { | 350 { |
351 Type tb = type.toBasetype(); | 351 Type tb = type.toBasetype(); |
352 if (tb.ty == TY.Tarray && e1.op == TOK.TOKvar && e1.type.toBasetype().ty ==TY.Tsarray) | 352 if (tb.ty == TY.Tarray && e1.op == TOK.TOKvar && e1.type.toBasetype().ty ==TY.Tsarray) |
353 { | 353 { |
354 VarExp ve = cast(VarExp)e1; | 354 VarExp ve = cast(VarExp)e1; |
359 error("escaping reference to local %s", v.toChars()); | 359 error("escaping reference to local %s", v.toChars()); |
360 } | 360 } |
361 } | 361 } |
362 } | 362 } |
363 | 363 |
364 void toCBuffer(OutBuffer buf, HdrGenState* hgs) | 364 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
365 { | 365 { |
366 buf.writestring("cast("); | 366 buf.writestring("cast("); |
367 version (DMDV1) { | 367 version (DMDV1) { |
368 to.toCBuffer(buf, null, hgs); | 368 to.toCBuffer(buf, null, hgs); |
369 } else { | 369 } else { |
396 } | 396 } |
397 buf.writeByte(')'); | 397 buf.writeByte(')'); |
398 expToCBuffer(buf, hgs, e1, precedence[op]); | 398 expToCBuffer(buf, hgs, e1, precedence[op]); |
399 } | 399 } |
400 | 400 |
401 void buildArrayIdent(OutBuffer buf, Expressions arguments) | 401 override void buildArrayIdent(OutBuffer buf, Expressions arguments) |
402 { | 402 { |
403 Type tb = type.toBasetype(); | 403 Type tb = type.toBasetype(); |
404 if (tb.ty == Tarray || tb.ty == Tsarray) | 404 if (tb.ty == Tarray || tb.ty == Tsarray) |
405 { | 405 { |
406 e1.buildArrayIdent(buf, arguments); | 406 e1.buildArrayIdent(buf, arguments); |
407 } | 407 } |
408 else | 408 else |
409 Expression.buildArrayIdent(buf, arguments); | 409 Expression.buildArrayIdent(buf, arguments); |
410 } | 410 } |
411 | 411 |
412 Expression buildArrayLoop(Arguments fparams) | 412 override Expression buildArrayLoop(Arguments fparams) |
413 { | 413 { |
414 Type tb = type.toBasetype(); | 414 Type tb = type.toBasetype(); |
415 if (tb.ty == Tarray || tb.ty == Tsarray) | 415 if (tb.ty == Tarray || tb.ty == Tsarray) |
416 { | 416 { |
417 return e1.buildArrayLoop(fparams); | 417 return e1.buildArrayLoop(fparams); |
422 | 422 |
423 static int X(int fty, int tty) { | 423 static int X(int fty, int tty) { |
424 return ((fty) * TY.TMAX + (tty)); | 424 return ((fty) * TY.TMAX + (tty)); |
425 } | 425 } |
426 | 426 |
427 elem* toElem(IRState* irs) | 427 override elem* toElem(IRState* irs) |
428 { | 428 { |
429 elem* e; | 429 elem* e; |
430 TY fty; | 430 TY fty; |
431 TY tty; | 431 TY tty; |
432 tym_t ftym; | 432 tym_t ftym; |
1225 | 1225 |
1226 el_setLoc(e,loc); | 1226 el_setLoc(e,loc); |
1227 return e; | 1227 return e; |
1228 } | 1228 } |
1229 | 1229 |
1230 Identifier opId() | 1230 override Identifier opId() |
1231 { | 1231 { |
1232 return Id.cast_; | 1232 return Id.cast_; |
1233 } | 1233 } |
1234 } | 1234 } |
1235 | 1235 |