** Process 1st operand 'v' of binary operation 'op' before reading ** 2nd operand. */
| 1634 | ** 2nd operand. |
| 1635 | */ |
| 1636 | void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { |
| 1637 | luaK_dischargevars(fs, v); |
| 1638 | switch (op) { |
| 1639 | case OPR_AND: { |
| 1640 | luaK_goiftrue(fs, v); /* go ahead only if 'v' is true */ |
| 1641 | break; |
| 1642 | } |
| 1643 | case OPR_OR: { |
| 1644 | luaK_goiffalse(fs, v); /* go ahead only if 'v' is false */ |
| 1645 | break; |
| 1646 | } |
| 1647 | case OPR_CONCAT: { |
| 1648 | luaK_exp2nextreg(fs, v); /* operand must be on the stack */ |
| 1649 | break; |
| 1650 | } |
| 1651 | case OPR_ADD: case OPR_SUB: |
| 1652 | case OPR_MUL: case OPR_DIV: case OPR_IDIV: |
| 1653 | case OPR_MOD: case OPR_POW: |
| 1654 | case OPR_BAND: case OPR_BOR: case OPR_BXOR: |
| 1655 | case OPR_SHL: case OPR_SHR: { |
| 1656 | if (!tonumeral(v, NULL)) |
| 1657 | luaK_exp2anyreg(fs, v); |
| 1658 | /* else keep numeral, which may be folded or used as an immediate |
| 1659 | operand */ |
| 1660 | break; |
| 1661 | } |
| 1662 | case OPR_EQ: case OPR_NE: { |
| 1663 | if (!tonumeral(v, NULL)) |
| 1664 | exp2RK(fs, v); |
| 1665 | /* else keep numeral, which may be an immediate operand */ |
| 1666 | break; |
| 1667 | } |
| 1668 | case OPR_LT: case OPR_LE: |
| 1669 | case OPR_GT: case OPR_GE: { |
| 1670 | int dummy, dummy2; |
| 1671 | if (!isSCnumber(v, &dummy, &dummy2)) |
| 1672 | luaK_exp2anyreg(fs, v); |
| 1673 | /* else keep numeral, which may be an immediate operand */ |
| 1674 | break; |
| 1675 | } |
| 1676 | default: lua_assert(0); |
| 1677 | } |
| 1678 | } |
| 1679 | |
| 1680 | /* |
| 1681 | ** Create code for '(e1 .. e2)'. |
no test coverage detected