625: minor rename r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2019-01-24 10:41:00 +00:00
commit eaef729377

View file

@ -42,7 +42,7 @@ impl SyntaxNodePtr {
/// Like `SyntaxNodePtr`, but remembers the type of node /// Like `SyntaxNodePtr`, but remembers the type of node
#[derive(Debug, PartialEq, Eq, Hash)] #[derive(Debug, PartialEq, Eq, Hash)]
pub struct AstPtr<N: AstNode> { pub struct AstPtr<N: AstNode> {
ptr: SyntaxNodePtr, raw: SyntaxNodePtr,
_ty: PhantomData<N>, _ty: PhantomData<N>,
} }
@ -56,18 +56,18 @@ impl<N: AstNode> Clone for AstPtr<N> {
impl<N: AstNode> AstPtr<N> { impl<N: AstNode> AstPtr<N> {
pub fn new(node: &N) -> AstPtr<N> { pub fn new(node: &N) -> AstPtr<N> {
AstPtr { AstPtr {
ptr: SyntaxNodePtr::new(node.syntax()), raw: SyntaxNodePtr::new(node.syntax()),
_ty: PhantomData, _ty: PhantomData,
} }
} }
pub fn to_node(self, source_file: &SourceFile) -> &N { pub fn to_node(self, source_file: &SourceFile) -> &N {
let syntax_node = self.ptr.to_node(source_file); let syntax_node = self.raw.to_node(source_file);
N::cast(syntax_node).unwrap() N::cast(syntax_node).unwrap()
} }
pub fn syntax_node_ptr(self) -> SyntaxNodePtr { pub fn syntax_node_ptr(self) -> SyntaxNodePtr {
self.ptr self.raw
} }
} }