C# Class Microsoft.Scripting.Actions.ActionBinder

Show file Open project: jschementi/iron Class Usage Examples

Private Properties

Property Type Description
ActionBinder System.Linq.Expressions

Public Methods

Method Description
CanConvertFrom ( Type fromType, Type toType, bool toNotNullable, NarrowingLevel level ) : bool

Determines if a conversion exists from fromType to toType at the specified narrowing level. toNotNullable is true if the target variable doesn't allow null values.

Convert ( object obj, Type toType ) : object

Converts an object at runtime into the specified type.

ConvertExpression ( Expression expr, Type toType, ConversionResultKind kind, Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory ) : Expression

Converts the provided expression to the given type. The expression is safe to evaluate multiple times.

GetAllExtensionMembers ( Type type, string name ) : MemberGroup

Gets the extension members of the given name from the provided type. Base classes are also searched for their extension members. Once any of the types in the inheritance hierarchy provide an extension member the search is stopped.

GetExtensionMembers ( Type declaringType, string name ) : MemberGroup

Gets the extension members of the given name from the provided type. Subclasses of the type and their extension members are not searched.

GetExtensionTypes ( Type t ) : IList
GetMember ( MemberRequestKind action, Type type, string name ) : MemberGroup

Gets the members that are visible from the provided type of the specified name. The default implemetnation first searches the type, then the flattened heirachy of the type, and then registered extension methods.

GetObjectTypeName ( object arg ) : string
GetTypeName ( Type t ) : string
IncludeExtensionMember ( MemberInfo member ) : bool
MakeCallExpression ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, MethodInfo method ) : DynamicMetaObject
MakeContainsGenericParametersError ( MemberTracker tracker ) : ErrorInfo
MakeConversionError ( Type toType, Expression value ) : ErrorInfo
MakeGenericAccessError ( MemberTracker info ) : ErrorInfo
MakeMissingMemberError ( Type type, DynamicMetaObject self, string name ) : ErrorInfo

Provides a way for the binder to provide a custom error message when lookup fails. Just doing this for the time being until we get a more robust error return mechanism. Deprecated, use the non-generic version instead

MakeMissingMemberErrorForAssign ( Type type, DynamicMetaObject self, string name ) : ErrorInfo
MakeMissingMemberErrorForAssignReadOnlyProperty ( Type type, DynamicMetaObject self, string name ) : ErrorInfo
MakeMissingMemberErrorForDelete ( Type type, DynamicMetaObject self, string name ) : ErrorInfo
MakeMissingMemberErrorInfo ( Type type, string name ) : ErrorInfo
MakeSetValueTypeFieldError ( Microsoft.Scripting.Actions.FieldTracker field, DynamicMetaObject instance, DynamicMetaObject value ) : ErrorInfo
MakeStaticAssignFromDerivedTypeError ( Type accessingType, DynamicMetaObject self, MemberTracker assigning, DynamicMetaObject assignedValue, Microsoft.Scripting.Actions.Calls.OverloadResolverFactory context ) : ErrorInfo

Called when a set is attempting to assign to a field or property from a derived class through the base class. The default behavior is to allow the assignment.

MakeStaticPropertyInstanceAccessError ( PropertyTracker tracker, bool isAssignment ) : ErrorInfo
MakeStaticPropertyInstanceAccessError ( PropertyTracker tracker, bool isAssignment, IList parameters ) : ErrorInfo

Creates an ErrorInfo object when a static property is accessed from an instance member. The default behavior is throw an exception indicating that static members properties be accessed via an instance. Languages can override this to customize the exception, message, or to produce an ErrorInfo object which reads or writes to the property being accessed.

PreferConvert ( Type t1, Type t2 ) : Candidate

Provides ordering for two parameter types if there is no conversion between the two parameter types.

ReturnMemberTracker ( Type type, MemberTracker memberTracker ) : DynamicMetaObject

Provides an opportunity for languages to replace all MemberTracker's with their own type. Alternatlely a language can expose MemberTracker's directly.

Protected Methods

Method Description
ActionBinder ( ) : System.Linq.Expressions

Private Methods

Method Description
ActionBinder ( Microsoft.Scripting.Runtime.ScriptDomainManager manager ) : System.Linq.Expressions

Method Details

ActionBinder() protected method

protected ActionBinder ( ) : System.Linq.Expressions
return System.Linq.Expressions

CanConvertFrom() public abstract method

Determines if a conversion exists from fromType to toType at the specified narrowing level. toNotNullable is true if the target variable doesn't allow null values.
public abstract CanConvertFrom ( Type fromType, Type toType, bool toNotNullable, NarrowingLevel level ) : bool
fromType System.Type
toType System.Type
toNotNullable bool
level NarrowingLevel
return bool

Convert() public method

Converts an object at runtime into the specified type.
public Convert ( object obj, Type toType ) : object
obj object
toType System.Type
return object

ConvertExpression() public method

Converts the provided expression to the given type. The expression is safe to evaluate multiple times.
public ConvertExpression ( Expression expr, Type toType, ConversionResultKind kind, Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory ) : Expression
expr Expression
toType System.Type
kind ConversionResultKind
resolverFactory Microsoft.Scripting.Actions.Calls.OverloadResolverFactory
return Expression

GetAllExtensionMembers() public method

Gets the extension members of the given name from the provided type. Base classes are also searched for their extension members. Once any of the types in the inheritance hierarchy provide an extension member the search is stopped.
public GetAllExtensionMembers ( Type type, string name ) : MemberGroup
type System.Type
name string
return MemberGroup

GetExtensionMembers() public method

Gets the extension members of the given name from the provided type. Subclasses of the type and their extension members are not searched.
public GetExtensionMembers ( Type declaringType, string name ) : MemberGroup
declaringType System.Type
name string
return MemberGroup

