diff options
author | Griffin Smith <root@gws.fyi> | 2022-10-08T17·33-0400 |
---|---|---|
committer | grfn <grfn@gws.fyi> | 2022-10-08T19·02+0000 |
commit | 278bccc1ea3542610012177171234ad1c3c44dcf (patch) | |
tree | 029d2723a6dd1e788cc5c165e015df255c033bed /tvix/eval/src/vm.rs | |
parent | f6bcd11cad1e370deb0580ae1a7f4d050cd75bab (diff) |
refactor(tvix/eval): Encapsulate Value::Attrs construction r/5067
Factor out the construction of Value::Attrs (including the Rc) into a new `attrs` constructor function, to abstract away the presence of the Rc itself. Change-Id: I42fd4c3841e1db368db999ddd651277ff995f025 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6892 Autosubmit: grfn <grfn@gws.fyi> Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/vm.rs')
-rw-r--r-- | tvix/eval/src/vm.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs index d616b9ce1c5c..9d28c7be1b93 100644 --- a/tvix/eval/src/vm.rs +++ b/tvix/eval/src/vm.rs @@ -374,7 +374,7 @@ impl<'o> VM<'o> { let rhs = unwrap_or_clone_rc(fallible!(self, self.pop().to_attrs())); let lhs = unwrap_or_clone_rc(fallible!(self, self.pop().to_attrs())); - self.push(Value::Attrs(Rc::new(lhs.update(rhs)))) + self.push(Value::attrs(lhs.update(rhs))) } OpCode::OpAttrsSelect => { @@ -641,7 +641,7 @@ impl<'o> VM<'o> { NixAttrs::construct(count, self.stack.split_off(self.stack.len() - count * 2)) ); - self.push(Value::Attrs(Rc::new(attrs))); + self.push(Value::attrs(attrs)); Ok(()) } |