MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / gotostat

Function gotostat

extlibs/lua/src/lparser.c:1397–1413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1395
1396
1397static 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/*

Callers 1

statementFunction · 0.85

Calls 7

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

Tested by

no test coverage detected