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

Function luaK_goiftrue

third-party/lua-5.5.0/src/lcode.c:1178–1199  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1176** Emit code to go through if 'e' is true, jump otherwise.
1177*/
1178void luaK_goiftrue (FuncState *fs, expdesc *e) {
1179 int pc; /* pc of new jump */
1180 luaK_dischargevars(fs, e);
1181 switch (e->k) {
1182 case VJMP: { /* condition? */
1183 negatecondition(fs, e); /* jump when it is false */
1184 pc = e->u.info; /* save jump position */
1185 break;
1186 }
1187 case VK: case VKFLT: case VKINT: case VKSTR: case VTRUE: {
1188 pc = NO_JUMP; /* always true; do nothing */
1189 break;
1190 }
1191 default: {
1192 pc = jumponcond(fs, e, 0); /* jump when false */
1193 break;
1194 }
1195 }
1196 luaK_concat(fs, &e->f, pc); /* insert new jump in false list */
1197 luaK_patchtohere(fs, e->t); /* true list jumps to here (to go through) */
1198 e->t = NO_JUMP;
1199}
1200
1201
1202/*

Callers 2

condFunction · 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

no test coverage detected