Add type aliases for registries

Introduces `GlobalFunctionRegistry` and `GlobalAnalyzedRegistry` type
aliases to clarify the usage of `HashMap`s for storing global functions
and their analyzed versions. This change also refactors the
`LambdaCollector` and `Optimizer` to use these new aliases, improving
code readability and maintainability.
This commit is contained in:
Michael Schimmel
2026-03-03 15:51:47 +01:00
parent a18642fd7b
commit 078b520c37
6 changed files with 94 additions and 82 deletions
+3 -3
View File
@@ -11,12 +11,12 @@ pub struct MonoCacheKey {
pub arg_types: Vec<StaticType>,
}
pub type CompileFunc = Rc<dyn Fn(BoundNode, &[StaticType]) -> Result<(Value, StaticType), String>>;
pub type CompileFunc = Rc<dyn Fn(Rc<BoundNode>, &[StaticType]) -> Result<(Value, StaticType), String>>;
pub type RtlLookupFunc = Rc<dyn Fn(&str, &[StaticType]) -> Option<(Value, StaticType)>>;
pub trait FunctionRegistry {
fn resolve(&self, addr: Address) -> Option<BoundNode>;
fn resolve_analyzed(&self, _addr: Address) -> Option<AnalyzedNode> {
fn resolve(&self, addr: Address) -> Option<Rc<BoundNode>>;
fn resolve_analyzed(&self, _addr: Address) -> Option<Rc<AnalyzedNode>> {
None
}
}