| 1395 | |
| 1396 | |
| 1397 | static void gotostat (LexState *ls) { |
| 1398 | FuncState *fs = ls->fs; |
| 1399 | int line = ls->linenumber; |
| 1400 | TString *name = str_checkname(ls); /* label's name */ |
| 1401 | Labeldesc *lb = findlabel(ls, name); |
| 1402 | if (lb == NULL) /* no label? */ |
| 1403 | /* forward jump; will be resolved when the label is declared */ |
| 1404 | newgotoentry(ls, name, line, luaK_jump(fs)); |
| 1405 | else { /* found a label */ |
| 1406 | /* backward jump; will be resolved here */ |
| 1407 | int lblevel = stacklevel(fs, lb->nactvar); /* label level */ |
| 1408 | if (luaY_nvarstack(fs) > lblevel) /* leaving the scope of a variable? */ |
| 1409 | luaK_codeABC(fs, OP_CLOSE, lblevel, 0, 0); |
| 1410 | /* create jump and link it to the label */ |
| 1411 | luaK_patchlist(fs, luaK_jump(fs), lb->pc); |
| 1412 | } |
| 1413 | } |
| 1414 | |
| 1415 | |
| 1416 | /* |
no test coverage detected