public override T BindDelegate <T>(System.Runtime.CompilerServices.CallSite <T> site, object[] args) { Func <CallSite, Any, Args, Any> func = (c, any, idx) => { Any val; if (!any.GetIndexOperation(this, idx, out val)) { throw new Exception(); } return(val); }; return((T)(object)func); }
public override T BindDelegate <T>(System.Runtime.CompilerServices.CallSite <T> site, object[] args) { //LambdaExpression lambda = null; // this.Bind() //Delegate precompiled = lambda.Compile(true); // Cache this //T result = (T) (object) precompiled; //this.CacheTarget(result); //return result; // // Get the Expression for the binding // var signature = LambdaSignature <T> .Instance; Expression binding = Bind(args, signature.Parameters, signature.ReturnLabel); // // Check the produced rule // if (binding == null) { throw new InvalidOperationException("No or Invalid Rule Produced"); } // // finally produce the new rule if we need to // #if !CLR2 && !SILVERLIGHT // We cannot compile rules in the heterogeneous app domains since they // may come from less trusted sources // Silverlight always uses a homogenous appdomain, so we don’t need this check if (!AppDomain.CurrentDomain.IsHomogenous) { throw new InvalidOperationException("Homogenous AppDomain Required"); } #endif Expression <T> e = Stitch(binding, signature); T newRule = e.Compile(true); CacheTarget(newRule); return(newRule); //return base.BindDelegate<T>(site, args); }
public virtual T BindDelegate <T>(System.Runtime.CompilerServices.CallSite <T> site, object[] args) where T : class { throw null; }