MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaK_infix

Function luaK_infix

third-party/lua-5.4.6/src/lcode.c:1637–1679  ·  view source on GitHub ↗

** Process 1st operand 'v' of binary operation 'op' before reading ** 2nd operand. */

Source from the content-addressed store, hash-verified

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

Callers 1

subexprFunction · 0.70

Calls 8

luaK_dischargevarsFunction · 0.70
luaK_goiftrueFunction · 0.70
luaK_goiffalseFunction · 0.70
luaK_exp2nextregFunction · 0.70
tonumeralFunction · 0.70
luaK_exp2anyregFunction · 0.70
exp2RKFunction · 0.70
isSCnumberFunction · 0.70

Tested by

no test coverage detected