Refactor closure instantiation and inlining
This commit makes several changes related to how closures are handled: - **Dumper:** Removes redundant introspection of closure ASTs, as this is no longer relevant. - **Optimizer:** Updates `try_inline` to accept `ExecNode` for parameters and adds a check to ensure the `function_node` is a `Lambda` before attempting inlining. - **Environment:** Simplifies closure creation by passing an `ExecNode` for parameters and ensuring the correct `stack_size` is used. - **VM:** Adjusts `Closure` to store an `ExecNode` for parameters and updates `VM::unpack` to accept an `ExecNode`.
This commit is contained in:
@@ -666,14 +666,13 @@ impl Environment {
|
||||
} = &node.kind
|
||||
&& upvalues.is_empty()
|
||||
{
|
||||
let stack_size = node.ty.stack_size;
|
||||
let closure = Rc::new(crate::ast::vm::Closure::new(
|
||||
params.ty.original.clone(),
|
||||
params.clone(),
|
||||
body.ty.original.clone(),
|
||||
body.clone(),
|
||||
vec![],
|
||||
Vec::new(),
|
||||
*positional_count,
|
||||
stack_size,
|
||||
node.ty.stack_size,
|
||||
));
|
||||
let closure_obj: Rc<dyn crate::ast::types::Object> = closure;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user