OutStack() public méthode

public OutStack ( CLS_Content expr ) : void
expr CLS_Content
Résultat void
Exemple #1
0
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            var parent = listParam[0].ComputeValue(content);

            if (parent == null)
            {
                throw new Exception("调用空对象的方法:" + listParam[0].ToString() + ":" + ToString());
            }
            ICLS_TypeFunction typefunction = content.environment.GetType(parent.type).function;

            if (parent.type is object)
            {
                SInstance s = parent.value as SInstance;
                if (s != null)
                {
                    typefunction = s.type;
                }
            }
            //var type = content.environment.GetType(parent.type);
            var value = typefunction.MemberValueGet(content, parent.value, membername);

            content.OutStack(this);
            return(value);
            //做数学计算
            //从上下文取值
            //_value = null;
            //return null;
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            List <object> list  = new List <object>();
            int           count = listParam[0] == null ? (listParam.Count - 1) : (int)listParam[0].ComputeValue(content).value;

            if (count == 0)
            {
                throw new Exception("不能创建0长度数组");
            }
            CLS_Content.Value vcount = new CLS_Content.Value();
            vcount.type  = typeof(int);
            vcount.value = count;
            for (int i = 1; i < listParam.Count; i++)
            {
                //if (listParam[i] != null)
                {
                    list.Add(listParam[i].ComputeValue(content).value);
                }
            }
            List <CLS_Content.Value> p = new List <CLS_Content.Value>();

            p.Add(vcount);
            var outvalue = type.function.New(content, p);

            for (int i = 0; i < list.Count; i++)
            {
                type.function.IndexSet(content, outvalue.value, i, list[i]);
            }
            content.OutStack(this);
            return(outvalue);
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            var parent = listParam[0].ComputeValue(content);
            if (parent == null)
            {
                throw new Exception("调用空对象的方法:" + listParam[0].ToString() + ":" + ToString());
            }
            var key = listParam[1].ComputeValue(content);
            var type = content.environment.GetType(parent.type);

            var value = type.function.IndexGet(content, parent.value, key.value);
            content.OutStack(this);

            //IndexGet返回的值类型是 System.Object.
            //在这里需要将类型明确化.
            //value.type = value.value.GetType();

            return value;
            //return type.function.MemberValueGet(content.environment, parent.value, membername);
            //做数学计算
            //从上下文取值
            //_value = null;
            //return null;
        }
