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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user