Skip to content

Commit

Permalink
feat(semantic): impl GetSpan for AstNode (#4717)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonIsaac committed Aug 7, 2024
1 parent 7345bc9 commit 33f1312
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/oxc_semantic/src/node.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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> {
Expand Down

0 comments on commit 33f1312

Please sign in to comment.