CSharpUnaryOperationBinder
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq.Expressions;
namespace Microsoft.CSharp.RuntimeBinder
{
internal sealed class CSharpUnaryOperationBinder : UnaryOperationBinder
{
private bool _isChecked;
private Type _callingContext;
private List<CSharpArgumentInfo> _argumentInfo;
private RuntimeBinder _binder;
internal bool IsChecked => _isChecked;
internal Type CallingContext => _callingContext;
internal IList<CSharpArgumentInfo> ArgumentInfo => _argumentInfo.AsReadOnly();
public CSharpUnaryOperationBinder(ExpressionType operation, bool isChecked, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
: base(operation)
{
_isChecked = isChecked;
_callingContext = callingContext;
_argumentInfo = BinderHelper.ToList(argumentInfo);
_binder = RuntimeBinder.GetInstance();
}
public sealed override DynamicMetaObject FallbackUnaryOperation(DynamicMetaObject target, DynamicMetaObject errorSuggestion)
{
return BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, null), _argumentInfo, errorSuggestion);
}
}
}