Exemplo n.º 1
0
        /// <summary>
        /// Equivalent to luaK_nil. </summary>
        internal void kNil(int from, int n)
        {
            int previous;

            if (pc > lasttarget) // no jumps to current position?
            {
                if (pc == 0)     // function start?
                {
                    return;      // positions are already clean
                }
                previous = pc - 1;
                int instr = f.code_Renamed[previous];
                if (Lua.OPCODE(instr) == Lua.OP_LOADNIL)
                {
                    int pfrom = Lua.ARGA(instr);
                    int pto   = Lua.ARGB(instr);
                    if (pfrom <= from && from <= pto + 1)     // can connect both?
                    {
                        if (from + n - 1 > pto)
                        {
                            f.code_Renamed[previous] = Lua.SETARG_B(instr, from + n - 1);
                        }
                        return;
                    }
                }
            }
            kCodeABC(Lua.OP_LOADNIL, from, from + n - 1, 0);
        }
Exemplo n.º 2
0
        private void invertjump(Expdesc e)
        {
            int at = getjumpcontrol(e.info_Renamed);

            int[] code  = f.code_Renamed;
            int   instr = code[at];

            //# assert testTMode(Lua.OPCODE(instr)) && Lua.OPCODE(instr) != Lua.OP_TESTSET && Lua.OPCODE(instr) != Lua.OP_TEST
            code[at] = Lua.SETARG_A(instr, (Lua.ARGA(instr) == 0 ? 1 : 0));
        }
Exemplo n.º 3
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;
     }
 }