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

Function luaK_exp2RK

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

** Ensures final expression result is in a valid R/K index ** (that is, it is either in a register or in 'k' with an index ** in the range of R/K indices). ** Returns R/K index. */

Source from the content-addressed store, hash-verified

763** Returns R/K index.
764*/
765int luaK_exp2RK (FuncState *fs, expdesc *e) {
766 luaK_exp2val(fs, e);
767 switch (e->k) { /* move constants to 'k' */
768 case VTRUE: e->u.info = boolK(fs, 1); goto vk;
769 case VFALSE: e->u.info = boolK(fs, 0); goto vk;
770 case VNIL: e->u.info = nilK(fs); goto vk;
771 case VKINT: e->u.info = luaK_intK(fs, e->u.ival); goto vk;
772 case VKFLT: e->u.info = luaK_numberK(fs, e->u.nval); goto vk;
773 case VK:
774 vk:
775 e->k = VK;
776 if (e->u.info <= MAXINDEXRK) /* constant fits in 'argC'? */
777 return RKASK(e->u.info);
778 else break;
779 default: break;
780 }
781 /* not a constant in the right range: put it in a register */
782 return luaK_exp2anyreg(fs, e);
783}
784
785
786/*

Callers 7

recfieldFunction · 0.85
luaK_storevarFunction · 0.85
luaK_selfFunction · 0.85
luaK_indexedFunction · 0.85
codebinexpvalFunction · 0.85
codecompFunction · 0.85
luaK_infixFunction · 0.85

Calls 6

luaK_exp2valFunction · 0.85
boolKFunction · 0.85
nilKFunction · 0.85
luaK_intKFunction · 0.85
luaK_numberKFunction · 0.85
luaK_exp2anyregFunction · 0.85

Tested by

no test coverage detected