MCPcopy Create free account
hub / github.com/Cubitect/cubiomes-viewer / gotostat

Function gotostat

lua/src/lparser.c:1415–1431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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