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