CSharpBinaryOperationBinder
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq.Expressions;
namespace Microsoft.CSharp.RuntimeBinder
{
internal sealed class CSharpBinaryOperationBinder : BinaryOperationBinder
{
private bool _isChecked;
private CSharpBinaryOperationFlags _binopFlags;
private Type _callingContext;
private List<CSharpArgumentInfo> _argumentInfo;
private RuntimeBinder _binder;
internal bool IsChecked => _isChecked;
internal bool IsLogicalOperation => (_binopFlags & CSharpBinaryOperationFlags.LogicalOperation) != CSharpBinaryOperationFlags.None;
internal Type CallingContext => _callingContext;
internal IList<CSharpArgumentInfo> ArgumentInfo => _argumentInfo.AsReadOnly();
public CSharpBinaryOperationBinder(ExpressionType operation, bool isChecked, CSharpBinaryOperationFlags binaryOperationFlags, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
: base(operation)
{
_isChecked = isChecked;
_binopFlags = binaryOperationFlags;
_callingContext = callingContext;
_argumentInfo = BinderHelper.ToList(argumentInfo);
_binder = RuntimeBinder.GetInstance();
}
public sealed override DynamicMetaObject FallbackBinaryOperation(DynamicMetaObject target, DynamicMetaObject arg, DynamicMetaObject errorSuggestion)
{
return BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, null, arg), _argumentInfo, errorSuggestion);
}
}
}