public static DynamicMetaObject/*!*/ Operation(BinaryOperationBinder/*!*/ operation, DynamicMetaObject target, DynamicMetaObject arg, DynamicMetaObject errorSuggestion) { PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "Fallback BinaryOperator " + target.LimitType.FullName + " " + operation.Operation + " " + arg.LimitType.FullName); PerfTrack.NoteEvent(PerfTrack.Categories.BindingTarget, operation.Operation.ToString()); DynamicMetaObject[] args = new[] { target, arg }; if (BindingHelpers.NeedsDeferral(args)) { return operation.Defer(target, arg); } ValidationInfo valInfo = BindingHelpers.GetValidationInfo(args); PythonOperationKind? pyOperator = null; switch (operation.Operation) { case ExpressionType.Add: pyOperator = PythonOperationKind.Add; break; case ExpressionType.And: pyOperator = PythonOperationKind.BitwiseAnd; break; case ExpressionType.Divide: pyOperator = PythonOperationKind.Divide; break; case ExpressionType.ExclusiveOr: pyOperator = PythonOperationKind.ExclusiveOr; break; case ExpressionType.Modulo: pyOperator = PythonOperationKind.Mod; break; case ExpressionType.Multiply: pyOperator = PythonOperationKind.Multiply; break; case ExpressionType.Or: pyOperator = PythonOperationKind.BitwiseOr; break; case ExpressionType.Power: pyOperator = PythonOperationKind.Power; break; case ExpressionType.RightShift: pyOperator = PythonOperationKind.RightShift; break; case ExpressionType.LeftShift: pyOperator = PythonOperationKind.LeftShift; break; case ExpressionType.Subtract: pyOperator = PythonOperationKind.Subtract; break; case ExpressionType.AddAssign: pyOperator = PythonOperationKind.InPlaceAdd; break; case ExpressionType.AndAssign: pyOperator = PythonOperationKind.InPlaceBitwiseAnd; break; case ExpressionType.DivideAssign: pyOperator = PythonOperationKind.InPlaceDivide; break; case ExpressionType.ExclusiveOrAssign: pyOperator = PythonOperationKind.InPlaceExclusiveOr; break; case ExpressionType.ModuloAssign: pyOperator = PythonOperationKind.InPlaceMod; break; case ExpressionType.MultiplyAssign: pyOperator = PythonOperationKind.InPlaceMultiply; break; case ExpressionType.OrAssign: pyOperator = PythonOperationKind.InPlaceBitwiseOr; break; case ExpressionType.PowerAssign: pyOperator = PythonOperationKind.InPlacePower; break; case ExpressionType.RightShiftAssign: pyOperator = PythonOperationKind.InPlaceRightShift; break; case ExpressionType.LeftShiftAssign: pyOperator = PythonOperationKind.InPlaceLeftShift; break; case ExpressionType.SubtractAssign: pyOperator = PythonOperationKind.InPlaceSubtract; break; case ExpressionType.Equal: pyOperator = PythonOperationKind.Equal; break; case ExpressionType.GreaterThan: pyOperator = PythonOperationKind.GreaterThan; break; case ExpressionType.GreaterThanOrEqual: pyOperator = PythonOperationKind.GreaterThanOrEqual; break; case ExpressionType.LessThan: pyOperator = PythonOperationKind.LessThan; break; case ExpressionType.LessThanOrEqual: pyOperator = PythonOperationKind.LessThanOrEqual; break; case ExpressionType.NotEqual: pyOperator = PythonOperationKind.NotEqual; break; } DynamicMetaObject res = null; if (pyOperator != null) { res = MakeBinaryOperation(operation, args, pyOperator.Value, errorSuggestion); } else { res = operation.FallbackBinaryOperation(target, arg); } return BindingHelpers.AddDynamicTestAndDefer(operation, BindingHelpers.AddPythonBoxing(res), args, valInfo); }
/// <summary> /// Provides the implementation of performing AddAssign and SubtractAssign binary operations. /// </summary> /// <param name="binder">The binder provided by the call site.</param> /// <param name="handler">The handler for the operation.</param> /// <param name="result">The result of the operation.</param> /// <returns>true if the operation is complete, false if the call site should determine behavior.</returns> public override bool TryBinaryOperation(BinaryOperationBinder binder, object handler, out object result) { if (binder.Operation == ExpressionType.AddAssign) { result = InPlaceAdd(handler); return true; } if (binder.Operation == ExpressionType.SubtractAssign) { result = InPlaceSubtract(handler); return true; } result = null; return false; }
public virtual bool TryBinaryOperation(T instance, BinaryOperationBinder binder, object arg, out object result) { result = null; return(false); }
/// <summary> /// 调用 varo + varo; 时执行 /// dynamic varo = new VarObject(); /// </summary> /// <param name="binder"></param> /// <param name="arg"></param> /// <param name="result"></param> /// <returns></returns> public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result) { return(base.TryBinaryOperation(binder, arg, out result)); }
public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) { return(AddRestrictions(_metaForwardee.BindBinaryOperation(binder, arg))); }
public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result) { if (binder.Operation == ExpressionType.Add) { AddableNum addend = arg as AddableNum; if (addend != null) { result = new Accumulator(Value + addend.Value); return true; } } result = null; return false; }
public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result) { if (binder.Operation == ExpressionType.LeftShiftAssign && _nodeType == NodeType.Element) { InternalContent = arg; result = this; return(true); } if (binder.Operation == ExpressionType.LeftShiftAssign && _nodeType == NodeType.Attribute) { InternalValue = arg; result = this; return(true); } switch (binder.Operation) { case ExpressionType.LeftShift: { if (arg is string) { var exp = new ElasticObject(arg as string, null) { _nodeType = NodeType.Element }; AddElement(exp); result = exp; return(true); } if (!(arg is ElasticObject)) { return(base.TryBinaryOperation(binder, arg, out result)); } var eobj = arg as ElasticObject; if (!Elements.Contains(eobj)) { AddElement(eobj); } result = eobj; return(true); } case ExpressionType.LessThan: { var memberName = ""; if (arg is string) { memberName = arg as string; if (HasAttribute(memberName)) { throw new InvalidOperationException("An attribute with name" + memberName + " already exists"); } var att = new ElasticObject(memberName, null); AddAttribute(memberName, att); result = att; return(true); } if (!(arg is ElasticObject)) { return(base.TryBinaryOperation(binder, arg, out result)); } var eobj = arg as ElasticObject; AddAttribute(memberName, eobj); result = eobj; return(true); } case ExpressionType.GreaterThan: { if (!(arg is FormatType)) { return(base.TryBinaryOperation(binder, arg, out result)); } result = this.ToXElement(); return(true); } } return(base.TryBinaryOperation(binder, arg, out result)); }
} // func BindInvokeMember public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) { return(GetTargetDynamicCall(binder, binder.ReturnType, arg)); } // func BindBinaryOperation
public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) { return(BuildCallSelf(_binaryMethod, Expression.Constant(binder.Operation), arg.Expression.Convert(typeof(object)))); }
/// <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 override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) { if (binder == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("binder")); } if (arg == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("arg")); } Expression thisExpression = this.Expression; Expression otherExpression = arg.Expression; Expression operExpression = null; JsonValue otherValue = arg.Value as JsonValue; JsonValue thisValue = this.Value as JsonValue; OperationSupport supportValue = JsonValueDynamicMetaObject.GetBinaryOperationSupport(binder.Operation, thisValue, arg.Value); if (supportValue == OperationSupport.Supported) { if (otherValue != null) { if (thisValue is JsonPrimitive && otherValue is JsonPrimitive) { //// operation on primitive types. JsonValueDynamicMetaObject.GetBinaryOperandExpressions(binder.Operation, this, arg, ref thisExpression, ref otherExpression); } else { //// operation on JsonValue types. thisExpression = Expression.Convert(thisExpression, typeof(JsonValue)); otherExpression = Expression.Convert(otherExpression, typeof(JsonValue)); } } else { if (arg.Value != null) { //// operation on JSON primitive and CLR primitive JsonValueDynamicMetaObject.GetBinaryOperandExpressions(binder.Operation, this, arg, ref thisExpression, ref otherExpression); } else { //// operation on JsonValue and null. thisExpression = Expression.Convert(thisExpression, typeof(JsonValue)); if (thisValue.JsonType == JsonType.Default) { thisExpression = Expression.Constant(null); } } } operExpression = JsonValueDynamicMetaObject.GetBinaryOperationExpression(binder.Operation, thisExpression, otherExpression); } if (operExpression == null) { operExpression = JsonValueDynamicMetaObject.GetOperationErrorExpression(supportValue, binder.Operation, thisValue, arg.Value); } operExpression = Expression.Convert(operExpression, typeof(object)); return(new DynamicMetaObject(operExpression, this.DefaultRestrictions)); }
public static DynamicMetaObject /*!*/ Bind(DynamicMetaObject /*!*/ context, BinaryOperationBinder /*!*/ binder, DynamicMetaObject /*!*/ target, DynamicMetaObject /*!*/ arg, Func <DynamicMetaObject, DynamicMetaObject, DynamicMetaObject> /*!*/ fallback) { return(InvokeMember.Bind(context, RubyUtils.MapOperator(binder.Operation), _CallInfo, binder, target, new[] { arg }, (trgt, args) => fallback(trgt, args[0]) )); }
public BinaryOperationExpression(Expression left, Expression right, SourceInfo sourceInfo, BinaryOperationBinder binder) : base(left, right, sourceInfo) { _binder = binder; }
public Object BinaryOperation(BinaryOperationBinder binder, Object arg) { throw Fallback(); }
// Token: 0x06000E9A RID: 3738 RVA: 0x0004D234 File Offset: 0x0004B434 public virtual bool nmethod_1(Class_362 arg_0, BinaryOperationBinder arg_1, object obje_0, out object arg_2) { object obje_ = (obje_0 is Class_362) ? ((Class_362)obje_0).prop_2 : obje_0; ExpressionType operation = arg_1.Operation; if (operation <= ExpressionType.NotEqual) { if (operation <= ExpressionType.LessThanOrEqual) { if (operation != ExpressionType.Add) { switch (operation) { case ExpressionType.Divide: break; case ExpressionType.Equal: arg_2 = (Class_362.xmethod_2591(arg_0.prop_3, arg_0.prop_2, obje_) == 0); return(true); case ExpressionType.ExclusiveOr: case ExpressionType.Invoke: case ExpressionType.Lambda: case ExpressionType.LeftShift: goto IL_1AE; case ExpressionType.GreaterThan: arg_2 = (Class_362.xmethod_2591(arg_0.prop_3, arg_0.prop_2, obje_) > 0); return(true); case ExpressionType.GreaterThanOrEqual: arg_2 = (Class_362.xmethod_2591(arg_0.prop_3, arg_0.prop_2, obje_) >= 0); return(true); case ExpressionType.LessThan: arg_2 = (Class_362.xmethod_2591(arg_0.prop_3, arg_0.prop_2, obje_) < 0); return(true); case ExpressionType.LessThanOrEqual: arg_2 = (Class_362.xmethod_2591(arg_0.prop_3, arg_0.prop_2, obje_) <= 0); return(true); default: goto IL_1AE; } } } else if (operation != ExpressionType.Multiply) { if (operation != ExpressionType.NotEqual) { goto IL_1AE; } arg_2 = (Class_362.xmethod_2591(arg_0.prop_3, arg_0.prop_2, obje_) != 0); return(true); } } else if (operation <= ExpressionType.DivideAssign) { if (operation != ExpressionType.Subtract) { switch (operation) { case ExpressionType.AddAssign: case ExpressionType.DivideAssign: break; case ExpressionType.AndAssign: goto IL_1AE; default: goto IL_1AE; } } } else if (operation != ExpressionType.MultiplyAssign && operation != ExpressionType.SubtractAssign) { goto IL_1AE; } if (Class_362.gmethod_2593(arg_1.Operation, arg_0.prop_2, obje_, out arg_2)) { arg_2 = new Class_362(arg_2); return(true); } IL_1AE: arg_2 = null; return(false); }
// binders protected abstract void WriteBinaryOperationBinder(BinaryOperationBinder binaryOperationBinder, IList <Expression> args);
internal CallSiteBinder GetBinaryCallSite(ExpressionType type) { BinaryOperationBinder binaryOp; if (!binaryOps.TryGetValue(type, out binaryOp)) { binaryOp = new BinaryOperationBinder(type); binaryOps[type] = binaryOp; } return binaryOp; }
public virtual bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result) { result = null; return false; }
public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result) { HandleLookup(); result = null; return(false); }
public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result) { string metamethodName; var switchOperands = false; //Lua has only comparison metamethods for less, so for greater the we have to switch the operands var negateResult = false; //Lua has only metamethods for equal, so we need this trick here. switch (binder.Operation) { //Math case ExpressionType.Add: case ExpressionType.AddChecked: case ExpressionType.AddAssign: case ExpressionType.AddAssignChecked: //TODO: Thing about __concat metamethodName = "add"; break; case ExpressionType.Subtract: case ExpressionType.SubtractChecked: case ExpressionType.SubtractAssign: case ExpressionType.SubtractAssignChecked: metamethodName = "sub"; break; case ExpressionType.Multiply: case ExpressionType.MultiplyChecked: case ExpressionType.MultiplyAssign: case ExpressionType.MultiplyAssignChecked: metamethodName = "mul"; break; case ExpressionType.Divide: case ExpressionType.DivideAssign: metamethodName = "div"; break; case ExpressionType.Modulo: case ExpressionType.ModuloAssign: metamethodName = "mod"; break; case ExpressionType.Power: case ExpressionType.PowerAssign: metamethodName = "pow"; break; //Logic Tests case ExpressionType.Equal: metamethodName = "eq"; break; case ExpressionType.NotEqual: metamethodName = "eq"; negateResult = true; break; case ExpressionType.GreaterThan: metamethodName = "lt"; switchOperands = true; break; case ExpressionType.GreaterThanOrEqual: metamethodName = "le"; switchOperands = true; break; case ExpressionType.LessThan: metamethodName = "lt"; break; case ExpressionType.LessThanOrEqual: metamethodName = "le"; break; default: //This operation is not supported by Lua... result = null; return(false); } var mtFunc = GetMetaFunction(metamethodName); if (mtFunc == null) { result = null; return(false); } if (!switchOperands) { //Metamethods just return one value, or the other will be ignored anyway result = mtFunc.Call(_table, LuaHelper.WrapObject(arg, _state)) [0]; } else { result = mtFunc.Call(LuaHelper.WrapObject(arg, _state), _table)[0]; } //We can't negate if its not bool. If the metamethod returned someting other than bool and ~= is called there will be a bug. (But who would do this?) if (negateResult && result is bool b) { result = !b; } return(true); }
public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) { return(binder.FallbackBinaryOperation(_baseMetaObject, arg, AddTypeRestrictions(_metaObject.BindBinaryOperation(binder, arg)))); }
public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) { return(scriptItem.PostProcessBindResult(metaDynamic.BindBinaryOperation(binder, arg))); }
public sealed override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) => VariantValue.BindBinaryOperation(binder, arg);
/// <summary> /// Forwards the binary operation /// </summary> /// <param name="binder"></param> /// <param name="arg"></param> /// <param name="result"></param> /// <returns></returns> public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result) { return(RemoteInvoke(new Invocation(InvocationKind.NotSet, "_BinaryOperator", new [] { binder.Operation, arg }), out result)); }
public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result) { Console.WriteLine("System.Windows.Interop.ComAutomationEventMetaObjectProvider.TryBinaryOperation: NIEX"); throw new NotImplementedException(); }
public override DynamicMetaObject /*!*/ BindBinaryOperation(BinaryOperationBinder /*!*/ binder, DynamicMetaObject /*!*/ arg) { return(PythonProtocol.Operation(binder, this, arg, null)); }
/// <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)); }
public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) { throw new NotImplementedException(); }
// Token: 0x06000D92 RID: 3474 RVA: 0x0004910C File Offset: 0x0004730C public virtual bool smethod_2430(T arg_0, BinaryOperationBinder arg_1, object obje_0, out object arg_2) { arg_2 = null; return(false); }
public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) { return(IsOverridden("TryBinaryOperation") ? CallMethodWithResult("TryBinaryOperation", binder, GetArgs(arg), e => binder.FallbackBinaryOperation(this, arg, e)) : base.BindBinaryOperation(binder, arg)); }
/// <summary> /// Performs the binding of the dynamic binary operation. /// </summary> /// <param name="binder">An instance of the System.Dynamic.BinaryOperationBinder that represents the details of the dynamic operation.</param> /// <param name="arg"> An instance of the System.Dynamic.DynamicMetaObject representing the right hand side of the binary operation.</param> /// <returns>The new System.Dynamic.DynamicMetaObject representing the result of the binding.</returns> public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) { return(Underlying.BindBinaryOperation(binder, arg)); }
public override DynamicMetaObject /*!*/ BindBinaryOperation(BinaryOperationBinder /*!*/ binder, DynamicMetaObject /*!*/ arg) { return(InteropBinder.BinaryOperation.Bind(CreateMetaContext(), binder, this, arg, binder.FallbackBinaryOperation)); }
/// <summary> /// Override on DynamicObject /// </summary> /// <param name="binder"></param> /// <param name="arg"></param> /// <param name="result"></param> /// <returns></returns> public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result) { result = new Mimic(); return(true); }
/// <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); }
public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result) { Assert.AreEqual(_type, binder.Operation); result = _type; return(true); }
public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) { if (IsOverridden("TryBinaryOperation")) { return CallMethodWithResult("TryBinaryOperation", binder, GetArgs(arg), (e) => binder.FallbackBinaryOperation(this, arg, e)); } return base.BindBinaryOperation(binder, arg); }
public override DynamicMetaObject /*!*/ BindBinaryOperation(BinaryOperationBinder /*!*/ binder, DynamicMetaObject /*!*/ arg) { PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "OldClass BinaryOperation" + binder.Operation); PerfTrack.NoteEvent(PerfTrack.Categories.BindingTarget, "OldClass BinaryOperation"); return(PythonProtocol.Operation(binder, this, arg, null)); }
public override DynamicMetaObject/*!*/ BindBinaryOperation(BinaryOperationBinder/*!*/ binder, DynamicMetaObject/*!*/ arg) { return PythonProtocol.Operation(binder, this, arg, null); }
public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result) { IntPtr res; if (!(arg is PyObject)) { arg = arg.ToPython(); } switch (binder.Operation) { case ExpressionType.Add: res = Runtime.Interop.PyNumber_Add(this.obj, ((PyObject)arg).obj); break; case ExpressionType.AddAssign: res = Runtime.Interop.PyNumber_InPlaceAdd(this.obj, ((PyObject)arg).obj); break; case ExpressionType.Subtract: res = Runtime.Interop.PyNumber_Subtract(this.obj, ((PyObject)arg).obj); break; case ExpressionType.SubtractAssign: res = Runtime.Interop.PyNumber_InPlaceSubtract(this.obj, ((PyObject)arg).obj); break; case ExpressionType.Multiply: res = Runtime.Interop.PyNumber_Multiply(this.obj, ((PyObject)arg).obj); break; case ExpressionType.MultiplyAssign: res = Runtime.Interop.PyNumber_InPlaceMultiply(this.obj, ((PyObject)arg).obj); break; case ExpressionType.Divide: res = Runtime.Interop.PyNumber_Divide(this.obj, ((PyObject)arg).obj); break; case ExpressionType.DivideAssign: res = Runtime.Interop.PyNumber_InPlaceDivide(this.obj, ((PyObject)arg).obj); break; case ExpressionType.And: res = Runtime.Interop.PyNumber_And(this.obj, ((PyObject)arg).obj); break; case ExpressionType.AndAssign: res = Runtime.Interop.PyNumber_InPlaceAnd(this.obj, ((PyObject)arg).obj); break; case ExpressionType.ExclusiveOr: res = Runtime.Interop.PyNumber_Xor(this.obj, ((PyObject)arg).obj); break; case ExpressionType.ExclusiveOrAssign: res = Runtime.Interop.PyNumber_InPlaceXor(this.obj, ((PyObject)arg).obj); break; case ExpressionType.GreaterThan: result = Runtime.PyObject_Compare(this.obj, ((PyObject)arg).obj) > 0; return(true); case ExpressionType.GreaterThanOrEqual: result = Runtime.PyObject_Compare(this.obj, ((PyObject)arg).obj) >= 0; return(true); case ExpressionType.LeftShift: res = Runtime.Interop.PyNumber_Lshift(this.obj, ((PyObject)arg).obj); break; case ExpressionType.LeftShiftAssign: res = Runtime.Interop.PyNumber_InPlaceLshift(this.obj, ((PyObject)arg).obj); break; case ExpressionType.LessThan: result = Runtime.PyObject_Compare(this.obj, ((PyObject)arg).obj) < 0; return(true); case ExpressionType.LessThanOrEqual: result = Runtime.PyObject_Compare(this.obj, ((PyObject)arg).obj) <= 0; return(true); case ExpressionType.Modulo: res = Runtime.Interop.PyNumber_Remainder(this.obj, ((PyObject)arg).obj); break; case ExpressionType.ModuloAssign: res = Runtime.Interop.PyNumber_InPlaceRemainder(this.obj, ((PyObject)arg).obj); break; case ExpressionType.NotEqual: result = Runtime.PyObject_Compare(this.obj, ((PyObject)arg).obj) != 0; return(true); case ExpressionType.Or: res = Runtime.Interop.PyNumber_Or(this.obj, ((PyObject)arg).obj); break; case ExpressionType.OrAssign: res = Runtime.Interop.PyNumber_InPlaceOr(this.obj, ((PyObject)arg).obj); break; case ExpressionType.Power: res = Runtime.Interop.PyNumber_Power(this.obj, ((PyObject)arg).obj); break; case ExpressionType.RightShift: res = Runtime.Interop.PyNumber_Rshift(this.obj, ((PyObject)arg).obj); break; case ExpressionType.RightShiftAssign: res = Runtime.Interop.PyNumber_InPlaceRshift(this.obj, ((PyObject)arg).obj); break; default: result = null; return(false); } result = CheckNone(new PyObject(res)); return(true); }
public override DynamicMetaObject/*!*/ BindBinaryOperation(BinaryOperationBinder/*!*/ binder, DynamicMetaObject/*!*/ arg) { PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "OldClass BinaryOperation" + binder.Operation); PerfTrack.NoteEvent(PerfTrack.Categories.BindingTarget, "OldClass BinaryOperation"); return PythonProtocol.Operation(binder, this, arg, null); }
public override DynamicMetaObject BindBinaryOperation( BinaryOperationBinder binder, DynamicMetaObject arg ) { DEBUG.IndentLine( "\n-- BindBinaryOperation: {0} {1}", binder.Operation, arg.Value == null ? "<null>" : arg.Value.ToString() ); var obj = (DynamicNode)this.Value; var node = new DynamicNode.Binary( obj, binder.Operation, arg.Value ) { _Parser = obj._Parser }; obj._Parser._LastNode = node; var par = Expression.Variable( typeof( DynamicNode ), "ret" ); var exp = Expression.Block( new ParameterExpression[] { par }, Expression.Assign( par, Expression.Constant( node ) ) ); DEBUG.Unindent(); return new DynamicMetaNode( exp, this.Restrictions, node ); }