MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / luaK_posfix

Function luaK_posfix

src/Chain/libraries/glua/lcode.cpp:885–933  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

883
884
885void luaK_posfix(FuncState *fs, BinOpr op,
886 expdesc *e1, expdesc *e2, int line) {
887 switch (op) {
888 case OPR_AND: {
889 lua_assert(e1->t == NO_JUMP); /* list must be closed */
890 luaK_dischargevars(fs, e2);
891 luaK_concat(fs, &e2->f, e1->f);
892 *e1 = *e2;
893 break;
894 }
895 case OPR_OR: {
896 lua_assert(e1->f == NO_JUMP); /* list must be closed */
897 luaK_dischargevars(fs, e2);
898 luaK_concat(fs, &e2->t, e1->t);
899 *e1 = *e2;
900 break;
901 }
902 case OPR_CONCAT: {
903 luaK_exp2val(fs, e2);
904 if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) {
905 lua_assert(e1->u.info == GETARG_B(getcode(fs, e2)) - 1);
906 freeexp(fs, e1);
907 SETARG_B(getcode(fs, e2), e1->u.info);
908 e1->k = VRELOCABLE; e1->u.info = e2->u.info;
909 }
910 else {
911 luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */
912 codeexpval(fs, OP_CONCAT, e1, e2, line);
913 }
914 break;
915 }
916 case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV:
917 case OPR_IDIV: case OPR_MOD: case OPR_POW:
918 case OPR_BAND: case OPR_BOR: case OPR_BXOR:
919 case OPR_SHL: case OPR_SHR: {
920 codeexpval(fs, lua_cast(OpCode, (op - OPR_ADD) + OP_ADD), e1, e2, line);
921 break;
922 }
923 case OPR_EQ: case OPR_LT: case OPR_LE: {
924 codecomp(fs, lua_cast(OpCode, (op - OPR_EQ) + OP_EQ), 1, e1, e2);
925 break;
926 }
927 case OPR_NE: case OPR_GT: case OPR_GE: {
928 codecomp(fs, lua_cast(OpCode, (op - OPR_NE) + OP_EQ), 0, e1, e2);
929 break;
930 }
931 default: lua_assert(0);
932 }
933}
934
935
936void 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
codeexpvalFunction · 0.85
codecompFunction · 0.85

Tested by

no test coverage detected