MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / assignment

Function assignment

ThirdParty/lua/lua/lparser.c:1141–1171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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