MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / gotostat

Function gotostat

3rd/lua-5.4.3/src/lparser.c:1404–1420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1402
1403
1404static 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/*

Callers 1

statementFunction · 0.85

Calls 7

str_checknameFunction · 0.85
findlabelFunction · 0.85
newgotoentryFunction · 0.85
luaK_jumpFunction · 0.85
reglevelFunction · 0.85
luaY_nvarstackFunction · 0.85
luaK_patchlistFunction · 0.85

Tested by

no test coverage detected