MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / luaK_goiffalse

Function luaK_goiffalse

xrepo/packages/l/lua/port/lua/src/lcode.c:1160–1180  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1158** Emit code to go through if 'e' is false, jump otherwise.
1159*/
1160void luaK_goiffalse (FuncState *fs, expdesc *e) {
1161 int pc; /* pc of new jump */
1162 luaK_dischargevars(fs, e);
1163 switch (e->k) {
1164 case VJMP: {
1165 pc = e->u.info; /* already jump if true */
1166 break;
1167 }
1168 case VNIL: case VFALSE: {
1169 pc = NO_JUMP; /* always false; do nothing */
1170 break;
1171 }
1172 default: {
1173 pc = jumponcond(fs, e, 1); /* jump if true */
1174 break;
1175 }
1176 }
1177 luaK_concat(fs, &e->t, pc); /* insert new jump in 't' list */
1178 luaK_patchtohere(fs, e->f); /* false list jumps to here (to go through) */
1179 e->f = NO_JUMP;
1180}
1181
1182
1183/*

Callers 2

test_then_blockFunction · 0.85
luaK_infixFunction · 0.85

Calls 4

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

Tested by 1

test_then_blockFunction · 0.68