public static DynamicMetaObject Operation(TotemOperationBinder operation, params DynamicMetaObject[] args) { if (args.Length == 1) PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "Fallback TotemOp " + " " + operation.Operation + " " + args[0].LimitType); else PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "Fallback TotemOp " + " " + operation.Operation + " " + args[0].LimitType + ", " + args[1].LimitType); PerfTrack.NoteEvent(PerfTrack.Categories.BindingTarget, operation.Operation.ToString()); if (BindingHelpers.NeedsDeferal(args)) return operation.Defer(args); return MakeOperationRule(operation, args); }
private static DynamicMetaObject MakeOperationRule(TotemOperationBinder operation, DynamicMetaObject[] args) { ValidationInfo valInfo = BindingHelpers.GetValidationInfo(args); DynamicMetaObject res; Type deferType = typeof(object); switch(NormalizeOperator(operation.Operation)) { default: res = BindingHelpers.AddTotemBoxing(MakeBinaryOperation(operation, args, operation.Operation, null)); break; } return BindingHelpers.AddDynamicTestAndDefer(operation, res, args, valInfo, deferType); }
internal TotemOperationBinder Operation(TotemOperationKind operation) { if (_operationBinders == null) { Interlocked.CompareExchange( ref _operationBinders, new Dictionary<TotemOperationKind, TotemOperationBinder>(), null ); } lock (_operationBinders) { TotemOperationBinder res; if (!_operationBinders.TryGetValue(operation, out res)) _operationBinders[operation] = res = new TotemOperationBinder(this, operation); return res; } }