@@ -23,6 +23,11 @@ use syntax::ext::tt::macro_rules;
23
23
use syntax:: parse:: token:: intern;
24
24
use syntax:: util:: lev_distance:: find_best_match_for_name;
25
25
26
+ // FIXME(jseyfried) Merge with `::NameBinding`.
27
+ pub struct NameBinding {
28
+ ext : Rc < SyntaxExtension > ,
29
+ }
30
+
26
31
#[ derive( Clone ) ]
27
32
pub struct ExpansionData < ' a > {
28
33
pub module : Module < ' a > ,
@@ -87,7 +92,9 @@ impl<'a> base::Resolver for Resolver<'a> {
87
92
while module. macros_escape {
88
93
module = module. parent . unwrap ( ) ;
89
94
}
90
- module. macros . borrow_mut ( ) . insert ( ident. name , ext) ;
95
+ module. macros . borrow_mut ( ) . insert ( ident. name , NameBinding {
96
+ ext : ext,
97
+ } ) ;
91
98
}
92
99
93
100
fn add_expansions_at_stmt ( & mut self , id : ast:: NodeId , macros : Vec < Mark > ) {
@@ -98,7 +105,7 @@ impl<'a> base::Resolver for Resolver<'a> {
98
105
for i in 0 ..attrs. len ( ) {
99
106
let name = intern ( & attrs[ i] . name ( ) ) ;
100
107
match self . expansion_data [ & 0 ] . module . macros . borrow ( ) . get ( & name) {
101
- Some ( ext ) => match * * ext {
108
+ Some ( binding ) => match * binding . ext {
102
109
MultiModifier ( ..) | MultiDecorator ( ..) | SyntaxExtension :: AttrProcMacro ( ..) => {
103
110
return Some ( attrs. remove ( i) )
104
111
}
@@ -127,8 +134,8 @@ impl<'a> base::Resolver for Resolver<'a> {
127
134
128
135
let mut module = self . expansion_data [ & scope. as_u32 ( ) ] . module ;
129
136
loop {
130
- if let Some ( ext ) = module. macros . borrow ( ) . get ( & name) {
131
- return Some ( ext. clone ( ) ) ;
137
+ if let Some ( binding ) = module. macros . borrow ( ) . get ( & name) {
138
+ return Some ( binding . ext . clone ( ) ) ;
132
139
}
133
140
match module. parent {
134
141
Some ( parent) => module = parent,
0 commit comments