** Fix an expression to return one result. ** If expression is not a multi-ret expression (function call or ** vararg), it already returns one result, so nothing needs to be done. ** Function calls become VNONRELOC expressions (as its result comes ** fixed in the base register of the call), while vararg expressions ** become VRELOCABLE (as OP_VARARG puts its results where it wants). ** (Calls are
| 537 | ** to be fixed.) |
| 538 | */ |
| 539 | void luaK_setoneret (FuncState *fs, expdesc *e) { |
| 540 | if (e->k == VCALL) { /* expression is an open function call? */ |
| 541 | /* already returns 1 value */ |
| 542 | lua_assert(GETARG_C(getinstruction(fs, e)) == 2); |
| 543 | e->k = VNONRELOC; /* result has fixed position */ |
| 544 | e->u.info = GETARG_A(getinstruction(fs, e)); |
| 545 | } |
| 546 | else if (e->k == VVARARG) { |
| 547 | SETARG_B(getinstruction(fs, e), 2); |
| 548 | e->k = VRELOCABLE; /* can relocate its simple result */ |
| 549 | } |
| 550 | } |
| 551 | |
| 552 | |
| 553 | /* |
no outgoing calls
no test coverage detected