MCPcopy Create free account
hub / github.com/F-Stack/f-stack / retstat

Function retstat

freebsd/contrib/openzfs/module/lua/lparser.c:1501–1531  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

statementFunction · 0.70

Calls 6

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

Tested by

no test coverage detected