From 16156d766dd8a5624d9455ffded6358fe879c416 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Mon, 23 Dec 2019 13:18:28 +0800 Subject: Add macro call support for type_of --- crates/ra_hir_def/src/body.rs | 16 ++++++---------- crates/ra_hir_def/src/lib.rs | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'crates/ra_hir_def/src') diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs index d3e4c50ae..8ab92b23a 100644 --- a/crates/ra_hir_def/src/body.rs +++ b/crates/ra_hir_def/src/body.rs @@ -26,7 +26,7 @@ use crate::{ DefWithBodyId, HasModule, Lookup, ModuleId, }; -pub(crate) struct Expander { +pub struct Expander { crate_def_map: Arc, current_file_id: HirFileId, hygiene: Hygiene, @@ -35,18 +35,14 @@ pub(crate) struct Expander { } impl Expander { - pub(crate) fn new( - db: &impl DefDatabase, - current_file_id: HirFileId, - module: ModuleId, - ) -> Expander { + pub fn new(db: &impl DefDatabase, current_file_id: HirFileId, module: ModuleId) -> Expander { let crate_def_map = db.crate_def_map(module.krate); let hygiene = Hygiene::new(db, current_file_id); let ast_id_map = db.ast_id_map(current_file_id); Expander { crate_def_map, current_file_id, hygiene, ast_id_map, module } } - pub(crate) fn enter_expand( + pub fn enter_expand( &mut self, db: &DB, macro_call: ast::MacroCall, @@ -84,14 +80,14 @@ impl Expander { None } - pub(crate) fn exit(&mut self, db: &impl DefDatabase, mut mark: Mark) { + pub fn exit(&mut self, db: &impl DefDatabase, mut mark: Mark) { self.hygiene = Hygiene::new(db, mark.file_id); self.current_file_id = mark.file_id; self.ast_id_map = mem::take(&mut mark.ast_id_map); mark.bomb.defuse(); } - pub(crate) fn to_source(&self, value: T) -> InFile { + pub fn to_source(&self, value: T) -> InFile { InFile { file_id: self.current_file_id, value } } @@ -116,7 +112,7 @@ impl Expander { } } -pub(crate) struct Mark { +pub struct Mark { file_id: HirFileId, ast_id_map: Arc, bomb: DropBomb, diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs index f6c7f38d1..f58ce9a95 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs @@ -48,7 +48,7 @@ use ra_arena::{impl_arena_id, RawId}; use ra_db::{impl_intern_key, salsa, CrateId}; use ra_syntax::{ast, AstNode}; -use crate::body::Expander; +pub use crate::body::Expander; use crate::builtin_type::BuiltinType; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -- cgit v1.2.3