** Process 1st operand 'v' of binary operation 'op' before reading ** 2nd operand. */
| 1716 | ** 2nd operand. |
| 1717 | */ |
| 1718 | void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { |
| 1719 | luaK_dischargevars(fs, v); |
| 1720 | switch (op) { |
| 1721 | case OPR_AND: { |
| 1722 | luaK_goiftrue(fs, v); /* go ahead only if 'v' is true */ |
| 1723 | break; |
| 1724 | } |
| 1725 | case OPR_OR: { |
| 1726 | luaK_goiffalse(fs, v); /* go ahead only if 'v' is false */ |
| 1727 | break; |
| 1728 | } |
| 1729 | case OPR_CONCAT: { |
| 1730 | luaK_exp2nextreg(fs, v); /* operand must be on the stack */ |
| 1731 | break; |
| 1732 | } |
| 1733 | case OPR_ADD: case OPR_SUB: |
| 1734 | case OPR_MUL: case OPR_DIV: case OPR_IDIV: |
| 1735 | case OPR_MOD: case OPR_POW: |
| 1736 | case OPR_BAND: case OPR_BOR: case OPR_BXOR: |
| 1737 | case OPR_SHL: case OPR_SHR: { |
| 1738 | if (!tonumeral(v, NULL)) |
| 1739 | luaK_exp2anyreg(fs, v); |
| 1740 | /* else keep numeral, which may be folded or used as an immediate |
| 1741 | operand */ |
| 1742 | break; |
| 1743 | } |
| 1744 | case OPR_EQ: case OPR_NE: { |
| 1745 | if (!tonumeral(v, NULL)) |
| 1746 | exp2RK(fs, v); |
| 1747 | /* else keep numeral, which may be an immediate operand */ |
| 1748 | break; |
| 1749 | } |
| 1750 | case OPR_LT: case OPR_LE: |
| 1751 | case OPR_GT: case OPR_GE: { |
| 1752 | int dummy, dummy2; |
| 1753 | if (!isSCnumber(v, &dummy, &dummy2)) |
| 1754 | luaK_exp2anyreg(fs, v); |
| 1755 | /* else keep numeral, which may be an immediate operand */ |
| 1756 | break; |
| 1757 | } |
| 1758 | default: lua_assert(0); |
| 1759 | } |
| 1760 | } |
| 1761 | |
| 1762 | /* |
| 1763 | ** Create code for '(e1 .. e2)'. |
no test coverage detected