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