internal static void InvokeMemberActionCallSite(object target, MemberInvocationMoniker name, object[] arguments, string[] argumentNames, Type context, bool staticContext, ref CallSite callSite) { LazyBinder binder = null; Type binderType = null; if (callSite == null) { binder = () => { var argumentBindingList = GetBindingArgumentList(arguments, argumentNames, staticContext); var flag = CSharpBinderFlags.ResultDiscarded; if (name.IsNameSpecial) { flag |= CSharpBinderFlags.InvokeSpecialName; } return(Binder.InvokeMember(flag, name.Name, name.GenericArguments, context, argumentBindingList)); }; binderType = typeof(InvokeMemberBinder); } MemberActionInvoke(ref callSite, binderType, binder, name, staticContext, context, argumentNames, target, arguments); }
internal static CallSite <T> CreateCallSite <T>( Type specificBinderType, LazyBinder binder, MemberInvocationMoniker name, Type context, string[] argumentNames = null, bool staticContext = false, bool isEvent = false) where T : class { var hashCode = BinderHashGenerator <T> .Create(name, context, argumentNames, specificBinderType, staticContext, isEvent); lock (_binderCacheLock) { CallSite callSite; if (!_binderCache.TryGetValue(hashCode, out callSite)) { callSite = CallSite <T> .Create(binder()); _binderCache[hashCode] = callSite; } return((CallSite <T>)callSite); } }
internal static TReturn InvokeMember <TReturn>(ref CallSite callsite, Type binderType, LazyBinder binder, MemberInvocationMoniker name, bool staticContext, Type context, string[] argumentNames, object target, params object[] arguments) { return(MemberTargetTypeInvoke <object, TReturn>(ref callsite, binderType, binder, name, staticContext, context, argumentNames, target, arguments)); }
protected BinderHashGenerator(Type delegateType, MemberInvocationMoniker name, Type context, string[] argumentNames, Type binderType, bool staticContext, bool isEvent) { BinderType = binderType; StaticContext = staticContext; DelegateType = delegateType; Name = name; Context = context; ArgumentNames = argumentNames; IsEvent = isEvent; }
public static InvocationCacheCompatible CreateCall( InvocationKind kind, MemberInvocationMoniker name = null, CallInfo callinfo = null, object context = null) { var argumentCount = callinfo != null ? callinfo.ArgumentCount : 0; var argumentNames = callinfo != null?callinfo.ArgumentNames.ToArray() : null; return(new InvocationCacheCompatible(kind, name, argumentCount, argumentNames, context)); }
public static CallSite <T> CreateCallSite <T>( CallSiteBinder binder, MemberInvocationMoniker name, Type context, string[] argumentNames = null, bool staticContext = false, bool isEvent = false) where T : class { return(InvocationMapping.CreateCallSite <T>(binder.GetType(), () => binder, name, context, argumentNames, staticContext, isEvent)); }
public static CallSite CreateCallSite( Type delegateType, CallSiteBinder binder, MemberInvocationMoniker name, Type context, string[] argumentNames = null, bool staticContext = false, bool isEvent = false) { return(InvocationMapping.CreateCallSite(delegateType, binder.GetType(), () => binder, name, context, argumentNames, staticContext, isEvent)); }
public static void InvokeMemberAction(object target, MemberInvocationMoniker name, params object[] arguments) { string[] argumentNames; Type context; bool staticContext; target = target.GetInvocationContext(out context, out staticContext); arguments = TypeFactorization.ExtractArgumentNamesAndValues(arguments, out argumentNames); CallSite theCallSite = null; InvocationMapping.InvokeMemberActionCallSite(target, name, arguments, argumentNames, context, staticContext, ref theCallSite); }
public InvocationCacheCompatible(InvocationKind kind, MemberInvocationMoniker name = null, int argCount = 0, string[] argNames = null, object context = null, Type convertType = null, bool convertExplict = false, object[] storedArgs = null) : base(kind, name, storedArgs) { _convertType = convertType; _convertExplict = convertExplict; ExtractArguments(argNames, storedArgs); DecideArgumentCountBasedOnType(kind, argCount, convertType); SetArgumentNames(); InitializeContext(context); }
internal static CallSite CreateCallSite( Type delegateType, Type specificBinderType, LazyBinder binder, MemberInvocationMoniker name, Type context, string[] argumentNames = null, bool staticContext = false, bool isEvent = false) { var hash = BinderHashGenerator.Create(delegateType, name, context, argumentNames, specificBinderType, staticContext, isEvent); lock (_binderCacheLock) { CallSite tOut; if (!_binderCache.TryGetValue(hash, out tOut)) { tOut = CallSite.Create(delegateType, binder()); _binderCache[hash] = tOut; } return(tOut); } }
public static Invocation Create(InvocationKind kind, MemberInvocationMoniker name, params object[] storedArgs) { return(new Invocation(kind, name, storedArgs)); }
public Invocation(InvocationKind kind, MemberInvocationMoniker name, params object[] storedArgs) { Kind = kind; Name = name; Arguments = storedArgs; }
public static BinderHashGenerator Create(Type delType, MemberInvocationMoniker name, Type context, string[] argumentNames, Type binderType, bool staticContext, bool isEvent) { return(new BinderHashGenerator(delType, name, context, argumentNames, binderType, staticContext, isEvent)); }
protected AbstractGenericBinderHashGenerator(Type delegateType, MemberInvocationMoniker name, Type context, string[] argumentNames, Type binderType, bool staticContext, bool isEvent) : base(delegateType, name, context, argumentNames, binderType, staticContext, isEvent) { }