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