aboutsummaryrefslogtreecommitdiff
path: root/mingling_pathf/src/patterns/dispatcher.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-21 06:03:24 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-21 06:03:24 +0800
commitd3abdd53e0cc86cb41c0793ce99dbb21b89a4361 (patch)
treee6d6eb1b674185d6a906a7940226a06f3b4cf50a /mingling_pathf/src/patterns/dispatcher.rs
parent700c049f64b66f424cda5da3021dfce4462655ca (diff)
feat(pathf): add foreign item support with is_foreign flag
Add `AnalyzeItem::foreign()` and `AnalyzeItem::local()` constructors to distinguish items resolved via `use` imports from local definitions. Update `GroupPattern` to collect use imports at file and module levels, resolving `group!(TypeName)` against them. Migrate all pattern implementations to use the new constructors, and adjust `type_mapping_builder` to skip the file's own module prefix for foreign items.
Diffstat (limited to 'mingling_pathf/src/patterns/dispatcher.rs')
-rw-r--r--mingling_pathf/src/patterns/dispatcher.rs15
1 files changed, 3 insertions, 12 deletions
diff --git a/mingling_pathf/src/patterns/dispatcher.rs b/mingling_pathf/src/patterns/dispatcher.rs
index eaa53f0..cedad9f 100644
--- a/mingling_pathf/src/patterns/dispatcher.rs
+++ b/mingling_pathf/src/patterns/dispatcher.rs
@@ -111,27 +111,18 @@ fn extract_all_types(
// Entry type — always
if let Some(ref entry) = entry_struct {
- items.push(AnalyzeItem {
- module: module.to_string(),
- item_name: entry.clone(),
- });
+ items.push(AnalyzeItem::local(module.to_string(), entry.clone()));
}
// CMD type — always
if let Some(ref cmd) = cmd_struct {
- items.push(AnalyzeItem {
- module: module.to_string(),
- item_name: cmd.clone(),
- });
+ items.push(AnalyzeItem::local(module.to_string(), cmd.clone()));
}
// __internal_dispatcher_* — when configured
if use_dispatch_tree {
let internal_name = format!("__internal_dispatcher_{}", snake_case(&cmd_name));
- items.push(AnalyzeItem {
- module: module.to_string(),
- item_name: internal_name,
- });
+ items.push(AnalyzeItem::local(module.to_string(), internal_name));
}
items