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

Function luaK_exp2K

third-party/lua-5.5.0/src/lcode.c:1055–1076  ·  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

1053** indices. Return true iff succeeded.
1054*/
1055static int luaK_exp2K (FuncState *fs, expdesc *e) {
1056 if (!hasjumps(e)) {
1057 int info;
1058 switch (e->k) { /* move constants to 'k' */
1059 case VTRUE: info = boolT(fs); break;
1060 case VFALSE: info = boolF(fs); break;
1061 case VNIL: info = nilK(fs); break;
1062 case VKINT: info = luaK_intK(fs, e->u.ival); break;
1063 case VKFLT: info = luaK_numberK(fs, e->u.nval); break;
1064 case VKSTR: info = stringK(fs, e->u.strval); break;
1065 case VK: info = e->u.info; break;
1066 default: return 0; /* not a constant */
1067 }
1068 if (info <= MAXINDEXRK) { /* does constant fit in 'argC'? */
1069 e->k = VK; /* make expression a 'K' expression */
1070 e->u.info = info;
1071 return 1;
1072 }
1073 }
1074 /* else, expression doesn't fit; leave it unchanged */
1075 return 0;
1076}
1077
1078
1079/*

Callers 4

exp2RKFunction · 0.70
luaK_selfFunction · 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