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

Function repeatstat

third-party/lua-5.4.6/src/lparser.c:1486–1508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1484
1485
1486static void repeatstat (LexState *ls, int line) {
1487 /* repeatstat -> REPEAT block UNTIL cond */
1488 int condexit;
1489 FuncState *fs = ls->fs;
1490 int repeat_init = luaK_getlabel(fs);
1491 BlockCnt bl1, bl2;
1492 enterblock(fs, &bl1, 1); /* loop block */
1493 enterblock(fs, &bl2, 0); /* scope block */
1494 luaX_next(ls); /* skip REPEAT */
1495 statlist(ls);
1496 check_match(ls, TK_UNTIL, TK_REPEAT, line);
1497 condexit = cond(ls); /* read condition (inside scope block) */
1498 leaveblock(fs); /* finish scope */
1499 if (bl2.upval) { /* upvalues? */
1500 int exit = luaK_jump(fs); /* normal exit must jump over fix */
1501 luaK_patchtohere(fs, condexit); /* repetition must close upvalues */
1502 luaK_codeABC(fs, OP_CLOSE, reglevel(fs, bl2.nactvar), 0, 0);
1503 condexit = luaK_jump(fs); /* repeat after closing upvalues */
1504 luaK_patchtohere(fs, exit); /* normal exit comes to here */
1505 }
1506 luaK_patchlist(fs, condexit, repeat_init); /* close the loop */
1507 leaveblock(fs); /* finish loop */
1508}
1509
1510
1511/*

Callers 1

statementFunction · 0.70

Calls 12

luaK_getlabelFunction · 0.70
enterblockFunction · 0.70
luaX_nextFunction · 0.70
statlistFunction · 0.70
check_matchFunction · 0.70
condFunction · 0.70
leaveblockFunction · 0.70
luaK_jumpFunction · 0.70
luaK_patchtohereFunction · 0.70
reglevelFunction · 0.70
luaK_patchlistFunction · 0.70
luaK_codeABCFunction · 0.50

Tested by

no test coverage detected