-fn walk_ast<'a>(in_dir: &str, path: &str, module: String, ast_storage: &'a FullLibraryAST, crate_types: &mut CrateTypes<'a>) {
- let syntax = if let Some(ast) = ast_storage.files.get(&module) { ast } else { return };
- assert_eq!(export_status(&syntax.attrs), ExportStatus::Export);
-
- for (path, new_mod, _) in file_iter(&syntax, in_dir, path, &module) {
- walk_ast(in_dir, &path, new_mod, ast_storage, crate_types);
- }
-
- let mut import_maps = HashMap::new();
-
- for item in syntax.items.iter() {
- match item {
- syn::Item::Use(u) => {
- process_use_intern(&u.tree, syn::punctuated::Punctuated::new(), &mut import_maps);
- },
- syn::Item::Struct(s) => {
- if let syn::Visibility::Public(_) = s.vis {
- match export_status(&s.attrs) {
- ExportStatus::Export => {},
- ExportStatus::NoExport|ExportStatus::TestOnly => continue,
- }
- let struct_path = format!("{}::{}", module, s.ident);
- if attrs_derives_clone(&s.attrs) {
- crate_types.clonable_types.insert("crate::".to_owned() + &struct_path);
- }
-
- crate_types.opaques.insert(struct_path, &s.ident);
- }
- },
- syn::Item::Trait(t) => {
- if let syn::Visibility::Public(_) = t.vis {
- match export_status(&t.attrs) {
- ExportStatus::Export => {},
- ExportStatus::NoExport|ExportStatus::TestOnly => continue,
- }
- let trait_path = format!("{}::{}", module, t.ident);
- walk_supertraits!(t, None, (
- ("Clone", _) => {
- crate_types.clonable_types.insert("crate::".to_owned() + &trait_path);
- },
- (_, _) => {}
- ) );
- crate_types.traits.insert(trait_path, &t);
- }
- },
- syn::Item::Type(t) => {
- if let syn::Visibility::Public(_) = t.vis {
- match export_status(&t.attrs) {
- ExportStatus::Export => {},
- ExportStatus::NoExport|ExportStatus::TestOnly => continue,
- }
- let type_path = format!("{}::{}", module, t.ident);
- let mut process_alias = true;
- for tok in t.generics.params.iter() {
- if let syn::GenericParam::Lifetime(_) = tok {}
- else { process_alias = false; }
+fn walk_ast<'a>(ast_storage: &'a FullLibraryAST, crate_types: &mut CrateTypes<'a>) {
+ for (module, astmod) in ast_storage.modules.iter() {
+ let ASTModule { ref attrs, ref items, submods: _ } = astmod;
+ assert_eq!(export_status(&attrs), ExportStatus::Export);
+ let import_resolver = ImportResolver::new(module, items);
+
+ for item in items.iter() {
+ match item {
+ syn::Item::Struct(s) => {
+ if let syn::Visibility::Public(_) = s.vis {
+ match export_status(&s.attrs) {
+ ExportStatus::Export => {},
+ ExportStatus::NoExport|ExportStatus::TestOnly => continue,
+ }
+ let struct_path = format!("{}::{}", module, s.ident);
+ crate_types.opaques.insert(struct_path, &s.ident);