};
self.load_module(modname, m.attrs, m.content.unwrap().1);
submods.push(modident);
+ } else {
+ non_mod_items.push(syn::Item::Mod(m));
}
}
},
+ syn::Item::Mod(_) => panic!("--pretty=expanded output should never have non-body modules"),
_ => { non_mod_items.push(item); }
}
}
module_path: &'mod_lifetime str,
imports: HashMap<syn::Ident, (String, syn::Path)>,
declared: HashMap<syn::Ident, DeclType<'crate_lft>>,
+ priv_modules: HashSet<syn::Ident>,
}
impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'crate_lft> {
fn process_use_intern(imports: &mut HashMap<syn::Ident, (String, syn::Path)>, u: &syn::UseTree, partial_path: &str, mut path: syn::punctuated::Punctuated<syn::PathSegment, syn::token::Colon2>) {
Self::insert_primitive(&mut imports, "Option");
let mut declared = HashMap::new();
+ let mut priv_modules = HashSet::new();
for item in contents.iter() {
match item {
declared.insert(t.ident.clone(), DeclType::Trait(t));
}
},
+ syn::Item::Mod(m) => {
+ priv_modules.insert(m.ident.clone());
+ },
_ => {},
}
}
- Self { module_path, imports, declared }
+ Self { module_path, imports, declared, priv_modules }
}
pub fn get_declared_type(&self, ident: &syn::Ident) -> Option<&DeclType<'crate_lft>> {
} else {
Some(imp.clone())
}
+ } else if let Some(_) = self.priv_modules.get(&first_seg.ident) {
+ Some(format!("{}::{}{}", self.module_path, first_seg.ident, remaining))
} else { None }
}
}