/// <summary> /// Transforms an invoke member into a Python GetMember/Invoke. The caller should /// verify that the given attribute is not resolved against a normal .NET class /// before calling this. If it is a normal .NET member then a fallback InvokeMember /// is preferred. /// </summary> internal static DynamicMetaObject /*!*/ GenericInvokeMember(InvokeMemberBinder /*!*/ action, ValidationInfo valInfo, DynamicMetaObject target, DynamicMetaObject /*!*/[] /*!*/ args) { if (target.NeedsDeferral()) { return(action.Defer(args)); } return(AddDynamicTestAndDefer(action, action.FallbackInvoke( new DynamicMetaObject( Binders.Get( PythonContext.GetCodeContext(action), PythonContext.GetPythonContext(action), typeof(object), action.Name, target.Expression ), BindingRestrictionsHelpers.GetRuntimeTypeRestriction(target) ), args, null ), args, valInfo )); }
} // func BindInvoke public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) { if (String.Compare(binder.Name, nameof(IsSmall), binder.IgnoreCase) == 0 || String.Compare(binder.Name, nameof(IsLarge), binder.IgnoreCase) == 0) { return(base.BindInvokeMember(binder, args)); } if (!HasValue) { return(binder.Defer(this, args)); } // redirect to the item return(binder.FallbackInvokeMember(GetRawItemBinder(), args)); } // func BindInvokeMember
public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) { ContractUtils.RequiresNotNull(binder, "binder"); return(binder.Defer(args.AddFirst(WrapSelf()))); }
/// <summary> /// Transforms an invoke member into a Python GetMember/Invoke. The caller should /// verify that the given attribute is not resolved against a normal .NET class /// before calling this. If it is a normal .NET member then a fallback InvokeMember /// is preferred. /// </summary> internal static DynamicMetaObject/*!*/ GenericInvokeMember(InvokeMemberBinder/*!*/ action, ValidationInfo valInfo, DynamicMetaObject target, DynamicMetaObject/*!*/[]/*!*/ args) { if (target.NeedsDeferral()) { return action.Defer(args); } return AddDynamicTestAndDefer(action, action.FallbackInvoke( new DynamicMetaObject( Binders.Get( BinderState.GetCodeContext(action), BinderState.GetBinderState(action), typeof(object), action.Name, target.Expression ), BindingRestrictionsHelpers.GetRuntimeTypeRestriction(target) ), args, null ), args, valInfo ); }
public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) { Requires.NotNull(binder, nameof(binder)); return(binder.Defer(args.AddFirst(WrapSelf()))); }
public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) { return(binder.Defer(args.AddFirst(WrapSelf()))); }
public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) { ContractUtils.RequiresNotNull(binder, "binder"); return binder.Defer(args.AddFirst(WrapSelf())); }
/// <summary> /// Transforms a call into a Python GetMember/Invoke. This isn't quite the correct semantic as /// we shouldn't be returning Python members (e.g. object.__repr__) to non-Python callers. This /// can go away as soon as all of the classes implement the full fidelity of the protocol /// </summary> internal static DynamicMetaObject/*!*/ GenericCall(InvokeMemberBinder/*!*/ action, DynamicMetaObject target, DynamicMetaObject/*!*/[]/*!*/ args) { if (target.NeedsDeferral()) { return action.Defer(args); } return new DynamicMetaObject( Invoke( BinderState.GetCodeContext(action), BinderState.GetBinderState(action), typeof(object), GetCallSignature(action), ArrayUtils.Insert( Binders.Get( BinderState.GetCodeContext(action), BinderState.GetBinderState(action), typeof(object), action.Name, target.Expression ), DynamicUtils.GetExpressions(args) ) ), BindingRestrictions.Combine(args).Merge(target.Restrict(target.GetLimitType()).Restrictions) ); }