** Emit code to go through if 'e' is true, jump otherwise. */
| 1176 | ** Emit code to go through if 'e' is true, jump otherwise. |
| 1177 | */ |
| 1178 | void luaK_goiftrue (FuncState *fs, expdesc *e) { |
| 1179 | int pc; /* pc of new jump */ |
| 1180 | luaK_dischargevars(fs, e); |
| 1181 | switch (e->k) { |
| 1182 | case VJMP: { /* condition? */ |
| 1183 | negatecondition(fs, e); /* jump when it is false */ |
| 1184 | pc = e->u.info; /* save jump position */ |
| 1185 | break; |
| 1186 | } |
| 1187 | case VK: case VKFLT: case VKINT: case VKSTR: case VTRUE: { |
| 1188 | pc = NO_JUMP; /* always true; do nothing */ |
| 1189 | break; |
| 1190 | } |
| 1191 | default: { |
| 1192 | pc = jumponcond(fs, e, 0); /* jump when false */ |
| 1193 | break; |
| 1194 | } |
| 1195 | } |
| 1196 | luaK_concat(fs, &e->f, pc); /* insert new jump in false list */ |
| 1197 | luaK_patchtohere(fs, e->t); /* true list jumps to here (to go through) */ |
| 1198 | e->t = NO_JUMP; |
| 1199 | } |
| 1200 | |
| 1201 | |
| 1202 | /* |
no test coverage detected