Exemple #4
0
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            CLS_Content.Value result = new CLS_Content.Value();
            result.type = typeof(bool);

            bool bleft = (bool)listParam[0].ComputeValue(content).value;

            if (mathop == '&')
            {
                if (!bleft)
                {
                    result.value = false;
                }
                else
                {
                    result.value = bleft && (bool)listParam[1].ComputeValue(content).value;
                }
            }
            else if (mathop == '|')
            {
                if (bleft)
                {
                    result.value = true;
                }
                else
                {
                    result.value = bleft || (bool)listParam[1].ComputeValue(content).value;
                }
            }

            content.OutStack(this);
            return(result);
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            var parent = listParam[0].ComputeValue(content);
            if (parent == null)
            {
                throw new Exception("调用空对象的方法:" + listParam[0].ToString() + ":" + ToString());
            }
            var type = content.environment.GetType(parent.type);
            //string membername=null;


            var getvalue = type.function.MemberValueGet(content, parent.value, membername);

            CLS_Content.Value vright = CLS_Content.Value.One;
            if (listParam.Count > 1)
            {
                vright = listParam[1].ComputeValue(content);
            }
            CLS_Content.Value vout =new CLS_Content.Value();
            var mtype = content.environment.GetType(getvalue.type);
            vout.value = mtype.Math2Value(content, mathop, getvalue.value, vright, out vout.type);

            type.function.MemberValueSet(content, parent.value, membername, vout.value);
            //CLS_Content.Value v = new CLS_Content.Value();

            content.OutStack(this);
            return vout;
            //做数学计算
            //从上下文取值
            //_value = null;
            //return null;

        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);

            if (_listParam != null && _listParam.Count > 0)
            {
                CLS_Content.Value v   = _listParam[0].ComputeValue(content);
                object            val = v.value;
                if ((Type)value_type == typeof(CLS_Type_Var.var))
                {
                    if (v.type != null)
                    {
                        value_type = v.type;
                    }
                }
                else if (v.type != value_type)
                {
                    val = content.environment.GetType(v.type).ConvertTo(content, v.value, value_type);
                }

                content.DefineAndSet(value_name, value_type, val);
            }
            else
            {
                content.Define(value_name, value_type);
            }
            //设置环境变量为
            content.OutStack(this);

            return(null);
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            var parent = listParam[0].ComputeValue(content);
            var type   = content.environment.GetType(parent.type);
            //string membername=null;


            var getvalue = type.function.MemberValueGet(content, parent.value, membername);

            CLS_Content.Value vright = CLS_Content.Value.One;
            if (listParam.Count > 1)
            {
                vright = listParam[1].ComputeValue(content);
            }
            CLS_Content.Value vout = new CLS_Content.Value();
            var mtype = content.environment.GetType(getvalue.type);

            vout.value = mtype.Math2Value(content, mathop, getvalue.value, vright, out vout.type);

            type.function.MemberValueSet(content, parent.value, membername, vout.value);
            CLS_Content.Value v = new CLS_Content.Value();

            content.OutStack(this);
            return(vout);
            //做数学计算
            //从上下文取值
            //_value = null;
            //return null;
        }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     var parent = listParam[0].ComputeValue(content);
     var value = listParam[1].ComputeValue(content);
     object setv=value.value;
     //if(value.type!=parent.type)
     //{
     //    var vtype = content.environment.GetType(value.type);
     //    setv = vtype.ConvertTo(content.environment, setv, parent.type);
     //}
     var typefunction = content.environment.GetType(parent.type).function;
     if(parent.type is object)
     {
         SInstance s = parent.value as SInstance;
         if(s!=null)
         {
             typefunction = s.type;
         }
     }
     typefunction.MemberValueSet(content, parent.value, membername, setv);
     //做数学计算
     //从上下文取值
     //_value = null;
     content.OutStack(this);
     return null;
 }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            content.DepthAdd();

            CLS_Content.Value vrt = null;

            ICLS_Expression expr_while = listParam[1];
            ICLS_Expression expr_block = listParam[0];

            do
            {
                if (expr_block != null)
                {
                    CLS_Content.Value v = expr_block.ComputeValue(content);
                    if (v != null)
                    {
                        if (v.breakBlock > 2)
                            vrt = v;
                        if (v.breakBlock > 1)
                            break;
                    }
                }
            } while ((bool)expr_while.ComputeValue(content).value);

            content.DepthRemove();
            content.OutStack(this);
            return vrt;
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            var parent = listParam[0].ComputeValue(content);

            if (parent == null)
            {
                throw new Exception("调用空对象的方法:" + listParam[0].ToString() + ":" + ToString());
            }
            var    value = listParam[1].ComputeValue(content);
            object setv  = value.value;
            //if(value.type!=parent.type)
            //{
            //    var vtype = content.environment.GetType(value.type);
            //    setv = vtype.ConvertTo(content.environment, setv, parent.type);
            //}
            var typefunction = content.environment.GetType(parent.type).function;

            if (parent.type is object)
            {
                SInstance s = parent.value as SInstance;
                if (s != null)
                {
                    typefunction = s.type;
                }
            }
            typefunction.MemberValueSet(content, parent.value, membername, setv);
            //做数学计算
            //从上下文取值
            //_value = null;
            content.OutStack(this);
            return(null);
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);

            {
                
                CLS_Content.Value v = listParam[0].ComputeValue(content);

                        {
                            object val = v.value;
                            if (content.values.ContainsKey(value_name))
                            {
                                CLType value_type = content.values[value_name].type;

                                val = v.value;
                                if ((Type)value_type != typeof(CLS_Type_Var.var) && value_type != v.type)
                                {
                                    val = content.environment.GetType(v.type).ConvertTo(content, v.value, value_type);
                                }
                            }
                    content.Set(value_name, val);
                    }
            }
            content.OutStack(this);
            return null;
        }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     //var parent = listParam[0].ComputeValue(content);
     //var type = content.environment.GetType(parent.type);
     List<CLS_Content.Value> _params = new List<CLS_Content.Value>();
     for (int i = 0; i < listParam.Count; i++)
     {
         _params.Add(listParam[i].ComputeValue(content));
     }
     CLS_Content.Value value = null;
     if (cache == null || cache.cachefail)
     {
         cache = new MethodCache();
         value = type.function.StaticCall(content, functionName, _params, cache);
     }
     else
     {
         value = type.function.StaticCallCache(content, _params, cache);
     }
     
     content.OutStack(this);
     return value;
     //做数学计算
     //从上下文取值
     //_value = null;
     //return null;
 }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     var parent = listParam[0].ComputeValue(content);
     var typefunction = content.environment.GetType(parent.type).function;
     if(parent.type is object)
     {
         SInstance s = parent.value as SInstance;
         if(s!=null)
         {
             typefunction = s.type;
         }
     }
     List<CLS_Content.Value> _params = new List<CLS_Content.Value>();
     for (int i = 1; i < listParam.Count; i++)
     {
         _params.Add(listParam[i].ComputeValue(content));
     }
     CLS_Content.Value value = null;
     if (cache == null||cache.cachefail)
     {
         cache = new MethodCache();
         value = typefunction.MemberCall(content, parent.value, functionName, _params,cache);
     }
     else
     {
         value = typefunction.MemberCallCache(content, parent.value, _params, cache);
     }
     content.OutStack(this);
     return value;
     //做数学计算
     //从上下文取值
     //_value = null;
     //return null;
 }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            var parent = listParam[0].ComputeValue(content);

            if (parent == null)
            {
                throw new Exception("调用空对象的方法:" + listParam[0].ToString() + ":" + ToString());
            }
            var key  = listParam[1].ComputeValue(content);
            var type = content.environment.GetType(parent.type);

            var value = type.function.IndexGet(content, parent.value, key.value);

            content.OutStack(this);

            //IndexGet返回的值类型是 System.Object.
            //在这里需要将类型明确化.
            //value.type = value.value.GetType();

            return(value);
            //return type.function.MemberValueGet(content.environment, parent.value, membername);
            //做数学计算
            //从上下文取值
            //_value = null;
            //return null;
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            List<object> list = new List<object>();
            int count = listParam[0] == null ? (listParam.Count - 1) : (int)listParam[0].ComputeValue(content).value;
            if (count == 0)
                throw new Exception("不能创建0长度数组");
            CLS_Content.Value vcount = new CLS_Content.Value();
            vcount.type = typeof(int);
            vcount.value = count;
            for (int i = 1; i < listParam.Count; i++)
            {
                //if (listParam[i] != null)
                {
                    list.Add(listParam[i].ComputeValue(content).value);
                }
            }
            List<CLS_Content.Value> p = new List<CLS_Content.Value>();
            p.Add(vcount);
            var outvalue = type.function.New(content, p);
            for (int i = 0; i < list.Count; i++)
            {
                type.function.IndexSet(content, outvalue.value, i, list[i]);
            }
            content.OutStack(this);
            return outvalue;

        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            CLS_Content.Value rv = new CLS_Content.Value();


            {
                var v = listParam[0].ComputeValue(content);
                {
                    rv.type = v.type;
                    rv.value = v.value;
                }
                Exception err = v.value as Exception;
                if (err != null)
                {
                    throw err;
                }
                else
                {
                    throw new Exception(v.ToString());
                }
            }

            content.OutStack(this);
            return rv;

            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            //var parent = listParam[0].ComputeValue(content);
            //var type = content.environment.GetType(parent.type);
            List <CLS_Content.Value> _params = new List <CLS_Content.Value>();

            for (int i = 0; i < listParam.Count; i++)
            {
                _params.Add(listParam[i].ComputeValue(content));
            }
            CLS_Content.Value value = null;
            if (cache == null || cache.cachefail)
            {
                cache = new MethodCache();
                value = type.function.StaticCall(content, functionName, _params, cache);
            }
            else
            {
                value = type.function.StaticCallCache(content, _params, cache);
            }

            content.OutStack(this);
            return(value);
            //做数学计算
            //从上下文取值
            //_value = null;
            //return null;
        }
