Ejemplo n.º 1
0
        public void MemberValueSet(CLS_Content content, object object_this, string valuename, object value, bool isBaseCall = false)
        {
            SInstance sin = object_this as SInstance;

            CLS_Content.Value mV;
            if (sin.member.TryGetValue(valuename, out mV))
            {
                mV.value = value;
                mV.FixValueType(content);
                return;
            }

            // 判断是否有同名的Set属性
            Member property;

            if (sin.type.propertys.TryGetValue(valuename, out property))
            {
                if (property.setFun != null)
                {
                    BetterList <CLS_Content.Value> _params = CLS_Content.NewParamList();
                    CLS_Content.Value hideValue            = new CLS_Content.Value()
                    {
                        type = property.type.type, value = value
                    };
                    hideValue.FixValueType(content);
                    _params.Add(hideValue);
                    this.MemberCall(content, object_this, property.setFun, _params, isBaseCall);
                    CLS_Content.PoolParamList(_params);
                    return;
                }
                throw new NotImplementedException("属性无set权限: " + this.Name + "." + valuename);
            }

            throw new NotImplementedException("未实现成员赋值字段: " + this.Name + "." + valuename);
        }
        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);
        }
        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 = content.environment.GetFunction(funcname).Call(content, _params);
            CLS_Content.PoolParamList(_params);
            content.OutStack(this);
            return(retVal);
        }
        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.New(content, _params);
            CLS_Content.PoolParamList(_params);
            content.OutStack(this);
            return(value);
        }
        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);
            BetterList <CLS_Content.Value> _params = CLS_Content.NewParamList();

            for (int i = 1, count = listParam.Count; i < count; i++)
            {
                _params.Add(listParam[i].ComputeValue(content));
            }
            CLS_Content.Value value = type.function.MemberCall(content, parent.value, functionName, _params, parent.breakBlock == 255);
            CLS_Content.PoolParamList(_params);
            content.OutStack(this);
            return(value);
        }
Ejemplo n.º 6
0
        public bool TryMemberValueSet(CLS_Content content, SInstance sin, string valuename, object value)
        {
            CLS_Content.Value mV;
            if (sin.member.TryGetValue(valuename, out mV))
            {
                mV.value = value;
                mV.FixValueType(content);
                return(true);
            }

            // 判断是否有同名的Set属性
            Member property;

            if (sin.type.propertys.TryGetValue(valuename, out property))
            {
                if (property.setFun != null)
                {
                    BetterList <CLS_Content.Value> _params = CLS_Content.NewParamList();
                    CLS_Content.Value hideValue            = new CLS_Content.Value()
                    {
                        type = property.type.type, value = value
                    };
                    hideValue.FixValueType(content);
                    _params.Add(hideValue);
                    if (property.bStatic)
                    {
                        this.StaticCall(content, property.setFun, _params);
                    }
                    else
                    {
                        this.MemberCall(content, sin, property.setFun, _params);
                    }
                    CLS_Content.PoolParamList(_params);
                    return(true);
                }
                throw new NotImplementedException("属性无set权限: " + this.Name + "." + valuename);
            }

            return(false);
        }
Ejemplo n.º 7
0
        public bool TryStaticValueSet(CLS_Content content, string valuename, object value)
        {
            if (staticMemberContent == null)
            {
                NewStatic(content.environment);
            }

            CLS_Content.Value sV;
            if (this.staticMemberValues.TryGetValue(valuename, out sV))
            {
                sV.value = value;
                sV.FixValueType(content);
                return(true);
            }

            // 判断是否有同名的Set属性
            Member property;

            if (this.propertys.TryGetValue(valuename, out property))
            {
                if (property.setFun != null)
                {
                    BetterList <CLS_Content.Value> _params = CLS_Content.NewParamList();
                    CLS_Content.Value hideValue            = new CLS_Content.Value()
                    {
                        type = property.type.type, value = value
                    };
                    hideValue.FixValueType(content);
                    _params.Add(hideValue);
                    this.StaticCall(content, property.setFun, _params);
                    CLS_Content.PoolParamList(_params);
                    return(true);
                }
                throw new NotImplementedException("属性无set权限: " + this.Name + "." + valuename);
            }

            return(false);
        }
Ejemplo n.º 8
0
        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);

            int arraySize = listParam[0] == null ? (listParam.Count - 1) : (int)listParam[0].ComputeValue(content).value;

            if (arraySize == 0)
            {
                throw new Exception("不能创建0长度数组");
            }

            int initValCount = listParam.Count - 1;

            object[] initVals = new object[initValCount];
            for (int i = 1; i < listParam.Count; i++)
            {
                initVals[i - 1] = listParam[i].ComputeValue(content).value;
            }

            CLS_Content.Value vcount = new CLS_Content.Value();
            vcount.type  = typeof(int);
            vcount.value = arraySize;
            BetterList <CLS_Content.Value> _params = CLS_Content.NewParamList();

            _params.Add(vcount);
            CLS_Content.Value newVal = type.function.New(content, _params);

            for (int i = 0; i < initValCount; i++)
            {
                type.function.IndexSet(content, newVal.value, i, initVals[i]);
            }

            CLS_Content.PoolParamList(_params);
            content.OutStack(this);
            return(newVal);
        }