Replace ID based TokenMap with proper relative text-ranges / spans

This commit is contained in:
Lukas Wirth 2023-09-29 12:37:57 +02:00
parent f79439caed
commit 890eb17b4e
80 changed files with 1816 additions and 2046 deletions

View file

@ -1,6 +1,9 @@
//! Macro expansion utilities.
use base_db::CrateId;
use base_db::{
span::{SpanAnchor, ROOT_ERASED_FILE_AST_ID},
CrateId,
};
use cfg::CfgOptions;
use drop_bomb::DropBomb;
use hir_expand::{
@ -118,7 +121,17 @@ impl Expander {
}
pub(crate) fn parse_attrs(&self, db: &dyn DefDatabase, owner: &dyn ast::HasAttrs) -> Attrs {
Attrs::filter(db, self.krate, RawAttrs::new(db.upcast(), owner, &self.hygiene))
Attrs::filter(
db,
self.krate,
RawAttrs::new(
db.upcast(),
// Usin `ROOT_ERASED_FILE_AST_ID` here is fine as this is only used for cfg checking
SpanAnchor { file_id: self.current_file_id, ast_id: ROOT_ERASED_FILE_AST_ID },
owner,
&self.hygiene,
),
)
}
pub(crate) fn cfg_options(&self) -> &CfgOptions {