From f9d0d511011b7071c621ac3f7c64c4aaec7f2dfb Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 24 Nov 2020 21:55:08 +0100 Subject: hir_expand::db: reduce fn visibility --- crates/hir_expand/src/db.rs | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'crates') diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs index 3fd9a90a8..36d3307a1 100644 --- a/crates/hir_expand/src/db.rs +++ b/crates/hir_expand/src/db.rs @@ -138,16 +138,13 @@ pub fn expand_hypothetical( Some((node.syntax_node(), token)) } -pub(crate) fn ast_id_map(db: &dyn AstDatabase, file_id: HirFileId) -> Arc { +fn ast_id_map(db: &dyn AstDatabase, file_id: HirFileId) -> Arc { let map = db.parse_or_expand(file_id).map_or_else(AstIdMap::default, |it| AstIdMap::from_source(&it)); Arc::new(map) } -pub(crate) fn macro_def( - db: &dyn AstDatabase, - id: MacroDefId, -) -> Option> { +fn macro_def(db: &dyn AstDatabase, id: MacroDefId) -> Option> { match id.kind { MacroDefKind::Declarative => { let macro_call = id.ast_id?.to_node(db); @@ -178,7 +175,7 @@ pub(crate) fn macro_def( } } -pub(crate) fn macro_arg_text(db: &dyn AstDatabase, id: MacroCallId) -> Option { +fn macro_arg_text(db: &dyn AstDatabase, id: MacroCallId) -> Option { let id = match id { MacroCallId::LazyMacro(id) => id, MacroCallId::EagerMacro(_id) => { @@ -191,16 +188,13 @@ pub(crate) fn macro_arg_text(db: &dyn AstDatabase, id: MacroCallId) -> Option Option> { +fn macro_arg(db: &dyn AstDatabase, id: MacroCallId) -> Option> { let arg = db.macro_arg_text(id)?; let (tt, tmap) = mbe::syntax_node_to_token_tree(&SyntaxNode::new_root(arg))?; Some(Arc::new((tt, tmap))) } -pub(crate) fn macro_expand(db: &dyn AstDatabase, id: MacroCallId) -> MacroResult> { +fn macro_expand(db: &dyn AstDatabase, id: MacroCallId) -> MacroResult> { macro_expand_with_arg(db, id, None) } @@ -258,7 +252,7 @@ fn macro_expand_with_arg( MacroResult { value: Some(Arc::new(tt)), error: err.map(|e| format!("{:?}", e)) } } -pub(crate) fn expand_proc_macro( +fn expand_proc_macro( db: &dyn AstDatabase, id: MacroCallId, ) -> Result { @@ -285,7 +279,7 @@ pub(crate) fn expand_proc_macro( expander.expand(db, lazy_id, ¯o_arg.0) } -pub(crate) fn parse_or_expand(db: &dyn AstDatabase, file_id: HirFileId) -> Option { +fn parse_or_expand(db: &dyn AstDatabase, file_id: HirFileId) -> Option { match file_id.0 { HirFileIdRepr::FileId(file_id) => Some(db.parse(file_id).tree().syntax().clone()), HirFileIdRepr::MacroFile(macro_file) => { @@ -294,14 +288,14 @@ pub(crate) fn parse_or_expand(db: &dyn AstDatabase, file_id: HirFileId) -> Optio } } -pub(crate) fn parse_macro( +fn parse_macro( db: &dyn AstDatabase, macro_file: MacroFile, ) -> MacroResult<(Parse, Arc)> { parse_macro_with_arg(db, macro_file, None) } -pub fn parse_macro_with_arg( +fn parse_macro_with_arg( db: &dyn AstDatabase, macro_file: MacroFile, arg: Option>, -- cgit v1.2.3