From 2ea9e9441d1cc6b524b57a01384bab353df4c215 Mon Sep 17 00:00:00 2001 From: Don Isaac Date: Tue, 6 Aug 2024 20:11:23 -0400 Subject: [PATCH] feat(semantic): impl GetSpan for AstNode --- crates/oxc_semantic/src/node.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/oxc_semantic/src/node.rs b/crates/oxc_semantic/src/node.rs index 41fca28af71f98..35324724e3547f 100644 --- a/crates/oxc_semantic/src/node.rs +++ b/crates/oxc_semantic/src/node.rs @@ -1,6 +1,7 @@ use oxc_ast::AstKind; use oxc_cfg::BasicBlockId; use oxc_index::IndexVec; +use oxc_span::GetSpan; pub use oxc_syntax::node::{AstNodeId, NodeFlags}; use crate::scope::ScopeId; @@ -64,6 +65,13 @@ impl<'a> AstNode<'a> { } } +impl GetSpan for AstNode<'_> { + #[inline] + fn span(&self) -> oxc_span::Span { + self.kind.span() + } +} + /// Untyped AST nodes flattened into an vec #[derive(Debug, Default)] pub struct AstNodes<'a> {