/* ** check whether new label 'lb' matches any pending gotos in current ** block; solves forward jumps */ static void findgotos (LexState *ls, Labeldesc *lb) { Labellist *gl = &ls->dyd->gt; int i = ls->fs->bl->firstgoto; while (i < gl->n) { if (eqstr(gl->arr[i].name, lb->name)) closegoto(ls, i, lb); else i++; } }
/* ** check whether new label 'lb' matches any pending gotos in current ** block; solves forward jumps */ /*static*/ void LexState::findgotos (/*LexState *ls,*/ Labeldesc *lb) { Labellist *gl = &dyd->gt; int i = fs->bl->firstgoto; while (i < gl->n) { if (eqstr(gl->arr[i].name, lb->name)) closegoto(i, lb); else i++; } }
/* * check whether new label 'lb' matches any pending gotos in current * block; solves forward jumps */ static void findgotos(ktap_lexstate *ls, ktap_labeldesc *lb) { ktap_labellist *gl = &ls->dyd->gt; int i = ls->fs->bl->firstgoto; while (i < gl->n) { if (ktapc_ts_eqstr(gl->arr[i].name, lb->name)) closegoto(ls, i, lb); else i++; } }
/* ** try to close a goto with existing labels; this solves backward jumps */ static int findlabel (LexState *ls, int g) { int i; BlockCnt *bl = ls->fs->bl; Dyndata *dyd = ls->dyd; Labeldesc *gt = &dyd->gt.arr[g]; /* check labels in current block for a match */ for (i = bl->firstlabel; i < dyd->label.n; i++) { Labeldesc *lb = &dyd->label.arr[i]; if (eqstr(lb->name, gt->name)) { /* correct label? */ if (gt->nactvar > lb->nactvar && (bl->upval || dyd->label.n > bl->firstlabel)) luaK_patchclose(ls->fs, gt->pc, lb->nactvar); closegoto(ls, g, lb); /* close it */ return 1; } } return 0; /* label not found; cannot close goto */ }