MCPcopy Create free account
hub / github.com/TASEmulators/fceux / luaK_posfix

Function luaK_posfix

src/lua/src/lcode.c:745–789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

743
744
745void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) {
746 switch (op) {
747 case OPR_AND: {
748 lua_assert(e1->t == NO_JUMP); /* list must be closed */
749 luaK_dischargevars(fs, e2);
750 luaK_concat(fs, &e2->f, e1->f);
751 *e1 = *e2;
752 break;
753 }
754 case OPR_OR: {
755 lua_assert(e1->f == NO_JUMP); /* list must be closed */
756 luaK_dischargevars(fs, e2);
757 luaK_concat(fs, &e2->t, e1->t);
758 *e1 = *e2;
759 break;
760 }
761 case OPR_CONCAT: {
762 luaK_exp2val(fs, e2);
763 if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) {
764 lua_assert(e1->u.s.info == GETARG_B(getcode(fs, e2))-1);
765 freeexp(fs, e1);
766 SETARG_B(getcode(fs, e2), e1->u.s.info);
767 e1->k = VRELOCABLE; e1->u.s.info = e2->u.s.info;
768 }
769 else {
770 luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */
771 codearith(fs, OP_CONCAT, e1, e2);
772 }
773 break;
774 }
775 case OPR_ADD: codearith(fs, OP_ADD, e1, e2); break;
776 case OPR_SUB: codearith(fs, OP_SUB, e1, e2); break;
777 case OPR_MUL: codearith(fs, OP_MUL, e1, e2); break;
778 case OPR_DIV: codearith(fs, OP_DIV, e1, e2); break;
779 case OPR_MOD: codearith(fs, OP_MOD, e1, e2); break;
780 case OPR_POW: codearith(fs, OP_POW, e1, e2); break;
781 case OPR_EQ: codecomp(fs, OP_EQ, 1, e1, e2); break;
782 case OPR_NE: codecomp(fs, OP_EQ, 0, e1, e2); break;
783 case OPR_LT: codecomp(fs, OP_LT, 1, e1, e2); break;
784 case OPR_LE: codecomp(fs, OP_LE, 1, e1, e2); break;
785 case OPR_GT: codecomp(fs, OP_LT, 0, e1, e2); break;
786 case OPR_GE: codecomp(fs, OP_LE, 0, e1, e2); break;
787 default: lua_assert(0);
788 }
789}
790
791
792void luaK_fixline (FuncState *fs, int line) {

Callers 1

subexprFunction · 0.85

Calls 7

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

Tested by

no test coverage detected