From 8b4d0db96ab6431a365dbe4805b6b1e35c44b1ed Mon Sep 17 00:00:00 2001 From: "evgeny.bovykin" Date: Tue, 5 Nov 2024 16:06:57 +0100 Subject: [PATCH 1/5] Make Context#mode field pub instead of pub(crate) This change will allow to locate the absolute paths to the generated files using Context#mode + Context#item_path --- pilota-build/src/middle/context.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pilota-build/src/middle/context.rs b/pilota-build/src/middle/context.rs index 0007cc2..a2521ce 100644 --- a/pilota-build/src/middle/context.rs +++ b/pilota-build/src/middle/context.rs @@ -66,7 +66,7 @@ pub struct Context { pub(crate) change_case: bool, pub(crate) codegen_items: Arc<[DefId]>, pub(crate) path_resolver: Arc, - pub(crate) mode: Arc, + pub mode: Arc, pub(crate) split: bool, pub(crate) keep_unknown_fields: Arc>, pub location_map: Arc>, From bab872970635c168b3f30ef087d6ee1d4b30e348 Mon Sep 17 00:00:00 2001 From: "evgeny.bovykin" Date: Tue, 5 Nov 2024 18:38:54 +0100 Subject: [PATCH 2/5] Make WorkspaceInfo#dir pub --- pilota-build/src/middle/context.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pilota-build/src/middle/context.rs b/pilota-build/src/middle/context.rs index a2521ce..df103cd 100644 --- a/pilota-build/src/middle/context.rs +++ b/pilota-build/src/middle/context.rs @@ -48,7 +48,7 @@ pub enum CollectMode { #[derive(Debug)] pub struct WorkspaceInfo { - pub(crate) dir: PathBuf, + pub dir: PathBuf, pub(crate) location_map: FxHashMap, } From 7cc105bd103759f157a768559b5db68604c96823 Mon Sep 17 00:00:00 2001 From: "evgeny.bovykin" Date: Wed, 6 Nov 2024 09:35:01 +0100 Subject: [PATCH 3/5] Pub Context#split --- pilota-build/src/middle/context.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pilota-build/src/middle/context.rs b/pilota-build/src/middle/context.rs index df103cd..6ffc1ca 100644 --- a/pilota-build/src/middle/context.rs +++ b/pilota-build/src/middle/context.rs @@ -67,7 +67,7 @@ pub struct Context { pub(crate) codegen_items: Arc<[DefId]>, pub(crate) path_resolver: Arc, pub mode: Arc, - pub(crate) split: bool, + pub split: bool, pub(crate) keep_unknown_fields: Arc>, pub location_map: Arc>, pub entry_map: Arc>>, From 95b41bd34e13a0e5350b418d0ef75f060064279e Mon Sep 17 00:00:00 2001 From: "evgeny.bovykin" Date: Thu, 7 Nov 2024 09:44:27 +0100 Subject: [PATCH 4/5] pub mod fmt --- pilota-build/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pilota-build/src/lib.rs b/pilota-build/src/lib.rs index 76bf2c0..0326c8a 100644 --- a/pilota-build/src/lib.rs +++ b/pilota-build/src/lib.rs @@ -9,7 +9,7 @@ mod util; pub mod codegen; pub mod db; pub(crate) mod errors; -mod fmt; +pub mod fmt; mod index; mod ir; pub mod middle; From d365b45f0e09247f4669b4c1deab998e839626a7 Mon Sep 17 00:00:00 2001 From: Millione Date: Wed, 20 Nov 2024 21:54:12 +0800 Subject: [PATCH 5/5] add ordered duplicate name info --- pilota-build/src/middle/context.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pilota-build/src/middle/context.rs b/pilota-build/src/middle/context.rs index 6ffc1ca..4e3f97d 100644 --- a/pilota-build/src/middle/context.rs +++ b/pilota-build/src/middle/context.rs @@ -74,7 +74,7 @@ pub struct Context { pub plugin_gen: Arc>, pub(crate) dedups: Vec, pub(crate) common_crate_name: FastStr, - pub names: FxHashSet, + pub names: FxHashMap, } impl Clone for Context { @@ -382,8 +382,9 @@ impl ContextBuilder { cx.names.extend( map.into_iter() .filter(|(_, v)| v.len() > 1) - .flat_map(|(_, v)| v) - .collect::>(), + .map(|(_, v)| v) + .flat_map(|v| v.into_iter().enumerate().map(|(i, def_id)| (def_id, i))) + .collect::>(), ); cx } @@ -804,7 +805,7 @@ impl Context { return name.0.into(); } - if !self.change_case || self.names.contains(&def_id) { + if !self.change_case || self.names.contains_key(&def_id) { return node.name(); }