Expr.pos.file - Retrieve macro file string

45 views
Skip to first unread message

AlienCoder

unread,
May 26, 2016, 4:25:26 AM5/26/16
to Haxe

Hello Community,

what am I doing wrong?

I try to retrieve the position of an expression. At this moment I use a regEx ( EReg ) to filter out the interesting parts of the String expr.pos

var pos = expr.pos;
trace( "Pos: " + pos.file );

But I think, it could be an increasing of performance just to take position file string that is already stored (expr.pos.file).

The compiler denies any cooperation with me (probably my fault).

It tells:

haxe.macro.Position has no field file

... although the API tells something else.

I also have surrounded the requesting method with              #if macro            #end

I feel like a total newby and want to excuse myself, to bother you with such a seemingly banal question.

I have made great experiences with this community. So I want to say thank you for being so supportive and respectful (which is not so certain for an expert community).

Kind regards
Michael

Ben Merckx

unread,
May 26, 2016, 6:27:51 AM5/26/16
to Haxe
You should be able to use Context.getPosInfos(expr.pos) to get the info.

Op donderdag 26 mei 2016 10:25:26 UTC+2 schreef AlienCoder:

AlienCoder

unread,
May 26, 2016, 9:01:15 AM5/26/16
to Haxe

Hello Ben,

thanks for your reply. I even tried that before, but probably something else was wrong, then.

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