C# Class Microsoft.Scripting.Actions.MemberTracker

Represents a logical member of a type. The member could either be real concrete member on a type or an extension member. This seperates the "physical" members that .NET knows exist on types from the members that logically exist on a type. It also provides other abstractions above the level of .NET reflection such as MemberGroups and NamespaceTracker's. It also provides a wrapper around the reflection APIs which cannot be extended from partial trust.
Mostra file Open project: jschementi/iron Class Usage Examples

Public Methods

Method Description
BindToInstance ( DynamicMetaObject instance ) : MemberTracker

Binds the member tracker to the specified instance rturning a new member tracker if binding is possible. If binding is not possible the existing member tracker will be returned. For example binding to a static field results in returning the original MemberTracker. Binding to an instance field results in a new BoundMemberTracker which will get GetBoundValue/SetBoundValue to pass the instance through.

FromMemberInfo ( MemberInfo member ) : MemberTracker
FromMemberInfo ( MemberInfo member, Type extending ) : MemberTracker
GetBoundError ( ActionBinder binder, DynamicMetaObject instance ) : ErrorInfo

Returns the error associated with accessing this member via a bound instance. A null return value indicates that the default error message should be provided by the caller.

GetError ( ActionBinder binder ) : ErrorInfo

Returns the error associated with getting the value. A null return value indicates that the default error message should be provided by the caller.

GetValue ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, ActionBinder binder, Type type ) : DynamicMetaObject

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).

SetValue ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject value ) : DynamicMetaObject

Gets an expression that assigns a value to the left hand side. Returns null if it's an error to assign to. The caller can then call GetErrorForSet to get the correct error Expression (or null if a default error should be provided).

SetValue ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject value, DynamicMetaObject errorSuggestion ) : DynamicMetaObject

Gets an expression that assigns a value to the left hand side. Returns null if it's an error to assign to. The caller can then call GetErrorForSet to get the correct error Expression (or null if a default error should be provided).

Protected Methods

Method Description
GetBoundValue ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject instance ) : DynamicMetaObject

Helper for getting values that have been bound. Called from BoundMemberTracker. Custom member trackers can override this to provide their own behaviors when bound to an instance.

SetBoundValue ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject value, DynamicMetaObject instance ) : DynamicMetaObject

Helper for setting values that have been bound. Called from BoundMemberTracker. Custom member trackers can override this to provide their own behaviors when bound to an instance.

SetBoundValue ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject value, DynamicMetaObject instance, DynamicMetaObject errorSuggestion ) : DynamicMetaObject

Helper for setting values that have been bound. Called from BoundMemberTracker. Custom member trackers can override this to provide their own behaviors when bound to an instance.

Private Methods

Method Description
Call ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, ActionBinder binder ) : DynamicMetaObject
MemberTracker ( ) : System

Method Details

BindToInstance() public method

Binds the member tracker to the specified instance rturning a new member tracker if binding is possible. If binding is not possible the existing member tracker will be returned. For example binding to a static field results in returning the original MemberTracker. Binding to an instance field results in a new BoundMemberTracker which will get GetBoundValue/SetBoundValue to pass the instance through.
public BindToInstance ( DynamicMetaObject instance ) : MemberTracker
instance System.Dynamic.DynamicMetaObject
return MemberTracker

FromMemberInfo() public static method

public static FromMemberInfo ( MemberInfo member ) : MemberTracker
member System.Reflection.MemberInfo
return MemberTracker

FromMemberInfo() public static method

public static FromMemberInfo ( MemberInfo member, Type extending ) : MemberTracker
member System.Reflection.MemberInfo
extending System.Type
return MemberTracker

GetBoundError() public method

Returns the error associated with accessing this member via a bound instance. A null return value indicates that the default error message should be provided by the caller.
public GetBoundError ( ActionBinder binder, DynamicMetaObject instance ) : ErrorInfo
binder ActionBinder
instance System.Dynamic.DynamicMetaObject
return ErrorInfo

GetBoundValue() protected method

Helper for getting values that have been bound. Called from BoundMemberTracker. Custom member trackers can override this to provide their own behaviors when bound to an instance.
protected GetBoundValue ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject instance ) : DynamicMetaObject
resolverFactory Microsoft.Scripting.Actions.Calls.OverloadResolverFactory
binder ActionBinder
type System.Type
instance System.Dynamic.DynamicMetaObject
return System.Dynamic.DynamicMetaObject

GetError() public method

Returns the error associated with getting the value. A null return value indicates that the default error message should be provided by the caller.
public GetError ( ActionBinder binder ) : ErrorInfo
binder ActionBinder
return ErrorInfo

GetValue() public method

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).
public GetValue ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, ActionBinder binder, Type type ) : DynamicMetaObject
resolverFactory Microsoft.Scripting.Actions.Calls.OverloadResolverFactory
binder ActionBinder
type System.Type
return System.Dynamic.DynamicMetaObject

SetBoundValue() protected method

Helper for setting values that have been bound. Called from BoundMemberTracker. Custom member trackers can override this to provide their own behaviors when bound to an instance.
protected SetBoundValue ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject value, DynamicMetaObject instance ) : DynamicMetaObject
resolverFactory Microsoft.Scripting.Actions.Calls.OverloadResolverFactory
binder ActionBinder
type System.Type
value System.Dynamic.DynamicMetaObject
instance System.Dynamic.DynamicMetaObject
return System.Dynamic.DynamicMetaObject

SetBoundValue() protected method

Helper for setting values that have been bound. Called from BoundMemberTracker. Custom member trackers can override this to provide their own behaviors when bound to an instance.
protected SetBoundValue ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject value, DynamicMetaObject instance, DynamicMetaObject errorSuggestion ) : DynamicMetaObject
resolverFactory Microsoft.Scripting.Actions.Calls.OverloadResolverFactory
binder ActionBinder
type System.Type
value System.Dynamic.DynamicMetaObject
instance System.Dynamic.DynamicMetaObject
errorSuggestion System.Dynamic.DynamicMetaObject
return System.Dynamic.DynamicMetaObject

SetValue() public method

Gets an expression that assigns a value to the left hand side. Returns null if it's an error to assign to. The caller can then call GetErrorForSet to get the correct error Expression (or null if a default error should be provided).
public SetValue ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject value ) : DynamicMetaObject
resolverFactory Microsoft.Scripting.Actions.Calls.OverloadResolverFactory
binder ActionBinder
type System.Type
value System.Dynamic.DynamicMetaObject
return System.Dynamic.DynamicMetaObject

SetValue() public method

Gets an expression that assigns a value to the left hand side. Returns null if it's an error to assign to. The caller can then call GetErrorForSet to get the correct error Expression (or null if a default error should be provided).
public SetValue ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject value, DynamicMetaObject errorSuggestion ) : DynamicMetaObject
resolverFactory Microsoft.Scripting.Actions.Calls.OverloadResolverFactory
binder ActionBinder
type System.Type
value System.Dynamic.DynamicMetaObject
errorSuggestion System.Dynamic.DynamicMetaObject
return System.Dynamic.DynamicMetaObject