public CQ_Content.Value ComputeValue(CQ_Content content)
        {
            content.InStack(this);


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

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

            {
                CQType 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(CQuark.DeleLambda) || t == typeof(CQuark.DeleFunction) || t == typeof(CQuark.DeleEvent))
                //{

                //}
                //else
                {
                    if (listParam[0] is CQ_Expression_MemberFind)
                    {
                        CQ_Expression_MemberFind f = listParam[0] as CQ_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 CQ_Expression_StaticFind)
                    {
                        CQ_Expression_StaticFind f = listParam[0] as CQ_Expression_StaticFind;
                        f.type.function.StaticValueSet(content, f.staticmembername, value);
                    }
                }
            }


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

            return(null);
        }
        public CQ_Content.Value ComputeValue(CQ_Content content)
        {
            content.InStack(this);

            CQ_Content.Value r    = listParam[0].ComputeValue(content);
            ICQ_Type         type = content.environment.GetType(r.type);

            r.value = type.Math2Value(content, '*', r.value, CQ_Content.Value.OneMinus, out r.type);
            content.OutStack(this);

            return(r);
        }
Beispiel #3
0
        public CQ_Content.Value ComputeValue(CQ_Content content)
        {
            content.InStack(this);

            var      v    = content.Get(value_name);
            ICQ_Type type = content.environment.GetType(v.type);
            CQType   returntype;
            object   value = type.Math2Value(content, mathop, v.value, CQ_Content.Value.One, out returntype);

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

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

            return(content.Get(value_name));
        }