| 466 | |
| 467 | |
| 468 | static void exp2reg (FuncState *fs, expdesc *e, int reg) { |
| 469 | discharge2reg(fs, e, reg); |
| 470 | if (e->k == VJMP) |
| 471 | luaK_concat(fs, &e->t, e->u.info); /* put this jump in `t' list */ |
| 472 | if (hasjumps(e)) { |
| 473 | int final; /* position after whole expression */ |
| 474 | int p_f = NO_JUMP; /* position of an eventual LOAD false */ |
| 475 | int p_t = NO_JUMP; /* position of an eventual LOAD true */ |
| 476 | if (need_value(fs, e->t) || need_value(fs, e->f)) { |
| 477 | int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); |
| 478 | p_f = code_label(fs, reg, 0, 1); |
| 479 | p_t = code_label(fs, reg, 1, 0); |
| 480 | luaK_patchtohere(fs, fj); |
| 481 | } |
| 482 | final = luaK_getlabel(fs); |
| 483 | patchlistaux(fs, e->f, final, reg, p_f); |
| 484 | patchlistaux(fs, e->t, final, reg, p_t); |
| 485 | } |
| 486 | e->f = e->t = NO_JUMP; |
| 487 | e->u.info = reg; |
| 488 | e->k = VNONRELOC; |
| 489 | } |
| 490 | |
| 491 | |
| 492 | void luaK_exp2nextreg (FuncState *fs, expdesc *e) { |
no test coverage detected