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

Function leaveblock

third-party/lua-5.3.5/src/lparser.c:473–493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

471
472
473static void leaveblock (FuncState *fs) {
474 BlockCnt *bl = fs->bl;
475 LexState *ls = fs->ls;
476 if (bl->previous && bl->upval) {
477 /* create a 'jump to here' to close upvalues */
478 int j = luaK_jump(fs);
479 luaK_patchclose(fs, j, bl->nactvar);
480 luaK_patchtohere(fs, j);
481 }
482 if (bl->isloop)
483 breaklabel(ls); /* close pending breaks */
484 fs->bl = bl->previous;
485 removevars(fs, bl->nactvar);
486 lua_assert(bl->nactvar == fs->nactvar);
487 fs->freereg = fs->nactvar; /* free registers */
488 ls->dyd->label.n = bl->firstlabel; /* remove local labels */
489 if (bl->previous) /* inner block? */
490 movegotosout(fs, bl); /* update pending gotos to outer block */
491 else if (bl->firstgoto < ls->dyd->gt.n) /* pending gotos in outer block? */
492 undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]); /* error */
493}
494
495
496/*

Callers 7

close_funcFunction · 0.70
blockFunction · 0.70
whilestatFunction · 0.70
repeatstatFunction · 0.70
forbodyFunction · 0.70
forstatFunction · 0.70
test_then_blockFunction · 0.70

Calls 7

luaK_jumpFunction · 0.70
luaK_patchcloseFunction · 0.70
luaK_patchtohereFunction · 0.70
breaklabelFunction · 0.70
removevarsFunction · 0.70
movegotosoutFunction · 0.70
undefgotoFunction · 0.70

Tested by 1

test_then_blockFunction · 0.56