问题
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.
回答1:
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())')
来源:https://stackoverflow.com/questions/38075206/haxe-add-build-metadata-to-all-classes-in-project