mirror of
https://github.com/aphrody-labs/oxc.git
synced 2026-10-14 22:29:17 +00:00
feat(ast): derive GetSpan for Comment (#25147)
This commit is contained in:
1 parent
61e5c54b63
commit
cb5bc08c65
2 files changed
+10
-2
No files matched your search
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user