Generate typedef alias for a class with macro

89 views
Skip to first unread message

Dinko Pavicic

unread,
Oct 28, 2017, 9:42:06 AM10/28/17
to Haxe
Hello!

I would like to generate typedef alias for a class with macros.

For example, I have a json config file with defined class path ... something like this: { "classPath":  "some.class.Class" }.
I'm reading and parsing the config file with build macro and that's easy.
After that I need to generate a typedef alias for a class specified in the config so the generated output would be:

typedef MyTypedef = some.class.Class;

I really don't understand how I could do that with macros.

Any help and example really appreciated!
Thanks in advance,

D.

Dan Korostelev

unread,
Oct 29, 2017, 8:03:06 AM10/29/17
to Haxe
You need to define a new type with kind = TDAlias using Context.defineType, like this: http://try-haxe.mrcdk.com/#F04E6

суббота, 28 октября 2017 г., 16:42:06 UTC+3 пользователь Dinko Pavicic написал:
Reply all
Reply to author
Forward
0 new messages