about summary refs log tree commit diff
path: root/tvix/eval/src/compiler/bindings.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-01-05T11·35+0300
committertazjin <tazjin@tvl.su>2023-01-06T12·23+0000
commit36e5a4cc07c963e89edd409d9050fe67c10e7e8d (patch)
treeacd843e9c866898a22192c8de585c738f8189acb /tvix/eval/src/compiler/bindings.rs
parent0e421a16c584db34742b8db644b80c9c9a5faf02 (diff)
refactor(tvix/eval): take owned ast::Expr in Compiler::compile r/5601
This adds a very minimal amount of additional Rc-increments (~1 per
compilation), but makes it a lot easier to add an AST-optimising
compiler pass without incurring a lot of extra cost.

Change-Id: I57208bdfc8882e3ae21c5850e14aa380d3ccea36
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7765
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/compiler/bindings.rs')
-rw-r--r--tvix/eval/src/compiler/bindings.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/tvix/eval/src/compiler/bindings.rs b/tvix/eval/src/compiler/bindings.rs
index 12eaae5c19..9d42690023 100644
--- a/tvix/eval/src/compiler/bindings.rs
+++ b/tvix/eval/src/compiler/bindings.rs
@@ -585,7 +585,7 @@ impl Compiler<'_> {
                     // Create a thunk wrapping value (which may be one as well)
                     // to avoid forcing the from expr too early.
                     self.thunk(binding.value_slot, &namespace, |c, s| {
-                        c.compile(s, &namespace);
+                        c.compile(s, namespace.clone());
                         c.emit_force(&namespace);
 
                         c.emit_constant(Value::String(name.into()), &span);
@@ -595,7 +595,7 @@ impl Compiler<'_> {
 
                 // Binding is "just" a plain expression that needs to be
                 // compiled.
-                Binding::Plain { expr } => self.compile(binding.value_slot, &expr),
+                Binding::Plain { expr } => self.compile(binding.value_slot, expr),
 
                 // Binding is a merged or nested attribute set, and needs to be
                 // recursively compiled as another binding.
@@ -651,7 +651,7 @@ impl Compiler<'_> {
         self.compile_bindings(slot, BindingsKind::LetIn, node);
 
         // Deal with the body, then clean up the locals afterwards.
-        self.compile(slot, &node.body().unwrap());
+        self.compile(slot, node.body().unwrap());
         self.cleanup_scope(node);
     }