| 1414 | |
| 1415 | |
| 1416 | static void gotostat (LexState *ls) { |
| 1417 | FuncState *fs = ls->fs; |
| 1418 | int line = ls->linenumber; |
| 1419 | TString *name = str_checkname(ls); /* label's name */ |
| 1420 | Labeldesc *lb = findlabel(ls, name); |
| 1421 | if (lb == NULL) /* no label? */ |
| 1422 | /* forward jump; will be resolved when the label is declared */ |
| 1423 | newgotoentry(ls, name, line, luaK_jump(fs)); |
| 1424 | else { /* found a label */ |
| 1425 | /* backward jump; will be resolved here */ |
| 1426 | int lblevel = reglevel(fs, lb->nactvar); /* label level */ |
| 1427 | if (luaY_nvarstack(fs) > lblevel) /* leaving the scope of a variable? */ |
| 1428 | luaK_codeABC(fs, OP_CLOSE, lblevel, 0, 0); |
| 1429 | /* create jump and link it to the label */ |
| 1430 | luaK_patchlist(fs, luaK_jump(fs), lb->pc); |
| 1431 | } |
| 1432 | } |
| 1433 | |
| 1434 | |
| 1435 | /* |
no test coverage detected