MCPcopy Create free account
hub / github.com/Cubitect/cubiomes-viewer / leaveblock

Function leaveblock

lua/src/lparser.c:671–691  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

669
670
671static void leaveblock (FuncState *fs) {
672 BlockCnt *bl = fs->bl;
673 LexState *ls = fs->ls;
674 int hasclose = 0;
675 int stklevel = reglevel(fs, bl->nactvar); /* level outside the block */
676 if (bl->isloop) /* fix pending breaks? */
677 hasclose = createlabel(ls, luaS_newliteral(ls->L, "break"), 0, 0);
678 if (!hasclose && bl->previous && bl->upval)
679 luaK_codeABC(fs, OP_CLOSE, stklevel, 0, 0);
680 fs->bl = bl->previous;
681 removevars(fs, bl->nactvar);
682 lua_assert(bl->nactvar == fs->nactvar);
683 fs->freereg = stklevel; /* free registers */
684 ls->dyd->label.n = bl->firstlabel; /* remove local labels */
685 if (bl->previous) /* inner block? */
686 movegotosout(fs, bl); /* update pending gotos to outer block */
687 else {
688 if (bl->firstgoto < ls->dyd->gt.n) /* pending gotos in outer block? */
689 undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]); /* error */
690 }
691}
692
693
694/*

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

reglevelFunction · 0.85
createlabelFunction · 0.85
removevarsFunction · 0.85
movegotosoutFunction · 0.85
undefgotoFunction · 0.85

Tested by 1

test_then_blockFunction · 0.68