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

Function assignment

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

Source from the content-addressed store, hash-verified

933
934
935static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) {
936 expdesc e;
937 check_condition(ls, VLOCAL <= lh->v.k && lh->v.k <= VINDEXED,
938 "syntax error");
939 if (testnext(ls, ',')) { /* assignment -> `,' primaryexp assignment */
940 struct LHS_assign nv;
941 nv.prev = lh;
942 primaryexp(ls, &nv.v);
943 if (nv.v.k == VLOCAL)
944 check_conflict(ls, lh, &nv.v);
945 luaY_checklimit(ls->fs, nvars, LUAI_MAXCCALLS - ls->L->nCcalls,
946 "variables in assignment");
947 assignment(ls, &nv, nvars+1);
948 }
949 else { /* assignment -> `=' explist1 */
950 int nexps;
951 checknext(ls, '=');
952 nexps = explist1(ls, &e);
953 if (nexps != nvars) {
954 adjust_assign(ls, nvars, nexps, &e);
955 if (nexps > nvars)
956 ls->fs->freereg -= nexps - nvars; /* remove extra values */
957 }
958 else {
959 luaK_setoneret(ls->fs, &e); /* close last expression */
960 luaK_storevar(ls->fs, &lh->v, &e);
961 return; /* avoid default */
962 }
963 }
964 init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */
965 luaK_storevar(ls->fs, &lh->v, &e);
966}
967
968
969static int cond (LexState *ls) {

Callers 1

exprstatFunction · 0.70

Calls 9

explist1Function · 0.85
testnextFunction · 0.70
primaryexpFunction · 0.70
check_conflictFunction · 0.70
checknextFunction · 0.70
adjust_assignFunction · 0.70
luaK_setoneretFunction · 0.70
luaK_storevarFunction · 0.70
init_expFunction · 0.70

Tested by

no test coverage detected