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