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

Function retstat

third-party/lua-5.4.6/src/lparser.c:1812–1841  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1810
1811
1812static void retstat (LexState *ls) {
1813 /* stat -> RETURN [explist] [';'] */
1814 FuncState *fs = ls->fs;
1815 expdesc e;
1816 int nret; /* number of values being returned */
1817 int first = luaY_nvarstack(fs); /* first slot to be returned */
1818 if (block_follow(ls, 1) || ls->t.token == ';')
1819 nret = 0; /* return no values */
1820 else {
1821 nret = explist(ls, &e); /* optional return values */
1822 if (hasmultret(e.k)) {
1823 luaK_setmultret(fs, &e);
1824 if (e.k == VCALL && nret == 1 && !fs->bl->insidetbc) { /* tail call? */
1825 SET_OPCODE(getinstruction(fs,&e), OP_TAILCALL);
1826 lua_assert(GETARG_A(getinstruction(fs,&e)) == luaY_nvarstack(fs));
1827 }
1828 nret = LUA_MULTRET; /* return all values */
1829 }
1830 else {
1831 if (nret == 1) /* only one single value? */
1832 first = luaK_exp2anyreg(fs, &e); /* can use original slot */
1833 else { /* values must go to the top of the stack */
1834 luaK_exp2nextreg(fs, &e);
1835 lua_assert(nret == fs->freereg - first);
1836 }
1837 }
1838 }
1839 luaK_ret(fs, first, nret);
1840 testnext(ls, ';'); /* skip optional semicolon */
1841}
1842
1843
1844static void statement (LexState *ls) {

Callers 1

statementFunction · 0.70

Calls 7

luaY_nvarstackFunction · 0.70
block_followFunction · 0.70
explistFunction · 0.70
luaK_exp2anyregFunction · 0.70
luaK_exp2nextregFunction · 0.70
luaK_retFunction · 0.70
testnextFunction · 0.70

Tested by

no test coverage detected