MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / leaveblock

Function leaveblock

src/Chain/libraries/glua/lparser.cpp:493–513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491
492
493static void leaveblock(FuncState *fs) {
494 BlockCnt *bl = fs->bl;
495 LexState *ls = fs->ls;
496 if (bl->previous && bl->upval) {
497 /* create a 'jump to here' to close upvalues */
498 int j = luaK_jump(fs);
499 luaK_patchclose(fs, j, bl->nactvar);
500 luaK_patchtohere(fs, j);
501 }
502 if (bl->isloop)
503 breaklabel(ls); /* close pending breaks */
504 fs->bl = bl->previous;
505 removevars(fs, bl->nactvar);
506 lua_assert(bl->nactvar == fs->nactvar);
507 fs->freereg = fs->nactvar; /* free registers */
508 ls->dyd->label.n = bl->firstlabel; /* remove local labels */
509 if (bl->previous) /* inner block? */
510 movegotosout(fs, bl); /* update pending gotos to outer block */
511 else if (bl->firstgoto < ls->dyd->gt.n) /* pending gotos in outer block? */
512 undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]); /* error */
513}
514
515
516/*

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 7

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

Tested by 1

test_then_blockFunction · 0.68