Skip to content

Commit c730388

Browse files
committed
feat(semantic): add is_inside_comment method
1 parent 7f7b9ae commit c730388

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/oxc_semantic/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
use std::ops::RangeBounds;
99

1010
use oxc_ast::{
11-
AstKind, Comment, CommentsRange, ast::IdentifierReference, comments_range, has_comments_between,
11+
AstKind, Comment, CommentsRange, ast::IdentifierReference, comments_range,
12+
has_comments_between, is_inside_comment,
1213
};
1314
#[cfg(feature = "cfg")]
1415
use oxc_cfg::ControlFlowGraph;
@@ -158,6 +159,10 @@ impl<'a> Semantic<'a> {
158159
has_comments_between(self.comments, span)
159160
}
160161

162+
pub fn is_inside_comment(&self, pos: u32) -> bool {
163+
is_inside_comment(self.comments, pos)
164+
}
165+
161166
pub fn irregular_whitespaces(&self) -> &[Span] {
162167
&self.irregular_whitespaces
163168
}

0 commit comments

Comments
 (0)