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

Function luaK_infix

third-party/lua-5.5.0/src/lcode.c:1718–1760  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1716** 2nd operand.
1717*/
1718void 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)'.

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