mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Don't expose SyntaxNodePtr impl details
This commit is contained in:
parent
fc0a47a0c1
commit
cae2498513
4 changed files with 7 additions and 9 deletions
|
@ -351,7 +351,7 @@ fn with_children(
|
|||
// FIXME: use a more elegant way to re-fetch the node (#1185), make
|
||||
// `range` private afterwards
|
||||
let mut ptr = SyntaxNodePtr::new(parent);
|
||||
ptr.range = TextRange::offset_len(ptr.range().start(), len);
|
||||
ptr.range = TextRange::offset_len(ptr.range.start(), len);
|
||||
ptr.to_node(&new_root_node)
|
||||
}
|
||||
|
||||
|
|
|
@ -34,12 +34,8 @@ impl SyntaxNodePtr {
|
|||
self.range
|
||||
}
|
||||
|
||||
pub fn kind(&self) -> SyntaxKind {
|
||||
self.kind
|
||||
}
|
||||
|
||||
pub fn cast<N: AstNode>(self) -> Option<AstPtr<N>> {
|
||||
if !N::can_cast(self.kind()) {
|
||||
if !N::can_cast(self.kind) {
|
||||
return None;
|
||||
}
|
||||
Some(AstPtr { raw: self, _ty: PhantomData })
|
||||
|
@ -88,7 +84,7 @@ impl<N: AstNode> AstPtr<N> {
|
|||
}
|
||||
|
||||
pub fn cast<U: AstNode>(self) -> Option<AstPtr<U>> {
|
||||
if !U::can_cast(self.raw.kind()) {
|
||||
if !U::can_cast(self.raw.kind) {
|
||||
return None;
|
||||
}
|
||||
Some(AstPtr { raw: self.raw, _ty: PhantomData })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue