** Emit code to go through if 'e' is true, jump otherwise. */
| 855 | ** Emit code to go through if 'e' is true, jump otherwise. |
| 856 | */ |
| 857 | void luaK_goiftrue (FuncState *fs, expdesc *e) { |
| 858 | int pc; /* pc of new jump */ |
| 859 | luaK_dischargevars(fs, e); |
| 860 | switch (e->k) { |
| 861 | case VJMP: { /* condition? */ |
| 862 | negatecondition(fs, e); /* jump when it is false */ |
| 863 | pc = e->u.info; /* save jump position */ |
| 864 | break; |
| 865 | } |
| 866 | case VK: case VKFLT: case VKINT: case VTRUE: { |
| 867 | pc = NO_JUMP; /* always true; do nothing */ |
| 868 | break; |
| 869 | } |
| 870 | default: { |
| 871 | pc = jumponcond(fs, e, 0); /* jump when false */ |
| 872 | break; |
| 873 | } |
| 874 | } |
| 875 | luaK_concat(fs, &e->f, pc); /* insert new jump in false list */ |
| 876 | luaK_patchtohere(fs, e->t); /* true list jumps to here (to go through) */ |
| 877 | e->t = NO_JUMP; |
| 878 | } |
| 879 | |
| 880 | |
| 881 | /* |