Add an expr_source method analogous to the source methods in the code model
... and use that instead of exposing the source map.
This commit is contained in:
@@ -15,9 +15,8 @@ impl SyntaxNodePtr {
|
||||
SyntaxNodePtr { range: node.text_range(), kind: node.kind() }
|
||||
}
|
||||
|
||||
pub fn to_node(self, root: &SyntaxNode) -> SyntaxNode {
|
||||
assert!(root.parent().is_none());
|
||||
successors(Some(root.clone()), |node| {
|
||||
pub fn to_node(self, parent: &SyntaxNode) -> SyntaxNode {
|
||||
successors(Some(parent.clone()), |node| {
|
||||
node.children().find(|it| self.range.is_subrange(&it.text_range()))
|
||||
})
|
||||
.find(|it| it.text_range() == self.range && it.kind() == self.kind)
|
||||
|
||||
Reference in New Issue
Block a user