public void checkParentLinks ( ) { this . visit ( new NodeVisitor ( ) { @ Override public boolean visit ( AstNode node ) { int type = node . getType ( ) ; if ( type == Token . SCRIPT ) return true ; if ( node . getParent ( ) == null ) throw new IllegalStateException ( "No parent for node: " + node + "\n" + node . toSource ( 0 ) ) ; return true ; } } ) ; }
Debugging function to check that the parser has set the parent link for every node in the tree .