MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / repeatstat

Function repeatstat

lib/lua/src/lparser.c:1487–1509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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