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

Function repeatstat

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

Source from the content-addressed store, hash-verified

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

Callers 1

statementFunction · 0.85

Calls 11

luaK_getlabelFunction · 0.85
enterblockFunction · 0.85
luaX_nextFunction · 0.85
statlistFunction · 0.85
check_matchFunction · 0.85
condFunction · 0.85
leaveblockFunction · 0.85
luaK_jumpFunction · 0.85
luaK_patchtohereFunction · 0.85
reglevelFunction · 0.85
luaK_patchlistFunction · 0.85

Tested by

no test coverage detected