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

Function ifstat

deps/lua/src/lparser.c:1141–1162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1139
1140
1141static void ifstat (LexState *ls, int line) {
1142 /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */
1143 FuncState *fs = ls->fs;
1144 int flist;
1145 int escapelist = NO_JUMP;
1146 flist = test_then_block(ls); /* IF cond THEN block */
1147 while (ls->t.token == TK_ELSEIF) {
1148 luaK_concat(fs, &escapelist, luaK_jump(fs));
1149 luaK_patchtohere(fs, flist);
1150 flist = test_then_block(ls); /* ELSEIF cond THEN block */
1151 }
1152 if (ls->t.token == TK_ELSE) {
1153 luaK_concat(fs, &escapelist, luaK_jump(fs));
1154 luaK_patchtohere(fs, flist);
1155 luaX_next(ls); /* skip ELSE (after patch, for correct line info) */
1156 block(ls); /* `else' part */
1157 }
1158 else
1159 luaK_concat(fs, &escapelist, flist);
1160 luaK_patchtohere(fs, escapelist);
1161 check_match(ls, TK_END, TK_IF, line);
1162}
1163
1164
1165static 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