public virtual bool TryUnaryOperation(UnaryOperationBinder binder, out object result);
public override bool TryUnaryOperation(UnaryOperationBinder binder, out object result) { result = this; return(true); }
public override DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder) { return(PostProcessBindResult(metaDynamic.BindUnaryOperation(binder))); }
/// <summary> /// Performs the binding of the dynamic unary operation. /// </summary> /// <param name="binder">An instance of the <see cref="UnaryOperationBinder"/> that represents the details of the dynamic operation.</param> /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns> public virtual DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder) { ContractUtils.RequiresNotNull(binder, "binder"); return binder.FallbackUnaryOperation(this); }
public override DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder) { return(base.BindUnaryOperation(binder)); }
public override DynamicMetaObject/*!*/ BindUnaryOperation(UnaryOperationBinder/*!*/ binder) { return PythonProtocol.Operation(binder, this, null); }
public override DynamicMetaObject BindUnaryOperation( UnaryOperationBinder binder ) { DEBUG.IndentLine( "\n-- BindUnaryOperation: {0}", binder.Operation ); var obj = (DynamicNode)this.Value; var node = new DynamicNode.Unary( binder.Operation, obj ) { _Parser = obj._Parser }; obj._Parser._LastNode = node; // If operation is 'IsTrue' or 'IsFalse', we will return false to keep the engine working... object ret = node; if( binder.Operation == ExpressionType.IsTrue ) ret = (object)false; if( binder.Operation == ExpressionType.IsFalse ) ret = (object)false; var par = Expression.Variable( ret.GetType(), "ret" ); // the type is now obtained from "ret" var exp = Expression.Block( new ParameterExpression[] { par }, Expression.Assign( par, Expression.Constant( ret ) ) // the expression is now obtained from "ret" ); DEBUG.Unindent(); return new DynamicMetaNode( exp, this.Restrictions, node ); }
public override DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder) { return(binder.FallbackUnaryOperation(_baseMetaObject, AddTypeRestrictions(_metaObject.BindUnaryOperation(binder)))); }
public sealed override DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder) => VariantValue.BindUnaryOperation(binder);
public override bool TryUnaryOperation(UnaryOperationBinder binder, out object result) { if (binder.Operation == ExpressionType.Increment) { if (this._value is short) { result = (short)this._value + 1; return(true); } else if (this._value is int) { result = (int)this._value + 1; return(true); } else if (this._value is long) { result = (long)this._value + 1; return(true); } else if (this._value is ushort) { result = (ushort)this._value + 1; return(true); } else if (this._value is uint) { result = (uint)this._value + 1; return(true); } else if (this._value is ulong) { result = (ulong)this._value + 1; return(true); } else if (this._value is decimal) { result = (decimal)this._value + 1; return(true); } else if (this._value is float) { result = (float)this._value + 1; return(true); } else if (this._value is double) { result = (double)this._value + 1; return(true); } } else if (binder.Operation == ExpressionType.Decrement) { if (this._value is short) { result = (short)this._value - 1; return(true); } else if (this._value is int) { result = (int)this._value - 1; return(true); } else if (this._value is long) { result = (long)this._value - 1; return(true); } else if (this._value is ushort) { result = (ushort)this._value - 1; return(true); } else if (this._value is uint) { result = (uint)this._value - 1; return(true); } else if (this._value is ulong) { result = (ulong)this._value - 1; return(true); } else if (this._value is decimal) { result = (decimal)this._value - 1; return(true); } else if (this._value is float) { result = (float)this._value - 1; return(true); } else if (this._value is double) { result = (double)this._value - 1; return(true); } } else if (binder.Operation == ExpressionType.Not) { if (this._value is bool) { result = !(bool)this._value; return(true); } //TODO: support numeric types? } else if (binder.Operation == ExpressionType.OnesComplement) { if (this._value is short) { result = ~(short)this._value; return(true); } else if (this._value is int) { result = ~(int)this._value; return(true); } else if (this._value is long) { result = ~(long)this._value; return(true); } else if (this._value is ushort) { result = ~(ushort)this._value; return(true); } else if (this._value is uint) { result = ~(uint)this._value; return(true); } else if (this._value is ulong) { result = ~(ulong)this._value; return(true); } } return(base.TryUnaryOperation(binder, out result)); }
public override DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder) { return(BuildCallSelf(_unaryMethod, Expression.Constant(ConvertUnaryOperation(binder.Operation)))); }
protected abstract void WriteUnaryOperationBinder(UnaryOperationBinder unaryOperationBinder, IList <Expression> args);
} // func BindSetMember public override DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder) { return(GetTargetDynamicCall(binder, binder.ReturnType)); } // func BindUnaryOperation
protected virtual void WriteUnaryOperationBinder(UnaryOperationBinder unaryOperationBinder, IList <Expression> args) => throw new NotImplementedException();
public override DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder) { return(AddRestrictions(_metaForwardee.BindUnaryOperation(binder))); }
/// <summary> /// Performs the binding of the dynamic unary operation. /// </summary> /// <param name="binder">An instance of the <see cref="UnaryOperationBinder"/> that represents the details of the dynamic operation.</param> /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns> public virtual DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder) { ContractUtils.RequiresNotNull(binder, "binder"); return(binder.FallbackUnaryOperation(this)); }
public virtual bool TryUnaryOperation(UnaryOperationBinder binder, out object result) { result = null; return false; }
// Token: 0x06000D9D RID: 3485 RVA: 0x00049113 File Offset: 0x00047313 public virtual bool xmethod_2441(T arg_0, UnaryOperationBinder arg_1, out object arg_2) { arg_2 = null; return(false); }
public static DynamicMetaObject/*!*/ Operation(UnaryOperationBinder/*!*/ operation, DynamicMetaObject arg, DynamicMetaObject errorSuggestion) { PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "Fallback UnaryOperator " + " " + operation.Operation + " " + arg.LimitType.FullName); PerfTrack.NoteEvent(PerfTrack.Categories.BindingTarget, operation.Operation.ToString()); DynamicMetaObject[] args = new[] { arg }; if (arg.NeedsDeferral()) { return operation.Defer(arg); } ValidationInfo valInfo = BindingHelpers.GetValidationInfo(args); DynamicMetaObject res = null; Type retType = typeof(object); switch (operation.Operation) { case ExpressionType.UnaryPlus: res = BindingHelpers.AddPythonBoxing(MakeUnaryOperation(operation, arg, "__pos__", errorSuggestion)); break; case ExpressionType.Negate: res = BindingHelpers.AddPythonBoxing(MakeUnaryOperation(operation, arg, "__neg__", errorSuggestion)); break; case ExpressionType.OnesComplement: res = BindingHelpers.AddPythonBoxing(MakeUnaryOperation(operation, arg, "__invert__", errorSuggestion)); break; case ExpressionType.Not: res = MakeUnaryNotOperation(operation, arg, typeof(object), errorSuggestion); break; case ExpressionType.IsFalse: res = MakeUnaryNotOperation(operation, arg, typeof(bool), errorSuggestion); retType = typeof(bool); break; case ExpressionType.IsTrue: res = PythonProtocol.ConvertToBool(operation, arg); retType = typeof(bool); break; default: res = TypeError(operation, "unknown operation: " + operation.ToString(), args); break; } return BindingHelpers.AddDynamicTestAndDefer(operation, res, args, valInfo, retType); }
public override bool TryUnaryOperation(UnaryOperationBinder binder, out object result) { var eng = GetEngine(); switch (binder.Operation) { case ExpressionType.IsFalse: result = !IsTruthy; return(true); case ExpressionType.IsTrue: result = IsTruthy; return(true); case ExpressionType.Negate: case ExpressionType.NegateChecked: switch (Type) { case JavaScriptValueType.Number: double n = eng.Converter.ToDouble(this); result = -n; return(true); case JavaScriptValueType.Boolean: if (IsTruthy) { result = -1; } else { result = -0; } return(true); // TODO // case JavaScriptValueType.String: } result = double.NaN; return(true); case ExpressionType.UnaryPlus: switch (Type) { case JavaScriptValueType.Number: result = eng.Converter.ToDouble(this); return(true); case JavaScriptValueType.Boolean: if (IsTruthy) { result = 1; } else { result = 0; } return(true); } result = double.NaN; return(true); } return(base.TryUnaryOperation(binder, out result)); }
public override bool TryUnaryOperation(UnaryOperationBinder binder, out object result) { Console.WriteLine("Unary op \"{0}\"", binder.Operation); result = new RichDynamo(); return(true); }
public override DynamicMetaObject /*!*/ BindUnaryOperation(UnaryOperationBinder /*!*/ binder) { PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "OldClass UnaryOperation" + binder.Operation); PerfTrack.NoteEvent(PerfTrack.Categories.BindingTarget, "OldClass UnaryOperation"); return(PythonProtocol.Operation(binder, this, null)); }
public override bool TryUnaryOperation(UnaryOperationBinder binder, out object result) { result = null; return(false); }
/// <summary> /// Forwads the unary operation /// </summary> /// <param name="binder"></param> /// <param name="result"></param> /// <returns></returns> public override bool TryUnaryOperation(UnaryOperationBinder binder, out object result) { return(RemoteInvoke(new Invocation(InvocationKind.NotSet, "_UnaryOperator", new[] { binder.Operation }), out result)); }
public static DynamicMetaObject /*!*/ Bind(DynamicMetaObject /*!*/ context, UnaryOperationBinder /*!*/ binder, DynamicMetaObject /*!*/ target, Func <DynamicMetaObject, DynamicMetaObject> /*!*/ fallback) { return(InvokeMember.Bind(context, RubyUtils.MapOperator(binder.Operation), _CallInfo, binder, target, DynamicMetaObject.EmptyMetaObjects, (trgt, _) => fallback(trgt) )); }
public override bool TryUnaryOperation(UnaryOperationBinder binder, out object result) { if (binder.Operation == ExpressionType.Negate) { result = new NegatableNum(unchecked(-Value)); return true; } result = null; return false; }
public override bool TryUnaryOperation(UnaryOperationBinder binder, out object result) { Assert.AreEqual(_type, binder.Operation); result = _type; return(true); }
public override DynamicMetaObject /*!*/ BindUnaryOperation(UnaryOperationBinder /*!*/ binder) { return(PythonProtocol.Operation(binder, this, null)); }
public virtual DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder);
public override DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder) { throw new NotImplementedException(); }
public virtual bool TryUnaryOperation(T instance, UnaryOperationBinder binder, out object result) { result = null; return(false); }
public override DynamicMetaObject /*!*/ BindUnaryOperation(UnaryOperationBinder /*!*/ binder) { return(InteropBinder.UnaryOperation.Bind(CreateMetaContext(), binder, this, binder.FallbackUnaryOperation)); }
public override DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder) { return(IsOverridden("TryUnaryOperation") ? CallMethodWithResult("TryUnaryOperation", binder, NoArgs, e => binder.FallbackUnaryOperation(this, e)) : base.BindUnaryOperation(binder)); }
internal CallSiteBinder GetUnaryCallSite(ExpressionType type) { UnaryOperationBinder unaryOp; if (!unaryOps.TryGetValue(type, out unaryOp)) { unaryOp = new UnaryOperationBinder(type); unaryOps[type] = unaryOp; } return unaryOp; }
public override DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder) { if (IsOverridden("TryUnaryOperation")) { return CallMethodWithResult("TryUnaryOperation", binder, NoArgs, (e) => binder.FallbackUnaryOperation(this, e)); } return base.BindUnaryOperation(binder); }
public virtual Object UnaryOperation(UnaryOperationBinder binder) { throw Fallback(); }
public static DynamicMetaObject Operation(UnaryOperationBinder operation, DynamicMetaObject arg, DynamicMetaObject errorSuggestion) { PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "Fallback UnaryOperator " + " " + operation.Operation + " " + arg.LimitType.FullName); PerfTrack.NoteEvent(PerfTrack.Categories.BindingTarget, operation.Operation.ToString()); DynamicMetaObject[] args = new[] { arg }; if (arg.NeedsDeferral()) return operation.Defer(arg); ValidationInfo valInfo = BindingHelpers.GetValidationInfo(args); TotemOperationKind? toOperator = null; Type retType = typeof(object); bool box = true; bool inverse = false; switch (operation.Operation) { case ExpressionType.UnaryPlus: toOperator = TotemOperationKind.Positive; break; case ExpressionType.Negate: toOperator = TotemOperationKind.Negate; break; case ExpressionType.OnesComplement: toOperator = TotemOperationKind.OnesComplement; break; case ExpressionType.Not: toOperator = TotemOperationKind.Not; box = false; break; case ExpressionType.IsFalse: toOperator = TotemOperationKind.IsFalse; box = false; retType = typeof(bool); break; case ExpressionType.IsTrue: toOperator = TotemOperationKind.IsFalse; box = false; retType = typeof(bool); inverse = true; break; } DynamicMetaObject res = null; if (toOperator != null) res = MakeUnaryOperation(operation, args[0], toOperator.Value, errorSuggestion, retType); else res = operation.FallbackUnaryOperation(arg); if (inverse) { res = new DynamicMetaObject( Expression.Condition( res.Expression, Utils.Constant(ScriptingRuntimeHelpers.False), Utils.Constant(ScriptingRuntimeHelpers.True) ), res.Restrictions ); } if (box) { res = BindingHelpers.AddTotemBoxing(res); } return BindingHelpers.AddDynamicTestAndDefer(operation, res, args, valInfo, retType); }
public override bool TryUnaryOperation(UnaryOperationBinder binder, out object result) { return(base.TryUnaryOperation(binder, out result)); }
public override DynamicMetaObject/*!*/ BindUnaryOperation(UnaryOperationBinder/*!*/ binder) { PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "OldClass UnaryOperation" + binder.Operation); PerfTrack.NoteEvent(PerfTrack.Categories.BindingTarget, "OldClass UnaryOperation"); return PythonProtocol.Operation(binder, this); }
public virtual DynamicMetaObject \u200F(UnaryOperationBinder _param1) { // ISSUE: unable to decompile the method. }