本文整理汇总了C#中DynamicMetaObjectBinder.Defer方法的典型用法代码示例。如果您正苦于以下问题:C# DynamicMetaObjectBinder.Defer方法的具体用法?C# DynamicMetaObjectBinder.Defer怎么用?C# DynamicMetaObjectBinder.Defer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicMetaObjectBinder
的用法示例。
在下文中一共展示了DynamicMetaObjectBinder.Defer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InvokeWorker
private DynamicMetaObject/*!*/ InvokeWorker(DynamicMetaObjectBinder/*!*/ call, DynamicMetaObject/*!*/[]/*!*/ args, Expression/*!*/ codeContext) {
if (this.NeedsDeferral()) {
return call.Defer(ArrayUtils.Insert(this, args));
}
for (int i = 0; i < args.Length; i++) {
if (args[i].NeedsDeferral()) {
return call.Defer(ArrayUtils.Insert(this, args));
}
}
if (IsStandardDotNetType(call)) {
return MakeStandardDotNetTypeCall(call, codeContext, args);
}
return MakePythonTypeCall(call, codeContext, args);
}
示例2: InvokeWorker
private DynamicMetaObject/*!*/ InvokeWorker(DynamicMetaObjectBinder/*!*/ call, DynamicMetaObject/*!*/[]/*!*/ args, Expression/*!*/ codeContext) {
PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "Type Invoke " + Value.UnderlyingSystemType.FullName + args.Length);
PerfTrack.NoteEvent(PerfTrack.Categories.BindingTarget, "Type Invoke");
if (this.NeedsDeferral()) {
return call.Defer(ArrayUtils.Insert(this, args));
}
for (int i = 0; i < args.Length; i++) {
if (args[i].NeedsDeferral()) {
return call.Defer(ArrayUtils.Insert(this, args));
}
}
if (IsStandardDotNetType(call)) {
return MakeStandardDotNetTypeCall(call, codeContext, args);
}
return MakePythonTypeCall(call, codeContext, args);
}
示例3: Index
public static DynamicMetaObject/*!*/ Index(DynamicMetaObjectBinder/*!*/ operation, PythonIndexType index, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion) {
if (args.Length >= 3) {
PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "Fallback Index " + " " + index + " " + args[0].LimitType + ", " + args[1].LimitType + ", " + args[2].LimitType + args.Length);
} else {
PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "Fallback Index " + " " + index + " " + args[0].LimitType + ", " + args[1].LimitType + args.Length);
}
PerfTrack.NoteEvent(PerfTrack.Categories.BindingTarget, index.ToString());
if (BindingHelpers.NeedsDeferral(args)) {
return operation.Defer(args);
}
ValidationInfo valInfo = BindingHelpers.GetValidationInfo(args[0]);
DynamicMetaObject res = BindingHelpers.AddPythonBoxing(MakeIndexerOperation(operation, index, args, errorSuggestion));
return BindingHelpers.AddDynamicTestAndDefer(operation, res, args, valInfo);
}
示例4: InvokeWorker
private DynamicMetaObject/*!*/ InvokeWorker(DynamicMetaObjectBinder/*!*/ call, Expression/*!*/ codeContext, DynamicMetaObject/*!*/[]/*!*/ args) {
PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "BuiltinFunc Invoke " + Value.DeclaringType.FullName + "." + Value.Name + " with " + args.Length + " args " + Value.IsUnbound);
PerfTrack.NoteEvent(PerfTrack.Categories.BindingTarget, "BuiltinFunction " + Value.Targets.Count + ", " + Value.Targets[0].GetParameters().Length);
PerfTrack.NoteEvent(PerfTrack.Categories.BindingSlow, "BuiltinFunction " + BindingHelpers.GetCallSignature(call));
if (this.NeedsDeferral()) {
return call.Defer(ArrayUtils.Insert(this, args));
}
for (int i = 0; i < args.Length; i++) {
if (args[i].NeedsDeferral()) {
return call.Defer(ArrayUtils.Insert(this, args));
}
}
if (Value.IsUnbound) {
return MakeSelflessCall(call, codeContext, args);
} else {
return MakeSelfCall(call, codeContext, args);
}
}
示例5: AddDynamicTestAndDefer
internal static DynamicMetaObject/*!*/ AddDynamicTestAndDefer(DynamicMetaObjectBinder/*!*/ operation, DynamicMetaObject/*!*/ res, DynamicMetaObject/*!*/[] args, ValidationInfo typeTest, Type deferType, params ParameterExpression[] temps) {
if (typeTest != null) {
if (typeTest.Test != null) {
// add the test and a validator if persent
Expression defer = operation.Defer(args).Expression;
if (deferType != null) {
defer = AstUtils.Convert(defer, deferType);
}
Type bestType = BindingHelpers.GetCompatibleType(defer.Type, res.Expression.Type);
res = new DynamicMetaObject(
Ast.Condition(
typeTest.Test,
AstUtils.Convert(res.Expression, bestType),
AstUtils.Convert(defer, bestType)
),
res.Restrictions // ,
//typeTest.Validator
);
} else if (typeTest.Validator != null) {
// just add the validator
res = new DynamicMetaObject(res.Expression, res.Restrictions); // , typeTest.Validator
}
}
if (temps.Length > 0) {
// finally add the scoped variables
res = new DynamicMetaObject(
Ast.Block(temps, res.Expression),
res.Restrictions,
null
);
}
return res;
}