addAnyChild<T extends ParseTree> method
T
addAnyChild<T extends ParseTree>(
- T t
inherited
Add a parse tree node to this as a child. Works for internal and leaf nodes. Does not set parent link; other add methods must do that. Other addChild methods call this.
We cannot set the parent pointer of the incoming node because the existing interfaces do not have a setParent() method and I don't want to break backward compatibility for this.
@since 4.7
Implementation
T addAnyChild<T extends ParseTree>(T t) {
children ??= [];
children!.add(t);
return t;
}