| 339 | |
| 340 | |
| 341 | static void closegoto (LexState *ls, int g, Labeldesc *label) { |
| 342 | int i; |
| 343 | FuncState *fs = ls->fs; |
| 344 | Labellist *gl = &ls->dyd->gt; |
| 345 | Labeldesc *gt = &gl->arr[g]; |
| 346 | lua_assert(eqstr(gt->name, label->name)); |
| 347 | if (gt->nactvar < label->nactvar) { |
| 348 | TString *vname = getlocvar(fs, gt->nactvar)->varname; |
| 349 | const char *msg = luaO_pushfstring(ls->L, |
| 350 | "<goto %s> at line %d jumps into the scope of local '%s'", |
| 351 | getstr(gt->name), gt->line, getstr(vname)); |
| 352 | semerror(ls, msg); |
| 353 | } |
| 354 | luaK_patchlist(fs, gt->pc, label->pc); |
| 355 | /* remove goto from pending list */ |
| 356 | for (i = g; i < gl->n - 1; i++) |
| 357 | gl->arr[i] = gl->arr[i + 1]; |
| 358 | gl->n--; |
| 359 | } |
| 360 | |
| 361 | |
| 362 | /* |
no test coverage detected