Exemple #18
0
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            var parent = listParam[0].ComputeValue(content);

            if (parent == null)
            {
                throw new Exception("调用空对象的方法:" + listParam[0].ToString() + ":" + ToString());
            }
            var key   = listParam[1].ComputeValue(content);
            var value = listParam[2].ComputeValue(content);
            //object setv=value.value;
            //if(value.type!=parent.type)
            //{
            //    var vtype = content.environment.GetType(value.type);
            //    setv = vtype.ConvertTo(content.environment, setv, parent.type);
            //}
            var type = content.environment.GetType(parent.type);

            type.function.IndexSet(content, parent.value, key.value, value.value);
            //做数学计算
            //从上下文取值
            //_value = null;
            content.OutStack(this);
            return(null);
        }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     CLS_Content.Value value = type.function.StaticValueGet(content, staticmembername);
     content.OutStack(this);
     return(value);
 }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            CLS_Content.Value rv = new CLS_Content.Value();
            rv.breakBlock = 10;
            if (listParam.Count > 0&&listParam[0]!=null)
            {
                var v = listParam[0].ComputeValue(content);
                {
                    rv.type = v.type;
                    rv.value = v.value;
                }
            }
            else
            {
                rv.type = typeof(void);
            }
            content.OutStack(this);
            return rv;

            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            CLS_Content.Value rv = new CLS_Content.Value();


            {
                var v = listParam[0].ComputeValue(content);
                {
                    rv.type  = v.type;
                    rv.value = v.value;
                }
                Exception err = v.value as Exception;
                if (err != null)
                {
                    throw err;
                }
                else
                {
                    throw new Exception(v.ToString());
                }
            }

            content.OutStack(this);
            return(rv);

            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
        }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     CLS_Content.Value value = type.function.StaticValueGet(content, staticmembername);
     content.OutStack(this);
     return value;
 }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);

            {
                CLS_Content.Value v = listParam[0].ComputeValue(content);

                {
                    object val = v.value;
                    if (content.values.ContainsKey(value_name))
                    {
                        CLType value_type = content.values[value_name].type;

                        val = v.value;
                        if ((Type)value_type != typeof(CLS_Type_Var.var) && value_type != v.type)
                        {
                            val = content.environment.GetType(v.type).ConvertTo(content, v.value, value_type);
                        }
                    }
                    content.Set(value_name, val);
                }
            }
            content.OutStack(this);
            return(null);
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);

            if (_listParam != null && _listParam.Count > 0)
            {

                CLS_Content.Value v = _listParam[0].ComputeValue(content);
                object val = v.value;
                if ((Type)value_type == typeof(CLS_Type_Var.var))
                {
                    if(v.type!=null)
                        value_type = v.type;
                    
                }
                else if (v.type != value_type)
                {
                    val = content.environment.GetType(v.type).ConvertTo(content, v.value, value_type);
                   
                }

                content.DefineAndSet(value_name, value_type, val);
            }
            else
            {
                content.Define(value_name, value_type);
            }
            //设置环境变量为
            content.OutStack(this);

            return null;
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            CLS_Content.Value result = new CLS_Content.Value();

            //if (mathop == "&&" || mathop == "||")
            {
                bool bleft  = false;
                bool bright = false;
                if (listParam[0] is ICLS_Value)
                {
                    bleft = (bool)((listParam[0] as ICLS_Value).value);
                }
                else
                {
                    bleft = (bool)listParam[0].ComputeValue(content).value;
                }
                result.type = typeof(bool);
                if (mathop == '&')
                {
                    if (!bleft)
                    {
                        result.value = false;
                    }
                    else
                    {
                        if (listParam[1] is ICLS_Value)
                        {
                            bright = (bool)((listParam[1] as ICLS_Value).value);
                        }
                        else
                        {
                            bright = (bool)listParam[1].ComputeValue(content).value;
                        }
                        result.value = (bool)(bleft && bright);
                    }
                }
                else if (mathop == '|')
                {
                    if (bleft)
                    {
                        result.value = true;
                    }
                    else
                    {
                        if (listParam[1] is ICLS_Value)
                        {
                            bright = (bool)((listParam[1] as ICLS_Value).value);
                        }
                        else
                        {
                            bright = (bool)listParam[1].ComputeValue(content).value;
                        }
                        result.value = (bool)(bleft || bright);
                    }
                }
            }
            content.OutStack(this);
            return(result);
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            var parent = listParam[0].ComputeValue(content);
            if (parent == null)
            {
                throw new Exception("调用空对象的方法:" + listParam[0].ToString() + ":" + ToString());
            }
            ICLS_TypeFunction typefunction = content.environment.GetType(parent.type).function;
            if(parent.type is object)
            {
                SInstance s =parent.value as SInstance;
                if(s!=null)
                {
                    typefunction = s.type;
                }
            }
            //var type = content.environment.GetType(parent.type);
            var value=typefunction.MemberValueGet(content, parent.value, membername);
            content.OutStack(this);
            return value;
            //做数学计算
            //从上下文取值
            //_value = null;
            //return null;

        }
