MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / solvegoto

Function solvegoto

lib/lua/src/lparser.c:527–538  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

525** If it jumps into the scope of some variable, raises an error.
526*/
527static void solvegoto (LexState *ls, int g, Labeldesc *label) {
528 int i;
529 Labellist *gl = &ls->dyd->gt; /* list of gotos */
530 Labeldesc *gt = &gl->arr[g]; /* goto to be resolved */
531 lua_assert(eqstr(gt->name, label->name));
532 if (l_unlikely(gt->nactvar < label->nactvar)) /* enter some scope? */
533 jumpscopeerror(ls, gt);
534 luaK_patchlist(ls->fs, gt->pc, label->pc);
535 for (i = g; i < gl->n - 1; i++) /* remove goto from pending list */
536 gl->arr[i] = gl->arr[i + 1];
537 gl->n--;
538}
539
540
541/*

Callers 1

solvegotosFunction · 0.85

Calls 2

jumpscopeerrorFunction · 0.85
luaK_patchlistFunction · 0.85

Tested by

no test coverage detected