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

Function retstat

third-party/lua-5.2.4/src/lparser.c:1496–1526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1494
1495
1496static void retstat (LexState *ls) {
1497 /* stat -> RETURN [explist] [';'] */
1498 FuncState *fs = ls->fs;
1499 expdesc e;
1500 int first, nret; /* registers with returned values */
1501 if (block_follow(ls, 1) || ls->t.token == ';')
1502 first = nret = 0; /* return no values */
1503 else {
1504 nret = explist(ls, &e); /* optional return values */
1505 if (hasmultret(e.k)) {
1506 luaK_setmultret(fs, &e);
1507 if (e.k == VCALL && nret == 1) { /* tail call? */
1508 SET_OPCODE(getcode(fs,&e), OP_TAILCALL);
1509 lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar);
1510 }
1511 first = fs->nactvar;
1512 nret = LUA_MULTRET; /* return all values */
1513 }
1514 else {
1515 if (nret == 1) /* only one single value? */
1516 first = luaK_exp2anyreg(fs, &e);
1517 else {
1518 luaK_exp2nextreg(fs, &e); /* values must go to the `stack' */
1519 first = fs->nactvar; /* return all `active' values */
1520 lua_assert(nret == fs->freereg - first);
1521 }
1522 }
1523 }
1524 luaK_ret(fs, first, nret);
1525 testnext(ls, ';'); /* skip optional semicolon */
1526}
1527
1528
1529static void statement (LexState *ls) {

Callers 1

statementFunction · 0.70

Calls 6

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