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

Function luaK_exp2RK

third-party/lua-5.2.4/src/lcode.c:528–555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526
527
528int luaK_exp2RK (FuncState *fs, expdesc *e) {
529 luaK_exp2val(fs, e);
530 switch (e->k) {
531 case VTRUE:
532 case VFALSE:
533 case VNIL: {
534 if (fs->nk <= MAXINDEXRK) { /* constant fits in RK operand? */
535 e->u.info = (e->k == VNIL) ? nilK(fs) : boolK(fs, (e->k == VTRUE));
536 e->k = VK;
537 return RKASK(e->u.info);
538 }
539 else break;
540 }
541 case VKNUM: {
542 e->u.info = luaK_numberK(fs, e->u.nval);
543 e->k = VK;
544 /* go through */
545 }
546 case VK: {
547 if (e->u.info <= MAXINDEXRK) /* constant fits in argC? */
548 return RKASK(e->u.info);
549 else break;
550 }
551 default: break;
552 }
553 /* not a constant in the right range: put it in a register */
554 return luaK_exp2anyreg(fs, e);
555}
556
557
558void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) {

Callers 7

recfieldFunction · 0.70
luaK_storevarFunction · 0.70
luaK_selfFunction · 0.70
luaK_indexedFunction · 0.70
codearithFunction · 0.70
codecompFunction · 0.70
luaK_infixFunction · 0.70

Calls 5

luaK_exp2valFunction · 0.70
nilKFunction · 0.70
boolKFunction · 0.70
luaK_numberKFunction · 0.70
luaK_exp2anyregFunction · 0.70

Tested by

no test coverage detected