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

会有一股神秘感。 提交于 2019-12-12 08:58:52

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!