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

Function restassign

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

** Parse and compile a multiple assignment. The first "variable" ** (a 'suffixedexp') was already read by the caller. ** ** assignment -> suffixedexp restassign ** restassign -> ',' suffixedexp restassign | '=' explist */

Source from the content-addressed store, hash-verified

1372** restassign -> ',' suffixedexp restassign | '=' explist
1373*/
1374static void restassign (LexState *ls, struct LHS_assign *lh, int nvars) {
1375 expdesc e;
1376 check_condition(ls, vkisvar(lh->v.k), "syntax error");
1377 check_readonly(ls, &lh->v);
1378 if (testnext(ls, ',')) { /* restassign -> ',' suffixedexp restassign */
1379 struct LHS_assign nv;
1380 nv.prev = lh;
1381 suffixedexp(ls, &nv.v);
1382 if (!vkisindexed(nv.v.k))
1383 check_conflict(ls, lh, &nv.v);
1384 enterlevel(ls); /* control recursion depth */
1385 restassign(ls, &nv, nvars+1);
1386 leavelevel(ls);
1387 }
1388 else { /* restassign -> '=' explist */
1389 int nexps;
1390 checknext(ls, '=');
1391 nexps = explist(ls, &e);
1392 if (nexps != nvars)
1393 adjust_assign(ls, nvars, nexps, &e);
1394 else {
1395 luaK_setoneret(ls->fs, &e); /* close last expression */
1396 luaK_storevar(ls->fs, &lh->v, &e);
1397 return; /* avoid default */
1398 }
1399 }
1400 init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */
1401 luaK_storevar(ls->fs, &lh->v, &e);
1402}
1403
1404
1405static int cond (LexState *ls) {

Callers 1

exprstatFunction · 0.70

Calls 11

check_readonlyFunction · 0.70
testnextFunction · 0.70
suffixedexpFunction · 0.70
check_conflictFunction · 0.70
checknextFunction · 0.70
explistFunction · 0.70
adjust_assignFunction · 0.70
luaK_setoneretFunction · 0.70
luaK_storevarFunction · 0.70
init_expFunction · 0.70
enterlevelFunction · 0.50

Tested by

no test coverage detected