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