MCPcopy Create free account
hub / github.com/Cubitect/cubiomes-viewer / luaK_infix

Function luaK_infix

lua/src/lcode.c:1592–1633  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1590** 2nd operand.
1591*/
1592void 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)'.

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