romamik
romamik

Reputation: 595

Haxe: add @:build metadata to all classes in project

Is it possible to apply my type building macro to all classes in a project without modifying their code?

I'm trying to implement a debugger based on Haxe macros: basically I inject calls to my function between every expression in every function of the class. Currently I have an interface IDebuggable and only code in classes that implement that interface can be stopped at breakpoints.

Upvotes: 3

Views: 511

Answers (1)

Gama11
Gama11

Reputation: 34148

You can use haxe.macro.Compiler.addGlobalMetadata() for this. This can either be done from an initialization macro or on the command line:

--macro addGlobalMetadata('', '@:build(Build.build())')

Upvotes: 7

Related Questions