MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / repeatstat

Function repeatstat

extlibs/lua/src/lparser.c:1468–1490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

statementFunction · 0.85

Calls 11

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

Tested by

no test coverage detected