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

Function leaveblock

src/vm/luavm/lua/lparser.c:468–488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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