Insert error after checking for binding usability.

This commit is contained in:
Camille GILLOT 2022-04-08 22:51:13 +02:00
parent 24b37a7374
commit 55ca03c0ac

View File

@ -913,12 +913,6 @@ impl<'a> Resolver<'a> {
return Err((Determined, Weak::No));
};
if !restricted_shadowing && binding.expansion != LocalExpnId::ROOT {
if let NameBindingKind::Res(_, true) = binding.kind {
self.macro_expanded_macro_export_errors.insert((path_span, binding.span));
}
}
// If the primary binding is unusable, search further and return the shadowed glob
// binding if it exists. What we really want here is having two separate scopes in
// a module - one for non-globs and one for globs, but until that's done use this
@ -965,6 +959,12 @@ impl<'a> Resolver<'a> {
});
}
if !restricted_shadowing && binding.expansion != LocalExpnId::ROOT {
if let NameBindingKind::Res(_, true) = binding.kind {
self.macro_expanded_macro_export_errors.insert((path_span, binding.span));
}
}
self.record_use(ident, binding, restricted_shadowing);
return Ok(binding);
}