Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/visibility.rs')
| -rw-r--r-- | crates/hir-def/src/visibility.rs | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/crates/hir-def/src/visibility.rs b/crates/hir-def/src/visibility.rs index 0f3fac1cec..1ef8fa772a 100644 --- a/crates/hir-def/src/visibility.rs +++ b/crates/hir-def/src/visibility.rs @@ -2,8 +2,8 @@ use std::iter; -use hir_expand::{span_map::SpanMapRef, InFile}; use la_arena::ArenaMap; +use span::SyntaxContextId; use syntax::ast; use triomphe::Arc; @@ -35,35 +35,24 @@ impl RawVisibility { pub(crate) fn from_ast( db: &dyn DefDatabase, - node: InFile<Option<ast::Visibility>>, - ) -> RawVisibility { - let node = match node.transpose() { - None => return RawVisibility::private(), - Some(node) => node, - }; - Self::from_ast_with_span_map(db, node.value, db.span_map(node.file_id).as_ref()) - } - - pub(crate) fn from_opt_ast_with_span_map( - db: &dyn DefDatabase, node: Option<ast::Visibility>, - span_map: SpanMapRef<'_>, + span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContextId, ) -> RawVisibility { let node = match node { None => return RawVisibility::private(), Some(node) => node, }; - Self::from_ast_with_span_map(db, node, span_map) + Self::from_ast_with_span_map(db, node, span_for_range) } fn from_ast_with_span_map( db: &dyn DefDatabase, node: ast::Visibility, - span_map: SpanMapRef<'_>, + span_for_range: &mut dyn FnMut(::tt::TextRange) -> SyntaxContextId, ) -> RawVisibility { let path = match node.kind() { ast::VisibilityKind::In(path) => { - let path = ModPath::from_src(db.upcast(), path, span_map); + let path = ModPath::from_src(db.upcast(), path, span_for_range); match path { None => return RawVisibility::private(), Some(path) => path, |