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

Function leaveblock

extlibs/lua/src/lparser.c:654–674  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

652
653
654static void leaveblock (FuncState *fs) {
655 BlockCnt *bl = fs->bl;
656 LexState *ls = fs->ls;
657 int hasclose = 0;
658 int stklevel = stacklevel(fs, bl->nactvar); /* level outside the block */
659 if (bl->isloop) /* fix pending breaks? */
660 hasclose = createlabel(ls, luaS_newliteral(ls->L, "break"), 0, 0);
661 if (!hasclose && bl->previous && bl->upval)
662 luaK_codeABC(fs, OP_CLOSE, stklevel, 0, 0);
663 fs->bl = bl->previous;
664 removevars(fs, bl->nactvar);
665 lua_assert(bl->nactvar == fs->nactvar);
666 fs->freereg = stklevel; /* free registers */
667 ls->dyd->label.n = bl->firstlabel; /* remove local labels */
668 if (bl->previous) /* inner block? */
669 movegotosout(fs, bl); /* update pending gotos to outer block */
670 else {
671 if (bl->firstgoto < ls->dyd->gt.n) /* pending gotos in outer block? */
672 undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]); /* error */
673 }
674}
675
676
677/*

Callers 7

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

Calls 5

stacklevelFunction · 0.85
createlabelFunction · 0.85
removevarsFunction · 0.85
movegotosoutFunction · 0.85
undefgotoFunction · 0.85

Tested by 1

test_then_blockFunction · 0.68