| 584 | |
| 585 | |
| 586 | static void codenot (FuncState *fs, expdesc *e) { |
| 587 | luaK_dischargevars(fs, e); |
| 588 | switch (e->k) { |
| 589 | case VNIL: case VFALSE: { |
| 590 | e->k = VTRUE; |
| 591 | break; |
| 592 | } |
| 593 | case VK: case VKNUM: case VTRUE: { |
| 594 | e->k = VFALSE; |
| 595 | break; |
| 596 | } |
| 597 | case VJMP: { |
| 598 | invertjump(fs, e); |
| 599 | break; |
| 600 | } |
| 601 | case VRELOCABLE: |
| 602 | case VNONRELOC: { |
| 603 | discharge2anyreg(fs, e); |
| 604 | freeexp(fs, e); |
| 605 | e->u.s.info = luaK_codeABC(fs, OP_NOT, 0, e->u.s.info, 0); |
| 606 | e->k = VRELOCABLE; |
| 607 | break; |
| 608 | } |
| 609 | default: { |
| 610 | lua_assert(0); /* cannot happen */ |
| 611 | break; |
| 612 | } |
| 613 | } |
| 614 | /* interchange true and false lists */ |
| 615 | { int temp = e->f; e->f = e->t; e->t = temp; } |
| 616 | removevalues(fs, e->f); |
| 617 | removevalues(fs, e->t); |
| 618 | } |
| 619 | |
| 620 | |
| 621 | void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { |
no test coverage detected