1
Fork 0

Record call_site parent for macros.

This commit is contained in:
Camille GILLOT 2021-05-02 21:19:28 +02:00
parent 5e026eacb1
commit 2e37ed87fc
4 changed files with 27 additions and 3 deletions

View file

@ -32,7 +32,13 @@ impl<'a, 'b> DefCollector<'a, 'b> {
fn create_def(&mut self, node_id: NodeId, data: DefPathData, span: Span) -> LocalDefId {
let parent_def = self.parent_def;
debug!("create_def(node_id={:?}, data={:?}, parent_def={:?})", node_id, data, parent_def);
self.resolver.create_def(parent_def, node_id, data, self.expansion.to_expn_id(), span)
self.resolver.create_def(
parent_def,
node_id,
data,
self.expansion.to_expn_id(),
span.with_parent(None),
)
}
fn with_parent<F: FnOnce(&mut Self)>(&mut self, parent_def: LocalDefId, f: F) {

View file

@ -180,6 +180,10 @@ impl<'a> ResolverExpand for Resolver<'a> {
self.next_node_id()
}
fn invocation_parent(&self, id: LocalExpnId) -> LocalDefId {
self.invocation_parents[&id].0
}
fn resolve_dollar_crates(&mut self) {
hygiene::update_dollar_crate_names(|ctxt| {
let ident = Ident::new(kw::DollarCrate, DUMMY_SP.with_ctxt(ctxt));