| 494 | |
| 495 | |
| 496 | static void exp2reg(FuncState *fs, expdesc *e, int reg) { |
| 497 | discharge2reg(fs, e, reg); |
| 498 | if (e->k == VJMP) |
| 499 | luaK_concat(fs, &e->t, e->u.info); /* put this jump in 't' list */ |
| 500 | if (hasjumps(e)) { |
| 501 | int final; /* position after whole expression */ |
| 502 | int p_f = NO_JUMP; /* position of an eventual LOAD false */ |
| 503 | int p_t = NO_JUMP; /* position of an eventual LOAD true */ |
| 504 | if (need_value(fs, e->t) || need_value(fs, e->f)) { |
| 505 | int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); |
| 506 | p_f = code_label(fs, reg, 0, 1); |
| 507 | p_t = code_label(fs, reg, 1, 0); |
| 508 | luaK_patchtohere(fs, fj); |
| 509 | } |
| 510 | final = luaK_getlabel(fs); |
| 511 | patchlistaux(fs, e->f, final, reg, p_f); |
| 512 | patchlistaux(fs, e->t, final, reg, p_t); |
| 513 | } |
| 514 | e->f = e->t = NO_JUMP; |
| 515 | e->u.info = reg; |
| 516 | e->k = VNONRELOC; |
| 517 | } |
| 518 | |
| 519 | |
| 520 | void luaK_exp2nextreg(FuncState *fs, expdesc *e) { |
no test coverage detected