Haxe:将@:build元数据添加到项目中的所有类 [英] Haxe: add @:build metadata to all classes in project

查看:69
本文介绍了Haxe:将@:build元数据添加到项目中的所有类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将我的类型构建宏应用于项目中的所有类而无需修改它们的代码?

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.

推荐答案

您可以使用初始化宏或在命令行上完成:

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元数据添加到项目中的所有类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