C# Class Fanx.Emit.FMethodEmit

FMethodEmit is used to emit IL methods from fcode methods. It encapsulates lot of nitty details like when to include an implicit self paramater, etc.
Afficher le fichier Open project: xored/f4

Méthodes publiques

Méthode Description
FMethodEmit ( FTypeEmit emit ) : System.Collections

Constructor.

FMethodEmit ( FTypeEmit emit, FMethod method ) : System.Collections

Constructor.

emitCtor ( ) : void

Emit a constructor - constructors get created as a static factory methods, so that that CallNew can just push args and invoke them fan: class Foo { new make(Long a) { ... } } .net: static Foo make(Long a) { return make_(new Foo(), a) } static Foo make_(Foo self, Long a) { ... return self } We call the first method "make" the "factory" and the second method "make_" the "body". CallNew opcodes are routed to the ctor factory, and CallCtor opcodes are routed to the ctor body.

emitInterfaceRouter ( Type implType, Method m ) : void

The CLR requires all methods implemented by an interface to be marked as virtual. However, Fantom (and Java) allow this: mixin Mixin { abstract Long foo() } class Base { Long foo() { return 5 } } class Child : Base, Mixin { // don't need to implement foo() since Base defined it } So to work correctly in the CLR we need to trap this case and emit a virtual router method on child to satisfy the interface requirement: class Child : Base, Mixin { public virtual Long foo() { return base.foo(); } } TODO - optimize the intra-pod case

emitMixinBody ( ) : void
emitMixinInterface ( ) : void

Emit the method as a mixin interface

emitMixinRouter ( Method m ) : void

Emit a mixin router from a class to the mixin body methods.

emitNative ( ) : void
emitStandard ( ) : void

Emit a standard instance/static class method.

Méthodes protégées

Méthode Description
doEmit ( ) : PERWAPI.CILInstructions

This is the method that all the public emitX methods route to once everything is setup correctly.

Private Methods

Méthode Description
doEmit ( string localNames, string localTypes ) : PERWAPI.CILInstructions
emitWrapper ( PERWAPI main, int paramLen ) : void

Emit wrapper.

emitWrappers ( ) : void

Emit wrappers.

pushArgs ( PERWAPI code, bool self, int count ) : void

Push the specified number of arguments onto the stack.

Method Details

FMethodEmit() public méthode

Constructor.
public FMethodEmit ( FTypeEmit emit ) : System.Collections
emit FTypeEmit
Résultat System.Collections

FMethodEmit() public méthode

Constructor.
public FMethodEmit ( FTypeEmit emit, FMethod method ) : System.Collections
emit FTypeEmit
method Fanx.Fcode.FMethod
Résultat System.Collections

doEmit() protected méthode

This is the method that all the public emitX methods route to once everything is setup correctly.
protected doEmit ( ) : PERWAPI.CILInstructions
Résultat PERWAPI.CILInstructions

emitCtor() public méthode

Emit a constructor - constructors get created as a static factory methods, so that that CallNew can just push args and invoke them fan: class Foo { new make(Long a) { ... } } .net: static Foo make(Long a) { return make_(new Foo(), a) } static Foo make_(Foo self, Long a) { ... return self } We call the first method "make" the "factory" and the second method "make_" the "body". CallNew opcodes are routed to the ctor factory, and CallCtor opcodes are routed to the ctor body.
public emitCtor ( ) : void
Résultat void

emitInterfaceRouter() public méthode

The CLR requires all methods implemented by an interface to be marked as virtual. However, Fantom (and Java) allow this: mixin Mixin { abstract Long foo() } class Base { Long foo() { return 5 } } class Child : Base, Mixin { // don't need to implement foo() since Base defined it } So to work correctly in the CLR we need to trap this case and emit a virtual router method on child to satisfy the interface requirement: class Child : Base, Mixin { public virtual Long foo() { return base.foo(); } } TODO - optimize the intra-pod case
public emitInterfaceRouter ( Type implType, Method m ) : void
implType Fan.Sys.Type
m Fan.Sys.Method
Résultat void

emitMixinBody() public méthode

public emitMixinBody ( ) : void
Résultat void

emitMixinInterface() public méthode

Emit the method as a mixin interface
public emitMixinInterface ( ) : void
Résultat void

emitMixinRouter() public méthode

Emit a mixin router from a class to the mixin body methods.
public emitMixinRouter ( Method m ) : void
m Fan.Sys.Method
Résultat void

emitNative() public méthode

public emitNative ( ) : void
Résultat void

emitStandard() public méthode

Emit a standard instance/static class method.
public emitStandard ( ) : void
Résultat void