View source

class thx.macro.MacroTypes

Available on neko

Extension methods to work with types at macro time.

Class Fields

static function argumentIsOptional(fun:Type, index:Int):Bool

It returns true if the argument at position index is optional for the given function.

static function getArgumentType(fun:Type, index:Int):Type

It returns the type of an argument at index for a given function.

static function getArity(fun:Type):Int

It returns the arity(number of arguments) of a given function.

static function getClassTypeParameters(type:Type):Array<Type>

It returns an array of type parameters.

static function getFunctionArgument(fun:Type, index:Int):{t:Type, opt:Bool, name:String}

It returns the argument description for a function at index.

static function getFunctionArguments(fun:Type):Array<{t:Type, opt:Bool, name:String}>

It returns an array of argument descriptions for a given function.

static function getFunctionReturn(type:Type):Type

It gets the return type of a function.

static function isFunction(type:Type):Bool

It returns true if the passed type is a function.

static function typeInheritance(type:Type):Array<String>

It returns an array of types in string format representing the inheritance chain of the passed Type.

Toggle inherited fields