All these methods can be called for compiler configuration macros.

Static methods

staticaddClassPath(path:String):Void

Available on neko, macro

Add a class path where ".hx" source files or packages (sub-directories) can be found.

Usage of this function outside of initialization macros is deprecated and may cause compilation server issues.

@:value({ toFields : false, toTypes : true, recursive : true })staticaddGlobalMetadata(pathFilter:String, meta:String, recursive:Bool = true, toTypes:Bool = true, toFields:Bool = false):Void

Available on neko, macro

Adds metadata meta to all types (if toTypes = true) or fields (if toFields = true) whose dot-path matches pathFilter.

If recursive is true a dot-path is considered matched if it starts with pathFilter. This automatically applies to path filters of packages. Otherwise an exact match is required.

If pathFilter is the empty String "" it matches everything (if recursive = true) or only top-level types (if recursive = false).

This operation has no effect if the type has already been loaded, e.g. through Context.getType.

staticaddMetadata(meta:String, className:String, ?field:String, ?isStatic:Bool):Void

Deprecated:

Available on neko, macro

Add metadata to a (static) field or class by name. An error is thrown when className or field is invalid.

staticaddNativeArg(argument:String):Void

Available on neko, macro

Adds an argument to be passed to the native compiler (e.g. -javac-arg for Java).

staticaddNativeLib(name:String):Void

Available on neko, macro

Adds a native library depending on the platform (e.g. -swf-lib for Flash).

Usage of this function outside of initialization macros is deprecated and may cause compilation server issues.

staticallowPackage(v:String):Void

Available on neko, macro

staticdefine(flag:String, ?value:String):Void

Available on neko, macro

Set a conditional compiler flag.

Usage of this function outside of initialization macros is deprecated and may cause compilation server issues.

@:value({ rec : true })staticexclude(pack:String, rec:Bool = true):Void

Available on neko, macro

Exclude a specific class, enum, or all classes and enums in a package from being generated. Excluded types become extern.

Parameters:

pack

The package dot-path as String. Use '' to exclude the root package.

rec

If true, recursively excludes all sub-packages.

staticexcludeFile(fileName:String):Void

Available on neko, macro

Exclude classes and enums listed in an extern file (one per line) from being generated.

staticflushDiskCache():Void

Available on neko, macro

Clears cached results of file lookups

staticgetConfiguration():Null<CompilerConfiguration>

Available on neko, macro

Returns all the configuration settings applied to the compiler.

Usage of this function outside a macro context returns null.

staticgetDefine(key:Dynamic):Dynamic

A conditional compilation flag can be set on the command line using -D key=value.

Returns the value of a compiler flag.

If the compiler flag is defined but no value is set, Compiler.getDefine returns "1" (e.g. -D key).

If the compiler flag is not defined, Compiler.getDefine returns null.

Note: This is a macro and cannot be called from within other macros. Refer to haxe.macro.Context.definedValue to obtain defined values in macro context.

See also:

staticgetDisplayPos():Null<{pos:Int, file:String}>

Available on neko, macro

staticgetOutput():String

Available on neko, macro

@:value({ strict : false, rec : true })staticinclude(pack:String, rec:Bool = true, ?ignore:Array<String>, ?classPaths:Array<String>, strict:Bool = false):Void

Available on neko, macro

Includes all modules in package pack in the compilation.

In order to include single modules, their paths can be listed directly on command line: haxe ... ModuleName pack.ModuleName.

By default Compiler.include will search for modules in the directories defined with -cp. If you want to specify a different set of paths to search for modules, you can use the optional argument classPath.

Parameters:

pack

The package dot-path as String. Use '' to include the root package.

rec

If true, recursively adds all sub-packages.

ignore

Array of module names to ignore for inclusion. You can use module* with a * at the end for Wildcard matching

classPaths

An alternative array of paths (directory names) to use to search for modules to include. Note that if you pass this argument, only the specified paths will be used for inclusion.

strict

If true and given package wasn't found in any of class paths, fail with an error.

staticincludeFile(file:Dynamic, position:Dynamic):Dynamic

Available on js, lua

Embed a JavaScript or Lua file at compile time (can be called by --macro or within an __init__ method).

@:has_untyped@:value({ position : Top })staticincludeFile(file:String, position:IncludePosition = Top):Expr

Available on macro

Embed a JavaScript or Lua file at compile time (can be called by --macro or within an __init__ method).

@:value({ recursive : true })statickeep(?path:String, ?paths:Array<String>, recursive:Bool = true):Void

Available on neko, macro

Marks types or packages to be kept by DCE.

This also extends to the sub-types of resolved modules.

In order to include module sub-types directly, their full dot path including the containing module has to be used (e.g. msignal.Signal.Signal0).

This operation has no effect if the type has already been loaded, e.g. through Context.getType.

Parameters:

path

A package, module or sub-type dot path to keep.

paths

An Array of package, module or sub-type dot paths to keep.

recursive

If true, recurses into sub-packages for package paths.

@:value({ recursive : true, mode : Loose })staticnullSafety(path:String, mode:NullSafetyMode = Loose, recursive:Bool = true):Void

Available on neko, macro

Enables null safety for a type or a package.

Parameters:

path

A package, module or sub-type dot path to enable null safety for.

recursive

If true, recurses into sub-packages for package paths.

staticpatchTypes(file:String):Void

Deprecated: "Will be removed in Haxe 5.0"

Available on neko, macro

Load a type patch file that can modify the field types within declared classes and enums.

staticregisterCustomDefine(define:DefineDescription, ?source:String):Void

Available on neko, macro

Register a custom define for documentation purposes

staticregisterCustomMetadata(meta:MetadataDescription, ?source:String):Void

Available on neko, macro

Register a custom medatada for documentation and completion purposes

staticregisterDefinesDescriptionFile(path:String, ?source:String):Void

Available on neko, macro

Reference a json file describing user-defined defines See https://github.com/HaxeFoundation/haxe/blob/development/src-json/define.json

staticregisterMetadataDescriptionFile(path:String, ?source:String):Void

Available on neko, macro

Reference a json file describing user-defined metadata See https://github.com/HaxeFoundation/haxe/blob/development/src-json/meta.json

staticremoveField(className:String, field:String, ?isStatic:Bool):Void

Deprecated: "Will be removed in Haxe 5.0"

Available on neko, macro

Removes a (static) field from a given class by name. An error is thrown when className or field is invalid.

staticsetCustomJSGenerator(callb:JSGenApi ‑> Void):Void

Available on neko, macro

Change the default JS output by using a custom generator callback

staticsetFieldType(className:String, field:String, type:String, ?isStatic:Bool):Void

Deprecated: "Will be removed in Haxe 5.0"

Available on neko, macro

Set the type of a (static) field at a given class by name. An error is thrown when className or field is invalid.

staticsetOutput(fileOrDir:String):Void

Available on neko, macro