feat: less env clone

This commit is contained in:
2025-05-22 19:21:14 +08:00
parent dcd22ad1f3
commit c898b577b0
5 changed files with 117 additions and 75 deletions

View File

@@ -55,8 +55,9 @@ impl<'vm, 'jit: 'vm> Func<'jit, 'vm> {
pub fn call(&self, vm: &'vm VM<'jit>, arg: Value<'jit, 'vm>) -> Result<Value<'jit, 'vm>> {
use Param::*;
let env = match self.func.param.clone() {
Ident(ident) => self.env.clone().enter_arg(ident, arg),
let mut env = self.env.clone();
match self.func.param.clone() {
Ident(ident) => env.enter_arg(ident, arg),
Formals {
formals,
ellipsis,
@@ -86,7 +87,7 @@ impl<'vm, 'jit: 'vm> Func<'jit, 'vm> {
if let Some(alias) = alias {
new.insert(alias, Value::AttrSet(arg));
}
self.env.clone().enter_attrs(new.into())
env.enter_let(new.into())
}
};