diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/syntax/src/ptr.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/syntax/src/ptr.rs b/crates/syntax/src/ptr.rs index 195d2251b..32aa69979 100644 --- a/crates/syntax/src/ptr.rs +++ b/crates/syntax/src/ptr.rs | |||
@@ -35,7 +35,7 @@ impl SyntaxNodePtr { | |||
35 | pub fn to_node(&self, root: &SyntaxNode) -> SyntaxNode { | 35 | pub fn to_node(&self, root: &SyntaxNode) -> SyntaxNode { |
36 | assert!(root.parent().is_none()); | 36 | assert!(root.parent().is_none()); |
37 | successors(Some(root.clone()), |node| { | 37 | successors(Some(root.clone()), |node| { |
38 | node.children().find(|it| it.text_range().contains_range(self.range)) | 38 | node.child_or_token_at_range(self.range).and_then(|it| it.into_node()) |
39 | }) | 39 | }) |
40 | .find(|it| it.text_range() == self.range && it.kind() == self.kind) | 40 | .find(|it| it.text_range() == self.range && it.kind() == self.kind) |
41 | .unwrap_or_else(|| panic!("can't resolve local ptr to SyntaxNode: {:?}", self)) | 41 | .unwrap_or_else(|| panic!("can't resolve local ptr to SyntaxNode: {:?}", self)) |