@@ -227,22 +227,19 @@ private static String getOperatorId(AstNode operatorFunctionId) {
227227 private static List <Token > getDeclaratorInlineComment (AstNode declarator ) {
228228 List <Token > comments ;
229229
230- // inline comments are attached to the next AST node (not sibling,
231- // because the last attribute inline comment is attached to the next
232- // node of the parent)
230+ // inline comments are attached to the next AST node (not sibling, because the last attribute inline comment
231+ // is attached to the next node of the parent)
233232 var next = declarator .getNextAstNode ();
234233
235- // inline documentation may be on the next definition token
236- // or next curly brace
234+ // inline documentation may be on the next definition token or next curly brace
237235 if (next != null ) {
238236 // discard COMMA and SEMICOLON
239237 if (next .getToken ().getType ().equals (CxxPunctuator .COMMA )
240238 || next .getToken ().getType ().equals (CxxPunctuator .SEMICOLON )) {
241239 next = next .getNextAstNode ();
242240 }
243241
244- comments = getInlineDocumentation (next .getToken (),
245- declarator .getTokenLine ());
242+ comments = getInlineDocumentation (next .getToken ());
246243 } else {
247244 // could happen on parse error ?
248245 comments = new ArrayList <>();
@@ -309,21 +306,18 @@ private static boolean isPublicApiMember(AstNode node) {
309306 }
310307
311308 /**
312- * Check if inline Doxygen documentation is attached to the given token at specified line
309+ * Check if inline Doxygen documentation is attached to the end of the line
313310 *
314311 * @param token the token to inspect
315- * @param line line of the inlined documentation
316312 * @return true if documentation is found for specified line, false otherwise
317313 */
318- private static List <Token > getInlineDocumentation (Token token , int line ) {
314+ private static List <Token > getInlineDocumentation (Token token ) {
319315 var comments = new ArrayList <Token >();
320316
321317 for (var trivia : token .getTrivia ()) {
322318 if (trivia .isComment ()) {
323319 var triviaToken = trivia .getToken ();
324- if ((triviaToken != null )
325- && (triviaToken .getLine () == line )
326- && (isDoxygenInlineComment (triviaToken .getValue ()))) {
320+ if ((triviaToken != null ) && (isDoxygenInlineComment (triviaToken .getValue ()))) {
327321 comments .add (triviaToken );
328322 }
329323 }
@@ -806,11 +800,9 @@ private void visitAliasDeclaration(AstNode aliasDeclNode) {
806800 }
807801
808802 private void visitEnumSpecifier (AstNode enumSpecifierNode ) {
809- var enumIdNode = enumSpecifierNode .getFirstDescendant (
810- GenericTokenType .IDENTIFIER );
803+ var enumIdNode = enumSpecifierNode .getFirstDescendant (GenericTokenType .IDENTIFIER );
811804
812- String enumId = (enumIdNode == null )
813- ? UNNAMED_ENUM_ID : enumIdNode .getTokenValue ();
805+ String enumId = (enumIdNode == null ) ? UNNAMED_ENUM_ID : enumIdNode .getTokenValue ();
814806
815807 if (!isPublicApiMember (enumSpecifierNode )) {
816808 // not in public API
@@ -823,17 +815,13 @@ private void visitEnumSpecifier(AstNode enumSpecifierNode) {
823815 docNode = enumSpecifierNode ;
824816 }
825817
826- visitPublicApi (
827- enumSpecifierNode , enumId ,
828- getBlockDocumentation (docNode ));
818+ visitPublicApi (enumSpecifierNode , enumId ,getBlockDocumentation (docNode ));
829819
830820 // deal with enumeration values
831- AstNode enumeratorList = enumSpecifierNode
832- .getFirstDescendant (CxxGrammarImpl .enumeratorList );
821+ AstNode enumeratorList = enumSpecifierNode .getFirstDescendant (CxxGrammarImpl .enumeratorList );
833822
834823 if (enumeratorList != null ) {
835- for (var definition : enumeratorList
836- .getChildren (CxxGrammarImpl .enumeratorDefinition )) {
824+ for (var definition : enumeratorList .getChildren (CxxGrammarImpl .enumeratorDefinition )) {
837825
838826 // look for block documentation
839827 List <Token > comments = getBlockDocumentation (definition );
@@ -842,24 +830,18 @@ private void visitEnumSpecifier(AstNode enumSpecifierNode) {
842830 if (comments .isEmpty ()) {
843831 var next = definition .getNextAstNode ();
844832
845- // inline documentation may be on the next definition token
846- // or next curly brace
833+ // inline documentation may be on the next definition token or next curly brace
847834 if (next != null ) {
848835 // discard COMMA
849836 if (next .getToken ().getType ().equals (CxxPunctuator .COMMA )) {
850837 next = next .getNextAstNode ();
851838 }
852839
853- comments = getInlineDocumentation (next .getToken (),
854- definition .getTokenLine ());
840+ comments = getInlineDocumentation (next .getToken ());
855841 }
856842 }
857843
858- visitPublicApi (
859- definition ,
860- definition .getFirstDescendant (
861- GenericTokenType .IDENTIFIER ).getTokenValue (),
862- comments );
844+ visitPublicApi (definition , definition .getFirstDescendant ( GenericTokenType .IDENTIFIER ).getTokenValue (), comments );
863845 }
864846 }
865847 }
0 commit comments