问题描述
是否可以将我的类型构建宏应用于项目中的所有类而无需修改它们的代码?
Is it possible to apply my type building macro to all classes in a project without modifying their code?
我试图基于Haxe宏实现调试器:基本上,我在类的每个函数中的每个表达式之间注入对函数的调用.当前,我有一个接口IDebuggable
,只有实现该接口的类中的代码才能在断点处停止.
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.
推荐答案
您可以使用 haxe.macro.Compiler.addGlobalMetadata()
.可以通过初始化宏或在命令行上完成:
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())')
这篇关于Haxe:将@:build元数据添加到项目中的所有类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!