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

Function luaK_posfix

third-party/lua-5.2.4/src/lcode.c:813–859  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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