public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); ICLS_Expression expr_while = listParam[1] as ICLS_Expression; ICLS_Expression expr_block = listParam[0] as ICLS_Expression; CLS_Content.Value vrt = null; do { if (expr_block != null) { if (expr_block is CLS_Expression_Block) { var v = expr_block.ComputeValue(content); if (v != null) { if (v.breakBlock > 2) { vrt = v; } if (v.breakBlock > 1) { break; } } } else { content.DepthAdd(); var v = expr_block.ComputeValue(content); if (v != null) { if (v.breakBlock > 2) { vrt = v; } if (v.breakBlock > 1) { break; } } content.DepthRemove(); } //if (v.breakBlock == 1) continue; //if (v.breakBlock == 2) break; //if (v.breakBlock == 10) return v; } } while ((bool)expr_while.ComputeValue(content).value); content.DepthRemove(); content.OutStack(this); return(vrt); //for 逻辑 //做数学计算 //从上下文取值 //_value = null; }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); List <string> depth__; content.Record(out depth__); try { ICLS_Expression expr = listParam[0]; if (expr is CLS_Expression_Block) { expr.ComputeValue(content); } else { content.DepthAdd(); expr.ComputeValue(content); content.DepthRemove(); } } catch (Exception err) { bool bParse = false; int i = 1; while (i < listParam.Count) { CLS_Expression_Define def = listParam[i] as CLS_Expression_Define; if (err.GetType() == (Type)def.value_type || err.GetType().IsSubclassOf((Type)def.value_type)) { content.DepthAdd(); content.DefineAndSet(def.value_name, def.value_type, err); listParam[i + 1].ComputeValue(content); content.DepthRemove(); bParse = true; break; } i += 2; } if (!bParse) { throw err; } } content.Restore(depth__, this); //while((bool)expr_continue.value); //for 逻辑 //做数学计算 //从上下文取值 //_value = null; content.OutStack(this); return(null); }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); List<string> depth__; content.Record(out depth__); try { ICLS_Expression expr = listParam[0]; if (expr is CLS_Expression_Block) { expr.ComputeValue(content); } else { content.DepthAdd(); expr.ComputeValue(content); content.DepthRemove(); } } catch (Exception err) { bool bParse = false; int i = 1; while (i < listParam.Count) { CLS_Expression_Define def = listParam[i] as CLS_Expression_Define; if (err.GetType()==(Type)def.value_type || err.GetType().IsSubclassOf((Type)def.value_type)) { content.DepthAdd(); content.DefineAndSet(def.value_name, def.value_type, err); listParam[i + 1].ComputeValue(content); content.DepthRemove(); bParse = true; break; } i += 2; } if (!bParse) { throw err; } } content.Restore(depth__, this); //while((bool)expr_continue.value); //for 逻辑 //做数学计算 //从上下文取值 //_value = null; content.OutStack(this); return null; }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); ICLS_Expression expr_init = listParam[0] as ICLS_Expression; if (expr_init != null) { expr_init.ComputeValue(content); } ICLS_Expression expr_continue = listParam[1] as ICLS_Expression; ICLS_Expression expr_step = listParam[2] as ICLS_Expression; ICLS_Expression expr_block = listParam[3] as ICLS_Expression; for (; (bool)expr_continue.ComputeValue(content).value; expr_step.ComputeValue(content)) { if (expr_block != null) { if (expr_block is CLS_Expression_Block) { var v = expr_block.ComputeValue(content); if (v != null && v.breakBlock > 1) { break; } ; } else { content.DepthAdd(); var v = expr_block.ComputeValue(content); if (v != null && v.breakBlock > 1) { break; } ; content.DepthRemove(); } //if (v.breakBlock == 1) continue; //if (v.breakBlock == 2) break; //if (v.breakBlock == 10) return v; } } content.DepthRemove(); content.OutStack(this); return(null); //for 逻辑 //做数学计算 //从上下文取值 //_value = null; }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); ICLS_Expression expr_if = listParam[0]; bool bif = (bool)expr_if.ComputeValue(content).value; //if (expr_init != null) expr_init.ComputeValue(content); ICLS_Expression expr_go1 = listParam[1]; ICLS_Expression expr_go2 = null; if (listParam.Count > 2) { expr_go2 = listParam[2]; } CLS_Content.Value value = null; if (bif && expr_go1 != null) { if (expr_go1 is CLS_Expression_Block) { value = expr_go1.ComputeValue(content); } else { content.DepthAdd(); value = expr_go1.ComputeValue(content); content.DepthRemove(); } } else if (!bif && expr_go2 != null) { if (expr_go2 is CLS_Expression_Block) { value = expr_go2.ComputeValue(content); } else { content.DepthAdd(); value = expr_go2.ComputeValue(content); content.DepthRemove(); } } //while((bool)expr_continue.value); //for 逻辑 //做数学计算 //从上下文取值 //_value = null; content.OutStack(this); return(value); }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); ICLS_Expression expr_init = listParam[0] as ICLS_Expression; if (expr_init != null) expr_init.ComputeValue(content); ICLS_Expression expr_continue = listParam[1] as ICLS_Expression; ICLS_Expression expr_step = listParam[2] as ICLS_Expression; ICLS_Expression expr_block = listParam[3] as ICLS_Expression; CLS_Content.Value vrt = null; for (; (bool)expr_continue.ComputeValue(content).value; expr_step.ComputeValue(content)) { if (expr_block != null) { if (expr_block is CLS_Expression_Block) { var v = expr_block.ComputeValue(content); if (v != null) { if (v.breakBlock > 2) vrt = v; if (v.breakBlock > 1) break ; } } else { content.DepthAdd(); var v = expr_block.ComputeValue(content); if (v != null) { if (v.breakBlock > 2) vrt = v; if (v.breakBlock > 1) break; } content.DepthRemove(); } //if (v.breakBlock == 1) continue; //if (v.breakBlock == 2) break; //if (v.breakBlock == 10) return v; } } content.DepthRemove(); content.OutStack(this); return vrt; //for 逻辑 //做数学计算 //从上下文取值 //_value = null; }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); ICLS_Expression expr_if = listParam[0]; bool bif = (bool)expr_if.ComputeValue(content).value; //if (expr_init != null) expr_init.ComputeValue(content); ICLS_Expression expr_go1 = listParam[1]; ICLS_Expression expr_go2 = null; if(listParam.Count>2)expr_go2= listParam[2]; CLS_Content.Value value = null; if (bif && expr_go1 != null) { if (expr_go1 is CLS_Expression_Block) { value = expr_go1.ComputeValue(content); } else { content.DepthAdd(); value = expr_go1.ComputeValue(content); content.DepthRemove(); } } else if (!bif && expr_go2 != null) { if (expr_go2 is CLS_Expression_Block) { value = expr_go2.ComputeValue(content); } else { content.DepthAdd(); value = expr_go2.ComputeValue(content); content.DepthRemove(); } } //while((bool)expr_continue.value); //for 逻辑 //做数学计算 //从上下文取值 //_value = null; content.OutStack(this); return value; }
public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda) { var pnames = lambda.paramNames; var expr = lambda.expr_func; Action dele = () => { if (expr != null) { CLS_Content content = lambda.content.Clone(); content.DepthAdd(); //content.DefineAndSet(pnames[0], typeof(T), param0); expr.ComputeValue(content); content.DepthRemove(); } }; Delegate d = dele as Delegate; if ((Type)this.type != typeof(Action)) { return(Delegate.CreateDelegate(this.type, d.Target, d.Method)); } else { return(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(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 CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); CLS_Content.Value vrt = null; ICLS_Expression expr_while = listParam[0]; ICLS_Expression expr_block = listParam[1]; while ((bool)expr_while.ComputeValue(content).value) { if (expr_block != null) { CLS_Content.Value v = expr_block.ComputeValue(content); if (v != null) { if (v.breakBlock > 2) { vrt = v; } if (v.breakBlock > 1) { break; } } } } content.DepthRemove(); content.OutStack(this); return(vrt); }
public Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc) { CLS_Content content = new CLS_Content(env); DeleFunction _func = delefunc; Action dele = () => { content.DepthAdd(); content.CallThis = _func.callthis; content.CallType = _func.calltype; content.function = _func.function; var func = _func.calltype.functions[_func.function]; //content.DefineAndSet(function._paramnames[0], function._paramtypes[0].type, param0); func.expr_runtime.ComputeValue(content); content.DepthRemove(); }; Delegate d = dele as Delegate; if ((Type)this.type != typeof(Action)) { return Delegate.CreateDelegate(this.type, d.Target, d.Method); } else { return dele; } }
public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda) { var pnames = lambda.paramNames; var expr = lambda.expr_func; NonVoidDelegate dele = delegate(T param0, T1 param1, T2 param2) { if (expr != null) { CLS_Content content = lambda.content.Clone(); content.DepthAdd(); content.DefineAndSet(pnames[0], typeof(T), param0); content.DefineAndSet(pnames[1], typeof(T1), param1); content.DefineAndSet(pnames[2], typeof(T2), param2); CLS_Content.Value retValue = expr.ComputeValue(content); content.DepthRemove(); return((ReturnType)retValue.value); } return(default(ReturnType)); }; Delegate d = dele as Delegate; return(Delegate.CreateDelegate(this.type, d.Target, d.Method)); }
public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda) { CLS_Content content = lambda.content.Clone(); var pnames = lambda.paramNames; var expr = lambda.expr_func; NonVoidDelegate dele = delegate(T param) { if (expr != null) { try { content.DepthAdd(); content.DefineAndSet(pnames[0], typeof(T), param); CLS_Content.Value retValue = expr.ComputeValue(content); content.DepthRemove(); return((ReturnType)retValue.value); } catch (Exception err) { env.logger.Log(content.Dump()); throw err; } } return(default(ReturnType)); }; Delegate d = dele as Delegate; return(Delegate.CreateDelegate(this.type, d.Target, d.Method)); }
public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda) { CLS_Content content = lambda.content.Clone(); var pnames = lambda.paramNames; var expr = lambda.expr_func; Action <T, T1, T2> dele = (T param0, T1 param1, T2 param2) => { content.DepthAdd(); content.DefineAndSet(pnames[0], typeof(T), param0); content.DefineAndSet(pnames[1], typeof(T1), param1); content.DefineAndSet(pnames[2], typeof(T2), param2); expr.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); } }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); CLS_Content.Value vrt = null; ICLS_Expression expr_while = listParam[1]; ICLS_Expression expr_block = listParam[0]; do { if (expr_block != null) { CLS_Content.Value v = expr_block.ComputeValue(content); if (v != null) { if (v.breakBlock > 2) vrt = v; if (v.breakBlock > 1) break; } } } while ((bool)expr_while.ComputeValue(content).value); content.DepthRemove(); content.OutStack(this); return vrt; }
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); } }
public Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc) { DeleFunction _func = delefunc; NonVoidDelegate dele = delegate() { 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; CLS_Content.Value retValue = func.expr_runtime.ComputeValue(content); content.DepthRemove(); return((ReturnType)retValue.value); } return(default(ReturnType)); }; Delegate d = dele; return(Delegate.CreateDelegate(this.type, d.Target, d.Method)); }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); ICLS_Expression expr_while = listParam[1] as ICLS_Expression; ICLS_Expression expr_block = listParam[0] as ICLS_Expression; CLS_Content.Value vrt = null; do { if (expr_block != null) { if (expr_block is CLS_Expression_Block) { var v = expr_block.ComputeValue(content); if (v != null) { if (v.breakBlock > 2) vrt = v; if (v.breakBlock > 1) break; } } else { content.DepthAdd(); bool bbreak = false; var v = expr_block.ComputeValue(content); if (v != null) { if (v.breakBlock > 2) vrt = v; if (v.breakBlock > 1) bbreak = true; } content.DepthRemove(); if (bbreak) break; } //if (v.breakBlock == 1) continue; //if (v.breakBlock == 2) break; //if (v.breakBlock == 10) return v; } } while ((bool)expr_while.ComputeValue(content).value); content.DepthRemove(); content.OutStack(this); return vrt; //for 逻辑 //做数学计算 //从上下文取值 //_value = null; }
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 CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); CLS_Content.Value value = null; if ((bool)listParam[0].ComputeValue(content).value) { ICLS_Expression expr_block = listParam[1]; if (expr_block != null) { if (expr_block is CLS_Expression_Block) { value = expr_block.ComputeValue(content); } else { content.DepthAdd(); value = expr_block.ComputeValue(content); content.DepthRemove(); } } } else if (listParam.Count > 2) { ICLS_Expression expr_elseif = listParam[2]; if (expr_elseif != null) { if (expr_elseif is CLS_Expression_Block) { value = expr_elseif.ComputeValue(content); } else { content.DepthAdd(); value = expr_elseif.ComputeValue(content); content.DepthRemove(); } } } content.OutStack(this); return(value); }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); CLS_Expression_Define define = listParam[0] as CLS_Expression_Define; if (define == null) { } define.ComputeValue(content); System.Collections.IEnumerable emu = listParam[1].ComputeValue(content).value as System.Collections.IEnumerable; ICLS_Expression expr_block = listParam[2] as ICLS_Expression; var it = emu.GetEnumerator(); while (it.MoveNext()) { content.Set(define.value_name, it.Current); if (expr_block != null) { var v = expr_block.ComputeValue(content); if (v != null && v.breakBlock > 1) { break; } ; } } //ICLS_Expression expr_continue = listParam[1] as ICLS_Expression; //ICLS_Expression expr_step = listParam[2] as ICLS_Expression; //ICLS_Expression expr_block = listParam[3] as ICLS_Expression; //for (;(bool)expr_continue.ComputeValue(content).value; expr_step.ComputeValue(content)) //{ // if(expr_block!=null) // { // var v = expr_block.ComputeValue(content); // if (v != null && v.breakBlock > 1) break; ; // //if (v.breakBlock == 1) continue; // //if (v.breakBlock == 2) break; // //if (v.breakBlock == 10) return v; // } //} content.DepthRemove(); content.OutStack(this); return(null); //for 逻辑 //做数学计算 //从上下文取值 //_value = null; }
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 CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); CLS_Expression_Define define = listParam[0] as CLS_Expression_Define; if (define == null) { } define.ComputeValue(content); System.Collections.IEnumerable emu = listParam[1].ComputeValue(content).value as System.Collections.IEnumerable; ICLS_Expression expr_block = listParam[2] as ICLS_Expression; var it = emu.GetEnumerator(); while (it.MoveNext()) { content.Set(define.value_name, it.Current); if (expr_block != null) { var v = expr_block.ComputeValue(content); if (v != null && v.breakBlock > 1) break; ; } } //ICLS_Expression expr_continue = listParam[1] as ICLS_Expression; //ICLS_Expression expr_step = listParam[2] as ICLS_Expression; //ICLS_Expression expr_block = listParam[3] as ICLS_Expression; //for (;(bool)expr_continue.ComputeValue(content).value; expr_step.ComputeValue(content)) //{ // if(expr_block!=null) // { // var v = expr_block.ComputeValue(content); // if (v != null && v.breakBlock > 1) break; ; // //if (v.breakBlock == 1) continue; // //if (v.breakBlock == 2) break; // //if (v.breakBlock == 10) return v; // } //} content.DepthRemove(); content.OutStack(this); return null; //for 逻辑 //做数学计算 //从上下文取值 //_value = null; }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); CLS_Content.Value vrt = null; ICLS_Expression expr_init = listParam[0]; ICLS_Expression expr_continue = listParam[1]; ICLS_Expression expr_step = listParam[2]; ICLS_Expression expr_block = listParam[3]; if (expr_init != null) { expr_init.ComputeValue(content); } for (;;) { if (expr_continue != null && !(bool)expr_continue.ComputeValue(content).value) { break; } if (expr_block != null) { CLS_Content.Value v = expr_block.ComputeValue(content); if (v != null) { if (v.breakBlock > 2) { vrt = v; } if (v.breakBlock > 1) { break; } } } if (expr_step != null) { expr_step.ComputeValue(content); } } content.DepthRemove(); content.OutStack(this); return(vrt); }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); CLS_Content.Value value = null; for (int i = 0, count = listParam.Count; i < count; i++) { value = listParam[i].ComputeValue(content); if (value != null && value.breakBlock != 0) break; } content.DepthRemove(); content.OutStack(this); return value; }
public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda) { CLS_Content content = lambda.content.Clone(); var pnames = lambda.paramNames; var expr = lambda.expr_func; Action <T, T1, T2> dele = (T param0, T1 param1, T2 param2) => { if (expr != null) { try { content.DepthAdd(); content.DefineAndSet(pnames[0], typeof(T), param0); content.DefineAndSet(pnames[1], typeof(T1), param1); content.DefineAndSet(pnames[2], typeof(T2), param2); expr.ComputeValue(content); content.DepthRemove(); } catch (Exception err) { string errinfo = "Dump Call lambda in:"; if (content.CallType != null) { errinfo += content.CallType.Name + "::"; } if (content.function != null) { errinfo += content.function; } errinfo += "\n"; env.logger.Log(errinfo + content.Dump()); throw err; } } }; 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); } }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); CLS_Content.Value value = null; foreach (ICLS_Expression i in listParam) { ICLS_Expression e =i as ICLS_Expression; if (e != null) value =e.ComputeValue(content); if (value!=null&&value.breakBlock != 0) break; } content.DepthRemove(); content.OutStack(this); return value; }
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 CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); CLS_Content.Value value = null; for (int i = 0, count = listParam.Count; i < count; i++) { value = listParam[i].ComputeValue(content); if (value != null && value.breakBlock != 0) { break; } } content.DepthRemove(); content.OutStack(this); return(value); }
public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda) { CLS_Content content = lambda.content.Clone(); var pnames = lambda.paramNames; var expr = lambda.expr_func; NonVoidDelegate dele = delegate(T param0, T1 param1) { if (expr != null) { try { content.DepthAdd(); content.DefineAndSet(pnames[0], typeof(T), param0); content.DefineAndSet(pnames[1], typeof(T1), param1); CLS_Content.Value retValue = expr.ComputeValue(content); content.DepthRemove(); return((ReturnType)retValue.value); } catch (Exception err) { string errinfo = "Dump Call lambda in:"; if (content.CallType != null) { errinfo += content.CallType.Name + "::"; } if (content.function != null) { errinfo += content.function; } errinfo += "\n"; env.logger.Log(errinfo + content.Dump()); throw err; } } return(default(ReturnType)); }; Delegate d = dele as Delegate; return(Delegate.CreateDelegate(this.type, d.Target, d.Method)); }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); CLS_Content.Value value = null; if ((bool)listParam[0].ComputeValue(content).value) { ICLS_Expression expr_block = listParam[1]; if (expr_block != null) { if (expr_block is CLS_Expression_Block) { value = expr_block.ComputeValue(content); } else { content.DepthAdd(); value = expr_block.ComputeValue(content); content.DepthRemove(); } } } else if (listParam.Count > 2) { ICLS_Expression expr_elseif = listParam[2]; if (expr_elseif != null) { if (expr_elseif is CLS_Expression_Block) { value = expr_elseif.ComputeValue(content); } else { content.DepthAdd(); value = expr_elseif.ComputeValue(content); content.DepthRemove(); } } } content.OutStack(this); return value; }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); CLS_Content.Value vrt = null; CLS_Expression_Define define = listParam[0] as CLS_Expression_Define; define.ComputeValue(content); IEnumerator it = (listParam[1].ComputeValue(content).value as IEnumerable).GetEnumerator(); ICLS_Expression expr_block = listParam[2]; while (it.MoveNext()) { content.Set(define.value_name, it.Current); if (expr_block != null) { CLS_Content.Value v = expr_block.ComputeValue(content); if (v != null) { if (v.breakBlock > 2) { vrt = v; } if (v.breakBlock > 1) { break; } } } } content.DepthRemove(); content.OutStack(this); return(vrt); }
public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda) { var pnames = lambda.paramNames; var expr = lambda.expr_func; NonVoidDelegate dele = delegate() { if (expr != null) { CLS_Content content = lambda.content.Clone(); content.DepthAdd(); CLS_Content.Value retValue = expr.ComputeValue(content); content.DepthRemove(); return((ReturnType)retValue.value); } return(default(ReturnType)); }; Delegate d = dele; return(Delegate.CreateDelegate(this.type, d.Target, d.Method)); }
public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda) { CLS_Content content = lambda.content.Clone(); var pnames = lambda.paramNames; var expr = lambda.expr_func; Action <T> dele = (T param0) => { if (expr != null) { try { content.DepthAdd(); content.DefineAndSet(pnames[0], typeof(T), param0); expr.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 <T>)) { return(Delegate.CreateDelegate(this.type, d.Target, d.Method)); } else { return(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 CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); CLS_Content.Value value = null; foreach (ICLS_Expression i in listParam) { ICLS_Expression e = i as ICLS_Expression; if (e != null) { value = e.ComputeValue(content); } if (value != null && value.breakBlock != 0) { break; } } content.DepthRemove(); content.OutStack(this); return(value); }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); CLS_Content.Value vrt = null; CLS_Expression_Define define = listParam[0] as CLS_Expression_Define; define.ComputeValue(content); IEnumerator it = (listParam[1].ComputeValue(content).value as IEnumerable).GetEnumerator(); ICLS_Expression expr_block = listParam[2]; while (it.MoveNext()) { content.Set(define.value_name, it.Current); if (expr_block != null) { CLS_Content.Value v = expr_block.ComputeValue(content); if (v != null) { if (v.breakBlock > 2) vrt = v; if (v.breakBlock > 1) break; } } } content.DepthRemove(); content.OutStack(this); return vrt; }
IEnumerator CustomCoroutine(CLS_Content content) { content.InStack(this); content.DepthAdd(); CLS_Content.Value retVal = null; ICLS_Expression exp = null; for (int i = 0, count = listParam.Count; i < count; i++) { exp = listParam[i]; CLS_Expression_LoopFor expLoopFor = exp as CLS_Expression_LoopFor; if (expLoopFor != null) { content.InStack(expLoopFor); content.DepthAdd(); ICLS_Expression expr_init = expLoopFor.listParam[0]; ICLS_Expression expr_continue = expLoopFor.listParam[1]; ICLS_Expression expr_step = expLoopFor.listParam[2]; ICLS_Expression expr_block = expLoopFor.listParam[3]; #if UNITY_EDITOR try { #endif if (expr_init != null) expr_init.ComputeValue(content); #if UNITY_EDITOR } catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); } #endif for (;;) { #if UNITY_EDITOR try { #endif if (expr_continue != null && !(bool)expr_continue.ComputeValue(content).value) break; #if UNITY_EDITOR } catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); } #endif if (expr_block != null) { if (expr_block is CLS_Expression_Block) { content.InStack(expr_block); content.DepthAdd(); for (int j = 0, count2 = expr_block.listParam.Count; j < count2; j++) { #if UNITY_EDITOR try { #endif retVal = expr_block.listParam[j].ComputeValue(content); #if UNITY_EDITOR } catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); } #endif if (retVal != null) { if (retVal.breakBlock == 12) { CLS_Content.PoolContent(content); yield break; } else if (retVal.breakBlock == 13) yield return retVal.value; else if (retVal.breakBlock > 1) break; } } content.DepthRemove(); content.OutStack(expr_block); } else { #if UNITY_EDITOR try { #endif retVal = expr_block.ComputeValue(content); #if UNITY_EDITOR } catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); } #endif if (retVal != null) { if (retVal.breakBlock == 12) { CLS_Content.PoolContent(content); yield break; } else if (retVal.breakBlock == 13) yield return retVal.value; else if (retVal.breakBlock > 1) break; } } } #if UNITY_EDITOR try { #endif if (expr_step != null) expr_step.ComputeValue(content); #if UNITY_EDITOR } catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); } #endif } content.DepthRemove(); content.OutStack(expLoopFor); } else { #if UNITY_EDITOR try { #endif retVal = exp.ComputeValue(content); #if UNITY_EDITOR } catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); } #endif if (retVal != null) { if (retVal.breakBlock == 12) { CLS_Content.PoolContent(content); yield break; } else if (retVal.breakBlock == 13) yield return retVal.value; } } } CLS_Content.PoolContent(content); }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); ICLS_Expression expr_init = listParam[0] as ICLS_Expression; if (expr_init != null) { expr_init.ComputeValue(content); //expr1 } ICLS_Expression expr_continue = listParam[1] as ICLS_Expression; ICLS_Expression expr_step = listParam[2] as ICLS_Expression; ICLS_Expression expr_block = listParam[3] as ICLS_Expression; CLS_Content.Value vrt = null; for (; ;) { if (expr_continue != null && !(bool)expr_continue.ComputeValue(content).value) { break; //expr2 } if (expr_block != null) { if (expr_block is CLS_Expression_Block) { var v = expr_block.ComputeValue(content); if (v != null) { if (v.breakBlock > 2) { vrt = v; } if (v.breakBlock > 1) { break; } } } else { content.DepthAdd(); bool bbreak = false; var v = expr_block.ComputeValue(content); if (v != null) { if (v.breakBlock > 2) { vrt = v; } if (v.breakBlock > 1) { bbreak = true; } } content.DepthRemove(); if (bbreak) { break; } } //if (v.breakBlock == 1) continue; //if (v.breakBlock == 2) break; //if (v.breakBlock == 10) return v; } if (expr_step != null) { expr_step.ComputeValue(content);//expr3 } } content.DepthRemove(); content.OutStack(this); return(vrt); //for 逻辑 //做数学计算 //从上下文取值 //_value = null; }
public CLS_Content.Value ComputeValue(CLS_Content content) { content.InStack(this); content.DepthAdd(); CLS_Content.Value vrt = null; ICLS_Expression expr_init = listParam[0]; ICLS_Expression expr_continue = listParam[1]; ICLS_Expression expr_step = listParam[2]; ICLS_Expression expr_block = listParam[3]; if (expr_init != null) expr_init.ComputeValue(content); for (;;) { if (expr_continue != null && !(bool)expr_continue.ComputeValue(content).value) break; if (expr_block != null) { CLS_Content.Value v = expr_block.ComputeValue(content); if (v != null) { if (v.breakBlock > 2) vrt = v; if (v.breakBlock > 1) break; } } if (expr_step != null) expr_step.ComputeValue(content); } content.DepthRemove(); content.OutStack(this); return vrt; }
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); }
IEnumerator CustomCoroutine(CLS_Content content) { content.InStack(this); content.DepthAdd(); CLS_Content.Value retVal = null; ICLS_Expression exp = null; for (int i = 0, count = listParam.Count; i < count; i++) { exp = listParam[i]; CLS_Expression_LoopFor expLoopFor = exp as CLS_Expression_LoopFor; if (expLoopFor != null) { content.InStack(expLoopFor); content.DepthAdd(); ICLS_Expression expr_init = expLoopFor.listParam[0]; ICLS_Expression expr_continue = expLoopFor.listParam[1]; ICLS_Expression expr_step = expLoopFor.listParam[2]; ICLS_Expression expr_block = expLoopFor.listParam[3]; #if UNITY_EDITOR try { #endif if (expr_init != null) { expr_init.ComputeValue(content); } #if UNITY_EDITOR } catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); } #endif for (;;) { #if UNITY_EDITOR try { #endif if (expr_continue != null && !(bool)expr_continue.ComputeValue(content).value) { break; } #if UNITY_EDITOR } catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); } #endif if (expr_block != null) { if (expr_block is CLS_Expression_Block) { content.InStack(expr_block); content.DepthAdd(); for (int j = 0, count2 = expr_block.listParam.Count; j < count2; j++) { #if UNITY_EDITOR try { #endif retVal = expr_block.listParam[j].ComputeValue(content); #if UNITY_EDITOR } catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); } #endif if (retVal != null) { if (retVal.breakBlock == 12) { CLS_Content.PoolContent(content); yield break; } else if (retVal.breakBlock == 13) { yield return(retVal.value); } else if (retVal.breakBlock > 1) { break; } } } content.DepthRemove(); content.OutStack(expr_block); } else { #if UNITY_EDITOR try { #endif retVal = expr_block.ComputeValue(content); #if UNITY_EDITOR } catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); } #endif if (retVal != null) { if (retVal.breakBlock == 12) { CLS_Content.PoolContent(content); yield break; } else if (retVal.breakBlock == 13) { yield return(retVal.value); } else if (retVal.breakBlock > 1) { break; } } } } #if UNITY_EDITOR try { #endif if (expr_step != null) { expr_step.ComputeValue(content); } #if UNITY_EDITOR } catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); } #endif } content.DepthRemove(); content.OutStack(expLoopFor); } else { #if UNITY_EDITOR try { #endif retVal = exp.ComputeValue(content); #if UNITY_EDITOR } catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); } #endif if (retVal != null) { if (retVal.breakBlock == 12) { CLS_Content.PoolContent(content); yield break; } else if (retVal.breakBlock == 13) { yield return(retVal.value); } } } } CLS_Content.PoolContent(content); }