Ejemplo n.º 1
0
        public CQ_Value ComputeValue(CQ_Content content)
        {
#if CQUARK_DEBUG
            content.InStack(this);
#endif
            CQ_Value parent = _expressions[0].ComputeValue(content);
            object   obj    = parent.GetObject();
            if (parent == CQ_Value.Null)
            {
                throw new Exception("调用空对象的方法:" + _expressions[0].ToString() + ":" + ToString());
            }
            var key = _expressions[1].ComputeValue(content);

            CQ_Value value = CQ_Value.Null;
            //这几行是为了快速获取Unity的静态变量,而不需要反射
            if (!Wrap.IndexGet(parent.m_type, obj, key, out value))
            {
                IType type = CQuark.AppDomain.GetITypeByCQValue(parent);
                value = type._class.IndexGet(content, obj, key.GetObject());
            }

#if CQUARK_DEBUG
            content.OutStack(this);
#endif

            return(value);
        }
Ejemplo n.º 2
0
        public CQ_Value ComputeValue(CQ_Content content)
        {
#if CQUARK_DEBUG
            content.InStack(this);
#endif
            var parent = _expressions[0].ComputeValue(content);
            if (parent == null)
            {
                throw new Exception("调用空对象的方法:" + _expressions[0].ToString() + ":" + ToString());
            }
            var key = _expressions[1].ComputeValue(content);

            CQ_Value value = null;
            //这几行是为了快速获取Unity的静态变量,而不需要反射
            if (!Wrap.IndexGet(parent.type.type, parent.value, key, out value))
            {
                var type = CQuark.AppDomain.GetType(parent.type);
                value = type._class.IndexGet(content, parent.value, key.value);
            }

#if CQUARK_DEBUG
            content.OutStack(this);
#endif

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

            return(value);
            //return type.function.MemberValueGet(CQuark.AppDomain, parent.value, membername);
            //做数学计算
            //从上下文取值
            //_value = null;
            //return null;
        }