C# Class Jurassic.Compiler.JSBinder

Binds to a method group using the default javascript rules (extra parameter values are ignored, missing parameter values are replaced with "undefined").
Inheritance: MethodBinder
显示文件 Open project: paulbartrum/jurassic

Public Methods

Method Description
JSBinder ( ) : System

Creates a new JSBinder instance.

JSBinder ( IEnumerable targetMethods ) : System

Creates a new JSBinder 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
EmitTypeConversion ( ILGenerator generator, Type fromType, BinderArgument argument ) : void

Pops the value on the stack, converts it from one type to another, then pushes the result onto the stack. Undefined is converted to the given default value.

EmitTypeConversion ( ILGenerator il, Type fromType, Type toType ) : void

Pops the value on the stack, converts it from one type to another, then pushes the result onto the stack.

EmitUndefined ( ILGenerator il, BinderArgument argument ) : void

Pushes the result of converting undefined to the given type onto the stack.

Method Details

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

JSBinder() public method

Creates a new JSBinder instance.
public JSBinder ( ) : System
return System

JSBinder() public method

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