MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaK_setoneret

Function luaK_setoneret

third-party/lua-5.5.0/src/lcode.c:792–803  ·  view source on GitHub ↗

** 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

Source from the content-addressed store, hash-verified

790** to be fixed.)
791*/
792void luaK_setoneret (FuncState *fs, expdesc *e) {
793 if (e->k == VCALL) { /* expression is an open function call? */
794 /* already returns 1 value */
795 lua_assert(GETARG_C(getinstruction(fs, e)) == 2);
796 e->k = VNONRELOC; /* result has fixed position */
797 e->u.info = GETARG_A(getinstruction(fs, e));
798 }
799 else if (e->k == VVARARG) {
800 SETARG_C(getinstruction(fs, e), 2);
801 e->k = VRELOC; /* can relocate its simple result */
802 }
803}
804
805/*
806** Change a vararg parameter into a regular local variable

Callers 2

restassignFunction · 0.70
luaK_dischargevarsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected