aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ptr.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-09-03 09:04:38 +0100
committerAleksey Kladov <[email protected]>2019-09-03 09:04:38 +0100
commit9c3b25177e3c8d609dd24d2c2e01cbb82cab665f (patch)
treedf19e2603745c348e2e5d8289be80c2f511b0b0d /crates/ra_syntax/src/ptr.rs
parent4b51c92feeda0078033508ceee7345c6ac1a97e6 (diff)
Correctly build BodySourceMap for macro-expanded expressions
Diffstat (limited to 'crates/ra_syntax/src/ptr.rs')
-rw-r--r--crates/ra_syntax/src/ptr.rs5
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)