MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / indexupvalue

Function indexupvalue

lua/lparser.c:214–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212
213
214static int indexupvalue (FuncState *fs, TString *name, expdesc *v) {
215 int i;
216 Proto *f = fs->f;
217 int oldsize = f->sizeupvalues;
218 for (i=0; i<f->nups; i++) {
219 if (fs->upvalues[i].k == v->k && fs->upvalues[i].info == v->u.s.info) {
220 lua_assert(f->upvalues[i] == name);
221 return i;
222 }
223 }
224 /* new one */
225 luaY_checklimit(fs, f->nups + 1, LUAI_MAXUPVALUES, "upvalues");
226 luaM_growvector(fs->L, f->upvalues, f->nups, f->sizeupvalues,
227 TString *, MAX_INT, "");
228 while (oldsize < f->sizeupvalues) f->upvalues[oldsize++] = NULL;
229 f->upvalues[f->nups] = name;
230 luaC_objbarrier(fs->L, f, name);
231 lua_assert(v->k == VLOCAL || v->k == VUPVAL);
232 fs->upvalues[f->nups].k = cast_byte(v->k);
233 fs->upvalues[f->nups].info = cast_byte(v->u.s.info);
234 return f->nups++;
235}
236
237
238static int searchvar (FuncState *fs, TString *n) {

Callers 1

singlevarauxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected