resolve: determined binding after parent module macro expand

This commit is contained in:
bohan 2023-09-04 20:14:40 +08:00
parent 1fe747c160
commit f1536507e1
14 changed files with 154 additions and 80 deletions

View file

@ -881,6 +881,19 @@ impl<'a> NameBindingData<'a> {
invoc_parent_expansion.is_descendant_of(self_parent_expansion);
!(certainly_before_other_or_simultaneously || certainly_before_invoc_or_simultaneously)
}
// Its purpose is to postpone the determination of a single binding because
// we can't predict whether it will be overwritten by recently expanded macros.
// FIXME: How can we integrate it with the `update_resolution`?
fn determined(&self) -> bool {
match &self.kind {
NameBindingKind::Import { binding, import, .. } if import.is_glob() => {
import.parent_scope.module.unexpanded_invocations.borrow().is_empty()
&& binding.determined()
}
_ => true,
}
}
}
#[derive(Default, Clone)]