diff options
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/ptr.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs index 80e55d2aa..992034ef0 100644 --- a/crates/ra_syntax/src/ptr.rs +++ b/crates/ra_syntax/src/ptr.rs | |||
@@ -15,8 +15,9 @@ impl SyntaxNodePtr { | |||
15 | SyntaxNodePtr { range: node.text_range(), kind: node.kind() } | 15 | SyntaxNodePtr { range: node.text_range(), kind: node.kind() } |
16 | } | 16 | } |
17 | 17 | ||
18 | pub fn to_node(self, parent: &SyntaxNode) -> SyntaxNode { | 18 | pub fn to_node(self, root: &SyntaxNode) -> SyntaxNode { |
19 | successors(Some(parent.clone()), |node| { | 19 | assert!(root.parent().is_none()); |
20 | successors(Some(root.clone()), |node| { | ||
20 | node.children().find(|it| self.range.is_subrange(&it.text_range())) | 21 | node.children().find(|it| self.range.is_subrange(&it.text_range())) |
21 | }) | 22 | }) |
22 | .find(|it| it.text_range() == self.range && it.kind() == self.kind) | 23 | .find(|it| it.text_range() == self.range && it.kind() == self.kind) |