Exemple #27
0
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            CLS_Content.Value result = null;


            {
                result = new CLS_Content.Value();
                var value = listParam[0].ComputeValue(content);
                if ((Type)value.type != typeof(bool))
                {
                    throw new Exception("三元表达式要求条件为bool型");
                }
                bool bv = (bool)value.value;
                if (bv)
                {
                    result = listParam[1].ComputeValue(content);
                }
                else
                {
                    result = listParam[2].ComputeValue(content);
                }
            }
            content.OutStack(this);
            return(result);
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);


            var       left  = listParam[0].ComputeValue(content);
            var       right = listParam[1].ComputeValue(content);
            ICLS_Type type  = content.environment.GetType(left.type);

            //if (mathop == "+=")

            {
                CLType returntype;
                object value = type.Math2Value(content, mathop, left.value, right, out returntype);
                value      = type.ConvertTo(content, value, left.type);
                left.value = value;

                //content.Set(value_name, value);
            }

            //操作变量之
            //做数学计算
            //从上下文取值
            //_value = null;
            content.OutStack(this);

            return(null);
        }
Exemple #29
0
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            CLS_Content.Value rv = new CLS_Content.Value();
            rv.breakBlock = 10;
            if (listParam.Count > 0 && listParam[0] != null)
            {
                var v = listParam[0].ComputeValue(content);
                {
                    rv.type  = v.type;
                    rv.value = v.value;
                }
            }
            else
            {
                rv.type = typeof(void);
            }
            content.OutStack(this);
            return(rv);

            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);


            var left = listParam[0].ComputeValue(content);
            var right = listParam[1].ComputeValue(content);
            ICLS_Type type = content.environment.GetType(left.type);
            //if (mathop == "+=")

            {
                CLType returntype;
                object value = type.Math2Value(content, mathop, left.value, right, out returntype);
                value = type.ConvertTo(content, value, left.type);
                left.value = value;

                //content.Set(value_name, value);
            }

            //操作变量之
            //做数学计算
            //从上下文取值
            //_value = null;
            content.OutStack(this);

            return null;
        }
