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

Function createlabel

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

** Create a new label with the given 'name' at the given 'line'. ** 'last' tells whether label is the last non-op statement in its ** block. Solves all pending goto's to this new label and adds ** a close instruction if necessary. ** Returns true iff it added a close instruction. */

Source from the content-addressed store, hash-verified

594** Returns true iff it added a close instruction.
595*/
596static int createlabel (LexState *ls, TString *name, int line,
597 int last) {
598 FuncState *fs = ls->fs;
599 Labellist *ll = &ls->dyd->label;
600 int l = newlabelentry(ls, ll, name, line, luaK_getlabel(fs));
601 if (last) { /* label is last no-op statement in the block? */
602 /* assume that locals are already out of scope */
603 ll->arr[l].nactvar = fs->bl->nactvar;
604 }
605 if (solvegotos(ls, &ll->arr[l])) { /* need close? */
606 luaK_codeABC(fs, OP_CLOSE, luaY_nvarstack(fs), 0, 0);
607 return 1;
608 }
609 return 0;
610}
611
612
613/*

Callers 2

leaveblockFunction · 0.85
labelstatFunction · 0.85

Calls 4

newlabelentryFunction · 0.85
luaK_getlabelFunction · 0.85
solvegotosFunction · 0.85
luaY_nvarstackFunction · 0.85

Tested by

no test coverage detected