Ejemplo n.º 1
0
        /// <param name="thisScop">Remarque : thisScop must be executed befor passing to function</param>
        public static BasicObject call(Function fn, BasicObject ns, Expression[] Params)
        {
            if (fn == null)
            {
                return(ns);
            }
            int i = 0;

            foreach (var p in fn.@params)
            {
                if (i < Params.Length)
                {
                    var pp = Params[i++];
                    ns[p] = pp.Calc();
                    Dot h;
                }
                else
                {
                    break;
                }
            }
            VM.OpenScop(ns);
            var r = fn.body.Calc();

            if (IsReturn)
            {
                r = VM.StopReturn();
            }
            VM.CloseScop();
            return(r);
        }
Ejemplo n.º 2
0
        protected override BasicObject calc()
        {
            VM.SetScop(Scop);
            var @const = Value.Calc();

            VM.CloseScop(true);
            return(@const);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Revolutionel Code !!!!!!!!!!!!!!!!!!!!!!!!!
        /// </summary>
        /// <returns></returns>
        protected override BasicObject calc()
        {
            var cs = VM.CurrentScop;

            for (int i = 0; i <= exps.index; i++)
            {
                var d = exps.Get(i);
                if (d is BasicConst)
                {
                    var c = (BasicConst)d;
                    if (c.IsNumbre())
                    {
                        cs = cs[c.ToNumbre <int>().ToString()];
                    }
                    else if (c is Text)
                    {
                        cs = cs[((Text)c).Value];
                    }
                }
                if (d is get)
                {
                    var g = (get)d;
                    cs = cs[((get)d).Path.Name];
                }
                else if (d is set)
                {
                    var s = (set)d;
                    cs[s.Path.Name] = s.Value.Calc();
                }
                else if (d is Call)
                {
                    var c = ((Call)d);
                    cs = QsScript.Call.call(cs, c.Method.Name, c.Params);
                }
                else if (d is Bloc)
                {
                    VM.OpenScop(cs);
                    cs = d.Calc();
                    VM.CloseScop(true);
                }
                else if (d is Dot)
                {
                    cs = d.Calc();
                }
                else
                {
                    throw null;
                }
                if (VM.JumperCode > 0)
                {
                    return(cs);
                }
            }
            return(cs);
        }
Ejemplo n.º 4
0
 protected static void CloseScop() => VM.CloseScop();