MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / newupvalue

Function newupvalue

extlibs/lua/src/lparser.c:357–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355
356
357static int newupvalue (FuncState *fs, TString *name, expdesc *v) {
358 Upvaldesc *up = allocupvalue(fs);
359 FuncState *prev = fs->prev;
360 if (v->k == VLOCAL) {
361 up->instack = 1;
362 up->idx = v->u.var.sidx;
363 up->kind = getlocalvardesc(prev, v->u.var.vidx)->vd.kind;
364 lua_assert(eqstr(name, getlocalvardesc(prev, v->u.var.vidx)->vd.name));
365 }
366 else {
367 up->instack = 0;
368 up->idx = cast_byte(v->u.info);
369 up->kind = prev->f->upvalues[v->u.info].kind;
370 lua_assert(eqstr(name, prev->f->upvalues[v->u.info].name));
371 }
372 up->name = name;
373 luaC_objbarrier(fs->ls->L, fs->f, name);
374 return fs->nups - 1;
375}
376
377
378/*

Callers 1

singlevarauxFunction · 0.85

Calls 2

allocupvalueFunction · 0.85
getlocalvardescFunction · 0.85

Tested by

no test coverage detected