MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / closegoto

Function closegoto

third-party/lua-5.2.4/src/lparser.c:340–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

findlabelFunction · 0.70
findgotosFunction · 0.70

Calls 5

luaS_eqstrFunction · 0.70
getlocvarFunction · 0.70
luaO_pushfstringFunction · 0.70
semerrorFunction · 0.70
luaK_patchlistFunction · 0.70

Tested by

no test coverage detected