** Emit code to go through if 'e' is false, jump otherwise. */
| 882 | ** Emit code to go through if 'e' is false, jump otherwise. |
| 883 | */ |
| 884 | void luaK_goiffalse (FuncState *fs, expdesc *e) { |
| 885 | int pc; /* pc of new jump */ |
| 886 | luaK_dischargevars(fs, e); |
| 887 | switch (e->k) { |
| 888 | case VJMP: { |
| 889 | pc = e->u.info; /* already jump if true */ |
| 890 | break; |
| 891 | } |
| 892 | case VNIL: case VFALSE: { |
| 893 | pc = NO_JUMP; /* always false; do nothing */ |
| 894 | break; |
| 895 | } |
| 896 | default: { |
| 897 | pc = jumponcond(fs, e, 1); /* jump if true */ |
| 898 | break; |
| 899 | } |
| 900 | } |
| 901 | luaK_concat(fs, &e->t, pc); /* insert new jump in 't' list */ |
| 902 | luaK_patchtohere(fs, e->f); /* false list jumps to here (to go through) */ |
| 903 | e->f = NO_JUMP; |
| 904 | } |
| 905 | |
| 906 | |
| 907 | /* |