Macro Trouble

109 views
Skip to first unread message

AlienCoder

unread,
May 13, 2016, 9:58:17 AM5/13/16
to Haxe

Hello Community,

I try to get familiar with HAXE macros. Therefore I have done some own experiments (not very successfully). Finally I have tried to get a script from GitHub to run:

https://gist.github.com/FuzzyWuzzie/412e2109a5f5fbcf12e1

The compiler claims:

src/Profile.hx 54:    Class <haxe.macro.Context> has no field 'makeExpr'

Which is a vicious lie of that damn mashine...

I have had a look in the specific class as maybe the API has changed in the meantime.

Confusingly this function is still present.

And I can't solute a problem, that apperently does not exist.
...

Another hint:
In the orignal code the error causing line is written as macro { ... } which is the shorthand for Context.makeExpr()

Does anybody have an idea?

HAXE macros are really cool. But still they are a secret science as many peoply say...

Kind regards
Michael

Anton Nesterov

unread,
May 13, 2016, 10:17:47 AM5/13/16
to Haxe
You need to add
#if macro

private static function remapReturn(expr:Expr):Expr
...

#end
around functions that don't have macro keyword and contain macro specific code. Class haxe.macro.Context doesn't have any methods when compiler generating final code.


пятница, 13 мая 2016 г., 16:58:17 UTC+3 пользователь AlienCoder написал:

AlienCoder

unread,
May 14, 2016, 8:59:25 AM5/14/16
to Haxe

Hello Anton,

thank you for your reply.

I'll try that out.

Kind regards
Michael
 
Reply all
Reply to author
Forward
Message has been deleted
0 new messages