From b62292e8f9e28410741059ebb25133b8e1e8638a Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 30 Dec 2019 21:18:43 +0100 Subject: basics working --- crates/ra_hir_expand/src/name.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/ra_hir_expand') diff --git a/crates/ra_hir_expand/src/name.rs b/crates/ra_hir_expand/src/name.rs index b3fa1efba..a4d912b99 100644 --- a/crates/ra_hir_expand/src/name.rs +++ b/crates/ra_hir_expand/src/name.rs @@ -37,6 +37,10 @@ impl Name { Name(Repr::TupleField(idx)) } + pub fn for_crate_dependency(dep: &ra_db::Dependency) -> Name { + Name::new_text(dep.name.clone()) + } + /// Shortcut to create inline plain text name const fn new_inline_ascii(text: &[u8]) -> Name { Name::new_text(SmolStr::new_inline_from_ascii(text.len(), text)) -- cgit v1.2.3 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') 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 From 4496e2a06a91e5825f355ce730af802643e8018a Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 10 Jan 2020 18:40:45 +0100 Subject: Apply review suggestions --- crates/ra_hir_expand/src/name.rs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'crates/ra_hir_expand') diff --git a/crates/ra_hir_expand/src/name.rs b/crates/ra_hir_expand/src/name.rs index a4d912b99..b3fa1efba 100644 --- a/crates/ra_hir_expand/src/name.rs +++ b/crates/ra_hir_expand/src/name.rs @@ -37,10 +37,6 @@ impl Name { Name(Repr::TupleField(idx)) } - pub fn for_crate_dependency(dep: &ra_db::Dependency) -> Name { - Name::new_text(dep.name.clone()) - } - /// Shortcut to create inline plain text name const fn new_inline_ascii(text: &[u8]) -> Name { Name::new_text(SmolStr::new_inline_from_ascii(text.len(), text)) -- cgit v1.2.3