@@ -34,7 +34,7 @@ pub struct NameBinding {
34
34
}
35
35
36
36
#[ derive( Clone ) ]
37
- pub struct ExpansionData < ' a > {
37
+ pub struct InvocationData < ' a > {
38
38
backtrace : SyntaxContext ,
39
39
pub module : Cell < Module < ' a > > ,
40
40
def_index : DefIndex ,
@@ -43,9 +43,9 @@ pub struct ExpansionData<'a> {
43
43
const_integer : bool ,
44
44
}
45
45
46
- impl < ' a > ExpansionData < ' a > {
46
+ impl < ' a > InvocationData < ' a > {
47
47
pub fn root ( graph_root : Module < ' a > ) -> Self {
48
- ExpansionData {
48
+ InvocationData {
49
49
backtrace : SyntaxContext :: empty ( ) ,
50
50
module : Cell :: new ( graph_root) ,
51
51
def_index : CRATE_DEF_INDEX ,
@@ -62,7 +62,7 @@ impl<'a> base::Resolver for Resolver<'a> {
62
62
fn get_module_scope ( & mut self , id : ast:: NodeId ) -> Mark {
63
63
let mark = Mark :: fresh ( ) ;
64
64
let module = self . module_map [ & id] ;
65
- self . expansion_data . insert ( mark, self . arenas . alloc_expansion_data ( ExpansionData {
65
+ self . invocations . insert ( mark, self . arenas . alloc_invocation_data ( InvocationData {
66
66
backtrace : SyntaxContext :: empty ( ) ,
67
67
module : Cell :: new ( module) ,
68
68
def_index : module. def_id ( ) . unwrap ( ) . index ,
@@ -73,7 +73,7 @@ impl<'a> base::Resolver for Resolver<'a> {
73
73
74
74
fn visit_expansion ( & mut self , mark : Mark , expansion : & Expansion ) {
75
75
self . collect_def_ids ( mark, expansion) ;
76
- self . current_module = self . expansion_data [ & mark] . module . get ( ) ;
76
+ self . current_module = self . invocations [ & mark] . module . get ( ) ;
77
77
expansion. visit_with ( & mut BuildReducedGraphVisitor { resolver : self , expansion : mark } ) ;
78
78
}
79
79
@@ -82,14 +82,14 @@ impl<'a> base::Resolver for Resolver<'a> {
82
82
self . session . span_err ( def. span , "user-defined macros may not be named `macro_rules`" ) ;
83
83
}
84
84
if def. use_locally {
85
- let expansion_data = self . expansion_data [ & scope] ;
86
- let mut module = expansion_data . module . get ( ) ;
85
+ let invocation = self . invocations [ & scope] ;
86
+ let mut module = invocation . module . get ( ) ;
87
87
while module. macros_escape {
88
88
module = module. parent . unwrap ( ) ;
89
89
}
90
90
let binding = NameBinding {
91
91
ext : Rc :: new ( macro_rules:: compile ( & self . session . parse_sess , & def) ) ,
92
- expansion : expansion_data . backtrace . data ( ) . prev_ctxt . data ( ) . outer_mark ,
92
+ expansion : invocation . backtrace . data ( ) . prev_ctxt . data ( ) . outer_mark ,
93
93
shadowing : self . resolve_macro_name ( scope, def. ident . name , false ) . is_some ( ) ,
94
94
span : def. span ,
95
95
} ;
@@ -121,7 +121,7 @@ impl<'a> base::Resolver for Resolver<'a> {
121
121
fn find_attr_invoc ( & mut self , attrs : & mut Vec < ast:: Attribute > ) -> Option < ast:: Attribute > {
122
122
for i in 0 ..attrs. len ( ) {
123
123
let name = intern ( & attrs[ i] . name ( ) ) ;
124
- match self . expansion_data [ & Mark :: root ( ) ] . module . get ( ) . macros . borrow ( ) . get ( & name) {
124
+ match self . invocations [ & Mark :: root ( ) ] . module . get ( ) . macros . borrow ( ) . get ( & name) {
125
125
Some ( binding) => match * binding. ext {
126
126
MultiModifier ( ..) | MultiDecorator ( ..) | SyntaxExtension :: AttrProcMacro ( ..) => {
127
127
return Some ( attrs. remove ( i) )
@@ -166,11 +166,11 @@ impl<'a> base::Resolver for Resolver<'a> {
166
166
impl < ' a > Resolver < ' a > {
167
167
pub fn resolve_macro_name ( & mut self , scope : Mark , name : ast:: Name , record_used : bool )
168
168
-> Option < Rc < SyntaxExtension > > {
169
- let expansion_data = self . expansion_data [ & scope] ;
170
- let mut module = expansion_data . module . get ( ) ;
169
+ let invocation = self . invocations [ & scope] ;
170
+ let mut module = invocation . module . get ( ) ;
171
171
loop {
172
172
if let Some ( binding) = module. macros . borrow ( ) . get ( & name) {
173
- let mut backtrace = expansion_data . backtrace . data ( ) ;
173
+ let mut backtrace = invocation . backtrace . data ( ) ;
174
174
while binding. expansion != backtrace. outer_mark {
175
175
if backtrace. outer_mark != Mark :: root ( ) {
176
176
backtrace = backtrace. prev_ctxt . data ( ) ;
@@ -208,13 +208,12 @@ impl<'a> Resolver<'a> {
208
208
}
209
209
210
210
fn collect_def_ids ( & mut self , mark : Mark , expansion : & Expansion ) {
211
- let Resolver { ref mut expansion_data, arenas, graph_root, .. } = * self ;
212
- let ExpansionData { def_index, const_integer, backtrace, .. } =
213
- expansion_data[ & mark] . clone ( ) ;
211
+ let Resolver { ref mut invocations, arenas, graph_root, .. } = * self ;
212
+ let InvocationData { def_index, const_integer, backtrace, .. } = invocations[ & mark] . clone ( ) ;
214
213
215
214
let visit_macro_invoc = & mut |invoc : map:: MacroInvocationData | {
216
- expansion_data . entry ( invoc. mark ) . or_insert_with ( || {
217
- arenas. alloc_expansion_data ( ExpansionData {
215
+ invocations . entry ( invoc. mark ) . or_insert_with ( || {
216
+ arenas. alloc_invocation_data ( InvocationData {
218
217
backtrace : backtrace. apply_mark ( invoc. mark ) ,
219
218
def_index : invoc. def_index ,
220
219
const_integer : invoc. const_integer ,
0 commit comments