| 388 | |
| 389 | |
| 390 | static void exp2reg (FuncState *fs, expdesc *e, int reg) { |
| 391 | discharge2reg(fs, e, reg); |
| 392 | if (e->k == VJMP) |
| 393 | luaK_concat(fs, &e->t, e->u.s.info); /* put this jump in `t' list */ |
| 394 | if (hasjumps(e)) { |
| 395 | int final; /* position after whole expression */ |
| 396 | int p_f = NO_JUMP; /* position of an eventual LOAD false */ |
| 397 | int p_t = NO_JUMP; /* position of an eventual LOAD true */ |
| 398 | if (need_value(fs, e->t) || need_value(fs, e->f)) { |
| 399 | int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); |
| 400 | p_f = code_label(fs, reg, 0, 1); |
| 401 | p_t = code_label(fs, reg, 1, 0); |
| 402 | luaK_patchtohere(fs, fj); |
| 403 | } |
| 404 | final = luaK_getlabel(fs); |
| 405 | patchlistaux(fs, e->f, final, reg, p_f); |
| 406 | patchlistaux(fs, e->t, final, reg, p_t); |
| 407 | } |
| 408 | e->f = e->t = NO_JUMP; |
| 409 | e->u.s.info = reg; |
| 410 | e->k = VNONRELOC; |
| 411 | } |
| 412 | |
| 413 | |
| 414 | void luaK_exp2nextreg (FuncState *fs, expdesc *e) { |
no test coverage detected