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