Don't expose SyntaxNodePtr impl details

This commit is contained in:
Aleksey Kladov 2020-04-16 19:21:18 +02:00
parent fc0a47a0c1
commit cae2498513
4 changed files with 7 additions and 9 deletions

View file

@ -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)
}

View file

@ -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 })