MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / solvegoto

Function solvegoto

3rd/lua-5.4.3/src/lparser.c:515–526  ·  view source on GitHub ↗

** Solves the goto at index 'g' to given 'label' and removes it ** from the list of pending goto's. ** If it jumps into the scope of some variable, raises an error. */

Source from the content-addressed store, hash-verified

513** If it jumps into the scope of some variable, raises an error.
514*/
515static void solvegoto (LexState *ls, int g, Labeldesc *label) {
516 int i;
517 Labellist *gl = &ls->dyd->gt; /* list of goto's */
518 Labeldesc *gt = &gl->arr[g]; /* goto to be resolved */
519 lua_assert(eqstr(gt->name, label->name));
520 if (l_unlikely(gt->nactvar < label->nactvar)) /* enter some scope? */
521 jumpscopeerror(ls, gt);
522 luaK_patchlist(ls->fs, gt->pc, label->pc);
523 for (i = g; i < gl->n - 1; i++) /* remove goto from pending list */
524 gl->arr[i] = gl->arr[i + 1];
525 gl->n--;
526}
527
528
529/*

Callers 1

solvegotosFunction · 0.85

Calls 2

jumpscopeerrorFunction · 0.85
luaK_patchlistFunction · 0.85

Tested by

no test coverage detected