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

Function assignment

third-party/lua-5.3.5/src/lparser.c:1147–1174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

exprstatFunction · 0.70

Calls 10

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

Tested by

no test coverage detected