refactor(tvix/eval): split out Upvalue struct & UpvalueKind enum
This separation makes it possible to annotate the upvalue itself with the span that created it, which (due to upvalue reuse) is only the first one for an instance of the given UpvalueKind. Change-Id: I9a991da6a3e8d71a92f981314bed900bcf434d44 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6399 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
b8874f8d35
commit
3efed26940
2 changed files with 19 additions and 14 deletions
|
|
@ -72,7 +72,7 @@ pub enum LocalPosition {
|
|||
/// Represents the different ways in which upvalues can be captured in
|
||||
/// closures or thunks.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum Upvalue {
|
||||
pub enum UpvalueKind {
|
||||
/// This upvalue captures a local from the stack.
|
||||
Local(LocalIdx),
|
||||
|
||||
|
|
@ -91,6 +91,11 @@ pub enum Upvalue {
|
|||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Upvalue {
|
||||
pub kind: UpvalueKind,
|
||||
}
|
||||
|
||||
/// Represents the index of a local in the scope's local array, which
|
||||
/// is subtly different from its `StackIdx` (which excludes
|
||||
/// uninitialised values in between).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue