Mercurial > projects > ddmd
comparison dmd/BinExp.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 |
---|---|
392 super(loc, op, size); | 392 super(loc, op, size); |
393 this.e1 = e1; | 393 this.e1 = e1; |
394 this.e2 = e2; | 394 this.e2 = e2; |
395 } | 395 } |
396 | 396 |
397 Expression syntaxCopy() | 397 override Expression syntaxCopy() |
398 { | 398 { |
399 BinExp e = cast(BinExp)copy(); | 399 BinExp e = cast(BinExp)copy(); |
400 e.type = null; | 400 e.type = null; |
401 e.e1 = e.e1.syntaxCopy(); | 401 e.e1 = e.e1.syntaxCopy(); |
402 e.e2 = e.e2.syntaxCopy(); | 402 e.e2 = e.e2.syntaxCopy(); |
403 | 403 |
404 return e; | 404 return e; |
405 } | 405 } |
406 | 406 |
407 Expression semantic(Scope sc) | 407 override Expression semantic(Scope sc) |
408 { | 408 { |
409 version (LOGSEMANTIC) { | 409 version (LOGSEMANTIC) { |
410 printf("BinExp.semantic('%.*s')\n", toChars()); | 410 printf("BinExp.semantic('%.*s')\n", toChars()); |
411 } | 411 } |
412 e1 = e1.semantic(sc); | 412 e1 = e1.semantic(sc); |
510 } | 510 } |
511 | 511 |
512 return this; | 512 return this; |
513 } | 513 } |
514 | 514 |
515 bool checkSideEffect(int flag) | 515 override bool checkSideEffect(int flag) |
516 { | 516 { |
517 switch (op) { | 517 switch (op) { |
518 case TOK.TOKplusplus: | 518 case TOK.TOKplusplus: |
519 case TOK.TOKminusminus: | 519 case TOK.TOKminusminus: |
520 case TOK.TOKassign: | 520 case TOK.TOKassign: |
539 default: | 539 default: |
540 return Expression.checkSideEffect(flag); | 540 return Expression.checkSideEffect(flag); |
541 } | 541 } |
542 } | 542 } |
543 | 543 |
544 void toCBuffer(OutBuffer buf, HdrGenState* hgs) | 544 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
545 { | 545 { |
546 expToCBuffer(buf, hgs, e1, precedence[op]); | 546 expToCBuffer(buf, hgs, e1, precedence[op]); |
547 buf.writeByte(' '); | 547 buf.writeByte(' '); |
548 buf.writestring(Token.toChars(op)); | 548 buf.writestring(Token.toChars(op)); |
549 buf.writeByte(' '); | 549 buf.writeByte(' '); |
625 e1 = new ErrorExp(); | 625 e1 = new ErrorExp(); |
626 e2 = new ErrorExp(); | 626 e2 = new ErrorExp(); |
627 return this; | 627 return this; |
628 } | 628 } |
629 | 629 |
630 Expression optimize(int result) | 630 override Expression optimize(int result) |
631 { | 631 { |
632 //printf("BinExp.optimize(result = %d) %s\n", result, toChars()); | 632 //printf("BinExp.optimize(result = %d) %s\n", result, toChars()); |
633 if (op != TOK.TOKconstruct && op != TOK.TOKblit) // don't replace const variable with its initializer | 633 if (op != TOK.TOKconstruct && op != TOK.TOKblit) // don't replace const variable with its initializer |
634 e1 = e1.optimize(result); | 634 e1 = e1.optimize(result); |
635 | 635 |
662 error("incompatible types for ((%s) %s (%s)): '%s' and '%s'", | 662 error("incompatible types for ((%s) %s (%s)): '%s' and '%s'", |
663 e1.toChars(), Token.toChars(op), e2.toChars(), | 663 e1.toChars(), Token.toChars(op), e2.toChars(), |
664 e1.type.toChars(), e2.type.toChars()); | 664 e1.type.toChars(), e2.type.toChars()); |
665 } | 665 } |
666 | 666 |
667 void dump(int indent) | 667 override void dump(int indent) |
668 { | 668 { |
669 assert(false); | 669 assert(false); |
670 } | 670 } |
671 | 671 |
672 void scanForNestedRef(Scope *sc) | 672 void scanForNestedRef(Scope *sc) |
1322 } | 1322 } |
1323 } | 1323 } |
1324 return e; | 1324 return e; |
1325 } | 1325 } |
1326 | 1326 |
1327 bool canThrow() | 1327 override bool canThrow() |
1328 { | 1328 { |
1329 return e1.canThrow() || e2.canThrow(); | 1329 return e1.canThrow() || e2.canThrow(); |
1330 } | 1330 } |
1331 | 1331 |
1332 /*********************************** | 1332 /*********************************** |
1606 Expression e = new CallExp(loc, ec, arguments); | 1606 Expression e = new CallExp(loc, ec, arguments); |
1607 e.type = type; | 1607 e.type = type; |
1608 return e; | 1608 return e; |
1609 } | 1609 } |
1610 | 1610 |
1611 int inlineCost(InlineCostState* ics) | 1611 override int inlineCost(InlineCostState* ics) |
1612 { | 1612 { |
1613 return 1 + e1.inlineCost(ics) + e2.inlineCost(ics); | 1613 return 1 + e1.inlineCost(ics) + e2.inlineCost(ics); |
1614 } | 1614 } |
1615 | 1615 |
1616 Expression doInline(InlineDoState ids) | 1616 override Expression doInline(InlineDoState ids) |
1617 { | 1617 { |
1618 BinExp be = cast(BinExp)copy(); | 1618 BinExp be = cast(BinExp)copy(); |
1619 | 1619 |
1620 be.e1 = e1.doInline(ids); | 1620 be.e1 = e1.doInline(ids); |
1621 be.e2 = e2.doInline(ids); | 1621 be.e2 = e2.doInline(ids); |
1622 return be; | 1622 return be; |
1623 } | 1623 } |
1624 | 1624 |
1625 Expression inlineScan(InlineScanState* iss) | 1625 override Expression inlineScan(InlineScanState* iss) |
1626 { | 1626 { |
1627 e1 = e1.inlineScan(iss); | 1627 e1 = e1.inlineScan(iss); |
1628 e2 = e2.inlineScan(iss); | 1628 e2 = e2.inlineScan(iss); |
1629 return this; | 1629 return this; |
1630 } | 1630 } |