MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaK_exp2K

Function luaK_exp2K

extlibs/lua/src/lcode.c:981–1002  ·  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

979** indices. Return true iff succeeded.
980*/
981static int luaK_exp2K (FuncState *fs, expdesc *e) {
982 if (!hasjumps(e)) {
983 int info;
984 switch (e->k) { /* move constants to 'k' */
985 case VTRUE: info = boolT(fs); break;
986 case VFALSE: info = boolF(fs); break;
987 case VNIL: info = nilK(fs); break;
988 case VKINT: info = luaK_intK(fs, e->u.ival); break;
989 case VKFLT: info = luaK_numberK(fs, e->u.nval); break;
990 case VKSTR: info = stringK(fs, e->u.strval); break;
991 case VK: info = e->u.info; break;
992 default: return 0; /* not a constant */
993 }
994 if (info <= MAXINDEXRK) { /* does constant fit in 'argC'? */
995 e->k = VK; /* make expression a 'K' expression */
996 e->u.info = info;
997 return 1;
998 }
999 }
1000 /* else, expression doesn't fit; leave it unchanged */
1001 return 0;
1002}
1003
1004
1005/*

Callers 2

luaK_exp2RKFunction · 0.85
codearithFunction · 0.85

Calls 6

boolTFunction · 0.85
boolFFunction · 0.85
nilKFunction · 0.85
luaK_intKFunction · 0.85
luaK_numberKFunction · 0.85
stringKFunction · 0.85

Tested by

no test coverage detected