From b52df9187730abbcd9cbb132f7d184c74b9a3b7f Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Wed, 26 May 2021 01:01:58 +0200 Subject: Stop expanding UseTrees during ItemTree lowering --- crates/hir_def/src/path.rs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'crates/hir_def/src/path.rs') diff --git a/crates/hir_def/src/path.rs b/crates/hir_def/src/path.rs index d9ec03d2d..16440041d 100644 --- a/crates/hir_def/src/path.rs +++ b/crates/hir_def/src/path.rs @@ -14,10 +14,7 @@ use hir_expand::{ }; use syntax::ast; -use crate::{ - type_ref::{TypeBound, TypeRef}, - InFile, -}; +use crate::type_ref::{TypeBound, TypeRef}; #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct ModPath { @@ -56,8 +53,7 @@ impl Display for ImportAlias { impl ModPath { pub fn from_src(db: &dyn DefDatabase, path: ast::Path, hygiene: &Hygiene) -> Option { - let ctx = LowerCtx::with_hygiene(db, hygiene); - lower::lower_path(path, &ctx).map(|it| (*it.mod_path).clone()) + lower::convert_path(db, None, path, hygiene) } pub fn from_segments(kind: PathKind, segments: impl IntoIterator) -> ModPath { @@ -70,18 +66,6 @@ impl ModPath { ModPath { kind, segments: Vec::new() } } - /// Calls `cb` with all paths, represented by this use item. - pub fn expand_use_item( - db: &dyn DefDatabase, - item_src: InFile, - hygiene: &Hygiene, - mut cb: impl FnMut(ModPath, &ast::UseTree, /* is_glob */ bool, Option), - ) { - if let Some(tree) = item_src.value.use_tree() { - lower::lower_use_tree(db, None, tree, hygiene, &mut cb); - } - } - pub fn segments(&self) -> &[Name] { &self.segments } -- cgit v1.2.3