Exemple #1
0
 public override string ToString(Context cx)
 {
     if (A == B)
     {
         if (!ObjLuaFunction.DEBUG)
         {
             return("");
         }
         return("/// " + AssignA(cx, cx.ListSR(B, C, " .. ", "")));
     }
     return(AssignA(cx, cx.ListSR(B, C, " .. ", "")));
 }
Exemple #2
0
        public override string ToString(Context cx)
        {
            bool haslocal = false;

            for (ushort i = A; i <= B; i++)
            {
                if (cx.IsLocal(i))
                {
                    haslocal = true;
                    break;
                }
            }

            if (!ObjLuaFunction.DEBUG && !haslocal)
            {
                return("");
            }
            string pref = "";

            if (!haslocal)
            {
                pref = "// ";
            }
            return(pref + cx.ListSR(A, B, " = ") + Context.Nil.ToString());
        }
Exemple #3
0
 public void Run(Context cx)
 {
     //cx.SetReg(this.A, cx.R(this.B));
     for (int i = A; i <= A + C - 2; i++)
     {
         cx.SetReg((ushort)i, Context.Nil);
         cx.SetSReg((ushort)i, cx.SR(A) + "(" + cx.ListSR(A + 1, A + B - 1, "") + ")" /*+".Result["+i+"]"*/);
     }
 }
Exemple #4
0
        public override string ToString(Context cx)
        {
            string content  = cx.SR(A) + "(" + cx.ListSR(A + 1, A + B - 1, "") + ")";
            bool   haslocal = false;

            for (ushort i = A; i <= A + C - 2; i++)
            {
                if (!cx.IsLocal(i))
                {
                    cx.DefineLocal(i);                                     //this fails, if this Register is used otherwise later
                }
                if (cx.IsLocal(i))
                {
                    haslocal = true;
                }
            }

            if (A <= A + C - 2)
            {
                if (!haslocal)
                {
                    if (!ObjLuaFunction.DEBUG)
                    {
                        return("");
                    }
                    return("// " + ListR(A, A + C - 2, " = ", ", ... ,") + content);
                }
                else
                {
                    string ret = "";
                    for (ushort i = A; i <= A + C - 2; i++)
                    {
                        if (i > A)
                        {
                            ret += ",";
                        }
                        if (cx.IsLocal(i))
                        {
                            ret += cx.LocalName(i);
                        }
                        else
                        {
                            ret += R(i);
                        }
                    }

                    return(ret + " = " + content);
                }
            }

            return(content);
        }
Exemple #5
0
        public override string ToString(Context cx)
        {
            if (tfl == null)
            {
                return("");
            }

            string str = "for ";

            str += cx.ListSR(tfl.A + 2, tfl.A + 2 + tfl.C, "") + " in ";
            str += cx.SR(A) + " do ";


            return(str);
        }
Exemple #6
0
 public override string ToString(Context cx)
 {
     return("return " + cx.ListSR(A, A + B - 2, ""));
 }