Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/ptr.rs')
| -rw-r--r-- | crates/syntax/src/ptr.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/syntax/src/ptr.rs b/crates/syntax/src/ptr.rs index bd96e35cc6..a886972fff 100644 --- a/crates/syntax/src/ptr.rs +++ b/crates/syntax/src/ptr.rs @@ -14,6 +14,8 @@ use std::{ marker::PhantomData, }; +use rowan::TextRange; + use crate::{syntax_node::RustLanguage, AstNode, SyntaxNode}; /// A "pointer" to a [`SyntaxNode`], via location in the source code. @@ -60,6 +62,10 @@ impl<N: AstNode> AstPtr<N> { self.raw.clone() } + pub fn text_range(&self) -> TextRange { + self.raw.text_range() + } + pub fn cast<U: AstNode>(self) -> Option<AstPtr<U>> { if !U::can_cast(self.raw.kind()) { return None; |