** Process 1st operand 'v' of binary operation 'op' before reading ** 2nd operand. */
| 1590 | ** 2nd operand. |
| 1591 | */ |
| 1592 | void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { |
| 1593 | luaK_dischargevars(fs, v); |
| 1594 | switch (op) { |
| 1595 | case OPR_AND: { |
| 1596 | luaK_goiftrue(fs, v); /* go ahead only if 'v' is true */ |
| 1597 | break; |
| 1598 | } |
| 1599 | case OPR_OR: { |
| 1600 | luaK_goiffalse(fs, v); /* go ahead only if 'v' is false */ |
| 1601 | break; |
| 1602 | } |
| 1603 | case OPR_CONCAT: { |
| 1604 | luaK_exp2nextreg(fs, v); /* operand must be on the stack */ |
| 1605 | break; |
| 1606 | } |
| 1607 | case OPR_ADD: case OPR_SUB: |
| 1608 | case OPR_MUL: case OPR_DIV: case OPR_IDIV: |
| 1609 | case OPR_MOD: case OPR_POW: |
| 1610 | case OPR_BAND: case OPR_BOR: case OPR_BXOR: |
| 1611 | case OPR_SHL: case OPR_SHR: { |
| 1612 | if (!tonumeral(v, NULL)) |
| 1613 | luaK_exp2anyreg(fs, v); |
| 1614 | /* else keep numeral, which may be folded with 2nd operand */ |
| 1615 | break; |
| 1616 | } |
| 1617 | case OPR_EQ: case OPR_NE: { |
| 1618 | if (!tonumeral(v, NULL)) |
| 1619 | luaK_exp2RK(fs, v); |
| 1620 | /* else keep numeral, which may be an immediate operand */ |
| 1621 | break; |
| 1622 | } |
| 1623 | case OPR_LT: case OPR_LE: |
| 1624 | case OPR_GT: case OPR_GE: { |
| 1625 | int dummy, dummy2; |
| 1626 | if (!isSCnumber(v, &dummy, &dummy2)) |
| 1627 | luaK_exp2anyreg(fs, v); |
| 1628 | /* else keep numeral, which may be an immediate operand */ |
| 1629 | break; |
| 1630 | } |
| 1631 | default: lua_assert(0); |
| 1632 | } |
| 1633 | } |
| 1634 | |
| 1635 | /* |
| 1636 | ** Create code for '(e1 .. e2)'. |
no test coverage detected