本文整理汇总了C#中IronPython.Runtime.Binding.PythonBinder.ConvertExpression方法的典型用法代码示例。如果您正苦于以下问题:C# PythonBinder.ConvertExpression方法的具体用法?C# PythonBinder.ConvertExpression怎么用?C# PythonBinder.ConvertExpression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronPython.Runtime.Binding.PythonBinder
的用法示例。
在下文中一共展示了PythonBinder.ConvertExpression方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeGetExpression
internal override Expression/*!*/ MakeGetExpression(PythonBinder/*!*/ binder, Expression/*!*/ codeContext, Expression instance, Expression/*!*/ owner, Expression/*!*/ error) {
if (!_info.IsPublic || _info.DeclaringType.ContainsGenericParameters) {
// fallback to reflection
return base.MakeGetExpression(binder, codeContext, instance, owner, error);
}
if (instance == null) {
if (_info.IsStatic) {
return Ast.Field(null, _info);
} else {
return AstUtils.Constant(this);
}
} else {
return Ast.Field(
binder.ConvertExpression(
instance,
_info.DeclaringType,
ConversionResultKind.ExplicitCast,
codeContext
),
_info
);
}
}
示例2: MakeGetExpression
internal override void MakeGetExpression(PythonBinder/*!*/ binder, Expression/*!*/ codeContext, DynamicMetaObject instance, DynamicMetaObject/*!*/ owner, ConditionalBuilder/*!*/ builder) {
if (!_info.IsPublic || _info.DeclaringType.ContainsGenericParameters) {
// fallback to reflection
base.MakeGetExpression(binder, codeContext, instance, owner, builder);
} else if (instance == null) {
if (_info.IsStatic) {
builder.FinishCondition(AstUtils.Convert(Ast.Field(null, _info), typeof(object)));
} else {
builder.FinishCondition(Ast.Constant(this));
}
} else {
builder.FinishCondition(
AstUtils.Convert(
Ast.Field(
binder.ConvertExpression(
instance.Expression,
_info.DeclaringType,
ConversionResultKind.ExplicitCast,
new PythonOverloadResolverFactory(binder, codeContext)
),
_info
),
typeof(object)
)
);
}
}