MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / repeatstat

Function repeatstat

deps/lua/src/lparser.c:1010–1033  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1008
1009
1010static void repeatstat (LexState *ls, int line) {
1011 /* repeatstat -> REPEAT block UNTIL cond */
1012 int condexit;
1013 FuncState *fs = ls->fs;
1014 int repeat_init = luaK_getlabel(fs);
1015 BlockCnt bl1, bl2;
1016 enterblock(fs, &bl1, 1); /* loop block */
1017 enterblock(fs, &bl2, 0); /* scope block */
1018 luaX_next(ls); /* skip REPEAT */
1019 chunk(ls);
1020 check_match(ls, TK_UNTIL, TK_REPEAT, line);
1021 condexit = cond(ls); /* read condition (inside scope block) */
1022 if (!bl2.upval) { /* no upvalues? */
1023 leaveblock(fs); /* finish scope */
1024 luaK_patchlist(ls->fs, condexit, repeat_init); /* close the loop */
1025 }
1026 else { /* complete semantics when there are upvalues */
1027 breakstat(ls); /* if condition then break */
1028 luaK_patchtohere(ls->fs, condexit); /* else... */
1029 leaveblock(fs); /* finish scope... */
1030 luaK_patchlist(ls->fs, luaK_jump(fs), repeat_init); /* and repeat */
1031 }
1032 leaveblock(fs); /* finish loop */
1033}
1034
1035
1036static int exp1 (LexState *ls) {

Callers 1

statementFunction · 0.85

Calls 11

luaK_getlabelFunction · 0.85
enterblockFunction · 0.85
luaX_nextFunction · 0.85
chunkFunction · 0.85
check_matchFunction · 0.85
condFunction · 0.85
leaveblockFunction · 0.85
luaK_patchlistFunction · 0.85
breakstatFunction · 0.85
luaK_patchtohereFunction · 0.85
luaK_jumpFunction · 0.85

Tested by

no test coverage detected