[SIP-16] Getting the source code for a macro application

26 views
Skip to first unread message

Peter Niederwieser

unread,
Mar 30, 2012, 8:44:00 PM3/30/12
to scala...@googlegroups.com
In my macro I'm trying to get hold of the exact source code for the macro application. By casting Tree.pos to scala.tools.nsc.util.Position, I can get lineContent and point, but since the position is not a RangePosition, I cannot get start and end. I was hoping that -Yrangepos would give me the range position (even outside the IDE), but it doesn't. Is this expected?

I was also hoping that I can use a Tree's position to determine whether the Tree is compiler-generated or corresponds to user code. However, I haven't been able to figure out a reliable way to do so. (Again, I don't get a TransparentPosition even with -Yrangepos). Is there a way to determine this, with or without using the Tree's position?

Cheers,
Peter
Reply all
Reply to author
Forward
0 new messages