MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / gotostat

Function gotostat

lib/lua/src/lparser.c:1416–1432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1414
1415
1416static 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/*

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