** Emit code to go through if 'e' is true, jump otherwise. */
| 1132 | ** Emit code to go through if 'e' is true, jump otherwise. |
| 1133 | */ |
| 1134 | void luaK_goiftrue (FuncState *fs, expdesc *e) { |
| 1135 | int pc; /* pc of new jump */ |
| 1136 | luaK_dischargevars(fs, e); |
| 1137 | switch (e->k) { |
| 1138 | case VJMP: { /* condition? */ |
| 1139 | negatecondition(fs, e); /* jump when it is false */ |
| 1140 | pc = e->u.info; /* save jump position */ |
| 1141 | break; |
| 1142 | } |
| 1143 | case VK: case VKFLT: case VKINT: case VKSTR: case VTRUE: { |
| 1144 | pc = NO_JUMP; /* always true; do nothing */ |
| 1145 | break; |
| 1146 | } |
| 1147 | default: { |
| 1148 | pc = jumponcond(fs, e, 0); /* jump when false */ |
| 1149 | break; |
| 1150 | } |
| 1151 | } |
| 1152 | luaK_concat(fs, &e->f, pc); /* insert new jump in false list */ |
| 1153 | luaK_patchtohere(fs, e->t); /* true list jumps to here (to go through) */ |
| 1154 | e->t = NO_JUMP; |
| 1155 | } |
| 1156 | |
| 1157 | |
| 1158 | /* |