refactor(tvix/eval): encapsulate internal mutability within Closure

This is required to efficiently construct the upvalue array at
runtime, as there are situations where during Closure construction
multiple things already have a reference to the closure (e.g. a
self-reference).

Change-Id: I35263b845fdc695dc873de489f5168d39b370f6a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6312
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Vincent Ambo 2022-08-27 20:41:10 +03:00 committed by tazjin
parent e646d5170c
commit 3089e46eb1
3 changed files with 47 additions and 25 deletions

View file

@ -87,8 +87,7 @@ impl Compiler {
}
fn chunk(&mut self) -> &mut Chunk {
Rc::<Chunk>::get_mut(self.context_mut().lambda.chunk())
.expect("compiler flaw: long-lived chunk reference")
&mut self.context_mut().lambda.chunk
}
fn scope(&self) -> &Scope {