** 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 VRELOC (as OP_VARARG puts its results where it wants). ** (Calls are crea
| 739 | ** to be fixed.) |
| 740 | */ |
| 741 | void luaK_setoneret (FuncState *fs, expdesc *e) { |
| 742 | if (e->k == VCALL) { /* expression is an open function call? */ |
| 743 | /* already returns 1 value */ |
| 744 | lua_assert(GETARG_C(getinstruction(fs, e)) == 2); |
| 745 | e->k = VNONRELOC; /* result has fixed position */ |
| 746 | e->u.info = GETARG_A(getinstruction(fs, e)); |
| 747 | } |
| 748 | else if (e->k == VVARARG) { |
| 749 | SETARG_C(getinstruction(fs, e), 2); |
| 750 | e->k = VRELOC; /* can relocate its simple result */ |
| 751 | } |
| 752 | } |
| 753 | |
| 754 | |
| 755 | /* |
no outgoing calls
no test coverage detected