MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / closegoto

Function closegoto

src/Chain/libraries/glua/lparser.cpp:361–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359
360
361static void closegoto(LexState *ls, int g, Labeldesc *label) {
362 int i;
363 FuncState *fs = ls->fs;
364 Labellist *gl = &ls->dyd->gt;
365 Labeldesc *gt = &gl->arr[g];
366 lua_assert(eqstr(gt->name, label->name));
367 if (gt->nactvar < label->nactvar) {
368 TString *vname = getlocvar(fs, gt->nactvar)->varname;
369 const char *msg = luaO_pushfstring(ls->L,
370 "<goto %s> at line %d jumps into the scope of local '%s'",
371 getstr(gt->name), gt->line, getstr(vname));
372 semerror(ls, msg);
373 }
374 luaK_patchlist(fs, gt->pc, label->pc);
375 /* remove goto from pending list */
376 for (i = g; i < gl->n - 1; i++)
377 gl->arr[i] = gl->arr[i + 1];
378 gl->n--;
379}
380
381
382/*

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