Hey guys,
I´m trying to dive into macros...trendy I know. :-) Untit now I can say, that the whole Topic is really hard, but I´ll keep fighting through it. Here´s my problem: I wanna edit the haxe output in JS from some functions. For example the cast-function or something like that.
My idea was to search in my haxecode for every "cast", write a macro to get the "cast"-expr and edit it to my desired output. But I´m stucked, because I can´t find a way to edit the appearance.
Here my idea:
macro static public function replaceCast( e : Expr ) : Array<Field>{
var fields = Context.getBuildFields();
var newField = {
name: "somename",
doc: null,
meta: [Context.addGlobalMetaData()],
access: [AStatic,APublic],
kind: FFun( ret: null, params : null, macro $v{ (cast $e : $type) }, args:[$e, $type]),
pos: Context.currentPos()
};
fields.push(newField);
return fields;
}
Hopefuly you can help me.
Greetings Garga