From 12905e5b58f22df026ef30afa6f0bdf7319cbddd Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 5 Jan 2020 21:32:18 +0100 Subject: Some more refactoring --- crates/ra_hir_expand/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'crates/ra_hir_expand/src') diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs index 2fa5d5140..51c5f9623 100644 --- a/crates/ra_hir_expand/src/lib.rs +++ b/crates/ra_hir_expand/src/lib.rs @@ -322,3 +322,13 @@ impl InFile { }) } } + +impl InFile { + pub fn descendants(self) -> impl Iterator> { + self.value.syntax().descendants().filter_map(T::cast).map(move |n| self.with_value(n)) + } + + pub fn syntax(&self) -> InFile<&SyntaxNode> { + self.with_value(self.value.syntax()) + } +} -- cgit v1.2.3