aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/syntax')
-rw-r--r--crates/syntax/src/ptr.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/syntax/src/ptr.rs b/crates/syntax/src/ptr.rs
index c077a04cb..282470bae 100644
--- a/crates/syntax/src/ptr.rs
+++ b/crates/syntax/src/ptr.rs
@@ -44,7 +44,7 @@ impl SyntaxNodePtr {
44 pub fn to_node(&self, root: &SyntaxNode) -> SyntaxNode { 44 pub fn to_node(&self, root: &SyntaxNode) -> SyntaxNode {
45 assert!(root.parent().is_none()); 45 assert!(root.parent().is_none());
46 successors(Some(root.clone()), |node| { 46 successors(Some(root.clone()), |node| {
47 node.children().find(|it| it.text_range().contains_range(self.range)) 47 node.child_or_token_at_range(self.range).and_then(|it| it.into_node())
48 }) 48 })
49 .find(|it| it.text_range() == self.range && it.kind() == self.kind) 49 .find(|it| it.text_range() == self.range && it.kind() == self.kind)
50 .unwrap_or_else(|| panic!("can't resolve local ptr to SyntaxNode: {:?}", self)) 50 .unwrap_or_else(|| panic!("can't resolve local ptr to SyntaxNode: {:?}", self))