Exemple #31
0
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            content.DepthAdd();

            CLS_Content.Value vrt = null;

            ICLS_Expression expr_while = listParam[0];
            ICLS_Expression expr_block = listParam[1];

            while ((bool)expr_while.ComputeValue(content).value)
            {
                if (expr_block != null)
                {
                    CLS_Content.Value v = expr_block.ComputeValue(content);
                    if (v != null)
                    {
                        if (v.breakBlock > 2)
                        {
                            vrt = v;
                        }
                        if (v.breakBlock > 1)
                        {
                            break;
                        }
                    }
                }
            }
            content.DepthRemove();
            content.OutStack(this);
            return(vrt);
        }
Exemple #32
0
        public CLS_Content.Value StaticCall(CLS_Content contentParent, string function, IList <CLS_Content.Value> _params)
        {
            NewStatic(contentParent.environment);
            if (this.functions.ContainsKey(function))
            {
                if (this.functions[function].bStatic == true)
                {
                    CLS_Content content = new CLS_Content(contentParent.environment, true);

                    contentParent.InStack(content);//把这个上下文推给上层的上下文,这样如果崩溃是可以一层层找到原因的
                    content.CallType = this;
                    content.CallThis = null;
                    content.function = function;
                    // int i = 0;
                    for (int i = 0; i < functions[function]._paramtypes.Count; i++)
                    //foreach (var p in this.functions[function]._params)
                    {
                        content.DefineAndSet(functions[function]._paramnames[i], functions[function]._paramtypes[i].type, _params[i].value);
                        //i++;
                    }
                    //var value = this.functions[function].expr_runtime.ComputeValue(content);
                    CLS_Content.Value value = null;
                    if (this.functions[function].expr_runtime != null)
                    {
                        value = this.functions[function].expr_runtime.ComputeValue(content);
                    }
                    else
                    {
                    }
                    contentParent.OutStack(content);
                    return(value);
                }
            }
            else if (this.members.ContainsKey(function))
            {
                if (this.members[function].bStatic == true)
                {
                    Delegate dele = this.staticMemberInstance[function].value as Delegate;
                    if (dele != null)
                    {
                        CLS_Content.Value value = new CLS_Content.Value();
                        value.type = null;
                        object[] objs = new object[_params.Count];
                        for (int i = 0; i < _params.Count; i++)
                        {
                            objs[i] = _params[i].value;
                        }
                        value.value = dele.DynamicInvoke(objs);
                        if (value.value != null)
                        {
                            value.type = value.value.GetType();
                        }

                        return(value);
                    }
                }
            }
            throw new NotImplementedException();
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            BetterList <CLS_Content.Value> _params = CLS_Content.NewParamList();

            for (int i = 0, count = listParam.Count; i < count; i++)
            {
                _params.Add(listParam[i].ComputeValue(content));
            }

            CLS_Content.Value retVal;
            SType.Function    fun;

            if (content.CallType != null && content.CallType.functions.TryGetValue(funcname, out fun))
            {
                if (fun.bStatic)
                {
                    retVal = content.CallType.StaticCall(content, funcname, _params);
                }
                else
                {
                    retVal = content.CallType.MemberCall(content, content.CallThis, funcname, _params);
                }
            }
            else
            {
                retVal = content.Get(funcname);
                Delegate sysDele = retVal.value as Delegate;
                if (sysDele != null)
                {
                    object[] args = CLS_Content.ParamObjsArray[_params.size];
                    for (int i = 0; i < _params.size; i++)
                    {
                        args[i] = _params[i].value;
                    }
                    retVal       = new CLS_Content.Value();
                    retVal.value = sysDele.DynamicInvoke(args);
                    if (retVal.value != null)
                    {
                        retVal.type = retVal.value.GetType();
                    }
                }
                else
                {
                    DeleFunction csleDele = retVal.value as DeleFunction;
                    if (csleDele.callthis != null)
                    {
                        retVal = csleDele.calltype.MemberCall(content, csleDele.callthis, csleDele.function, _params);
                    }
                    else
                    {
                        retVal = csleDele.calltype.StaticCall(content, csleDele.function, _params);
                    }
                }
            }
            CLS_Content.PoolParamList(_params);
            content.OutStack(this);
            return(retVal);
        }
