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));
}