Ejemplo n.º 1
0
 /// <summary>
 /// Equivalent to luaK_setoneret. </summary>
 internal void kSetoneret(Expdesc e)
 {
     if (e.kind() == Expdesc.VCALL)     // expression is an open function call?
     {
         e.nonreloc(Lua.ARGA(getcode(e)));
     }
     else if (e.kind() == Expdesc.VVARARG)
     {
         setargb(e, 2);
         e.Kind = Expdesc.VRELOCABLE;
     }
 }
Ejemplo n.º 2
0
        private void discharge2reg(Expdesc e, int reg)
        {
            kDischargevars(e);
            switch (e.k)
            {
            case Expdesc.VNIL:
                kNil(reg, 1);
                break;

            case Expdesc.VFALSE:
            case Expdesc.VTRUE:
                kCodeABC(Lua.OP_LOADBOOL, reg, (e.k == Expdesc.VTRUE ? 1 : 0), 0);
                break;

            case Expdesc.VK:
                kCodeABx(Lua.OP_LOADK, reg, e.info_Renamed);
                break;

            case Expdesc.VKNUM:
                kCodeABx(Lua.OP_LOADK, reg, kNumberK(e.nval_Renamed));
                break;

            case Expdesc.VRELOCABLE:
                setarga(e, reg);
                break;

            case Expdesc.VNONRELOC:
                if (reg != e.info_Renamed)
                {
                    kCodeABC(Lua.OP_MOVE, reg, e.info_Renamed, 0);
                }
                break;

            case Expdesc.VVOID:
            case Expdesc.VJMP:
                return;

            default:
                //# assert false
                break;
            }
            e.nonreloc(reg);
        }