@@ -30,6 +30,7 @@ use syntax::attr;
3030use syntax:: ast:: { self , Block , ForeignItem , ForeignItemKind , Item , ItemKind , NodeId } ;
3131use syntax:: ast:: { MetaItemKind , StmtKind , TraitItem , TraitItemKind , Variant } ;
3232use syntax:: ext:: base:: { MacroKind , SyntaxExtension } ;
33+ use syntax:: ext:: expand:: AstFragment ;
3334use syntax:: ext:: hygiene:: ExpnId ;
3435use syntax:: feature_gate:: is_builtin_attr;
3536use syntax:: parse:: token:: { self , Token } ;
@@ -67,7 +68,7 @@ impl<'a> ToNameBinding<'a> for (Res, ty::Visibility, Span, ExpnId) {
6768 }
6869}
6970
70- pub ( crate ) struct IsMacroExport ;
71+ struct IsMacroExport ;
7172
7273impl < ' a > ToNameBinding < ' a > for ( Res , ty:: Visibility , Span , ExpnId , IsMacroExport ) {
7374 fn to_name_binding ( self , arenas : & ' a ResolverArenas < ' a > ) -> & ' a NameBinding < ' a > {
@@ -84,7 +85,7 @@ impl<'a> ToNameBinding<'a> for (Res, ty::Visibility, Span, ExpnId, IsMacroExport
8485impl < ' a > Resolver < ' a > {
8586 /// Defines `name` in namespace `ns` of module `parent` to be `def` if it is not yet defined;
8687 /// otherwise, reports an error.
87- pub fn define < T > ( & mut self , parent : Module < ' a > , ident : Ident , ns : Namespace , def : T )
88+ crate fn define < T > ( & mut self , parent : Module < ' a > , ident : Ident , ns : Namespace , def : T )
8889 where T : ToNameBinding < ' a > ,
8990 {
9091 let binding = def. to_name_binding ( self . arenas ) ;
@@ -93,7 +94,7 @@ impl<'a> Resolver<'a> {
9394 }
9495 }
9596
96- pub fn get_module ( & mut self , def_id : DefId ) -> Module < ' a > {
97+ crate fn get_module ( & mut self , def_id : DefId ) -> Module < ' a > {
9798 if def_id. krate == LOCAL_CRATE {
9899 return self . module_map [ & def_id]
99100 }
@@ -119,7 +120,7 @@ impl<'a> Resolver<'a> {
119120 module
120121 }
121122
122- pub fn macro_def_scope ( & mut self , expn_id : ExpnId ) -> Module < ' a > {
123+ crate fn macro_def_scope ( & mut self , expn_id : ExpnId ) -> Module < ' a > {
123124 let def_id = match self . macro_defs . get ( & expn_id) {
124125 Some ( def_id) => * def_id,
125126 None => return self . graph_root ,
@@ -141,7 +142,7 @@ impl<'a> Resolver<'a> {
141142 }
142143 }
143144
144- crate fn get_macro_by_def_id ( & mut self , def_id : DefId ) -> Option < Lrc < SyntaxExtension > > {
145+ fn get_macro_by_def_id ( & mut self , def_id : DefId ) -> Option < Lrc < SyntaxExtension > > {
145146 if let Some ( ext) = self . macro_map . get ( & def_id) {
146147 return Some ( ext. clone ( ) ) ;
147148 }
@@ -158,7 +159,7 @@ impl<'a> Resolver<'a> {
158159
159160 /// Ensures that the reduced graph rooted at the given external module
160161 /// is built, building it if it is not.
161- pub fn populate_module_if_necessary ( & mut self , module : Module < ' a > ) {
162+ crate fn populate_module_if_necessary ( & mut self , module : Module < ' a > ) {
162163 if module. populated . get ( ) { return }
163164 let def_id = module. def_id ( ) . unwrap ( ) ;
164165 for child in self . cstore . item_children_untracked ( def_id, self . session ) {
@@ -168,11 +169,19 @@ impl<'a> Resolver<'a> {
168169 }
169170 module. populated . set ( true )
170171 }
172+
173+ crate fn build_reduced_graph (
174+ & mut self , fragment : & AstFragment , parent_scope : ParentScope < ' a >
175+ ) -> LegacyScope < ' a > {
176+ let mut visitor = BuildReducedGraphVisitor { r : self , parent_scope } ;
177+ fragment. visit_with ( & mut visitor) ;
178+ visitor. parent_scope . legacy
179+ }
171180}
172181
173- pub struct BuildReducedGraphVisitor < ' a , ' b > {
174- pub r : & ' b mut Resolver < ' a > ,
175- pub parent_scope : ParentScope < ' a > ,
182+ struct BuildReducedGraphVisitor < ' a , ' b > {
183+ r : & ' b mut Resolver < ' a > ,
184+ parent_scope : ParentScope < ' a > ,
176185}
177186
178187impl < ' a , ' b > BuildReducedGraphVisitor < ' a , ' b > {
0 commit comments