haXe API Documentation
Back | Index
class haxe.macro.Context
Available in neko
This is an API that can be used by macros implementations.
static function addResource(name : String, data : haxe.io.Bytes) : Unknown
Add or modify a resource that will be accessible with haxe.Resource api.
static function currentPos() : Position
Returns the position at which the macro is called
static function defined(s : String) : Bool
Tells is the given compiler directive has been defined with -D
static function error(msg : String, pos : Position) : Dynamic
Display a compilation error at the given position in code
static function getClassPath() : Array<String>
Return the current classpath
static function getLocalClass() : Null<Ref<ClassType>>
Returns the current class in which the macro is called
static function getModule(name : String) : Array<Type>
Return the list of types defined in the given compilation unit module
static function getPosInfos(p : Position) : { min : Int, max : Int, file : String}
Get the informations stored into a given position.
static function getType(name : String) : Type
Resolve a type from its name.
static function makePosition(inf : { min : Int, max : Int, file : String}) : Position
Build a position with the given informations.
static function onGenerate(callb : Array<Type> -> Void) : Void
Set a callback function that will return all the types compiled before they get generated.
static function parse(expr : String, pos : Position) : Expr
Parse an expression.
static function resolvePath(file : String) : String
Resolve a filename based on current classpath.
static function signature(v : Dynamic) : String
Quickly build an hashed MD5 signature for any given value
static function typeof(e : Expr) : Type
Evaluate the type a given expression would have in the context of the current macro call.
static function warning(msg : String, pos : Position) : Void
Display a compilation warning at the given position in code
Back | Index