diff options
author | Florian Diebold <[email protected]> | 2019-08-30 19:16:28 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-09-02 13:56:38 +0100 |
commit | f92177cfb5088809892455262841e24cf1ecf5b6 (patch) | |
tree | 789f733506520663e6cb5f99eec7d56c1a443831 /crates/ra_syntax | |
parent | a7858bb7bf0a784d56b2b9ef97785a4fa78f7853 (diff) |
Add an expr_source method analogous to the source methods in the code model
... and use that instead of exposing the source map.
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/ptr.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs index 992034ef0..80e55d2aa 100644 --- a/crates/ra_syntax/src/ptr.rs +++ b/crates/ra_syntax/src/ptr.rs | |||
@@ -15,9 +15,8 @@ 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, root: &SyntaxNode) -> SyntaxNode { | 18 | pub fn to_node(self, parent: &SyntaxNode) -> SyntaxNode { |
19 | assert!(root.parent().is_none()); | 19 | successors(Some(parent.clone()), |node| { |
20 | successors(Some(root.clone()), |node| { | ||
21 | node.children().find(|it| self.range.is_subrange(&it.text_range())) | 20 | node.children().find(|it| self.range.is_subrange(&it.text_range())) |
22 | }) | 21 | }) |
23 | .find(|it| it.text_range() == self.range && it.kind() == self.kind) | 22 | .find(|it| it.text_range() == self.range && it.kind() == self.kind) |