MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaK_posfix

Function luaK_posfix

freebsd/contrib/openzfs/module/lua/lcode.c:816–862  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

814
815
816void luaK_posfix (FuncState *fs, BinOpr op,
817 expdesc *e1, expdesc *e2, int line) {
818 switch (op) {
819 case OPR_AND: {
820 lua_assert(e1->t == NO_JUMP); /* list must be closed */
821 luaK_dischargevars(fs, e2);
822 luaK_concat(fs, &e2->f, e1->f);
823 *e1 = *e2;
824 break;
825 }
826 case OPR_OR: {
827 lua_assert(e1->f == NO_JUMP); /* list must be closed */
828 luaK_dischargevars(fs, e2);
829 luaK_concat(fs, &e2->t, e1->t);
830 *e1 = *e2;
831 break;
832 }
833 case OPR_CONCAT: {
834 luaK_exp2val(fs, e2);
835 if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) {
836 lua_assert(e1->u.info == GETARG_B(getcode(fs, e2))-1);
837 freeexp(fs, e1);
838 SETARG_B(getcode(fs, e2), e1->u.info);
839 e1->k = VRELOCABLE; e1->u.info = e2->u.info;
840 }
841 else {
842 luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */
843 codearith(fs, OP_CONCAT, e1, e2, line);
844 }
845 break;
846 }
847 case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV:
848 case OPR_MOD: case OPR_POW: {
849 codearith(fs, cast(OpCode, op - OPR_ADD + OP_ADD), e1, e2, line);
850 break;
851 }
852 case OPR_EQ: case OPR_LT: case OPR_LE: {
853 codecomp(fs, cast(OpCode, op - OPR_EQ + OP_EQ), 1, e1, e2);
854 break;
855 }
856 case OPR_NE: case OPR_GT: case OPR_GE: {
857 codecomp(fs, cast(OpCode, op - OPR_NE + OP_EQ), 0, e1, e2);
858 break;
859 }
860 default: lua_assert(0);
861 }
862}
863
864
865void luaK_fixline (FuncState *fs, int line) {

Callers 1

subexprFunction · 0.70

Calls 7

luaK_dischargevarsFunction · 0.70
luaK_concatFunction · 0.70
luaK_exp2valFunction · 0.70
freeexpFunction · 0.70
luaK_exp2nextregFunction · 0.70
codearithFunction · 0.70
codecompFunction · 0.70

Tested by

no test coverage detected