aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-09-03 11:38:47 +0100
committerGitHub <[email protected]>2019-09-03 11:38:47 +0100
commit1c0672b7f802c7e7814ba9a1b3b21ecf866343d6 (patch)
treedf19e2603745c348e2e5d8289be80c2f511b0b0d /crates/ra_syntax
parentf5b60a53f68100937d561acae51e06b5ebb6bd18 (diff)
parent9c3b25177e3c8d609dd24d2c2e01cbb82cab665f (diff)
Merge #1756
1756: Correctly build BodySourceMap for macro-expanded expressions r=flodiebold a=matklad r? @flodiebold Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax')
-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)