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

Function leaveblock

third-party/lua-5.2.4/src/lparser.c:472–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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