Function To Macro Expression Without @:build

44 views
Skip to first unread message

AlienCoder

unread,
Feb 14, 2017, 1:04:07 PM2/14/17
to Haxe

Hello Community,

I would like to use a macro to rebuild a given function. The parameterTypes, the function body and the returnValueType should be seperated and be handed over to another object.


But instead of analysing the fields of a whole class with @:build I would like to hand over a function to a macro function that returns an object like the following.


macro static function rebuildFunction( func : haxe.Constraints.Function ) : Expr

... which finally supplies the following object on runtime:

{ func : Function, params : Array<T>, returnValue : T }



So how do I convert a haxe.Constraints.Function type to a haxe.macro.Expr.
Function type?

Does anybody have an idea?

Kind regards
Michael

AlienCoder

unread,
Feb 16, 2017, 4:03:34 AM2/16/17
to Haxe
PS:

As nobody has answered yet, I assume the question was incorrectly posed. Probably it would not work the "easy" way, as I hoped for.

Now I am working on the same objective. This time I go the apparently more complicated way to have each function being analyzed component by component.

And it turns out, that it is not as complicated as it looked on the first sight.
;-)

Kind regards
Michael
Reply all
Reply to author
Forward
0 new messages