@@ -132,9 +132,9 @@ private newtype TPrintAstNode =
132
132
TGenericTypeNode ( GenericType ty ) { shouldPrint ( ty , _) } or
133
133
TGenericCallableNode ( GenericCallable c ) { shouldPrint ( c , _) } or
134
134
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 , _)
138
138
} or
139
139
TImportsNode ( CompilationUnit cu ) {
140
140
shouldPrint ( cu , _) and exists ( Import i | i .getCompilationUnit ( ) = cu )
@@ -794,6 +794,7 @@ final class DocumentableNode extends PrintAstNode, TDocumentableNode {
794
794
override Location getLocation ( ) { none ( ) }
795
795
796
796
override JavadocNode getChild ( int childIndex ) {
797
+ result .getDocumentable ( ) = d and
797
798
result .getJavadoc ( ) =
798
799
rank [ childIndex ] ( Javadoc jd , string file , int line , int column |
799
800
jd .getCommentedElement ( ) = d and jd .getLocation ( ) .hasLocationInfo ( file , line , column , _, _)
@@ -814,21 +815,28 @@ final class DocumentableNode extends PrintAstNode, TDocumentableNode {
814
815
*/
815
816
final class JavadocNode extends PrintAstNode , TJavadocNode {
816
817
Javadoc jd ;
818
+ Documentable d ;
817
819
818
- JavadocNode ( ) { this = TJavadocNode ( jd ) }
820
+ JavadocNode ( ) { this = TJavadocNode ( jd , d ) and not duplicateMetadata ( d ) }
819
821
820
822
override string toString ( ) { result = getQlClass ( jd ) + jd .toString ( ) }
821
823
822
824
override Location getLocation ( ) { result = jd .getLocation ( ) }
823
825
824
826
override JavadocElementNode getChild ( int childIndex ) {
827
+ result .getDocumentable ( ) = d and
825
828
result .getJavadocElement ( ) = jd .getChild ( childIndex )
826
829
}
827
830
828
831
/**
829
832
* Gets the `Javadoc` represented by this node.
830
833
*/
831
834
Javadoc getJavadoc ( ) { result = jd }
835
+
836
+ /**
837
+ * Gets the `Documentable` whose `Javadoc` is represented by this node.
838
+ */
839
+ Documentable getDocumentable ( ) { result = d }
832
840
}
833
841
834
842
/**
@@ -837,21 +845,28 @@ final class JavadocNode extends PrintAstNode, TJavadocNode {
837
845
*/
838
846
final class JavadocElementNode extends PrintAstNode , TJavadocElementNode {
839
847
JavadocElement jd ;
848
+ Documentable d ;
840
849
841
- JavadocElementNode ( ) { this = TJavadocElementNode ( jd ) }
850
+ JavadocElementNode ( ) { this = TJavadocElementNode ( jd , d ) and not duplicateMetadata ( d ) }
842
851
843
852
override string toString ( ) { result = getQlClass ( jd ) + jd .toString ( ) }
844
853
845
854
override Location getLocation ( ) { result = jd .getLocation ( ) }
846
855
847
856
override JavadocElementNode getChild ( int childIndex ) {
857
+ result .getDocumentable ( ) = d and
848
858
result .getJavadocElement ( ) = jd .( JavadocParent ) .getChild ( childIndex )
849
859
}
850
860
851
861
/**
852
862
* Gets the `JavadocElement` represented by this node.
853
863
*/
854
864
JavadocElement getJavadocElement ( ) { result = jd }
865
+
866
+ /**
867
+ * Gets the `Documentable` whose `JavadocElement` is represented by this node.
868
+ */
869
+ Documentable getDocumentable ( ) { result = d }
855
870
}
856
871
857
872
/**
0 commit comments