C# Class Jurassic.Compiler.ClrBinder

Binds to a method group using pretty standard .NET rules. The main difference from the JSBinder is that the number of arguments must be correct. Additionally, it is possible to bind to overloaded methods with the same number of arguments.
Inheritance: MethodBinder
Show file Open project: paulbartrum/jurassic Class Usage Examples

Public Methods

Method Description
ClrBinder ( IEnumerable targetMethods ) : System

Creates a new ClrBinder instance.

ClrBinder ( IEnumerable targetMethods ) : System

Creates a new ClrBinder instance.

ClrBinder ( MethodBase targetMethod ) : System

Creates a new ClrBinder instance.

Protected Methods

Method Description
GenerateStub ( ILGenerator generator, int argumentCount ) : void

Generates a method that does type conversion and calls the bound method.

Private Methods

Method Description
EmitConversionToObject ( ILGenerator generator, Type fromType ) : void

Pops the value on the stack, converts it to an object, then pushes the result onto the stack.

EmitConversionToType ( ILGenerator generator, Type toType, bool convertToAddress ) : void

Pops the value on the stack, converts it from an object to the given type, then pushes the result onto the stack.

Method Details

ClrBinder() public method

Creates a new ClrBinder instance.
public ClrBinder ( IEnumerable targetMethods ) : System
targetMethods IEnumerable An enumerable list of methods to bind to.
return System

ClrBinder() public method

Creates a new ClrBinder instance.
public ClrBinder ( IEnumerable targetMethods ) : System
targetMethods IEnumerable An enumerable list of methods to bind to.
return System

ClrBinder() public method

Creates a new ClrBinder instance.
public ClrBinder ( MethodBase targetMethod ) : System
targetMethod System.Reflection.MethodBase A method to bind to.
return System

GenerateStub() protected method

Generates a method that does type conversion and calls the bound method.
protected GenerateStub ( ILGenerator generator, int argumentCount ) : void
generator ILGenerator The ILGenerator used to output the body of the method.
argumentCount int The number of arguments that will be passed to the delegate.
return void