MCPcopy Create free account
hub / github.com/danomatika/ofxLua / luaK_infix

Function luaK_infix

libs/lua/lcode.c:1633–1675  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 1

subexprFunction · 0.85

Calls 8

luaK_dischargevarsFunction · 0.85
luaK_goiftrueFunction · 0.85
luaK_goiffalseFunction · 0.85
luaK_exp2nextregFunction · 0.85
tonumeralFunction · 0.85
luaK_exp2anyregFunction · 0.85
luaK_exp2RKFunction · 0.85
isSCnumberFunction · 0.85

Tested by

no test coverage detected