Mercurial > projects > ddmd
comparison dmd/ReturnStatement.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 | ee3a9f34dc48 |
children | ef02e2e203c2 |
comparison
equal
deleted
inserted
replaced
71:8e24ef1dd139 | 72:2e2a5c3f943a |
---|---|
55 { | 55 { |
56 super(loc); | 56 super(loc); |
57 this.exp = exp; | 57 this.exp = exp; |
58 } | 58 } |
59 | 59 |
60 Statement syntaxCopy() | 60 override Statement syntaxCopy() |
61 { | 61 { |
62 Expression e = exp ? exp.syntaxCopy() : null; | 62 Expression e = exp ? exp.syntaxCopy() : null; |
63 return new ReturnStatement(loc, e); | 63 return new ReturnStatement(loc, e); |
64 } | 64 } |
65 | 65 |
66 void toCBuffer(OutBuffer buf, HdrGenState* hgs) | 66 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
67 { | 67 { |
68 assert(false); | 68 assert(false); |
69 } | 69 } |
70 | 70 |
71 Statement semantic(Scope sc) | 71 override Statement semantic(Scope sc) |
72 { | 72 { |
73 //printf("ReturnStatement.semantic() %s\n", toChars()); | 73 //printf("ReturnStatement.semantic() %s\n", toChars()); |
74 | 74 |
75 FuncDeclaration fd = sc.parent.isFuncDeclaration(); | 75 FuncDeclaration fd = sc.parent.isFuncDeclaration(); |
76 Scope scx = sc; | 76 Scope scx = sc; |
344 } | 344 } |
345 | 345 |
346 return this; | 346 return this; |
347 } | 347 } |
348 | 348 |
349 BE blockExit() | 349 override BE blockExit() |
350 { | 350 { |
351 BE result = BE.BEreturn; | 351 BE result = BE.BEreturn; |
352 if (exp && exp.canThrow()) | 352 if (exp && exp.canThrow()) |
353 result |= BE.BEthrow; | 353 result |= BE.BEthrow; |
354 | 354 |
355 return result; | 355 return result; |
356 } | 356 } |
357 | 357 |
358 Expression interpret(InterState istate) | 358 override Expression interpret(InterState istate) |
359 { | 359 { |
360 version (LOG) { | 360 version (LOG) { |
361 printf("ReturnStatement.interpret(%s)\n", exp ? exp.toChars() : ""); | 361 printf("ReturnStatement.interpret(%s)\n", exp ? exp.toChars() : ""); |
362 } | 362 } |
363 mixin(START!()); | 363 mixin(START!()); |
370 } else { | 370 } else { |
371 return exp.interpret(istate); | 371 return exp.interpret(istate); |
372 } | 372 } |
373 } | 373 } |
374 | 374 |
375 int inlineCost(InlineCostState* ics) | 375 override int inlineCost(InlineCostState* ics) |
376 { | 376 { |
377 // Can't handle return statements nested in if's | 377 // Can't handle return statements nested in if's |
378 if (ics.nested) | 378 if (ics.nested) |
379 return COST_MAX; | 379 return COST_MAX; |
380 return exp ? exp.inlineCost(ics) : 0; | 380 return exp ? exp.inlineCost(ics) : 0; |
381 } | 381 } |
382 | 382 |
383 Expression doInline(InlineDoState ids) | 383 override Expression doInline(InlineDoState ids) |
384 { | 384 { |
385 //printf("ReturnStatement.doInline() '%s'\n", exp ? exp.toChars() : ""); | 385 //printf("ReturnStatement.doInline() '%s'\n", exp ? exp.toChars() : ""); |
386 return exp ? exp.doInline(ids) : null; | 386 return exp ? exp.doInline(ids) : null; |
387 } | 387 } |
388 | 388 |
389 Statement inlineScan(InlineScanState* iss) | 389 override Statement inlineScan(InlineScanState* iss) |
390 { | 390 { |
391 //printf("ReturnStatement.inlineScan()\n"); | 391 //printf("ReturnStatement.inlineScan()\n"); |
392 if (exp) | 392 if (exp) |
393 { | 393 { |
394 exp = exp.inlineScan(iss); | 394 exp = exp.inlineScan(iss); |
395 } | 395 } |
396 return this; | 396 return this; |
397 } | 397 } |
398 | 398 |
399 void toIR(IRState* irs) | 399 override void toIR(IRState* irs) |
400 { | 400 { |
401 Blockx* blx = irs.blx; | 401 Blockx* blx = irs.blx; |
402 | 402 |
403 incUsage(irs, loc); | 403 incUsage(irs, loc); |
404 if (exp) | 404 if (exp) |
511 } | 511 } |
512 else | 512 else |
513 block_next(blx, BC.BCret, null); | 513 block_next(blx, BC.BCret, null); |
514 } | 514 } |
515 | 515 |
516 ReturnStatement isReturnStatement() { return this; } | 516 override ReturnStatement isReturnStatement() { return this; } |
517 } | 517 } |