11package checkstyle .checks .comments ;
22
33import checkstyle .checks .comments .TypeDocCommentCheck .TypeDocCommentToken ;
4+ import checkstyle .utils .PosHelper ;
45
56/**
67 Checks code documentation on type level
@@ -121,7 +122,7 @@ class FieldDocCommentCheck extends Check {
121122 var prevToken : TokenTree = token .previousSibling ;
122123
123124 if (prevToken == null || ! prevToken .isComment ()) {
124- logPos (' Field " $name " should have documentation' , getReportPos (token ));
125+ logPos (' Field " $name " should have documentation' , PosHelper . getReportPos (token ));
125126 return ;
126127 }
127128 switch (prevToken .tok ) {
@@ -131,29 +132,6 @@ class FieldDocCommentCheck extends Check {
131132 }
132133 }
133134
134- /**
135- report function signature not body
136- @param token function or var token
137- @return Position token position without body
138- **/
139- public static function getReportPos (token : TokenTree ): Position {
140- var pos : Position = token .getPos ();
141- var body : Null <TokenTree > = token .access ().firstChild ().firstOf (POpen ).token ;
142- if (body == null ) return pos ;
143- body = body .nextSibling ;
144- if (body == null ) return pos ;
145- switch (body .tok ) {
146- case BrOpen :
147- case DblDot :
148- body = body .nextSibling ;
149- default :
150- return pos ;
151- }
152- if (body == null ) return pos ;
153- pos .max = body .pos .min ;
154- return pos ;
155- }
156-
157135 function checkIgnoreOverride (token : TokenTree ): Bool {
158136 if (! ignoreOverride ) return false ;
159137 var ignoreTokens : Array <TokenTree > = token .filter ([Kwd (KwdOverride )], FIRST );
0 commit comments