Exemple #34
0
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     CLS_Content.Value value = listParam[0].ComputeValue(content);
     type.function.StaticValueSet(content, staticmembername, value.value);
     content.OutStack(this);
     return(null);
 }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     CLS_Content.Value value = listParam[0].ComputeValue(content);
     type.function.StaticValueSet(content, staticmembername, value.value);
     content.OutStack(this);
     return null;
 }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);


            var       left  = listParam[0].ComputeValue(content);
            var       right = listParam[1].ComputeValue(content);
            ICLS_Type type  = content.environment.GetType(left.type);

            //if (mathop == "+=")

            {
                CLType returntype;
                object value = type.Math2Value(content, mathop, left.value, right, out returntype);
                value      = type.ConvertTo(content, value, left.type);
                left.value = value;

                Type t = right.type;
                //if(t.IsSubclassOf(typeof(MulticastDelegate))||t.IsSubclassOf(typeof(Delegate)))
                //{

                //}
                ////content.Set(value_name, value);
                //else if (t == typeof(CSLE.DeleLambda) || t == typeof(CSLE.DeleFunction) || t == typeof(CSLE.DeleEvent))
                //{

                //}
                //else
                {
                    if (listParam[0] is CLS_Expression_MemberFind)
                    {
                        CLS_Expression_MemberFind f = listParam[0] as CLS_Expression_MemberFind;

                        var parent = f.listParam[0].ComputeValue(content);
                        if (parent == null)
                        {
                            throw new Exception("调用空对象的方法:" + f.listParam[0].ToString() + ":" + ToString());
                        }
                        var ptype = content.environment.GetType(parent.type);
                        ptype.function.MemberValueSet(content, parent.value, f.membername, value);
                    }
                    if (listParam[0] is CLS_Expression_StaticFind)
                    {
                        CLS_Expression_StaticFind f = listParam[0] as CLS_Expression_StaticFind;
                        f.type.function.StaticValueSet(content, f.staticmembername, value);
                    }
                }
            }


            //操作变量之
            //做数学计算
            //从上下文取值
            //_value = null;
            content.OutStack(this);

            return(null);
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            content.DepthAdd();
            ICLS_Expression expr_while = listParam[1] as ICLS_Expression;
            ICLS_Expression expr_block = listParam[0] as ICLS_Expression;

            CLS_Content.Value vrt = null;
            do
            {
                if (expr_block != null)
                {
                    if (expr_block is CLS_Expression_Block)
                    {
                        var v = expr_block.ComputeValue(content);
                        if (v != null)
                        {
                            if (v.breakBlock > 2)
                            {
                                vrt = v;
                            }
                            if (v.breakBlock > 1)
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        content.DepthAdd();
                        var v = expr_block.ComputeValue(content);
                        if (v != null)
                        {
                            if (v.breakBlock > 2)
                            {
                                vrt = v;
                            }
                            if (v.breakBlock > 1)
                            {
                                break;
                            }
                        }
                        content.DepthRemove();
                    }
                    //if (v.breakBlock == 1) continue;
                    //if (v.breakBlock == 2) break;
                    //if (v.breakBlock == 10) return v;
                }
            } while ((bool)expr_while.ComputeValue(content).value);
            content.DepthRemove();
            content.OutStack(this);
            return(vrt);
            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
        }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     CLS_Content.Value v = new CLS_Content.Value();
     v.type  = this.type;
     v.value = this.value_value;
     content.OutStack(this);
     return(v);
 }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     CLS_Content.Value rv = new CLS_Content.Value();
     rv.breakBlock = 2;
     //跳出逻辑
     content.OutStack(this);
     return(rv);
 }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     CLS_Content.Value rv = new CLS_Content.Value();
     rv.breakBlock = 2;
     //跳出逻辑
     content.OutStack(this);
     return rv;
 }
Exemple #41
0
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     CLS_Content.Value parent = listParam[0].ComputeValue(content);
     CLS_Content.Value value  = listParam[1].ComputeValue(content);
     content.environment.GetType(parent.type).function.MemberValueSet(content, parent.value, membername, value.value, parent.breakBlock == 255);
     content.OutStack(this);
     return(null);
 }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     CLS_Content.Value parent = listParam[0].ComputeValue(content);
     ICLS_Type type = content.environment.GetType(parent.type);
     CLS_Content.Value value = type.function.MemberValueGet(content, parent.value, membername, parent.breakBlock == 255);
     content.OutStack(this);
     return value;
 }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     if (_listParam != null && _listParam.Count > 0)
         content.DefineAndSet(value_name, value_type, _listParam[0].ComputeValue(content).value);
     else
         content.Define(value_name, value_type);
     content.OutStack(this);
     return null;
 }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     CLS_Content.Value left = listParam[0].ComputeValue(content);
     CLS_Content.Value right = listParam[1].ComputeValue(content);
     CLS_Content.Value result = new CLS_Content.Value();
     result.value = content.environment.GetType(left.type).Math2Value(content, mathop, left.value, right, out result.type);
     content.OutStack(this);
     return result;
 }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            var value=content.Get(value_name);
            content.OutStack(this);

            //从上下文取值

            return value;
        }
