Fantom

 

abstract class compiler::CBridge

sys::Obj
  compiler::CompilerSupport
    compiler::CBridge

Source

CBridge is the base class for compiler FFI plugins to expose external type systems to the Fantom compiler as CPods, CTypes, and CSlots. Subclasses are registered for a FFI name with the "compilerBridge" facet and must declare a constructor with a Compiler arg.

checkOverride

abstract Void checkOverride(TypeDef t, CSlot base, SlotDef def)

Source

Called during Inherit step when a Fantom slot overrides a FFI slot. Log and throw compiler error if there is a problem.

checkType

abstract Void checkType(TypeDef def)

Source

Called during CheckErrors step for a type which extends a FFI class or implements any FFI mixins.

cleanup

virtual Void cleanup()

Source

Guaranteed cleanup hook

coerce

virtual Expr coerce(Expr expr, CType expected, |->Void| onErr)

Source

Coerce the target expression to the specified type. If the expression is not type compatible run the onErr function. Default implementation provides standard Fantom coercion.

If the bridge is going to coerce expr into a new expression, then it should mark the resulting expression as synthetic. A synthetic expression must be "undoable":

  • TypeCheckExpr where target is uncoerced expr
  • CallExpr where last argument is uncoerced expr See ResolveExpr.resolveAssign for more details.
make

new make(Compiler c)

Source

Constructor with associated compiler.

resolveCall

abstract Expr resolveCall(CallExpr call)

Source

Resolve a method call. Type check the arguments and insert any conversions needed.

resolveConstruction

abstract Expr resolveConstruction(CallExpr call)

Source

Resolve a construction call. Type check the arguments and insert any conversions needed.

resolveConstructorChain

abstract Expr resolveConstructorChain(CallExpr call)

Source

Resolve a construction chain call where a Fantom constructor calls the super-class constructor. Type check the arguments and insert any conversions needed.

resolvePod

abstract CPod resolvePod(Str name, Loc? loc)

Source

Resolve the specified foreign namespace to a CPod. Throw a CompilerErr with appropriate message if name cannot be resolved.

resolveSlotAccess

abstract CSlot? resolveSlotAccess(CType base, Str name, Bool noParens)

Source

Given a dot operator slot access on the given foreign base type, determine the appopriate slot to use based on whether parens were used

base.name    =>  noParens = true
base.name()  =>  noParens = false