| 359 | |
| 360 | |
| 361 | static void closegoto(LexState *ls, int g, Labeldesc *label) { |
| 362 | int i; |
| 363 | FuncState *fs = ls->fs; |
| 364 | Labellist *gl = &ls->dyd->gt; |
| 365 | Labeldesc *gt = &gl->arr[g]; |
| 366 | lua_assert(eqstr(gt->name, label->name)); |
| 367 | if (gt->nactvar < label->nactvar) { |
| 368 | TString *vname = getlocvar(fs, gt->nactvar)->varname; |
| 369 | const char *msg = luaO_pushfstring(ls->L, |
| 370 | "<goto %s> at line %d jumps into the scope of local '%s'", |
| 371 | getstr(gt->name), gt->line, getstr(vname)); |
| 372 | semerror(ls, msg); |
| 373 | } |
| 374 | luaK_patchlist(fs, gt->pc, label->pc); |
| 375 | /* remove goto from pending list */ |
| 376 | for (i = g; i < gl->n - 1; i++) |
| 377 | gl->arr[i] = gl->arr[i + 1]; |
| 378 | gl->n--; |
| 379 | } |
| 380 | |
| 381 | |
| 382 | /* |
no test coverage detected