This commit is contained in:
Lukas Wirth 2024-04-06 13:12:07 +02:00
parent 6a852d7627
commit 13890697eb
12 changed files with 121 additions and 136 deletions

View file

@ -21,7 +21,6 @@ use crate::{
pub struct Expander {
cfg_options: CfgOptions,
span_map: OnceCell<SpanMap>,
krate: CrateId,
current_file_id: HirFileId,
pub(crate) module: ModuleId,
/// `recursion_depth == usize::MAX` indicates that the recursion limit has been reached.
@ -45,10 +44,13 @@ impl Expander {
recursion_limit,
cfg_options: db.crate_graph()[module.krate].cfg_options.clone(),
span_map: OnceCell::new(),
krate: module.krate,
}
}
pub fn krate(&self) -> CrateId {
self.module.krate
}
pub fn enter_expand<T: ast::AstNode>(
&mut self,
db: &dyn DefDatabase,
@ -112,7 +114,7 @@ impl Expander {
pub(crate) fn parse_attrs(&self, db: &dyn DefDatabase, owner: &dyn ast::HasAttrs) -> Attrs {
Attrs::filter(
db,
self.krate,
self.krate(),
RawAttrs::new(
db.upcast(),
owner,