MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / discharge2reg

Function discharge2reg

Source/Misc/lua/src/lua.c:4012–4048  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4010
4011
4012static void discharge2reg (FuncState *fs, expdesc *e, int reg) {
4013luaK_dischargevars(fs, e);
4014switch (e->k) {
4015case VNIL: {
4016luaK_nil(fs, reg, 1);
4017break;
4018}
4019case VFALSE: case VTRUE: {
4020luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0);
4021break;
4022}
4023case VK: {
4024luaK_codeABx(fs, OP_LOADK, reg, e->u.s.info);
4025break;
4026}
4027case VKNUM: {
4028luaK_codeABx(fs, OP_LOADK, reg, luaK_numberK(fs, e->u.nval));
4029break;
4030}
4031case VRELOCABLE: {
4032Instruction *pc = &getcode(fs, e);
4033SETARG_A(*pc, reg);
4034break;
4035}
4036case VNONRELOC: {
4037if (reg != e->u.s.info)
4038luaK_codeABC(fs, OP_MOVE, reg, e->u.s.info, 0);
4039break;
4040}
4041default: {
4042lua_assert(e->k == VVOID || e->k == VJMP);
4043return; /* nothing to do... */
4044}
4045}
4046e->u.s.info = reg;
4047e->k = VNONRELOC;
4048}
4049
4050
4051static void discharge2anyreg (FuncState *fs, expdesc *e) {

Callers 2

discharge2anyregFunction · 0.85
exp2regFunction · 0.85

Calls 5

luaK_dischargevarsFunction · 0.85
luaK_nilFunction · 0.85
luaK_codeABCFunction · 0.85
luaK_codeABxFunction · 0.85
luaK_numberKFunction · 0.85

Tested by

no test coverage detected