From 9cc7d57429542a547f2ea57cf99e370b67e24564 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 1 Feb 2021 13:19:55 +0100 Subject: Use block_def_map in body lowering --- crates/hir_def/src/body.rs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'crates/hir_def/src/body.rs') diff --git a/crates/hir_def/src/body.rs b/crates/hir_def/src/body.rs index b9ecf22fa..41abd8f83 100644 --- a/crates/hir_def/src/body.rs +++ b/crates/hir_def/src/body.rs @@ -46,7 +46,7 @@ pub(crate) struct CfgExpander { pub(crate) struct Expander { cfg_expander: CfgExpander, - crate_def_map: Arc, + def_map: Arc, current_file_id: HirFileId, ast_id_map: Arc, module: ModuleId, @@ -91,7 +91,7 @@ impl Expander { let ast_id_map = db.ast_id_map(current_file_id); Expander { cfg_expander, - crate_def_map, + def_map: crate_def_map, current_file_id, ast_id_map, module, @@ -102,7 +102,6 @@ impl Expander { pub(crate) fn enter_expand( &mut self, db: &dyn DefDatabase, - local_scope: Option<&ItemScope>, macro_call: ast::MacroCall, ) -> ExpandResult> { if self.recursion_limit + 1 > EXPANSION_RECURSION_LIMIT { @@ -112,18 +111,12 @@ impl Expander { let macro_call = InFile::new(self.current_file_id, ¯o_call); - let resolver = |path: ModPath| -> Option { - if let Some(local_scope) = local_scope { - if let Some(def) = path.as_ident().and_then(|n| local_scope.get_legacy_macro(n)) { - return Some(def); - } - } - self.resolve_path_as_macro(db, &path) - }; + let resolver = + |path: ModPath| -> Option { self.resolve_path_as_macro(db, &path) }; let mut err = None; let call_id = - macro_call.as_call_id_with_errors(db, self.crate_def_map.krate(), resolver, &mut |e| { + macro_call.as_call_id_with_errors(db, self.def_map.krate(), resolver, &mut |e| { err.get_or_insert(e); }); let call_id = match call_id { @@ -204,7 +197,7 @@ impl Expander { } fn resolve_path_as_macro(&self, db: &dyn DefDatabase, path: &ModPath) -> Option { - self.crate_def_map + self.def_map .resolve_path(db, self.module.local_id, path, BuiltinShadowMode::Other) .0 .take_macros() -- cgit v1.2.3