+ fn process_use_intern(crate_name: &str, module_path: &str, dependencies: &HashSet<syn::Ident>, imports: &mut HashMap<syn::Ident, (String, syn::Path)>,
+ u: &syn::UseTree, partial_path: &str, mut path: syn::punctuated::Punctuated<syn::PathSegment, syn::token::Colon2>) {
+
+ let new_path;
+ macro_rules! push_path {
+ ($ident: expr, $path_suffix: expr) => {
+ if partial_path == "" && format!("{}", $ident) == "super" {
+ let mut mod_iter = module_path.rsplitn(2, "::");
+ mod_iter.next().unwrap();
+ let super_mod = mod_iter.next().unwrap();
+ new_path = format!("{}{}", super_mod, $path_suffix);
+ assert_eq!(path.len(), 0);
+ for module in super_mod.split("::") {
+ path.push(syn::PathSegment { ident: syn::Ident::new(module, Span::call_site()), arguments: syn::PathArguments::None });
+ }
+ } else if partial_path == "" && !dependencies.contains(&$ident) {
+ new_path = format!("{}::{}{}", crate_name, $ident, $path_suffix);
+ let crate_name_ident = format_ident!("{}", crate_name);
+ path.push(parse_quote!(#crate_name_ident));
+ } else {
+ new_path = format!("{}{}{}", partial_path, $ident, $path_suffix);
+ }
+ let ident = &$ident;
+ path.push(parse_quote!(#ident));
+ }
+ }