feat(ast): derive GetSpan for Comment (#25147)

This commit is contained in:
leaysgur committed 2026-07-31 10:06:21 +00:00
1 parent 61e5c54b63
commit cb5bc08c65
2 files changed
+10 -2

No files matched your search

+2 -2
View File
@@ -3,7 +3,7 @@ use bitflags::bitflags;
use oxc_allocator::{Allocator, CloneIn, CloneInSemanticIds};
use oxc_ast_macros::ast;
use oxc_estree::ESTree;
use oxc_span::{ContentEq, Span};
use oxc_span::{ContentEq, GetSpan, Span};
/// Indicates a line or block comment.
#[ast]
@@ -144,7 +144,7 @@ impl<'alloc> CloneIn<'alloc> for CommentNewlines {
/// A comment in source code.
#[ast]
#[generate_derive(CloneIn, ContentEq, ESTree)]
#[generate_derive(CloneIn, ContentEq, ESTree, GetSpan)]
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)]
#[estree(add_fields(value = CommentValue), no_ts_def, no_parent)]
pub struct Comment {
@@ -5,6 +5,7 @@
use oxc_span::{GetSpan, Span};
use crate::ast::comment::*;
use crate::ast::js::*;
use crate::ast::jsx::*;
use crate::ast::literal::*;
@@ -2245,3 +2246,10 @@ impl GetSpan for JSDocUnknownType {
self.span
}
}
impl GetSpan for Comment {
#[inline]
fn span(&self) -> Span {
self.span
}
}