Understanding the AST...
Stefan Koch
uplink.coder at googlemail.com
Thu Feb 22 13:28:37 UTC 2018
On Thursday, 22 February 2018 at 13:21:04 UTC, joe wrote:
> On Monday, 12 February 2018 at 08:47:58 UTC, RazvanN wrote:
>> [...]
>
> Follow up question...
>
> Why is *.parent always null?
> e.g.:
>
> extern(C++) class MyVisitor(AST): ParseTimeTransitiveVisitor!AST
> {
> override void visit(AST.Import i)
> {
> assert(i.parent is null); // always true
> }
>
> override void visitFuncBody(AST.FuncDeclaration f)
> {
> assert(f.parent is null); // always true
> }
> }
I think parent is only set after sema.
and you are overriding the parsetime visitor.
More information about the Digitalmars-d-learn
mailing list