On Thursday, 22 February 2018 at 13:44:51 UTC, RazvanN wrote:
On Thursday, 22 February 2018 at 13:21:04 UTC, joe wrote:
[...]


Indeed, @Stefan is right. The ParseTimeVisitor only contains information available at parse time. If you are interested in the parent you have 2 options: either (1) use the ParseTimeVisitor and implement the AST traversal logic yourself or (2) you can use the SemanticTimeTransitiveVisitor in which case the parent is not going to be null. In the case of (2) you need to also do some semantic analysis (so you need the whole dmd library, not just the parsing one). Here's an example on using the dmd library (including semantic) [1]. You can copy paste that example and add a few lines of code where you instantiate your visitor (which will inherit SemanticTimeTransitiveVisitor).

[...]

awesome, that helps a lot!

Thanks both of you :)

Reply via email to