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

Function open_func

lua/lparser.c:359–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357
358
359static void open_func (LexState *ls, FuncState *fs) {
360 lua_State *L = ls->L;
361 Proto *f = luaF_newproto(L);
362 fs->f = f;
363 fs->prev = ls->fs; /* linked list of funcstates */
364 fs->ls = ls;
365 fs->L = L;
366 ls->fs = fs;
367 fs->pc = 0;
368 fs->lasttarget = -1;
369 fs->jpc = NO_JUMP;
370 fs->freereg = 0;
371 fs->nk = 0;
372 fs->np = 0;
373 fs->nlocvars = 0;
374 fs->nactvar = 0;
375 fs->bl = NULL;
376 f->source = ls->source;
377 f->maxstacksize = 2; /* registers 0/1 are always valid */
378 fs->h = luaH_new(L, 0, 0);
379 /* anchor table of constants and prototype (to avoid being collected) */
380 sethvalue2s(L, L->top, fs->h);
381 incr_top(L);
382 setptvalue2s(L, L->top, f);
383 incr_top(L);
384}
385
386
387static void close_func (LexState *ls) {

Callers 2

luaY_parserFunction · 0.85
bodyFunction · 0.85

Calls 2

luaF_newprotoFunction · 0.85
luaH_newFunction · 0.85

Tested by

no test coverage detected