MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaK_goiftrue

Function luaK_goiftrue

third-party/lua-5.4.6/src/lcode.c:1135–1156  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1133** Emit code to go through if 'e' is true, jump otherwise.
1134*/
1135void luaK_goiftrue (FuncState *fs, expdesc *e) {
1136 int pc; /* pc of new jump */
1137 luaK_dischargevars(fs, e);
1138 switch (e->k) {
1139 case VJMP: { /* condition? */
1140 negatecondition(fs, e); /* jump when it is false */
1141 pc = e->u.info; /* save jump position */
1142 break;
1143 }
1144 case VK: case VKFLT: case VKINT: case VKSTR: case VTRUE: {
1145 pc = NO_JUMP; /* always true; do nothing */
1146 break;
1147 }
1148 default: {
1149 pc = jumponcond(fs, e, 0); /* jump when false */
1150 break;
1151 }
1152 }
1153 luaK_concat(fs, &e->f, pc); /* insert new jump in false list */
1154 luaK_patchtohere(fs, e->t); /* true list jumps to here (to go through) */
1155 e->t = NO_JUMP;
1156}
1157
1158
1159/*

Callers 3

condFunction · 0.70
test_then_blockFunction · 0.70
luaK_infixFunction · 0.70

Calls 5

luaK_dischargevarsFunction · 0.70
negateconditionFunction · 0.70
jumponcondFunction · 0.70
luaK_concatFunction · 0.70
luaK_patchtohereFunction · 0.70

Tested by 1

test_then_blockFunction · 0.56