Don't store call-site text offsets in hygiene info

This commit is contained in:
Jonas Schievink 2021-05-06 19:59:54 +02:00
parent b37b709459
commit 976a3226fe
19 changed files with 145 additions and 93 deletions

View file

@ -204,7 +204,8 @@ impl SourceAnalyzer {
macro_call: InFile<&ast::MacroCall>,
) -> Option<MacroDef> {
let ctx = body::LowerCtx::new(db.upcast(), macro_call.file_id);
let path = macro_call.value.path().and_then(|ast| Path::from_src(ast, &ctx))?;
let path =
macro_call.value.path().and_then(|ast| Path::from_src(db.upcast(), ast, &ctx))?;
self.resolver.resolve_path_as_macro(db.upcast(), path.mod_path()).map(|it| it.into())
}
@ -283,8 +284,8 @@ impl SourceAnalyzer {
// This must be a normal source file rather than macro file.
let hygiene = Hygiene::new(db.upcast(), self.file_id);
let ctx = body::LowerCtx::with_hygiene(&hygiene);
let hir_path = Path::from_src(path.clone(), &ctx)?;
let ctx = body::LowerCtx::with_hygiene(db.upcast(), &hygiene);
let hir_path = Path::from_src(db.upcast(), path.clone(), &ctx)?;
// Case where path is a qualifier of another path, e.g. foo::bar::Baz where we
// trying to resolve foo::bar.