MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / assignment

Function assignment

src/Chain/libraries/glua/lparser.cpp:1180–1210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1178
1179
1180static void assignment(LexState *ls, struct LHS_assign *lh, int nvars) {
1181 expdesc e;
1182 check_condition(ls, vkisvar(lh->v.k), "syntax error");
1183 if (testnext(ls, ',')) { /* assignment -> ',' suffixedexp assignment */
1184 struct LHS_assign nv;
1185 nv.prev = lh;
1186 suffixedexp(ls, &nv.v);
1187 if (nv.v.k != VINDEXED)
1188 check_conflict(ls, lh, &nv.v);
1189 checklimit(ls->fs, nvars + ls->L->nCcalls, LUAI_MAXCCALLS,
1190 "C levels");
1191 assignment(ls, &nv, nvars + 1);
1192 }
1193 else { /* assignment -> '=' explist */
1194 int nexps;
1195 checknext(ls, '=');
1196 nexps = explist(ls, &e);
1197 if (nexps != nvars) {
1198 adjust_assign(ls, nvars, nexps, &e);
1199 if (nexps > nvars)
1200 ls->fs->freereg -= nexps - nvars; /* remove extra values */
1201 }
1202 else {
1203 luaK_setoneret(ls->fs, &e); /* close last expression */
1204 luaK_storevar(ls->fs, &lh->v, &e);
1205 return; /* avoid default */
1206 }
1207 }
1208 init_exp(&e, VNONRELOC, ls->fs->freereg - 1); /* default assignment */
1209 luaK_storevar(ls->fs, &lh->v, &e);
1210}
1211
1212
1213static int cond(LexState *ls) {

Callers 1

exprstatFunction · 0.85

Calls 10

testnextFunction · 0.85
suffixedexpFunction · 0.85
check_conflictFunction · 0.85
checklimitFunction · 0.85
checknextFunction · 0.85
explistFunction · 0.85
adjust_assignFunction · 0.85
luaK_setoneretFunction · 0.85
luaK_storevarFunction · 0.85
init_expFunction · 0.85

Tested by

no test coverage detected