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

Function assignment

third-party/lua-5.2.4/src/lparser.c:1136–1166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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