@@ -132,9 +132,9 @@ private newtype TPrintAstNode =
132132 TGenericTypeNode ( GenericType ty ) { shouldPrint ( ty , _) } or
133133 TGenericCallableNode ( GenericCallable c ) { shouldPrint ( c , _) } or
134134 TDocumentableNode ( Documentable d ) { shouldPrint ( d , _) and exists ( d .getJavadoc ( ) ) } or
135- TJavadocNode ( Javadoc jd ) { exists ( Documentable d | d .getJavadoc ( ) = jd | shouldPrint ( d , _) ) } or
136- TJavadocElementNode ( JavadocElement jd ) {
137- exists ( Documentable d | d .getJavadoc ( ) = jd .getParent * ( ) | shouldPrint ( d , _) )
135+ TJavadocNode ( Javadoc jd , Documentable d ) { d .getJavadoc ( ) = jd and shouldPrint ( d , _) } or
136+ TJavadocElementNode ( JavadocElement jd , Documentable d ) {
137+ d .getJavadoc ( ) = jd .getParent * ( ) and shouldPrint ( d , _)
138138 } or
139139 TImportsNode ( CompilationUnit cu ) {
140140 shouldPrint ( cu , _) and exists ( Import i | i .getCompilationUnit ( ) = cu )
@@ -794,6 +794,7 @@ final class DocumentableNode extends PrintAstNode, TDocumentableNode {
794794 override Location getLocation ( ) { none ( ) }
795795
796796 override JavadocNode getChild ( int childIndex ) {
797+ result .getDocumentable ( ) = d and
797798 result .getJavadoc ( ) =
798799 rank [ childIndex ] ( Javadoc jd , string file , int line , int column |
799800 jd .getCommentedElement ( ) = d and jd .getLocation ( ) .hasLocationInfo ( file , line , column , _, _)
@@ -814,21 +815,28 @@ final class DocumentableNode extends PrintAstNode, TDocumentableNode {
814815 */
815816final class JavadocNode extends PrintAstNode , TJavadocNode {
816817 Javadoc jd ;
818+ Documentable d ;
817819
818- JavadocNode ( ) { this = TJavadocNode ( jd ) }
820+ JavadocNode ( ) { this = TJavadocNode ( jd , d ) and not duplicateMetadata ( d ) }
819821
820822 override string toString ( ) { result = getQlClass ( jd ) + jd .toString ( ) }
821823
822824 override Location getLocation ( ) { result = jd .getLocation ( ) }
823825
824826 override JavadocElementNode getChild ( int childIndex ) {
827+ result .getDocumentable ( ) = d and
825828 result .getJavadocElement ( ) = jd .getChild ( childIndex )
826829 }
827830
828831 /**
829832 * Gets the `Javadoc` represented by this node.
830833 */
831834 Javadoc getJavadoc ( ) { result = jd }
835+
836+ /**
837+ * Gets the `Documentable` whose `Javadoc` is represented by this node.
838+ */
839+ Documentable getDocumentable ( ) { result = d }
832840}
833841
834842/**
@@ -837,21 +845,28 @@ final class JavadocNode extends PrintAstNode, TJavadocNode {
837845 */
838846final class JavadocElementNode extends PrintAstNode , TJavadocElementNode {
839847 JavadocElement jd ;
848+ Documentable d ;
840849
841- JavadocElementNode ( ) { this = TJavadocElementNode ( jd ) }
850+ JavadocElementNode ( ) { this = TJavadocElementNode ( jd , d ) and not duplicateMetadata ( d ) }
842851
843852 override string toString ( ) { result = getQlClass ( jd ) + jd .toString ( ) }
844853
845854 override Location getLocation ( ) { result = jd .getLocation ( ) }
846855
847856 override JavadocElementNode getChild ( int childIndex ) {
857+ result .getDocumentable ( ) = d and
848858 result .getJavadocElement ( ) = jd .( JavadocParent ) .getChild ( childIndex )
849859 }
850860
851861 /**
852862 * Gets the `JavadocElement` represented by this node.
853863 */
854864 JavadocElement getJavadocElement ( ) { result = jd }
865+
866+ /**
867+ * Gets the `Documentable` whose `JavadocElement` is represented by this node.
868+ */
869+ Documentable getDocumentable ( ) { result = d }
855870}
856871
857872/**
0 commit comments