** Emit code to go through if 'e' is true, jump otherwise. */
| 1114 | ** Emit code to go through if 'e' is true, jump otherwise. |
| 1115 | */ |
| 1116 | void luaK_goiftrue (FuncState *fs, expdesc *e) { |
| 1117 | int pc; /* pc of new jump */ |
| 1118 | luaK_dischargevars(fs, e); |
| 1119 | switch (e->k) { |
| 1120 | case VJMP: { /* condition? */ |
| 1121 | negatecondition(fs, e); /* jump when it is false */ |
| 1122 | pc = e->u.info; /* save jump position */ |
| 1123 | break; |
| 1124 | } |
| 1125 | case VK: case VKFLT: case VKINT: case VKSTR: case VTRUE: { |
| 1126 | pc = NO_JUMP; /* always true; do nothing */ |
| 1127 | break; |
| 1128 | } |
| 1129 | default: { |
| 1130 | pc = jumponcond(fs, e, 0); /* jump when false */ |
| 1131 | break; |
| 1132 | } |
| 1133 | } |
| 1134 | luaK_concat(fs, &e->f, pc); /* insert new jump in false list */ |
| 1135 | luaK_patchtohere(fs, e->t); /* true list jumps to here (to go through) */ |
| 1136 | e->t = NO_JUMP; |
| 1137 | } |
| 1138 | |
| 1139 | |
| 1140 | /* |