CSharpInvokeConstructorBinder
sealed class CSharpInvokeConstructorBinder : DynamicMetaObjectBinder, ICSharpInvokeOrInvokeMemberBinder, ICSharpBinder
using Microsoft.CSharp.RuntimeBinder.Semantics;
using System;
using System.Collections.Generic;
using System.Dynamic;
namespace Microsoft.CSharp.RuntimeBinder
{
internal sealed class CSharpInvokeConstructorBinder : DynamicMetaObjectBinder, ICSharpInvokeOrInvokeMemberBinder, ICSharpBinder
{
private readonly CSharpArgumentInfo[] _argumentInfo;
private readonly RuntimeBinder _binder;
public BindingFlag BindingFlags => (BindingFlag)0;
public bool IsBinderThatCanHaveRefReceiver => true;
public CSharpCallFlags Flags { get; }
public bool StaticCall => true;
public Type[] TypeArguments => Array.Empty<Type>();
public string Name => ".ctor";
bool ICSharpInvokeOrInvokeMemberBinder.ResultDiscarded {
get {
return false;
}
}
public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals)
{
return runtimeBinder.DispatchPayload(this, arguments, locals);
}
public void PopulateSymbolTableWithName(Type callingType, ArgumentObject[] arguments)
{
RuntimeBinder.PopulateSymbolTableWithPayloadInformation(this, callingType, arguments);
}
CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index)
{
return _argumentInfo[index];
}
public CSharpInvokeConstructorBinder(CSharpCallFlags flags, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
{
Flags = flags;
_argumentInfo = BinderHelper.ToArray(argumentInfo);
_binder = new RuntimeBinder(callingContext, false);
}
public override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args)
{
BinderHelper.ValidateBindArgument(target, "target");
BinderHelper.ValidateBindArgument(args, "args");
return BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, args), _argumentInfo, null);
}
}
}