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);
        }
        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);

            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);

            CLS_Content.Value left = content.Get(value_name);
            ICLS_Type         type = content.environment.GetType(left.type);
            CLType            returntype;

            left.value = type.Math2Value(content, mathop, left.value, CLS_Content.Value.One, out returntype);
            //left.value = type.ConvertTo(content, left.value, v.type);
            //content.Set(value_name, left.value);

            content.OutStack(this);

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

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

            CLS_Content.Value retVal = new CLS_Content.Value();

            ICLS_Type type = content.environment.GetType(oriVal.type);

            retVal.value = type.Math2Value(content, '*', oriVal.value, CLS_Content.Value.OneMinus, out retVal.type);

            content.OutStack(this);

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

            ICLS_Expression leftExp = listParam[0];

            CLS_Content.Value left  = leftExp.ComputeValue(content);
            CLS_Content.Value right = listParam[1].ComputeValue(content);
            ICLS_Type         type  = content.environment.GetType(left.type);

            CLType returntype;

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

            if (leftExp is CLS_Expression_MemberFind)
            {
                CLS_Expression_MemberFind f = leftExp as CLS_Expression_MemberFind;

                CLS_Content.Value parent = f.listParam[0].ComputeValue(content);
                ICLS_Type         ptype  = content.environment.GetType(parent.type);
                ptype.function.MemberValueSet(content, parent.value, f.membername, left.value);
            }
            else if (leftExp is CLS_Expression_StaticFind)
            {
                CLS_Expression_StaticFind f = leftExp as CLS_Expression_StaticFind;
                f.type.function.StaticValueSet(content, f.staticmembername, left.value);
            }
            else if (leftExp is CLS_Expression_IndexFind)
            {
                CLS_Expression_IndexFind f = leftExp as CLS_Expression_IndexFind;

                CLS_Content.Value parent = f.listParam[0].ComputeValue(content);
                CLS_Content.Value key    = f.listParam[1].ComputeValue(content);
                ICLS_Type         ptype  = content.environment.GetType(parent.type);
                ptype.function.IndexSet(content, parent.value, key.value, left.value);
            }

            content.OutStack(this);

            return(null);
        }
Пример #7
0
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);

            var       v    = content.Get(value_name);
            ICLS_Type type = content.environment.GetType(v.type);
            CLType    returntype;
            object    value = type.Math2Value(content, mathop, v.value, CLS_Content.Value.One, out returntype);

            value = type.ConvertTo(content, value, v.type);
            content.Set(value_name, value);

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

            return(null);
        }