public Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc) { DeleFunction _func = delefunc; Delegate _dele = delefunc.cacheFunction(null); if (_dele != null) { return(_dele); } NonVoidDelegate dele = delegate(T param0, T1 param1, T2 param2) { var func = _func.calltype.functions[_func.function]; if (func.expr_runtime != null) { CLS_Content content = new CLS_Content(env); content.DepthAdd(); content.CallThis = _func.callthis; content.CallType = _func.calltype; content.function = _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); CLS_Content.Value retValue = func.expr_runtime.ComputeValue(content); content.DepthRemove(); return((ReturnType)retValue.value); } return(default(ReturnType)); }; _dele = Delegate.CreateDelegate(this.type, dele.Target, dele.Method); return(delefunc.cacheFunction(_dele)); }
public Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc) { DeleFunction _func = delefunc; Delegate _dele = delefunc.cacheFunction(this._type, null); if (_dele != null) { return(_dele); } Action <T, T1, T2> dele = (T param0, T1 param1, T2 param2) => { var func = _func.calltype.functions[_func.function]; if (func.expr_runtime != null) { CLS_Content content = new CLS_Content(env, true); try { content.DepthAdd(); content.CallThis = _func.callthis; content.CallType = _func.calltype; content.function = _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(); } catch (Exception err) { string errinfo = "Dump Call in:"; if (_func.calltype != null) { errinfo += _func.calltype.Name + "::"; } if (_func.function != null) { errinfo += _func.function; } errinfo += "\n"; env.logger.Log(errinfo + content.Dump()); throw err; } } }; Delegate d = dele as Delegate; if ((Type)this.type != typeof(Action)) { _dele = Delegate.CreateDelegate(this.type, d.Target, d.Method); } else { _dele = dele; } return(delefunc.cacheFunction(this._type, _dele)); }
public Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc) { DeleFunction _func = delefunc; Delegate _dele = delefunc.cacheFunction(this._type, null); if (_dele != null) { return(_dele); } NonVoidDelegate dele = delegate(T param0, T1 param1, T2 param2) { var func = _func.calltype.functions[_func.function]; if (func.expr_runtime != null) { CLS_Content content = new CLS_Content(env, true); try { content.DepthAdd(); content.CallThis = _func.callthis; content.CallType = _func.calltype; content.function = _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); CLS_Content.Value retValue = func.expr_runtime.ComputeValue(content); content.DepthRemove(); return((ReturnType)retValue.value); } catch (Exception err) { string errinfo = "Dump Call in:"; if (_func.calltype != null) { errinfo += _func.calltype.Name + "::"; } if (_func.function != null) { errinfo += _func.function; } errinfo += "\n"; env.logger.Log(errinfo + content.Dump()); throw err; } } return(default(ReturnType)); }; _dele = Delegate.CreateDelegate(this.type, dele.Target, dele.Method); return(delefunc.cacheFunction(this._type, _dele)); }
public override Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc) { Delegate _dele = delefunc.cacheFunction(null); if (_dele != null) { return(_dele); } var func = delefunc.calltype.functions[delefunc.function]; Action <T, T1, T2> dele; if (func.expr_runtime != null) { dele = (T param0, T1 param1, T2 param2) => { CLS_Content content = CLS_Content.NewContent(env); #if UNITY_EDITOR try{ #endif content.CallThis = delefunc.callthis; content.CallType = delefunc.calltype; 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); CLS_Content.PoolContent(content); #if UNITY_EDITOR }catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); } #endif }; } else { dele = (T param0, T1 param1, T2 param2) => { }; } if (this.sysType != typeof(Action <T, T1, T2>)) { _dele = Delegate.CreateDelegate(this.sysType, dele.Target, dele.Method); } else { _dele = dele; } return(delefunc.cacheFunction(_dele)); }
public Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc) { DeleFunction _func = delefunc; Delegate _dele = delefunc.cacheFunction(null); if (_dele != null) { return(_dele); } Action <T> dele = (T param0) => { var func = _func.calltype.functions[_func.function]; if (func.expr_runtime != null) { CLS_Content content = new CLS_Content(env); try { content.DepthAdd(); content.CallThis = _func.callthis; content.CallType = _func.calltype; content.function = _func.function; content.DefineAndSet(func._paramnames[0], func._paramtypes[0].type, param0); func.expr_runtime.ComputeValue(content); content.DepthRemove(); } catch (Exception err) { env.logger.Log(content.Dump()); throw err; } } }; Delegate d = dele as Delegate; if ((Type)this.type != typeof(Action)) { _dele = Delegate.CreateDelegate(this.type, d.Target, d.Method); } else { _dele = dele; } return(delefunc.cacheFunction(_dele)); }
public override Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc) { Delegate _dele = delefunc.cacheFunction(null); if (_dele != null) { return(_dele); } var func = delefunc.calltype.functions[delefunc.function]; NonVoidDelegate dele; if (func.expr_runtime != null) { dele = delegate(T param, T1 param1) { CLS_Content content = CLS_Content.NewContent(env); #if UNITY_EDITOR try{ #endif content.CallThis = delefunc.callthis; content.CallType = delefunc.calltype; content.DefineAndSet(func._paramnames[0], func._paramtypes[0].type, param); content.DefineAndSet(func._paramnames[1], func._paramtypes[1].type, param1); CLS_Content.Value retValue = func.expr_runtime.ComputeValue(content); CLS_Content.PoolContent(content); return((ReturnType)retValue.value); #if UNITY_EDITOR }catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); return(default(ReturnType)); } #endif }; } else { dele = delegate(T param, T1 param1) { return(default(ReturnType)); }; } _dele = Delegate.CreateDelegate(this.type, dele.Target, dele.Method); return(delefunc.cacheFunction(_dele)); }
public override Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc) { Delegate _dele = delefunc.cacheFunction(null); if (_dele != null) return _dele; var func = delefunc.calltype.functions[delefunc.function]; Action dele; if (func.expr_runtime != null) { dele = () => { CLS_Content content = CLS_Content.NewContent(env); #if UNITY_EDITOR try{ #endif content.CallThis = delefunc.callthis; content.CallType = delefunc.calltype; func.expr_runtime.ComputeValue(content); CLS_Content.PoolContent(content); #if UNITY_EDITOR }catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); } #endif }; } else { dele = () => { }; } if (this.sysType != typeof(Action)) { _dele = Delegate.CreateDelegate(this.sysType, dele.Target, dele.Method); } else { _dele = dele; } return delefunc.cacheFunction(_dele); }
public Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc) { DeleFunction _func = delefunc; Delegate _dele = delefunc.cacheFunction(null); if (_dele != null) { return(_dele); } NonVoidDelegate dele = delegate() { var func = _func.calltype.functions[_func.function]; if (func.expr_runtime != null) { CLS_Content content = new CLS_Content(env); try { content.DepthAdd(); content.CallThis = _func.callthis; content.CallType = _func.calltype; content.function = _func.function; CLS_Content.Value retValue = func.expr_runtime.ComputeValue(content); content.DepthRemove(); return((ReturnType)retValue.value); } catch (Exception err) { env.logger.Log(content.Dump()); throw err; } } return(default(ReturnType)); }; _dele = Delegate.CreateDelegate(this.type, dele.Target, dele.Method); return(delefunc.cacheFunction(_dele)); }
public Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc) { DeleFunction _func = delefunc; Delegate _dele = delefunc.cacheFunction(null); if (_dele != null) return _dele; Action dele = () => { var func = _func.calltype.functions[_func.function]; if (func.expr_runtime != null) { CLS_Content content = new CLS_Content(env); try { content.DepthAdd(); content.CallThis = _func.callthis; content.CallType = _func.calltype; content.function = _func.function; //content.DefineAndSet(function._paramnames[0], function._paramtypes[0].type, param0); func.expr_runtime.ComputeValue(content); content.DepthRemove(); } catch (Exception err) { env.logger.Log(content.Dump()); throw err; } } }; Delegate d = dele as Delegate; if ((Type)this.type != typeof(Action)) { _dele = Delegate.CreateDelegate(this.type, d.Target, d.Method); } else { _dele = dele; } return delefunc.cacheFunction(_dele); }