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

Function assignment

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

Source from the content-addressed store, hash-verified

1138
1139
1140static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) {
1141 expdesc e;
1142 check_condition(ls, vkisvar(lh->v.k), "syntax error");
1143 if (testnext(ls, ',')) { /* assignment -> ',' suffixedexp assignment */
1144 struct LHS_assign nv;
1145 nv.prev = lh;
1146 suffixedexp(ls, &nv.v);
1147 if (nv.v.k != VINDEXED)
1148 check_conflict(ls, lh, &nv.v);
1149 checklimit(ls->fs, nvars + ls->L->nCcalls, LUAI_MAXCCALLS,
1150 "C levels");
1151 assignment(ls, &nv, nvars+1);
1152 }
1153 else { /* assignment -> `=' explist */
1154 int nexps;
1155 checknext(ls, '=');
1156 nexps = explist(ls, &e);
1157 if (nexps != nvars) {
1158 adjust_assign(ls, nvars, nexps, &e);
1159 if (nexps > nvars)
1160 ls->fs->freereg -= nexps - nvars; /* remove extra values */
1161 }
1162 else {
1163 luaK_setoneret(ls->fs, &e); /* close last expression */
1164 luaK_storevar(ls->fs, &lh->v, &e);
1165 return; /* avoid default */
1166 }
1167 }
1168 init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */
1169 luaK_storevar(ls->fs, &lh->v, &e);
1170}
1171
1172
1173static int cond (LexState *ls) {

Callers 1

exprstatFunction · 0.70

Calls 10

suffixedexpFunction · 0.85
checklimitFunction · 0.85
explistFunction · 0.85
testnextFunction · 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