feat(tvix/eval): track source spans for upvalues

With this change, the upvalue data instructions used by finalisers for
thunks and closures track the source span of the first identifier that
created the upvalue (if the same value is closed over multiple times
the upvalue will be reused, hence only the first one).

To do this the upvalue struct used by the compiler's scope now carries
an identifier node, which had to be threaded through quite a few
places.

Change-Id: I15a5fcb4c8abbd48544a2325f297a5ad14ec06ae
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6400
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2022-09-01 19:02:38 +03:00 committed by tazjin
parent 3efed26940
commit c269b44f41
2 changed files with 43 additions and 17 deletions

View file

@ -94,6 +94,7 @@ pub enum UpvalueKind {
#[derive(Clone, Debug)]
pub struct Upvalue {
pub kind: UpvalueKind,
pub node: rnix::ast::Ident,
}
/// Represents the index of a local in the scope's local array, which