feat(m0.6-r1): unified callable registry
- add CallableId/Descriptor/Origin and CallableRegistry in marqdo-ir - include builtins, Marqdo functions and declared ABI exports in one static lookup model with deterministic conflict rules - validate declared plugin export signatures in the frontend without loading any shared library - add registry and frontend static-plugin-signature tests
This commit is contained in:
1 parent
5877d9aa5e
commit
4ecf537141
4 files changed
+440
-1
No files matched your search
@@ -17,6 +17,7 @@ use marqdo_span::Span;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub mod builtins;
|
||||
pub mod callable;
|
||||
|
||||
/// Canonical logical identity of a module: package instance plus a path
|
||||
/// relative to that package's module root.
|
||||
@@ -477,6 +478,10 @@ pub struct Program {
|
||||
/// Resolved import edges.
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub resolved_imports: Vec<ResolvedImport>,
|
||||
/// Explicit external callable descriptors (plugin manifests). They are
|
||||
/// metadata only: `check` never loads a library.
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub external_callables: Vec<callable::CallableDescriptor>,
|
||||
}
|
||||
|
||||
impl Program {
|
||||
@@ -502,6 +507,18 @@ impl Program {
|
||||
.find(|edge| &edge.from == from && edge.alias == alias)
|
||||
.map(|edge| &edge.to)
|
||||
}
|
||||
|
||||
/// Static external callable descriptor by complete dotted name.
|
||||
pub fn external_callable(&self, name: &str) -> Option<&callable::CallableDescriptor> {
|
||||
self.external_callables
|
||||
.iter()
|
||||
.find(|descriptor| descriptor.public_name == name)
|
||||
}
|
||||
|
||||
/// Build the unified callable registry for this program.
|
||||
pub fn callable_registry(&self) -> callable::CallableRegistry {
|
||||
callable::CallableRegistry::from_program(self)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in new issue
Block a user