MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / luaK_goiffalse

Function luaK_goiffalse

libraries/AP_Scripting/lua/src/lcode.c:891–911  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

889** Emit code to go through if 'e' is false, jump otherwise.
890*/
891void luaK_goiffalse (FuncState *fs, expdesc *e) {
892 int pc; /* pc of new jump */
893 luaK_dischargevars(fs, e);
894 switch (e->k) {
895 case VJMP: {
896 pc = e->u.info; /* already jump if true */
897 break;
898 }
899 case VNIL: case VFALSE: {
900 pc = NO_JUMP; /* always false; do nothing */
901 break;
902 }
903 default: {
904 pc = jumponcond(fs, e, 1); /* jump if true */
905 break;
906 }
907 }
908 luaK_concat(fs, &e->t, pc); /* insert new jump in 't' list */
909 luaK_patchtohere(fs, e->f); /* false list jumps to here (to go through) */
910 e->f = NO_JUMP;
911}
912
913
914/*

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