@@ -32,12 +32,6 @@ use syntax_pos::Span;
3232use std:: cell:: { Cell , RefCell } ;
3333use std:: mem;
3434
35- impl < ' a > Resolver < ' a > {
36- pub fn resolve_imports ( & mut self ) {
37- ImportResolver { resolver : self } . resolve_imports ( ) ;
38- }
39- }
40-
4135/// Contains data for specific types of import directives.
4236#[ derive( Clone , Debug ) ]
4337pub enum ImportDirectiveSubclass < ' a > {
@@ -399,8 +393,8 @@ impl<'a> Resolver<'a> {
399393 }
400394}
401395
402- struct ImportResolver < ' a , ' b : ' a > {
403- resolver : & ' a mut Resolver < ' b > ,
396+ pub struct ImportResolver < ' a , ' b : ' a > {
397+ pub resolver : & ' a mut Resolver < ' b > ,
404398}
405399
406400impl < ' a , ' b : ' a > :: std:: ops:: Deref for ImportResolver < ' a , ' b > {
@@ -433,28 +427,21 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
433427
434428 /// Resolves all imports for the crate. This method performs the fixed-
435429 /// point iteration.
436- fn resolve_imports ( & mut self ) {
437- let mut i = 0 ;
430+ pub fn resolve_imports ( & mut self ) {
438431 let mut prev_num_indeterminates = self . indeterminate_imports . len ( ) + 1 ;
439-
440432 while self . indeterminate_imports . len ( ) < prev_num_indeterminates {
441433 prev_num_indeterminates = self . indeterminate_imports . len ( ) ;
442- debug ! ( "(resolving imports) iteration {}, {} imports left" , i, prev_num_indeterminates) ;
443-
444- let mut imports = Vec :: new ( ) ;
445- :: std:: mem:: swap ( & mut imports, & mut self . indeterminate_imports ) ;
446-
447- for import in imports {
434+ for import in mem:: replace ( & mut self . indeterminate_imports , Vec :: new ( ) ) {
448435 match self . resolve_import ( & import) {
449436 Failed ( _) => self . determined_imports . push ( import) ,
450437 Indeterminate => self . indeterminate_imports . push ( import) ,
451438 Success ( ( ) ) => self . determined_imports . push ( import) ,
452439 }
453440 }
454-
455- i += 1 ;
456441 }
442+ }
457443
444+ pub fn finalize_imports ( & mut self ) {
458445 for module in self . arenas . local_modules ( ) . iter ( ) {
459446 self . finalize_resolutions_in ( module) ;
460447 }
0 commit comments