本文整理汇总了C#中System.Dynamic.CallInfo类的典型用法代码示例。如果您正苦于以下问题:C# CallInfo类的具体用法?C# CallInfo怎么用?C# CallInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CallInfo类属于System.Dynamic命名空间,在下文中一共展示了CallInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindComInvoke
private DynamicMetaObject BindComInvoke(DynamicMetaObject[] args, ComMethodDesc method, CallInfo callInfo, bool[] isByRef,
List<ParameterExpression> temps, List<Expression> initTemps)
{
DynamicMetaObject invoke = new ComInvokeBinder(
callInfo,
args,
isByRef,
IDispatchRestriction(),
Expression.Constant(method),
Expression.Property(
Helpers.Convert(Expression, typeof(IDispatchComObject)),
typeof(IDispatchComObject).GetProperty("DispatchObject")
),
method
).Invoke();
if ((temps != null) && (temps.Any()))
{
Expression invokeExpression = invoke.Expression;
Expression call = Expression.Block(invokeExpression.Type, temps, initTemps.Append(invokeExpression));
invoke = new DynamicMetaObject(call, invoke.Restrictions);
}
return invoke;
}
示例2: TotemSetIndexBinder
public TotemSetIndexBinder(TotemContext /*!*/ context, CallInfo callInfo)
: base(callInfo)
{
Assert.NotNull(context);
_context = context;
}
示例3: Bind
public static DynamicMetaObject/*!*/ Bind(string/*!*/ methodName, CallInfo/*!*/ callInfo,
DynamicMetaObjectBinder/*!*/ binder, DynamicMetaObject/*!*/ target, DynamicMetaObject/*!*/[]/*!*/ args,
Func<DynamicMetaObject, DynamicMetaObject[], DynamicMetaObject>/*!*/ fallback)
{
Debug.Assert(fallback != null);
//create DMO
var phpInvokeBinder = Binder.MethodCall(methodName, 0, callInfo.ArgumentCount, null, Types.Object[0]) as PhpBaseInvokeMemberBinder;
if (phpInvokeBinder != null)
{
//Add ScriptContext.CurrentContext
var context = new DynamicMetaObject(Expression.Call(Methods.ScriptContext.GetCurrentContext), BindingRestrictions.Empty);
var restrictions = BinderHelper.GetSimpleInvokeRestrictions(target, args);
//Value type arguments have to be boxed
DynamicMetaObject[] arguments = new DynamicMetaObject[1 + args.Length];
arguments[0] = context;
for (int i = 0; i < args.Length; ++i)
arguments[1 + i] = new DynamicMetaObject(WrapDynamic(args[i].Expression),
args[i].Restrictions);
var result = phpInvokeBinder.Bind(target, arguments);
//Unwrap result
var res = new DynamicMetaObject(Unwrap(result.Expression), restrictions);
return res;
}
else
return fallback(target, args);//this will never happen
}
示例4: CreateCall
/// <summary>
/// Creates the cacheable method or indexer or property call.
/// </summary>
/// <param name="kind">The kind.</param>
/// <param name="name">The name.</param>
/// <param name="callInfo">The callInfo.</param>
/// <param name="context">The context.</param>
/// <returns></returns>
public static CacheableInvocation CreateCall(InvocationKind kind, String_OR_InvokeMemberName name = null, CallInfo callInfo = null,object context = null)
{
var tArgCount = callInfo != null ? callInfo.ArgumentCount : 0;
var tArgNames = callInfo != null ? callInfo.ArgumentNames.ToArray() : null;
return new CacheableInvocation(kind, name, tArgCount, tArgNames, context);
}
示例5: ComInvokeBinder
internal ComInvokeBinder(
CallInfo callInfo,
DynamicMetaObject[] args,
bool[] isByRef,
BindingRestrictions restrictions,
Expression method,
Expression dispatch,
ComMethodDesc methodDesc
)
{
Debug.Assert(callInfo != null, "arguments");
Debug.Assert(args != null, "args");
Debug.Assert(isByRef != null, "isByRef");
Debug.Assert(method != null, "method");
Debug.Assert(dispatch != null, "dispatch");
Debug.Assert(TypeUtils.AreReferenceAssignable(typeof(ComMethodDesc), method.Type), "method");
Debug.Assert(TypeUtils.AreReferenceAssignable(typeof(IDispatch), dispatch.Type), "dispatch");
_method = method;
_dispatch = dispatch;
_methodDesc = methodDesc;
_callInfo = callInfo;
_args = args;
_isByRef = isByRef;
_restrictions = restrictions;
// Set Instance to some value so that CallBinderHelper has the right number of parameters to work with
_instance = dispatch;
}
示例6: New
public static InvokeMemberBinder New(
StaticMetaTables metaTables,
string name,
CallInfo info)
{
return new InvokeMemberBinder(metaTables, name, info);
}
示例7: GetIndexBinder
public GetIndexBinder(
StaticMetaTables metaTables,
CallInfo callInfo)
: base(callInfo)
{
_metaTables = metaTables;
}
示例8: CreateNodes
static IReadOnlyList<IMemberDefinition> CreateNodes(CallInfo callInfo, IReadOnlyList<object> args)
{
var result = new List<IMemberDefinition>();
int difference;
var nameCount = callInfo.ArgumentNames.Count;
var argumentCount = args.Count;
if (argumentCount != nameCount)
{
if (nameCount != args.Count(x => !(x is IMemberDefinition)))
throw new NotSupportedException("Unnamed arguments must be MemberDefinition instances.");
difference = argumentCount - nameCount;
}
else
{
difference = 0;
}
var argumentNames = callInfo.ArgumentNames;
for (var i = argumentCount - 1; i >= 0; i--)
{
var argument = args[i];
var dynamicMember = argument as IMemberDefinition;
if (dynamicMember == null)
{
var name = argumentNames[i - difference];
var @delegate = argument as Delegate;
if (@delegate != null)
{
dynamicMember = MemberDefinition.Method(name, @delegate);
}
else
{
var type = argument as Type;
if (type == null)
throw new NotSupportedException("Definitions require a type.");
if (typeof(Delegate).IsAssignableFrom(type))
{
dynamicMember = MemberDefinition.EmptyMethod(name, type);
}
else
{
dynamicMember = MemberDefinition.Property(name, type);
}
}
}
result.Add(dynamicMember);
}
return result;
}
示例9: InvokeMemberBinder
public InvokeMemberBinder(
StaticMetaTables metaTables,
string name,
CallInfo callInfo)
: base(name, false, callInfo)
{
_metaTables = metaTables;
}
示例10: InvokeMemberBinder
/// <summary>
/// Initializes a new instance of the <see cref="InvokeMemberBinder" />.
/// </summary>
/// <param name="name">The name of the member to invoke.</param>
/// <param name="ignoreCase">true if the name should be matched ignoring case; false otherwise.</param>
/// <param name="callInfo">The signature of the arguments at the call site.</param>
protected InvokeMemberBinder(string name, bool ignoreCase, CallInfo callInfo) {
ContractUtils.RequiresNotNull(name, "name");
ContractUtils.RequiresNotNull(callInfo, "callInfo");
_name = name;
_ignoreCase = ignoreCase;
_callInfo = callInfo;
}
示例11: InvokeMemberBinder
/// <summary>
/// Initializes a new instance of the <see cref="InvokeMemberBinder" />.
/// </summary>
/// <param name="name">The name of the member to invoke.</param>
/// <param name="ignoreCase">true if the name should be matched ignoring case; false otherwise.</param>
/// <param name="callInfo">The signature of the arguments at the call site.</param>
protected InvokeMemberBinder(string name, bool ignoreCase, CallInfo callInfo)
{
ContractUtils.RequiresNotNull(name, nameof(name));
ContractUtils.RequiresNotNull(callInfo, nameof(callInfo));
Name = name;
IgnoreCase = ignoreCase;
CallInfo = callInfo;
}
示例12: BindGetOrInvoke
private DynamicMetaObject BindGetOrInvoke(DynamicMetaObject[] args, CallInfo callInfo) {
ComMethodDesc method;
var target = _callable.DispatchComObject;
var name = _callable.MemberName;
if (target.TryGetMemberMethod(name, out method) ||
target.TryGetMemberMethodExplicit(name, out method)) {
bool[] isByRef = ComBinderHelpers.ProcessArgumentsForCom(ref args);
return BindComInvoke(method, args, callInfo, isByRef);
}
return null;
}
示例13: BindComInvoke
private DynamicMetaObject BindComInvoke(DynamicMetaObject[] args, ComMethodDesc method, CallInfo callInfo, bool[] isByRef) {
return new ComInvokeBinder(
callInfo,
args,
isByRef,
IDispatchRestriction(),
Expression.Constant(method),
Expression.Property(
Helpers.Convert(Expression, typeof(IDispatchComObject)),
typeof(IDispatchComObject).GetProperty("DispatchObject")
),
method
).Invoke();
}
示例14: CopyBackArguments
public static void CopyBackArguments(CallInfo callInfo, object[] packedArgs, object[] args)
{
if (packedArgs != args)
{
int length = packedArgs.Length;
int argumentCount = callInfo.ArgumentCount;
int num3 = length - callInfo.ArgumentNames.Count;
int num5 = length - 1;
for (int i = 0; i <= num5; i++)
{
args[i] = packedArgs[(i < argumentCount) ? ((i + num3) % argumentCount) : i];
}
}
}
示例15: BindComInvoke
private DynamicMetaObject BindComInvoke(ComMethodDesc method, DynamicMetaObject[] indexes, CallInfo callInfo, bool[] isByRef) {
var callable = Expression;
var dispCall = Helpers.Convert(callable, typeof(DispCallable));
return new ComInvokeBinder(
callInfo,
indexes,
isByRef,
DispCallableRestrictions(),
Expression.Constant(method),
Expression.Property(
dispCall,
typeof(DispCallable).GetProperty("DispatchObject")
),
method
).Invoke();
}