Haxe:将@:build元数据添加到项目中的所有类

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

是否可以在不修改代码的情况下将我的类型构建宏应用于项目中的所有 classes?

我正在尝试实现一个基于 Haxe 宏的调试器:基本上我在 class 的每个函数的每个表达式之间注入对我的函数的调用。目前我有一个接口 IDebuggable 并且只有 classes 中实现该接口的代码可以在断点处停止。

您可以使用haxe.macro.Compiler.addGlobalMetadata() for this. This can either be done from an initialization macro或在命令行上:

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