| 763 | |
| 764 | |
| 765 | void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) { |
| 766 | expdesc e2; |
| 767 | e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; |
| 768 | switch (op) { |
| 769 | case OPR_MINUS: { |
| 770 | if (isnumeral(e)) /* minus constant? */ |
| 771 | e->u.nval = luai_numunm(NULL, e->u.nval); /* fold it */ |
| 772 | else { |
| 773 | luaK_exp2anyreg(fs, e); |
| 774 | codearith(fs, OP_UNM, e, &e2, line); |
| 775 | } |
| 776 | break; |
| 777 | } |
| 778 | case OPR_NOT: codenot(fs, e); break; |
| 779 | case OPR_LEN: { |
| 780 | luaK_exp2anyreg(fs, e); /* cannot operate on constants */ |
| 781 | codearith(fs, OP_LEN, e, &e2, line); |
| 782 | break; |
| 783 | } |
| 784 | default: lua_assert(0); |
| 785 | } |
| 786 | } |
| 787 | |
| 788 | |
| 789 | void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { |
no test coverage detected