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

Function luaK_exp2K

third-party/lua-5.4.6/src/lcode.c:1000–1021  ·  view source on GitHub ↗

** Try to make 'e' a K expression with an index in the range of R/K ** indices. Return true iff succeeded. */

Source from the content-addressed store, hash-verified

998** indices. Return true iff succeeded.
999*/
1000static int luaK_exp2K (FuncState *fs, expdesc *e) {
1001 if (!hasjumps(e)) {
1002 int info;
1003 switch (e->k) { /* move constants to 'k' */
1004 case VTRUE: info = boolT(fs); break;
1005 case VFALSE: info = boolF(fs); break;
1006 case VNIL: info = nilK(fs); break;
1007 case VKINT: info = luaK_intK(fs, e->u.ival); break;
1008 case VKFLT: info = luaK_numberK(fs, e->u.nval); break;
1009 case VKSTR: info = stringK(fs, e->u.strval); break;
1010 case VK: info = e->u.info; break;
1011 default: return 0; /* not a constant */
1012 }
1013 if (info <= MAXINDEXRK) { /* does constant fit in 'argC'? */
1014 e->k = VK; /* make expression a 'K' expression */
1015 e->u.info = info;
1016 return 1;
1017 }
1018 }
1019 /* else, expression doesn't fit; leave it unchanged */
1020 return 0;
1021}
1022
1023
1024/*

Callers 3

exp2RKFunction · 0.70
codearithFunction · 0.70
codebitwiseFunction · 0.70

Calls 6

boolTFunction · 0.70
boolFFunction · 0.70
nilKFunction · 0.70
luaK_intKFunction · 0.70
luaK_numberKFunction · 0.70
stringKFunction · 0.70

Tested by

no test coverage detected