MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / ifstat

Function ifstat

lua/lparser.c:1201–1222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1199
1200
1201static void ifstat (LexState *ls, int line) {
1202 /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */
1203 FuncState *fs = ls->fs;
1204 int flist;
1205 int escapelist = NO_JUMP;
1206 flist = test_then_block(ls); /* IF cond THEN block */
1207 while (ls->t.token == TK_ELSEIF) {
1208 luaK_concat(fs, &escapelist, luaK_jump(fs));
1209 luaK_patchtohere(fs, flist);
1210 flist = test_then_block(ls); /* ELSEIF cond THEN block */
1211 }
1212 if (ls->t.token == TK_ELSE) {
1213 luaK_concat(fs, &escapelist, luaK_jump(fs));
1214 luaK_patchtohere(fs, flist);
1215 luaX_next(ls); /* skip ELSE (after patch, for correct line info) */
1216 block(ls); /* `else' part */
1217 }
1218 else
1219 luaK_concat(fs, &escapelist, flist);
1220 luaK_patchtohere(fs, escapelist);
1221 check_match(ls, TK_END, TK_IF, line);
1222}
1223
1224
1225static void localfunc (LexState *ls) {

Callers 1

statementFunction · 0.85

Calls 7

test_then_blockFunction · 0.85
luaK_concatFunction · 0.85
luaK_jumpFunction · 0.85
luaK_patchtohereFunction · 0.85
luaX_nextFunction · 0.85
blockFunction · 0.85
check_matchFunction · 0.85

Tested by

no test coverage detected