MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / luaK_exp2RK

Function luaK_exp2RK

deps/lua/src/lcode.c:444–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442
443
444int luaK_exp2RK (FuncState *fs, expdesc *e) {
445 luaK_exp2val(fs, e);
446 switch (e->k) {
447 case VKNUM:
448 case VTRUE:
449 case VFALSE:
450 case VNIL: {
451 if (fs->nk <= MAXINDEXRK) { /* constant fit in RK operand? */
452 e->u.s.info = (e->k == VNIL) ? nilK(fs) :
453 (e->k == VKNUM) ? luaK_numberK(fs, e->u.nval) :
454 boolK(fs, (e->k == VTRUE));
455 e->k = VK;
456 return RKASK(e->u.s.info);
457 }
458 else break;
459 }
460 case VK: {
461 if (e->u.s.info <= MAXINDEXRK) /* constant fit in argC? */
462 return RKASK(e->u.s.info);
463 else break;
464 }
465 default: break;
466 }
467 /* not a constant in the right range: put it in a register */
468 return luaK_exp2anyreg(fs, e);
469}
470
471
472void 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
codearithFunction · 0.85
codecompFunction · 0.85
luaK_infixFunction · 0.85

Calls 5

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

Tested by

no test coverage detected