C# Class Jurassic.Compiler.ReflectionHelpers

Used by the code generator. Not intended for user code (the class needs to be public because when using Reflection Emit, all calls into Jurassic.dll are cross-assembly and thus must be public).
Show file Open project: paulbartrum/jurassic Class Usage Examples

Public Methods

Method Description
GetConstructor ( Type type ) : ConstructorInfo

Gets the ConstructorInfo for a constructor. Throws an exception if the search fails.

GetField ( Type type, string name ) : FieldInfo

Gets the FieldInfo for a field. Throws an exception if the search fails.

GetInstanceMethod ( Type type, string name ) : MethodInfo

Gets the MethodInfo for an instance method. Throws an exception if the search fails.

GetStaticMethod ( Type type, string name ) : MethodInfo

Gets the MethodInfo for a static method. Throws an exception if the search fails.

SetObjectLiteralGetter ( ObjectInstance obj, object key, Jurassic.Library.UserDefinedFunction getter ) : void

Sets the value of a object literal property to a getter. If the value already has a setter then it will be retained.

SetObjectLiteralSetter ( ObjectInstance obj, object key, Jurassic.Library.UserDefinedFunction setter ) : void

Sets the value of a object literal property to a setter. If the value already has a getter then it will be retained.

SetObjectLiteralValue ( ObjectInstance obj, object key, object value ) : void

Sets the value of a object literal property to a value.

Private Methods

Method Description
GetGenericInstanceMethod ( Type type, string name ) : MethodInfo

Gets the MethodInfo for a generic instance method. Throws an exception if the search fails.

GetMembers ( ) : IEnumerable

Gets an enumerable list of all the MemberInfos that are statically known to be used by this DLL.

ReflectionHelpers ( ) : System

Initializes static members of this class.

Method Details

GetConstructor() public static method

Gets the ConstructorInfo for a constructor. Throws an exception if the search fails.
public static GetConstructor ( Type type ) : ConstructorInfo
type System.Type The type to search.
return System.Reflection.ConstructorInfo

GetField() public static method

Gets the FieldInfo for a field. Throws an exception if the search fails.
public static GetField ( Type type, string name ) : FieldInfo
type System.Type The type to search.
name string The name of the field.
return System.Reflection.FieldInfo

GetInstanceMethod() public static method

Gets the MethodInfo for an instance method. Throws an exception if the search fails.
public static GetInstanceMethod ( Type type, string name ) : MethodInfo
type System.Type The type to search.
name string The name of the method to search for.
return System.Reflection.MethodInfo

GetStaticMethod() public static method

Gets the MethodInfo for a static method. Throws an exception if the search fails.
public static GetStaticMethod ( Type type, string name ) : MethodInfo
type System.Type The type to search.
name string The name of the method to search for.
return System.Reflection.MethodInfo

SetObjectLiteralGetter() public static method

Sets the value of a object literal property to a getter. If the value already has a setter then it will be retained.
public static SetObjectLiteralGetter ( ObjectInstance obj, object key, Jurassic.Library.UserDefinedFunction getter ) : void
obj Jurassic.Library.ObjectInstance The object to set the property on.
key object The property key (can be a string or a symbol).
getter Jurassic.Library.UserDefinedFunction The getter function.
return void

SetObjectLiteralSetter() public static method

Sets the value of a object literal property to a setter. If the value already has a getter then it will be retained.
public static SetObjectLiteralSetter ( ObjectInstance obj, object key, Jurassic.Library.UserDefinedFunction setter ) : void
obj Jurassic.Library.ObjectInstance The object to set the property on.
key object The property key (can be a string or a symbol).
setter Jurassic.Library.UserDefinedFunction The setter function.
return void

SetObjectLiteralValue() public static method

Sets the value of a object literal property to a value.
public static SetObjectLiteralValue ( ObjectInstance obj, object key, object value ) : void
obj Jurassic.Library.ObjectInstance The object to set the property on.
key object The property key (can be a string or a symbol).
value object The value to set.
return void