MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / luaK_exp2RK

Function luaK_exp2RK

ThirdParty/lua/lua/lcode.c:555–588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

553
554
555int luaK_exp2RK (FuncState *fs, expdesc *e) {
556 luaK_exp2val(fs, e);
557 switch (e->k) {
558 case VTRUE:
559 case VFALSE:
560 case VNIL: {
561 if (fs->nk <= MAXINDEXRK) { /* constant fits in RK operand? */
562 e->u.info = (e->k == VNIL) ? nilK(fs) : boolK(fs, (e->k == VTRUE));
563 e->k = VK;
564 return RKASK(e->u.info);
565 }
566 else break;
567 }
568 case VKINT: {
569 e->u.info = luaK_intK(fs, e->u.ival);
570 e->k = VK;
571 goto vk;
572 }
573 case VKFLT: {
574 e->u.info = luaK_numberK(fs, e->u.nval);
575 e->k = VK;
576 /* go through */
577 }
578 case VK: {
579 vk:
580 if (e->u.info <= MAXINDEXRK) /* constant fits in 'argC'? */
581 return RKASK(e->u.info);
582 else break;
583 }
584 default: break;
585 }
586 /* not a constant in the right range: put it in a register */
587 return luaK_exp2anyreg(fs, e);
588}
589
590
591void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) {

Callers 7

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

Calls 6

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

Tested by

no test coverage detected