aboutsummaryrefslogtreecommitdiff
path: root/mingling_pathf/src/pattern_analyzer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'mingling_pathf/src/pattern_analyzer.rs')
-rw-r--r--mingling_pathf/src/pattern_analyzer.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/mingling_pathf/src/pattern_analyzer.rs b/mingling_pathf/src/pattern_analyzer.rs
index 5b25c15..79b1c5a 100644
--- a/mingling_pathf/src/pattern_analyzer.rs
+++ b/mingling_pathf/src/pattern_analyzer.rs
@@ -33,6 +33,7 @@ pub fn init_with_config(config: PathfinderConfig) -> PatternAnalyzer {
analyzer.add_pattern(GroupPattern);
analyzer.add_pattern(GroupedDerivePattern);
analyzer.add_pattern(ChainPattern);
+ analyzer.add_pattern(CommandPattern);
analyzer.add_pattern(RendererPattern);
analyzer.add_pattern(HelpPattern);
analyzer.add_pattern(CompletionPattern);
@@ -50,6 +51,8 @@ pub struct AnalyzeItem {
pub item_name: String,
/// Whether the item is from an external crate (resolved via `use`), bypassing the file's own module path.
pub is_foreign: bool,
+ /// When `true`, this item is a module whose contents should be glob-imported (`::*`).
+ pub is_module: bool,
}
impl AnalyzeItem {
@@ -59,6 +62,17 @@ impl AnalyzeItem {
module,
item_name,
is_foreign: false,
+ is_module: false,
+ }
+ }
+
+ /// Creates a local module item — generates a `use path::item_name::*;` glob import.
+ pub fn local_module(module: String, item_name: String) -> Self {
+ Self {
+ module,
+ item_name,
+ is_foreign: false,
+ is_module: true,
}
}
@@ -68,6 +82,7 @@ impl AnalyzeItem {
module,
item_name,
is_foreign: true,
+ is_module: false,
}
}
}