haxe.macro.Compiler.addMetadata and Enums

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

haxe.macro.Compiler.addMetadata and Enums

Dominic De Lorenzo-2
Hi List,

Is it possible to dynamically add metadata to an Enum in a macro in the same way you can currently for classes using Compiler.addMetadata?

For example, I have a macro that injects @:nativePath metadata into all classes to remap their compile-time paths. 

     Compiler.addMetadata("@:nativePath('aaa.Class1', 'com.example.OriginalClass');

I'd also like to be able to remap Enums in the same way, however addMetadata ignores Enums :

     Compiler.addMetadata("@:nativePath('aaa.Enum1', 'com.example.OriginalEnum');

   1) adding '@:nativePath' to a Enum in hx source works fine (in 2.0.8) ,
   2) the same issue arrises with any custom metadata like '@Foo'

Is there a workaround for Enums, or is it a limitation of the current haxe.macro.Compiler API?


haXe - an open source web programming language