Get type/type name from a haxe.macro.Position?

As titled.

For example, from a haxe.macro.ClassType we have a pos:Position value. From that Position value alone is it possible to deduce back the type/type name?

The worst case I can think of is to parse the source at that position and get the info from there? Anything better?

This should work:

  1. deduce the module from the file name (class paths should help)
  2. get all types from Context.getModule
  3. find the one that contains the position
1 Like