GetExtensionTypes() public method

public GetExtensionTypes ( Type t ) : IList
t System.Type
return IList

GetMember() public method

Gets the members that are visible from the provided type of the specified name. The default implemetnation first searches the type, then the flattened heirachy of the type, and then registered extension methods.
public GetMember ( MemberRequestKind action, Type type, string name ) : MemberGroup
action MemberRequestKind
type System.Type
name string
return MemberGroup

GetObjectTypeName() public method

public GetObjectTypeName ( object arg ) : string
arg object
return string

GetTypeName() public method

public GetTypeName ( Type t ) : string
t System.Type
return string

IncludeExtensionMember() public method

public IncludeExtensionMember ( MemberInfo member ) : bool
member System.Reflection.MemberInfo
return bool

MakeCallExpression() public method

public MakeCallExpression ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, MethodInfo method ) : DynamicMetaObject
resolverFactory Microsoft.Scripting.Actions.Calls.OverloadResolverFactory
method System.Reflection.MethodInfo
return System.Dynamic.DynamicMetaObject

MakeContainsGenericParametersError() public method

public MakeContainsGenericParametersError ( MemberTracker tracker ) : ErrorInfo
tracker MemberTracker
return ErrorInfo

MakeConversionError() public method

public MakeConversionError ( Type toType, Expression value ) : ErrorInfo
toType System.Type
value Expression
return ErrorInfo

MakeGenericAccessError() public method

public MakeGenericAccessError ( MemberTracker info ) : ErrorInfo
info MemberTracker
return ErrorInfo

MakeMissingMemberError() public method

Provides a way for the binder to provide a custom error message when lookup fails. Just doing this for the time being until we get a more robust error return mechanism. Deprecated, use the non-generic version instead
public MakeMissingMemberError ( Type type, DynamicMetaObject self, string name ) : ErrorInfo
type System.Type
self System.Dynamic.DynamicMetaObject
name string
return ErrorInfo

MakeMissingMemberErrorForAssign() public method

public MakeMissingMemberErrorForAssign ( Type type, DynamicMetaObject self, string name ) : ErrorInfo
type System.Type
self System.Dynamic.DynamicMetaObject
name string
return ErrorInfo

MakeMissingMemberErrorForAssignReadOnlyProperty() public method

public MakeMissingMemberErrorForAssignReadOnlyProperty ( Type type, DynamicMetaObject self, string name ) : ErrorInfo
type System.Type
self System.Dynamic.DynamicMetaObject
name string
return ErrorInfo

MakeMissingMemberErrorForDelete() public method

public MakeMissingMemberErrorForDelete ( Type type, DynamicMetaObject self, string name ) : ErrorInfo
type System.Type
self System.Dynamic.DynamicMetaObject
name string
return ErrorInfo

MakeMissingMemberErrorInfo() public method

public MakeMissingMemberErrorInfo ( Type type, string name ) : ErrorInfo
type System.Type
name string
return ErrorInfo

MakeSetValueTypeFieldError() public method

public MakeSetValueTypeFieldError ( Microsoft.Scripting.Actions.FieldTracker field, DynamicMetaObject instance, DynamicMetaObject value ) : ErrorInfo
field Microsoft.Scripting.Actions.FieldTracker
instance System.Dynamic.DynamicMetaObject
value System.Dynamic.DynamicMetaObject
return ErrorInfo

MakeStaticAssignFromDerivedTypeError() public method

Called when a set is attempting to assign to a field or property from a derived class through the base class. The default behavior is to allow the assignment.
public MakeStaticAssignFromDerivedTypeError ( Type accessingType, DynamicMetaObject self, MemberTracker assigning, DynamicMetaObject assignedValue, Microsoft.Scripting.Actions.Calls.OverloadResolverFactory context ) : ErrorInfo
accessingType System.Type
self System.Dynamic.DynamicMetaObject
assigning MemberTracker
assignedValue System.Dynamic.DynamicMetaObject
context Microsoft.Scripting.Actions.Calls.OverloadResolverFactory
return ErrorInfo

MakeStaticPropertyInstanceAccessError() public method

public MakeStaticPropertyInstanceAccessError ( PropertyTracker tracker, bool isAssignment ) : ErrorInfo
tracker PropertyTracker
isAssignment bool
return ErrorInfo

MakeStaticPropertyInstanceAccessError() public method

Creates an ErrorInfo object when a static property is accessed from an instance member. The default behavior is throw an exception indicating that static members properties be accessed via an instance. Languages can override this to customize the exception, message, or to produce an ErrorInfo object which reads or writes to the property being accessed.
public MakeStaticPropertyInstanceAccessError ( PropertyTracker tracker, bool isAssignment, IList parameters ) : ErrorInfo
tracker PropertyTracker The static property being accessed through an instance
isAssignment bool True if the user is assigning to the property, false if the user is reading from the property
parameters IList The parameters being used to access the property. This includes the instance as the first entry, any index parameters, and the /// value being assigned as the last entry if isAssignment is true.
return ErrorInfo

PreferConvert() public abstract method

Provides ordering for two parameter types if there is no conversion between the two parameter types.
public abstract PreferConvert ( Type t1, Type t2 ) : Candidate
t1 System.Type
t2 System.Type
return Candidate

ReturnMemberTracker() public method

Provides an opportunity for languages to replace all MemberTracker's with their own type. Alternatlely a language can expose MemberTracker's directly.
public ReturnMemberTracker ( Type type, MemberTracker memberTracker ) : DynamicMetaObject
type System.Type Tthe type which the memberTrack was accessed from
memberTracker MemberTracker The member which is being returned to the user.
return System.Dynamic.DynamicMetaObject