MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / luaK_goiffalse

Function luaK_goiffalse

3rd/lua-5.4.3/src/lcode.c:1142–1162  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1140** Emit code to go through if 'e' is false, jump otherwise.
1141*/
1142void luaK_goiffalse (FuncState *fs, expdesc *e) {
1143 int pc; /* pc of new jump */
1144 luaK_dischargevars(fs, e);
1145 switch (e->k) {
1146 case VJMP: {
1147 pc = e->u.info; /* already jump if true */
1148 break;
1149 }
1150 case VNIL: case VFALSE: {
1151 pc = NO_JUMP; /* always false; do nothing */
1152 break;
1153 }
1154 default: {
1155 pc = jumponcond(fs, e, 1); /* jump if true */
1156 break;
1157 }
1158 }
1159 luaK_concat(fs, &e->t, pc); /* insert new jump in 't' list */
1160 luaK_patchtohere(fs, e->f); /* false list jumps to here (to go through) */
1161 e->f = NO_JUMP;
1162}
1163
1164
1165/*

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