public int GetGetBinderEquivalenceHash() { int hash = _callingContext?.GetHashCode() ?? 0; hash = BinderHelper.AddArgHashes(hash, _argumentInfo); return(hash); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpGetIndexBinder" />. /// </summary> /// <param name="callingContext">The <see cref="System.Type"/> that indicates where this operation is defined.</param> /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param> public CSharpGetIndexBinder( Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) : base(BinderHelper.CreateCallInfo(ref argumentInfo, 1)) // discard 1 argument: the target object { _argumentInfo = argumentInfo as CSharpArgumentInfo[]; _binder = new RuntimeBinder(callingContext); }
public CSharpInvokeConstructorBinder( CSharpCallFlags flags, Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) { Flags = flags; _argumentInfo = BinderHelper.ToArray(argumentInfo); _binder = new RuntimeBinder(callingContext); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpGetIndexBinder" />. /// </summary> /// <param name="callingContext">The <see cref="System.Type"/> that indicates where this operation is defined.</param> /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param> public CSharpGetIndexBinder( Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) : base(BinderHelper.CreateCallInfo(argumentInfo, 1)) // discard 1 argument: the target object { CallingContext = callingContext; _argumentInfo = BinderHelper.ToList(argumentInfo); _binder = RuntimeBinder.GetInstance(); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpInvokeBinder" />. /// </summary> /// <param name="flags">Extra information about this operation that is not specific to any particular argument.</param> /// <param name="callingContext">The <see cref="System.Type"/> that indicates where this operation is defined.</param> /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param> public CSharpInvokeBinder( CSharpCallFlags flags, Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) : base(BinderHelper.CreateCallInfo(ref argumentInfo, 1)) // discard 1 argument: the target object (even if static, arg is type) { _flags = flags; _argumentInfo = argumentInfo as CSharpArgumentInfo[]; _binder = new RuntimeBinder(callingContext); }
public CSharpInvokeConstructorBinder( CSharpCallFlags flags, Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) { _flags = flags; _callingContext = callingContext; _argumentInfo = BinderHelper.ToList(argumentInfo); _binder = RuntimeBinder.GetInstance(); }
/// <summary> /// Performs the binding of the dynamic set member operation if the target dynamic object cannot bind. /// </summary> /// <param name="target">The target of the dynamic set member operation.</param> /// <param name="value">The value to set to the member.</param> /// <param name="errorSuggestion">The binding result to use if binding fails, or null.</param> /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns> public override DynamicMetaObject FallbackSetMember(DynamicMetaObject target, DynamicMetaObject value, DynamicMetaObject errorSuggestion) { #if !SILVERLIGHT DynamicMetaObject com; if (!BinderHelper.IsWindowsRuntimeObject(target) && ComBinder.TryBindSetMember(this, target, value, out com)) { return(com); } #endif return(BinderHelper.Bind(this, m_binder, new[] { target, value }, m_argumentInfo, errorSuggestion)); }
/// <summary> /// Performs the binding of the dynamic invoke operation if the target dynamic object cannot bind. /// </summary> /// <param name="target">The target of the dynamic invoke operation.</param> /// <param name="args">The arguments of the dynamic invoke operation.</param> /// <param name="errorSuggestion">The binding result to use if binding fails, or null.</param> /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns> public override DynamicMetaObject FallbackInvoke(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion) { #if !SILVERLIGHT DynamicMetaObject com; if (!BinderHelper.IsWindowsRuntimeObject(target) && ComBinder.TryBindInvoke(this, target, args, out com)) { return(com); } #endif return(BinderHelper.Bind(this, m_binder, BinderHelper.Cons(target, args), m_argumentInfo, errorSuggestion)); }
public int GetGetBinderEquivalenceHash() { int hash = CallingContext?.GetHashCode() ?? 0; hash = HashHelpers.Combine(hash, (int)Flags); hash = HashHelpers.Combine(hash, Name.GetHashCode()); hash = BinderHelper.AddArgHashes(hash, TypeArguments, _argumentInfo); return(hash); }
////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="CSharpSetIndexBinder" />. /// </summary> /// <param name="isCompoundAssignment">True if the assignment comes from a compound assignment in source.</param> /// <param name="isChecked">True if the operation is defined in a checked context; otherwise, false.</param> /// <param name="callingContext">The <see cref="Type"/> that indicates where this operation is defined.</param> /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param> public CSharpSetIndexBinder( bool isCompoundAssignment, bool isChecked, Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) : base(BinderHelper.CreateCallInfo(ref argumentInfo, 2)) // discard 2 arguments: the target object and the value { IsCompoundAssignment = isCompoundAssignment; _argumentInfo = argumentInfo as CSharpArgumentInfo[]; _binder = new RuntimeBinder(callingContext, isChecked); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpInvokeBinder" />. /// </summary> /// <param name="flags">Extra information about this operation that is not specific to any particular argument.</param> /// <param name="callingContext">The <see cref="System.Type"/> that indicates where this operation is defined.</param> /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param> public CSharpInvokeBinder( CSharpCallFlags flags, Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) : base(BinderHelper.CreateCallInfo(argumentInfo, 1)) // discard 1 argument: the target object (even if static, arg is type) { _flags = flags; CallingContext = callingContext; _argumentInfo = BinderHelper.ToList(argumentInfo); _binder = RuntimeBinder.GetInstance(); }
/// <summary> /// Performs the binding of the dynamic set index operation if the target dynamic object cannot bind. /// </summary> /// <param name="target">The target of the dynamic set index operation.</param> /// <param name="indexes">The arguments of the dynamic set index operation.</param> /// <param name="value">The value to set to the collection.</param> /// <param name="errorSuggestion">The binding result to use if binding fails, or null.</param> /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns> public override DynamicMetaObject FallbackSetIndex(DynamicMetaObject target, DynamicMetaObject[] indexes, DynamicMetaObject value, DynamicMetaObject errorSuggestion) { #if ENABLECOMBINDER DynamicMetaObject com; if (!BinderHelper.IsWindowsRuntimeObject(target) && ComBinder.TryBindSetIndex(this, target, indexes, value, out com)) { return(com); } #endif return(BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, indexes, value), _argumentInfo, errorSuggestion)); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpUnaryOperationBinder"/> class. /// </summary> /// <param name="operation">The unary operation kind.</param> /// <param name="isChecked">True if the operation is defined in a checked context; otherwise, false.</param> /// <param name="callingContext">The <see cref="Type"/> that indicates where this operation is defined.</param> /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param> public CSharpUnaryOperationBinder( ExpressionType operation, bool isChecked, Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) : base(operation) { _argumentInfo = BinderHelper.ToArray(argumentInfo); Debug.Assert(_argumentInfo.Length == 1); _binder = new RuntimeBinder(callingContext, isChecked); }
/// <summary> /// Performs the binding of the dynamic convert operation if the target dynamic object cannot bind. /// </summary> /// <param name="target">The target of the dynamic convert operation.</param> /// <param name="errorSuggestion">The binding result to use if binding fails, or null.</param> /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns> public override DynamicMetaObject FallbackConvert(DynamicMetaObject target, DynamicMetaObject errorSuggestion) { #if ENABLECOMBINDER DynamicMetaObject com; if (!BinderHelper.IsWindowsRuntimeObject(target) && ComBinder.TryConvert(this, target, out com)) { return(com); } #endif return(BinderHelper.Bind(this, _binder, new[] { target }, null, errorSuggestion)); }
/// <summary> /// Performs the binding of the dynamic get member operation if the target dynamic object cannot bind. /// </summary> /// <param name="target">The target of the dynamic get member operation.</param> /// <param name="errorSuggestion">The binding result to use if binding fails, or null.</param> /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns> public override DynamicMetaObject FallbackGetMember(DynamicMetaObject target, DynamicMetaObject errorSuggestion) { #if ENABLECOMBINDER DynamicMetaObject com; if (!BinderHelper.IsWindowsRuntimeObject(target) && ComBinder.TryBindGetMember(this, target, out com, ResultIndexed)) { return(com); } #endif return(BinderHelper.Bind(this, _binder, new[] { target }, _argumentInfo, errorSuggestion)); }
/// <summary> /// Performs the binding of the dynamic invoke member operation if the target dynamic object cannot bind. /// </summary> /// <param name="target">The target of the dynamic invoke member operation.</param> /// <param name="args">The arguments of the dynamic invoke member operation.</param> /// <param name="errorSuggestion">The binding result to use if binding fails, or null.</param> /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns> public override DynamicMetaObject FallbackInvokeMember(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion) { #if ENABLECOMBINDER DynamicMetaObject com; if (!BinderHelper.IsWindowsRuntimeObject(target) && ComBinder.TryBindInvokeMember(this, target, args, out com)) { return(com); } #endif return(BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, args), _argumentInfo, errorSuggestion)); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpGetMemberBinder" />. /// </summary> /// <param name="name">The name of the member to get.</param> /// <param name="resultIndexed">Determines if COM binder should return a callable object.</param> /// <param name="callingContext">The <see cref="System.Type"/> that indicates where this operation is defined.</param> /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param> public CSharpGetMemberBinder( string name, bool resultIndexed, Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) : base(name, false /*caseInsensitive*/) { ResultIndexed = resultIndexed; _argumentInfo = BinderHelper.ToArray(argumentInfo); _binder = new RuntimeBinder(callingContext); }
////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="SetMemberBinder" />. /// </summary> /// <param name="name">The name of the member to get.</param> /// <param name="isCompoundAssignment">True if the assignment comes from a compound assignment in source.</param> /// <param name="isChecked">True if the operation is defined in a checked context; otherwise, false.</param> /// <param name="callingContext">The <see cref="Type"/> that indicates where this operation is defined.</param> /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param> public CSharpSetMemberBinder( string name, bool isCompoundAssignment, bool isChecked, Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) : base(name, false) { IsCompoundAssignment = isCompoundAssignment; _argumentInfo = BinderHelper.ToArray(argumentInfo); _binder = new RuntimeBinder(callingContext, isChecked); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpGetMemberBinder" />. /// </summary> /// <param name="name">The name of the member to get.</param> /// <param name="resultIndexed">Determines if COM binder should return a callable object.</param> /// <param name="callingContext">The <see cref="System.Type"/> that indicates where this operation is defined.</param> /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param> public CSharpGetMemberBinder( string name, bool resultIndexed, Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) : base(name, false /*caseInsensitive*/) { _bResultIndexed = resultIndexed; _callingContext = callingContext; _argumentInfo = BinderHelper.ToList(argumentInfo); _binder = RuntimeBinder.GetInstance(); }
/// <summary> /// Performs the binding of the dynamic set member operation if the target dynamic object cannot bind. /// </summary> /// <param name="target">The target of the dynamic set member operation.</param> /// <param name="value">The value to set to the member.</param> /// <param name="errorSuggestion">The binding result to use if binding fails, or null.</param> /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns> public override DynamicMetaObject FallbackSetMember(DynamicMetaObject target, DynamicMetaObject value, DynamicMetaObject errorSuggestion) { #if ENABLECOMBINDER DynamicMetaObject com; if (!BinderHelper.IsWindowsRuntimeObject(target) && ComBinder.TryBindSetMember(this, target, value, out com)) { return(com); } #endif BinderHelper.ValidateBindArgument(target, nameof(target)); BinderHelper.ValidateBindArgument(value, nameof(value)); return(BinderHelper.Bind(this, _binder, new[] { target, value }, _argumentInfo, errorSuggestion)); }
/// <summary> /// Performs the binding of the dynamic get index operation if the target dynamic object cannot bind. /// </summary> /// <param name="target">The target of the dynamic get index operation.</param> /// <param name="indexes">The arguments of the dynamic get index operation.</param> /// <param name="errorSuggestion">The binding result to use if binding fails, or null.</param> /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns> public override DynamicMetaObject FallbackGetIndex(DynamicMetaObject target, DynamicMetaObject[] indexes, DynamicMetaObject errorSuggestion) { #if ENABLECOMBINDER DynamicMetaObject com; if (!BinderHelper.IsWindowsRuntimeObject(target) && ComBinder.TryBindGetIndex(this, target, indexes, out com)) { return(com); } #endif BinderHelper.ValidateBindArgument(target, nameof(target)); BinderHelper.ValidateBindArgument(indexes, nameof(indexes)); return(BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, indexes), _argumentInfo, errorSuggestion)); }
public int GetGetBinderEquivalenceHash() { int hash = _callingContext?.GetHashCode() ?? 0; hash = HashHelpers.Combine(hash, (int)Operation); if (IsChecked) { hash = HashHelpers.Combine(hash, 1); } hash = BinderHelper.AddArgHashes(hash, _argumentInfo); return(hash); }
public int GetGetBinderEquivalenceHash() { int hash = _callingContext?.GetHashCode() ?? 0; if (ResultIndexed) { hash = HashHelpers.Combine(hash, 1); } hash = HashHelpers.Combine(hash, Name.GetHashCode()); hash = BinderHelper.AddArgHashes(hash, _argumentInfo); return(hash); }
////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="CSharpSetIndexBinder" />. /// </summary> /// <param name="isCompoundAssignment">True if the assignment comes from a compound assignment in source.</param> /// <param name="callingContext">The <see cref="System.Type"/> that indicates where this operation is defined.</param> /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param> public CSharpSetIndexBinder( bool isCompoundAssignment, bool isChecked, Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) : base(BinderHelper.CreateCallInfo(argumentInfo, 2)) // discard 2 arguments: the target object and the value { _bIsCompoundAssignment = isCompoundAssignment; _isChecked = isChecked; _callingContext = callingContext; _argumentInfo = BinderHelper.ToList(argumentInfo); _binder = RuntimeBinder.GetInstance(); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpUnaryOperationBinder"/> class. /// </summary> /// <param name="operation">The unary operation kind.</param> /// <param name="isChecked">True if the operation is defined in a checked context; otherwise, false.</param> /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param> public CSharpUnaryOperationBinder( ExpressionType operation, bool isChecked, Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) : base(operation) { IsChecked = isChecked; CallingContext = callingContext; _argumentInfo = BinderHelper.ToList(argumentInfo); Debug.Assert(_argumentInfo.Count == 1); _binder = RuntimeBinder.GetInstance(); }
////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="SetMemberBinder" />. /// </summary> /// <param name="name">The name of the member to get.</param> /// <param name="isCompoundAssignment">True if the assignment comes from a compound assignment in source.</param> /// <param name="callingContext">The <see cref="System.Type"/> that indicates where this operation is defined.</param> /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param> public CSharpSetMemberBinder( string name, bool isCompoundAssignment, bool isChecked, Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) : base(name, false) { _bIsCompoundAssignment = isCompoundAssignment; _isChecked = isChecked; _callingContext = callingContext; _argumentInfo = BinderHelper.ToList(argumentInfo); _binder = RuntimeBinder.GetInstance(); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpInvokeMemberBinder" />. /// </summary> /// <param name="flags">Extra information about this operation that is not specific to any particular argument.</param> /// <param name="name">The name of the member to invoke.</param> /// <param name="callingContext">The <see cref="System.Type"/> that indicates where this operation is defined.</param> /// <param name="typeArguments">The list of user-specified type arguments to this call.</param> /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param> public CSharpInvokeMemberBinder( CSharpCallFlags flags, string name, Type callingContext, IEnumerable <Type> typeArguments, IEnumerable <CSharpArgumentInfo> argumentInfo) : base(name, false, BinderHelper.CreateCallInfo(argumentInfo, 1)) // discard 1 argument: the target object (even if static, arg is type) { Flags = flags; CallingContext = callingContext; _typeArguments = BinderHelper.ToList(typeArguments); _argumentInfo = BinderHelper.ToList(argumentInfo); _binder = RuntimeBinder.GetInstance(); }
/// <summary> /// Performs the binding of the dynamic convert operation if the target dynamic object cannot bind. /// </summary> /// <param name="target">The target of the dynamic convert operation.</param> /// <param name="errorSuggestion">The binding result to use if binding fails, or null.</param> /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns> public override DynamicMetaObject FallbackConvert(DynamicMetaObject target, DynamicMetaObject errorSuggestion) { #if ENABLECOMBINDER DynamicMetaObject com; if (ComInterop.ComBinder.TryConvert(this, target, out com)) { return(com); } #else BinderHelper.ThrowIfUsingDynamicCom(target); #endif BinderHelper.ValidateBindArgument(target, nameof(target)); return(BinderHelper.Bind(this, _binder, new[] { target }, null, errorSuggestion)); }
////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="CSharpBinaryOperationBinder"/> class. /// </summary> /// <param name="operation">The binary operation kind.</param> /// <param name="isChecked">True if the operation is defined in a checked context; otherwise false.</param> /// <param name="binaryOperationFlags">The flags associated with this binary operation.</param> /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param> public CSharpBinaryOperationBinder( ExpressionType operation, bool isChecked, CSharpBinaryOperationFlags binaryOperationFlags, Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) : base(operation) { m_isChecked = isChecked; m_binopFlags = binaryOperationFlags; m_callingContext = callingContext; m_argumentInfo = BinderHelper.ToList(argumentInfo); Debug.Assert(m_argumentInfo.Count == 2); m_binder = RuntimeBinder.GetInstance(); }
////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="CSharpBinaryOperationBinder"/> class. /// </summary> /// <param name="operation">The binary operation kind.</param> /// <param name="isChecked">True if the operation is defined in a checked context; otherwise false.</param> /// <param name="binaryOperationFlags">The flags associated with this binary operation.</param> /// <param name="callingContext">The <see cref="Type"/> that indicates where this operation is defined.</param> /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param> public CSharpBinaryOperationBinder( ExpressionType operation, bool isChecked, CSharpBinaryOperationFlags binaryOperationFlags, Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo) : base(operation) { IsChecked = isChecked; _binopFlags = binaryOperationFlags; CallingContext = callingContext; _argumentInfo = BinderHelper.ToArray(argumentInfo); Debug.Assert(_argumentInfo.Length == 2); _binder = RuntimeBinder.GetInstance(); }