MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / findlabel

Function findlabel

ThirdParty/lua/lua/lparser.c:360–377  ·  view source on GitHub ↗

** try to close a goto with existing labels; this solves backward jumps */

Source from the content-addressed store, hash-verified

358** try to close a goto with existing labels; this solves backward jumps
359*/
360static int findlabel (LexState *ls, int g) {
361 int i;
362 BlockCnt *bl = ls->fs->bl;
363 Dyndata *dyd = ls->dyd;
364 Labeldesc *gt = &dyd->gt.arr[g];
365 /* check labels in current block for a match */
366 for (i = bl->firstlabel; i < dyd->label.n; i++) {
367 Labeldesc *lb = &dyd->label.arr[i];
368 if (eqstr(lb->name, gt->name)) { /* correct label? */
369 if (gt->nactvar > lb->nactvar &&
370 (bl->upval || dyd->label.n > bl->firstlabel))
371 luaK_patchclose(ls->fs, gt->pc, lb->nactvar);
372 closegoto(ls, g, lb); /* close it */
373 return 1;
374 }
375 }
376 return 0; /* label not found; cannot close goto */
377}
378
379
380static int newlabelentry (LexState *ls, Labellist *l, TString *name,

Callers 2

movegotosoutFunction · 0.85
gotostatFunction · 0.85

Calls 2

luaK_patchcloseFunction · 0.85
closegotoFunction · 0.85

Tested by

no test coverage detected