FallbackBinaryOperation() public method

Performs the binding of the binary dynamic operation if the target dynamic object cannot bind.
public FallbackBinaryOperation ( DynamicMetaObject target, DynamicMetaObject arg ) : DynamicMetaObject
target DynamicMetaObject The target of the dynamic binary operation.
arg DynamicMetaObject The right hand side operand of the dynamic binary operation.
return DynamicMetaObject
コード例 #1
0
            public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg)
            {
                Fallback fallback = null;

                if (!this.IsOverridden("TryBinaryOperation"))
                {
                    return(base.BindBinaryOperation(binder, arg));
                }
                if (fallback == null)
                {
                    fallback = e => binder.FallbackBinaryOperation(this, arg, e);
                }
                return(this.CallMethodWithResult("TryBinaryOperation", binder, GetArgs(new DynamicMetaObject[] { arg }), fallback));
            }
コード例 #2
0
 /// <summary>
 /// Performs the binding of the dynamic binary operation.
 /// </summary>
 /// <param name="binder">An instance of the <see cref="BinaryOperationBinder"/> that represents the details of the dynamic operation.</param>
 /// <param name="arg">An instance of the <see cref="DynamicMetaObject"/> representing the right hand side of the binary operation.</param>
 /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
 public virtual DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg)
 {
     ContractUtils.RequiresNotNull(binder, "binder");
     return(binder.FallbackBinaryOperation(this, arg));
 }
コード例 #3
0
            public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) {
                if (IsOverridden("TryBinaryOperation")) {
                    return CallMethodWithResult("TryBinaryOperation", binder, DynamicMetaObject.GetExpressions(new DynamicMetaObject[] {arg}), (e) => binder.FallbackBinaryOperation(this, arg, e));
                }

                return base.BindBinaryOperation(binder, arg);
            }
コード例 #4
0
            public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg)
            {
                if (IsOverridden("TryBinaryOperation"))
                {
                    return(CallMethodWithResult("TryBinaryOperation", binder, DynamicMetaObject.GetExpressions(new DynamicMetaObject[] { arg }), (e) => binder.FallbackBinaryOperation(this, arg, e)));
                }

                return(base.BindBinaryOperation(binder, arg));
            }
コード例 #5
0
 /// <summary>
 /// Performs the binding of the dynamic binary operation.
 /// </summary>
 /// <param name="binder">An instance of the <see cref="BinaryOperationBinder"/> that represents the details of the dynamic operation.</param>
 /// <param name="arg">An instance of the <see cref="DynamicMetaObject"/> representing the right hand side of the binary operation.</param>
 /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
 public virtual DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) {
     ContractUtils.RequiresNotNull(binder, "binder");
     return binder.FallbackBinaryOperation(this, arg);
 }
コード例 #6
0
ファイル: TotemType.cs プロジェクト: Alxandr/IronTotem
            public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg)
            {
                DynamicMetaObject result = null;
                if (!(arg is TotemType.MetaObject))
                {
                    var lt = arg.LimitType;
                    var handler = _type._context.GetTypeHandler(lt);
                    if (handler != null)
                        handler.GetBinaryOperator(binder.Operation);
                }
                var op = _type.GetBinaryOperator(binder.Operation);
                if (op != null)
                {
                    if (TotemProtocol.TryResolveOverload(binder, _type, new CallInfo(2), TotemProtocol.GetOperationName(binder.Operation), op, null, new[] { this, arg }, out result))
                        return result;
                }

                return binder.FallbackBinaryOperation(this, arg, result);
            }
コード例 #7
0
 /// <summary>
 /// Performs the binding of the dynamic binary operation.
 /// </summary>
 /// <param name="binder">An instance of the <see cref="BinaryOperationBinder"/> that represents the details of the dynamic operation.</param>
 /// <param name="arg">An instance of the <see cref="DynamicMetaObject"/> representing the right hand side of the binary operation.</param>
 /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
 public virtual DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg)
 {
     ArgumentNullException.ThrowIfNull(binder);
     return(binder.FallbackBinaryOperation(this, arg));
 }
コード例 #8
0
 public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg)
 {
     Fallback fallback = null;
     if (!this.IsOverridden("TryBinaryOperation"))
     {
         return base.BindBinaryOperation(binder, arg);
     }
     if (fallback == null)
     {
         fallback = e => binder.FallbackBinaryOperation(this, arg, e);
     }
     return this.CallMethodWithResult("TryBinaryOperation", binder, GetArgs(new DynamicMetaObject[] { arg }), fallback);
 }
コード例 #9
0
 /// <summary>
 ///     Performs the binding of the dynamic binary operation.
 /// </summary>
 /// <param name="binder">
 ///     An instance of the <see cref="T:System.Dynamic.BinaryOperationBinder" /> that represents the details of the dynamic operation.
 /// </param>
 /// <param name="arg">
 ///     An instance of the <see cref="T:System.Dynamic.DynamicMetaObject" /> representing the right hand side of the binary operation.
 /// </param>
 /// <returns>
 ///     The new <see cref="T:System.Dynamic.DynamicMetaObject" /> representing the result of the binding.
 /// </returns>
 public override DynamicMetaObject BindBinaryOperation( BinaryOperationBinder binder, DynamicMetaObject arg )
 {
     return ApplyBinding( meta => meta.BindBinaryOperation( binder, arg ),
                          ( target, errorSuggestion ) =>
                          binder.FallbackBinaryOperation( target, arg, errorSuggestion ) );
 }
コード例 #10
0
 public override DynamicMetaObject BindBinaryOperation( BinaryOperationBinder binder, DynamicMetaObject arg )
 {
     return binder.FallbackBinaryOperation( _baseMetaObject,
                                            arg,
                                            AddTypeRestrictions( _metaObject.BindBinaryOperation( binder, arg ) ) );
 }