C# Класс 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.
Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
doEmit ( ) : PERWAPI.CILInstructions

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

Приватные методы

Метод Описание
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.

Описание методов

FMethodEmit() публичный Метод

Constructor.
public FMethodEmit ( FTypeEmit emit ) : System.Collections
emit FTypeEmit
Результат System.Collections

FMethodEmit() публичный Метод

Constructor.
public FMethodEmit ( FTypeEmit emit, FMethod method ) : System.Collections
emit FTypeEmit
method Fanx.Fcode.FMethod
Результат System.Collections

doEmit() защищенный Метод

This is the method that all the public emitX methods route to once everything is setup correctly.
protected doEmit ( ) : PERWAPI.CILInstructions
Результат PERWAPI.CILInstructions

emitCtor() публичный Метод

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
Результат void

emitInterfaceRouter() публичный Метод

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
Результат void

emitMixinBody() публичный Метод

public emitMixinBody ( ) : void
Результат void

emitMixinInterface() публичный Метод

Emit the method as a mixin interface
public emitMixinInterface ( ) : void
Результат void

emitMixinRouter() публичный Метод

Emit a mixin router from a class to the mixin body methods.
public emitMixinRouter ( Method m ) : void
m Fan.Sys.Method
Результат void

emitNative() публичный Метод

public emitNative ( ) : void
Результат void

emitStandard() публичный Метод

Emit a standard instance/static class method.
public emitStandard ( ) : void
Результат void