MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / ifstat

Function ifstat

Source/Misc/lua/src/lua.c:8717–8738  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8715
8716
8717static void ifstat (LexState *ls, int line) {
8718/* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */
8719FuncState *fs = ls->fs;
8720int flist;
8721int escapelist = NO_JUMP;
8722flist = test_then_block(ls); /* IF cond THEN block */
8723while (ls->t.token == TK_ELSEIF) {
8724luaK_concat(fs, &escapelist, luaK_jump(fs));
8725luaK_patchtohere(fs, flist);
8726flist = test_then_block(ls); /* ELSEIF cond THEN block */
8727}
8728if (ls->t.token == TK_ELSE) {
8729luaK_concat(fs, &escapelist, luaK_jump(fs));
8730luaK_patchtohere(fs, flist);
8731luaX_next(ls); /* skip ELSE (after patch, for correct line info) */
8732block(ls); /* `else' part */
8733}
8734else
8735luaK_concat(fs, &escapelist, flist);
8736luaK_patchtohere(fs, escapelist);
8737check_match(ls, TK_END, TK_IF, line);
8738}
8739
8740
8741static 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.70

Tested by

no test coverage detected