1
1
use std:: collections:: BTreeMap ;
2
2
3
- use oxc_ast:: { AstKind , CommentKind , Trivias } ;
3
+ use oxc_ast:: { AstKind , Comment , Trivias } ;
4
4
use oxc_span:: { GetSpan , Span } ;
5
5
use rustc_hash:: FxHashSet ;
6
6
@@ -32,7 +32,7 @@ impl<'a> JSDocBuilder<'a> {
32
32
. trivias
33
33
. comments ( )
34
34
. filter ( |comment| !self . leading_comments_seen . contains ( & comment. span . start ) )
35
- . filter_map ( |comment| self . parse_if_jsdoc_comment ( comment. kind , comment . span ) )
35
+ . filter_map ( |comment| self . parse_if_jsdoc_comment ( comment) )
36
36
. collect :: < Vec < _ > > ( ) ;
37
37
38
38
JSDocFinder :: new ( self . attached_docs , not_attached_docs)
@@ -129,7 +129,7 @@ impl<'a> JSDocBuilder<'a> {
129
129
}
130
130
131
131
self . leading_comments_seen . insert ( comment. span . start ) ;
132
- if let Some ( jsdoc) = self . parse_if_jsdoc_comment ( comment. kind , comment . span ) {
132
+ if let Some ( jsdoc) = self . parse_if_jsdoc_comment ( comment) {
133
133
leading_jsdoc_comments. push ( jsdoc) ;
134
134
}
135
135
}
@@ -144,20 +144,20 @@ impl<'a> JSDocBuilder<'a> {
144
144
true
145
145
}
146
146
147
- fn parse_if_jsdoc_comment ( & self , kind : CommentKind , comment_span : Span ) -> Option < JSDoc < ' a > > {
148
- if !kind. is_multi_line ( ) {
147
+ fn parse_if_jsdoc_comment ( & self , comment : & Comment ) -> Option < JSDoc < ' a > > {
148
+ if !comment . kind . is_multi_line ( ) {
149
149
return None ;
150
150
}
151
151
152
152
// Inside of marker: /*CONTENT*/ => CONTENT
153
- let comment_content = comment_span . source_text ( self . source_text ) ;
153
+ let comment_content = comment . span . source_text ( self . source_text ) ;
154
154
// Should start with "*"
155
155
if !comment_content. starts_with ( '*' ) {
156
156
return None ;
157
157
}
158
158
159
159
// Remove the very first `*`
160
- let jsdoc_span = Span :: new ( comment_span . start + 1 , comment_span . end ) ;
160
+ let jsdoc_span = Span :: new ( comment . span . start + 1 , comment . span . end ) ;
161
161
Some ( JSDoc :: new ( & comment_content[ 1 ..] , jsdoc_span) )
162
162
}
163
163
}
0 commit comments