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

Function restassign

third-party/lua-5.5.0/src/lparser.c:1498–1525  ·  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

1496** restassign -> ',' suffixedexp restassign | '=' explist
1497*/
1498static void restassign (LexState *ls, struct LHS_assign *lh, int nvars) {
1499 expdesc e;
1500 check_condition(ls, vkisvar(lh->v.k), "syntax error");
1501 check_readonly(ls, &lh->v);
1502 if (testnext(ls, ',')) { /* restassign -> ',' suffixedexp restassign */
1503 struct LHS_assign nv;
1504 nv.prev = lh;
1505 suffixedexp(ls, &nv.v);
1506 if (!vkisindexed(nv.v.k))
1507 check_conflict(ls, lh, &nv.v);
1508 enterlevel(ls); /* control recursion depth */
1509 restassign(ls, &nv, nvars+1);
1510 leavelevel(ls);
1511 }
1512 else { /* restassign -> '=' explist */
1513 int nexps;
1514 checknext(ls, '=');
1515 nexps = explist(ls, &e);
1516 if (nexps != nvars)
1517 adjust_assign(ls, nvars, nexps, &e);
1518 else {
1519 luaK_setoneret(ls->fs, &e); /* close last expression */
1520 luaK_storevar(ls->fs, &lh->v, &e);
1521 return; /* avoid default */
1522 }
1523 }
1524 storevartop(ls->fs, &lh->v); /* default assignment */
1525}
1526
1527
1528static int cond (LexState *ls) {

Callers 1

exprstatFunction · 0.70

Calls 11

storevartopFunction · 0.85
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
enterlevelFunction · 0.50

Tested by

no test coverage detected