本文整理汇总了C#中Microsoft.Scripting.Actions.ActionBinder.ReturnMemberTracker方法的典型用法代码示例。如果您正苦于以下问题:C# ActionBinder.ReturnMemberTracker方法的具体用法?C# ActionBinder.ReturnMemberTracker怎么用?C# ActionBinder.ReturnMemberTracker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Scripting.Actions.ActionBinder
的用法示例。
在下文中一共展示了ActionBinder.ReturnMemberTracker方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetValue
public override DynamicMetaObject GetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type) {
if (!IsStatic || GetIndexParameters().Length > 0) {
// need to bind to a value or parameters to get the value.
return binder.ReturnMemberTracker(type, this);
}
MethodInfo getter = ResolveGetter(binder.PrivateBinding);
if (getter == null || getter.ContainsGenericParameters) {
// no usable getter
return null;
}
if (getter.IsPublic && getter.DeclaringType.IsPublic) {
return binder.MakeCallExpression(resolverFactory, getter);
}
// private binding is just a call to the getter method...
return MemberTracker.FromMemberInfo(getter).Call(resolverFactory, binder);
}
示例2: GetBoundValue
protected internal override Expression GetBoundValue(Expression context, ActionBinder binder, Type type, Expression instance) {
return binder.ReturnMemberTracker(type, BindToInstance(instance));
}
示例3: GetBoundValue
protected internal override DynamicMetaObject GetBoundValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject instance)
{
return binder.ReturnMemberTracker(type, BindToInstance(instance));
}
示例4: GetValue
public override DynamicMetaObject GetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type) {
if (Field.IsLiteral) {
return new DynamicMetaObject(
AstUtils.Constant(Field.GetValue(null), typeof(object)),
BindingRestrictions.Empty
);
}
if (!IsStatic) {
// return the field tracker...
return binder.ReturnMemberTracker(type, this);
}
if (Field.DeclaringType.ContainsGenericParameters) {
return null;
}
if (IsPublic && DeclaringType.IsPublic) {
return new DynamicMetaObject(
Ast.Convert(Ast.Field(null, Field), typeof(object)),
BindingRestrictions.Empty
);
}
return new DynamicMetaObject(
Ast.Call(
AstUtils.Convert(AstUtils.Constant(Field), typeof(FieldInfo)),
typeof(FieldInfo).GetMethod("GetValue"),
AstUtils.Constant(null)
),
BindingRestrictions.Empty
);
}
示例5: GetValue
/// <summary>
/// Gets the expression that creates the value.
///
/// Returns null if it's an error to get the value. The caller can then call GetErrorForGet to get
/// the correct error Expression (or null if they should provide a default).
/// </summary>
public virtual DynamicMetaObject GetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type) {
return binder.ReturnMemberTracker(type, this);
}
示例6: GetValue
public override Expression GetValue(Expression context, ActionBinder binder, Type type) {
if (Field.IsLiteral) {
return AstUtils.Constant(Field.GetValue(null), typeof(object));
}
if (!IsStatic) {
// return the field tracker...
return binder.ReturnMemberTracker(type, this);
}
if (Field.DeclaringType.ContainsGenericParameters) {
return null;
}
if (IsPublic && DeclaringType.IsPublic) {
return Ast.Convert(Ast.Field(null, Field), typeof(object));
}
return Ast.Call(
AstUtils.Convert(AstUtils.Constant(Field), typeof(FieldInfo)),
typeof(FieldInfo).GetMethod("GetValue"),
AstUtils.Constant(null)
);
}
示例7: GetBoundValue
internal override Expression GetBoundValue(ActionBinder binder, Type type, Expression instance) {
return binder.ReturnMemberTracker(type, new BoundMemberTracker(this, instance));
}
示例8: GetBoundValue
protected internal override DynamicMetaObject GetBoundValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject instance) {
if (instance != null && IsStatic) {
return null;
}
if (GetIndexParameters().Length > 0) {
// need to bind to a value or parameters to get the value.
return binder.ReturnMemberTracker(type, BindToInstance(instance));
}
MethodInfo getter = GetGetMethod(true);
if (getter == null || getter.ContainsGenericParameters) {
// no usable getter
return null;
}
getter = CompilerHelpers.TryGetCallableMethod(getter);
var defaultBinder = (DefaultBinder)binder;
if (binder.PrivateBinding || CompilerHelpers.IsVisible(getter)) {
return defaultBinder.MakeCallExpression(resolverFactory, getter, instance);
}
// private binding is just a call to the getter method...
return DefaultBinder.MakeError(defaultBinder.MakeNonPublicMemberGetError(resolverFactory, this, type, instance), BindingRestrictions.Empty, typeof(object));
}
示例9: GetValue
/// <summary>
/// Gets the expression that creates the value.
///
/// Returns null if it's an error to get the value. The caller can then call GetErrorForGet to get
/// the correct error Expression (or null if they should provide a default).
/// </summary>
public virtual Expression GetValue(Expression context, ActionBinder binder, Type type) {
return binder.ReturnMemberTracker(type, this);
}
示例10: GetValue
public override Expression GetValue(ActionBinder binder, Type type) {
if (Field.IsLiteral) {
return Ast.Constant(Field.GetValue(null));
}
if (!IsStatic) {
// return the field tracker...
return binder.ReturnMemberTracker(type, this);
}
if (IsPublic && DeclaringType.IsPublic) {
return Ast.ReadField(null, Field);
}
return Ast.Call(
Ast.ConvertHelper(Ast.RuntimeConstant(Field), typeof(FieldInfo)),
typeof(FieldInfo).GetMethod("GetValue"),
Ast.Null()
);
}
示例11: GetBoundValue
protected internal override Expression GetBoundValue(Expression context, ActionBinder binder, Type type, Expression instance) {
if (instance != null && IsStatic) {
return null;
}
if (GetIndexParameters().Length > 0) {
// need to bind to a value or parameters to get the value.
return binder.ReturnMemberTracker(type, BindToInstance(instance));
}
MethodInfo getter = GetGetMethod(true);
if (getter == null || getter.ContainsGenericParameters) {
// no usable getter
return null;
}
getter = CompilerHelpers.TryGetCallableMethod(getter);
if (binder.PrivateBinding || CompilerHelpers.IsVisible(getter)) {
return binder.MakeCallExpression(context, getter, instance);
}
// private binding is just a call to the getter method...
return DefaultBinder.MakeError(((DefaultBinder)binder).MakeNonPublicMemberGetError(context, this, type, instance));
}