MCPcopy Create free account
hub / github.com/DFHack/dfhack / closegoto

Function closegoto

depends/lua/src/lparser.c:341–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339
340
341static void closegoto (LexState *ls, int g, Labeldesc *label) {
342 int i;
343 FuncState *fs = ls->fs;
344 Labellist *gl = &ls->dyd->gt;
345 Labeldesc *gt = &gl->arr[g];
346 lua_assert(eqstr(gt->name, label->name));
347 if (gt->nactvar < label->nactvar) {
348 TString *vname = getlocvar(fs, gt->nactvar)->varname;
349 const char *msg = luaO_pushfstring(ls->L,
350 "<goto %s> at line %d jumps into the scope of local '%s'",
351 getstr(gt->name), gt->line, getstr(vname));
352 semerror(ls, msg);
353 }
354 luaK_patchlist(fs, gt->pc, label->pc);
355 /* remove goto from pending list */
356 for (i = g; i < gl->n - 1; i++)
357 gl->arr[i] = gl->arr[i + 1];
358 gl->n--;
359}
360
361
362/*

Callers 2

findlabelFunction · 0.85
findgotosFunction · 0.85

Calls 4

getlocvarFunction · 0.85
luaO_pushfstringFunction · 0.85
semerrorFunction · 0.85
luaK_patchlistFunction · 0.85

Tested by

no test coverage detected