MCPcopy Create free account
hub / github.com/DFHack/dfhack / luaK_goiftrue

Function luaK_goiftrue

depends/lua/src/lcode.c:857–878  ·  view source on GitHub ↗

** Emit code to go through if 'e' is true, jump otherwise. */

Source from the content-addressed store, hash-verified

855** Emit code to go through if 'e' is true, jump otherwise.
856*/
857void luaK_goiftrue (FuncState *fs, expdesc *e) {
858 int pc; /* pc of new jump */
859 luaK_dischargevars(fs, e);
860 switch (e->k) {
861 case VJMP: { /* condition? */
862 negatecondition(fs, e); /* jump when it is false */
863 pc = e->u.info; /* save jump position */
864 break;
865 }
866 case VK: case VKFLT: case VKINT: case VTRUE: {
867 pc = NO_JUMP; /* always true; do nothing */
868 break;
869 }
870 default: {
871 pc = jumponcond(fs, e, 0); /* jump when false */
872 break;
873 }
874 }
875 luaK_concat(fs, &e->f, pc); /* insert new jump in false list */
876 luaK_patchtohere(fs, e->t); /* true list jumps to here (to go through) */
877 e->t = NO_JUMP;
878}
879
880
881/*

Callers 3

condFunction · 0.85
test_then_blockFunction · 0.85
luaK_infixFunction · 0.85

Calls 5

luaK_dischargevarsFunction · 0.85
negateconditionFunction · 0.85
jumponcondFunction · 0.85
luaK_concatFunction · 0.85
luaK_patchtohereFunction · 0.85

Tested by 1

test_then_blockFunction · 0.68