Separate macro_rules and macro_definition.
This commit is contained in:
parent
c485fccd81
commit
b0b46c0a10
@ -1010,13 +1010,7 @@ fn for_each_module_child(
|
||||
let span = self.get_span(child_index, sess);
|
||||
let macro_rules = match kind {
|
||||
DefKind::Macro(..) => {
|
||||
self.root
|
||||
.tables
|
||||
.macro_definition
|
||||
.get(self, child_index)
|
||||
.unwrap()
|
||||
.decode((self, sess))
|
||||
.macro_rules
|
||||
self.root.tables.macro_rules.get(self, child_index).is_some()
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
@ -1326,7 +1320,10 @@ fn exported_symbols(
|
||||
fn get_macro(self, id: DefIndex, sess: &Session) -> ast::MacroDef {
|
||||
match self.def_kind(id) {
|
||||
DefKind::Macro(_) => {
|
||||
self.root.tables.macro_definition.get(self, id).unwrap().decode((self, sess))
|
||||
let macro_rules = self.root.tables.macro_rules.get(self, id).is_some();
|
||||
let body =
|
||||
self.root.tables.macro_definition.get(self, id).unwrap().decode((self, sess));
|
||||
ast::MacroDef { macro_rules, body: ast::ptr::P(body) }
|
||||
}
|
||||
_ => bug!(),
|
||||
}
|
||||
|
@ -1494,7 +1494,10 @@ fn encode_info_for_item(&mut self, def_id: DefId, item: &'tcx hir::Item<'tcx>) {
|
||||
self.tables.constness.set(def_id.index, sig.header.constness);
|
||||
}
|
||||
hir::ItemKind::Macro(ref macro_def, _) => {
|
||||
record!(self.tables.macro_definition[def_id] <- macro_def);
|
||||
if macro_def.macro_rules {
|
||||
self.tables.macro_rules.set(def_id.index, ());
|
||||
}
|
||||
record!(self.tables.macro_definition[def_id] <- &*macro_def.body);
|
||||
}
|
||||
hir::ItemKind::Mod(ref m) => {
|
||||
return self.encode_info_for_mod(item.def_id, m);
|
||||
|
@ -394,7 +394,9 @@ fn encode(&self, buf: &mut FileEncoder) -> LazyTables {
|
||||
may_have_doc_links: Table<DefIndex, ()>,
|
||||
variant_data: Table<DefIndex, LazyValue<VariantData>>,
|
||||
assoc_container: Table<DefIndex, ty::AssocItemContainer>,
|
||||
macro_definition: Table<DefIndex, LazyValue<ast::MacroDef>>,
|
||||
// Slot is full when macro is macro_rules.
|
||||
macro_rules: Table<DefIndex, ()>,
|
||||
macro_definition: Table<DefIndex, LazyValue<ast::MacArgs>>,
|
||||
proc_macro: Table<DefIndex, MacroKind>,
|
||||
// Slot is full when there is a self parameter.
|
||||
fn_has_self_parameter: Table<DefIndex, ()>,
|
||||
|
@ -64,7 +64,7 @@ impl $crate::ty::ParameterizedOverTcx for $ty {
|
||||
ty::adjustment::CoerceUnsizedInfo,
|
||||
ty::fast_reject::SimplifiedTypeGen<DefId>,
|
||||
rustc_ast::Attribute,
|
||||
rustc_ast::MacroDef,
|
||||
rustc_ast::MacArgs,
|
||||
rustc_attr::ConstStability,
|
||||
rustc_attr::DefaultBodyStability,
|
||||
rustc_attr::Deprecation,
|
||||
|
Loading…
Reference in New Issue
Block a user