简体   繁体   English

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

[英]Haxe: add @:build metadata to all classes in project

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. 我正在尝试实现一个基于Haxe宏的调试器:基本上我在类的每个函数中的每个表达式之间调用我的函数。 Currently I have an interface IDebuggable and only code in classes that implement that interface can be stopped at breakpoints. 目前我有一个IDebuggable接口,只有实现该接口的类中的代码才能在断点处停止。

You can use haxe.macro.Compiler.addGlobalMetadata() for this. 您可以使用haxe.macro.Compiler.addGlobalMetadata() This can either be done from an initialization macro or on the command line: 这可以从初始化宏或命令行完成:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM