Simplify eager macro representation

This commit is contained in:
Jonas Schievink 2021-05-19 20:19:08 +02:00
parent c7196620ab
commit ea8555b155
10 changed files with 166 additions and 278 deletions

View file

@ -948,20 +948,17 @@ impl DefCollector<'_> {
// incrementality).
let err = self.db.macro_expand_error(macro_call_id);
if let Some(err) = err {
if let MacroCallId::LazyMacro(id) = macro_call_id {
let loc: MacroCallLoc = self.db.lookup_intern_macro(id);
let loc: MacroCallLoc = self.db.lookup_intern_macro(macro_call_id);
let diag = match err {
hir_expand::ExpandError::UnresolvedProcMacro => {
// Missing proc macros are non-fatal, so they are handled specially.
DefDiagnostic::unresolved_proc_macro(module_id, loc.kind)
}
_ => DefDiagnostic::macro_error(module_id, loc.kind, err.to_string()),
};
let diag = match err {
hir_expand::ExpandError::UnresolvedProcMacro => {
// Missing proc macros are non-fatal, so they are handled specially.
DefDiagnostic::unresolved_proc_macro(module_id, loc.kind)
}
_ => DefDiagnostic::macro_error(module_id, loc.kind, err.to_string()),
};
self.def_map.diagnostics.push(diag);
}
// FIXME: Handle eager macros.
self.def_map.diagnostics.push(diag);
}
// Then, fetch and process the item tree. This will reuse the expansion result from above.