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

Function retstat

app/redis-6.2.6/deps/lua/src/lparser.c:1242–1272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1240
1241
1242static void retstat (LexState *ls) {
1243 /* stat -> RETURN explist */
1244 FuncState *fs = ls->fs;
1245 expdesc e;
1246 int first, nret; /* registers with returned values */
1247 luaX_next(ls); /* skip RETURN */
1248 if (block_follow(ls->t.token) || ls->t.token == ';')
1249 first = nret = 0; /* return no values */
1250 else {
1251 nret = explist1(ls, &e); /* optional return values */
1252 if (hasmultret(e.k)) {
1253 luaK_setmultret(fs, &e);
1254 if (e.k == VCALL && nret == 1) { /* tail call? */
1255 SET_OPCODE(getcode(fs,&e), OP_TAILCALL);
1256 lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar);
1257 }
1258 first = fs->nactvar;
1259 nret = LUA_MULTRET; /* return all values */
1260 }
1261 else {
1262 if (nret == 1) /* only one single value? */
1263 first = luaK_exp2anyreg(fs, &e);
1264 else {
1265 luaK_exp2nextreg(fs, &e); /* values must go to the `stack' */
1266 first = fs->nactvar; /* return all `active' values */
1267 lua_assert(nret == fs->freereg - first);
1268 }
1269 }
1270 }
1271 luaK_ret(fs, first, nret);
1272}
1273
1274
1275static int statement (LexState *ls) {

Callers 1

statementFunction · 0.70

Calls 6

explist1Function · 0.85
luaX_nextFunction · 0.70
block_followFunction · 0.70
luaK_exp2anyregFunction · 0.70
luaK_exp2nextregFunction · 0.70
luaK_retFunction · 0.70

Tested by

no test coverage detected