Exemple #46
0
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     CLS_Content.Value left   = listParam[0].ComputeValue(content);
     CLS_Content.Value right  = listParam[1].ComputeValue(content);
     CLS_Content.Value result = new CLS_Content.Value();
     result.value = content.environment.GetType(left.type).Math2Value(content, mathop, left.value, right, out result.type);
     content.OutStack(this);
     return(result);
 }
Exemple #47
0
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            content.DepthAdd();
            CLS_Expression_Define define = listParam[0] as CLS_Expression_Define;

            if (define == null)
            {
            }
            define.ComputeValue(content);

            System.Collections.IEnumerable emu = listParam[1].ComputeValue(content).value as System.Collections.IEnumerable;

            ICLS_Expression expr_block = listParam[2] as ICLS_Expression;

            var it = emu.GetEnumerator();

            while (it.MoveNext())
            {
                content.Set(define.value_name, it.Current);

                if (expr_block != null)
                {
                    var v = expr_block.ComputeValue(content);
                    if (v != null && v.breakBlock > 1)
                    {
                        break;
                    }
                    ;
                }
            }
            //ICLS_Expression expr_continue = listParam[1] as ICLS_Expression;
            //ICLS_Expression expr_step = listParam[2] as ICLS_Expression;

            //ICLS_Expression expr_block = listParam[3] as ICLS_Expression;

            //for (;(bool)expr_continue.ComputeValue(content).value; expr_step.ComputeValue(content))
            //{
            //    if(expr_block!=null)
            //    {
            //        var v = expr_block.ComputeValue(content);
            //        if (v != null && v.breakBlock > 1) break; ;
            //        //if (v.breakBlock == 1) continue;
            //        //if (v.breakBlock == 2) break;
            //        //if (v.breakBlock == 10) return v;
            //    }
            //}
            content.DepthRemove();
            content.OutStack(this);
            return(null);
            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            List <string> depth__;

            content.Record(out depth__);
            try
            {
                ICLS_Expression expr = listParam[0];
                if (expr is CLS_Expression_Block)
                {
                    expr.ComputeValue(content);
                }
                else
                {
                    content.DepthAdd();
                    expr.ComputeValue(content);
                    content.DepthRemove();
                }
            }
            catch (Exception err)
            {
                bool bParse = false;
                int  i      = 1;
                while (i < listParam.Count)
                {
                    CLS_Expression_Define def = listParam[i] as CLS_Expression_Define;
                    if (err.GetType() == (Type)def.value_type || err.GetType().IsSubclassOf((Type)def.value_type))
                    {
                        content.DepthAdd();
                        content.DefineAndSet(def.value_name, def.value_type, err);

                        listParam[i + 1].ComputeValue(content);
                        content.DepthRemove();
                        bParse = true;
                        break;
                    }
                    i += 2;
                }
                if (!bParse)
                {
                    throw err;
                }
            }
            content.Restore(depth__, this);
            //while((bool)expr_continue.value);

            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
            content.OutStack(this);
            return(null);
        }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     //List<CLS_Content.Value> list = new List<CLS_Content.Value>();
     CLS_Content.Value value = new CLS_Content.Value();
     value.type  = typeof(DeleLambda);
     value.value = new DeleLambda(content, (this.listParam[0] as CLS_Expression_Block).listParam, this.listParam[1]);
     //创建一个匿名方法
     content.OutStack(this);
     return(value);
 }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            var value = content.Get(value_name);

            content.OutStack(this);

            //从上下文取值

            return(value);
        }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     var parent = listParam[0].ComputeValue(content);
     var key = listParam[1].ComputeValue(content);
     var value = listParam[2].ComputeValue(content);
     var type = content.environment.GetType(parent.type);
     type.function.IndexSet(content, parent.value, key.value, value.value);
     content.OutStack(this);
     return null;
 }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     CLS_Content.Value right = listParam[0].ComputeValue(content);
     ICLS_Type type = content.environment.GetType(right.type);
     CLS_Content.Value value = new CLS_Content.Value();
     value.type = targettype;
     value.value = type.ConvertTo(content, right.value, targettype);
     content.OutStack(this);
     return value;
 }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     CLS_Content.Value value = listParam[0].ComputeValue(content);
     CLS_Content.Value result;
     if ((bool)value.value)
         result = listParam[1].ComputeValue(content);
     else
         result = listParam[2].ComputeValue(content);
     content.OutStack(this);
     return result;
 }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            //List<CLS_Content.Value> list = new List<CLS_Content.Value>();
            CLS_Content.Value value = new CLS_Content.Value();
            value.type = typeof(DeleLambda);
            value.value = new DeleLambda(content,(this.listParam[0] as CLS_Expression_Block).listParam,this.listParam[1]);
            //创建一个匿名方法
            content.OutStack(this);
            return value;

        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);

            CLS_Content.Value r = listParam[0].ComputeValue(content);
            ICLS_Type type =content.environment.GetType(r.type);
            
            r.value= type.Math2Value(content, '*', r.value, CLS_Content.Value.OneMinus, out r.type);
            content.OutStack(this);

            return r;
        }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     BetterList<CLS_Content.Value> _params = CLS_Content.NewParamList();
     for (int i = 0, count = listParam.Count; i < count; i++)
     {
         _params.Add(listParam[i].ComputeValue(content));
     }
     CLS_Content.Value value = type.function.StaticCall(content, functionName, _params);
     CLS_Content.PoolParamList(_params);
     content.OutStack(this);
     return value;
 }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            //var parent = listParam[0].ComputeValue(content);
            var value = listParam[0].ComputeValue(content);

            type.function.StaticValueSet(content, staticmembername, value.value);
            //做数学计算
            //从上下文取值
            //_value = null;
            content.OutStack(this);
            return null;
        }
 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     var parent = listParam[0].ComputeValue(content);
     var type = content.environment.GetType(parent.type);
     var value=type.function.MemberValueGet(content, parent.value, membername);
     content.OutStack(this);
     return value;
     //做数学计算
     //从上下文取值
     //_value = null;
     //return null;
 }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            content.DepthAdd();
            CLS_Expression_Define define = listParam[0] as CLS_Expression_Define;
            if (define == null)
            {

            }
            define.ComputeValue(content);

            System.Collections.IEnumerable emu = listParam[1].ComputeValue(content).value as System.Collections.IEnumerable;

            ICLS_Expression expr_block = listParam[2] as ICLS_Expression;

            var it = emu.GetEnumerator();
            while (it.MoveNext())
            {
                content.Set(define.value_name, it.Current);

                if (expr_block != null)
                {
                    var v = expr_block.ComputeValue(content);
                    if (v != null && v.breakBlock > 1) break; ;
                }
            }
            //ICLS_Expression expr_continue = listParam[1] as ICLS_Expression;
            //ICLS_Expression expr_step = listParam[2] as ICLS_Expression;

            //ICLS_Expression expr_block = listParam[3] as ICLS_Expression;

            //for (;(bool)expr_continue.ComputeValue(content).value; expr_step.ComputeValue(content))
            //{
            //    if(expr_block!=null)
            //    {
            //        var v = expr_block.ComputeValue(content);
            //        if (v != null && v.breakBlock > 1) break; ;
            //        //if (v.breakBlock == 1) continue;
            //        //if (v.breakBlock == 2) break;
            //        //if (v.breakBlock == 10) return v;
            //    }
            //}
            content.DepthRemove();
            content.OutStack(this);
            return null;
            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
        }
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            content.DepthAdd();
            ICLS_Expression expr_init = listParam[0] as ICLS_Expression;
            if (expr_init != null) expr_init.ComputeValue(content);

            ICLS_Expression expr_continue = listParam[1] as ICLS_Expression;
            ICLS_Expression expr_step = listParam[2] as ICLS_Expression;

            ICLS_Expression expr_block = listParam[3] as ICLS_Expression;
            CLS_Content.Value vrt = null;
            for (; (bool)expr_continue.ComputeValue(content).value; expr_step.ComputeValue(content))
            {
                if (expr_block != null)
                {
                    if (expr_block is CLS_Expression_Block)
                    {
                        var v = expr_block.ComputeValue(content);
                        if (v != null)
                        {
                            if (v.breakBlock > 2) vrt = v;
                            if (v.breakBlock > 1) break ;
                        }
                    }
                    else
                    {
                        content.DepthAdd();
                        var v = expr_block.ComputeValue(content);
                        if (v != null)
                        {
                            if (v.breakBlock > 2) vrt = v;
                            if (v.breakBlock > 1) break;
                        }
                        content.DepthRemove();
                    }
                    //if (v.breakBlock == 1) continue;
                    //if (v.breakBlock == 2) break;
                    //if (v.breakBlock == 10) return v;
                }
            }
            content.DepthRemove();
            content.OutStack(this);
            return vrt;
            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
        }