CSLE.CLS_Content.DefineAndSet C# (CSharp) Method

DefineAndSet() public method

public DefineAndSet ( string name, CLType type, object value ) : void
name string
type CLType
value object
return void
        public void DefineAndSet(string name,CLType type,object value)
        {
            if (values.ContainsKey(name)) 
                throw new Exception(type.ToString()+":"+name+"已经定义过");
            Value v = new Value();
            v.type = type;
            v.value = value;
            values[name] = v;
            if(tvalues.Count>0)
            {
                tvalues.Peek().Add(name);//暂存临时变量
            }
        }
        public Value Get(string name)

Usage Example

Example #1
0
        public Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc)
        {
            CLS_Content        content = new CLS_Content(env);
            DeleFunction       _func   = delefunc;
            Action <T, T1, T2> dele    = (T param0, T1 param1, T2 param2) =>
            {
                content.DepthAdd();
                content.CallThis = _func.callthis;
                content.CallType = _func.calltype;
                content.function = _func.function;
                var func = _func.calltype.functions[_func.function];

                content.DefineAndSet(func._paramnames[0], func._paramtypes[0].type, param0);
                content.DefineAndSet(func._paramnames[1], func._paramtypes[1].type, param1);
                content.DefineAndSet(func._paramnames[2], func._paramtypes[2].type, param2);

                func.expr_runtime.ComputeValue(content);
                content.DepthRemove();
            };
            Delegate d = dele as Delegate;

            if ((Type)this.type != typeof(Action <T, T1, T2>))
            {
                return(Delegate.CreateDelegate(this.type, d.Target, d.Method));
            }
            else
            {
                return(dele);
            }
        }
All Usage Examples Of CSLE.CLS_Content::DefineAndSet