feat(tvix/eval): construct internal attribute path representation
This is required for constructing nested attribute sets at runtime. There'll be quite a lot of optimisation potential with this solution eventually, if it should turn out to be a bottleneck. This introduces a conceptual change, in that the `Value` enum is now an enum representing "all runtime values" instead of "all Nix language types". This makes sense in general, as this type will also contain Chunk representations etc. which are not exposed to users. Change-Id: Ic5f72b2a0965b146c6a451efad34c6a81ca1aad8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6103 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
parent
ec1770f95a
commit
175eb97505
4 changed files with 30 additions and 1 deletions
|
|
@ -21,6 +21,10 @@ pub enum Value {
|
|||
String(NixString),
|
||||
Attrs(Rc<NixAttrs>),
|
||||
List(NixList),
|
||||
|
||||
// Internal values that, while they technically exist at runtime,
|
||||
// are never returned to or created directly by users.
|
||||
AttrPath(Vec<NixString>),
|
||||
}
|
||||
|
||||
impl Value {
|
||||
|
|
@ -41,6 +45,9 @@ impl Value {
|
|||
Value::String(_) => "string",
|
||||
Value::Attrs(_) => "set",
|
||||
Value::List(_) => "list",
|
||||
|
||||
// Internal types
|
||||
Value::AttrPath(_) => "internal",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -76,6 +83,9 @@ impl Display for Value {
|
|||
Value::String(s) => s.fmt(f),
|
||||
Value::Attrs(attrs) => attrs.fmt(f),
|
||||
Value::List(list) => list.fmt(f),
|
||||
|
||||
// internal types
|
||||
Value::AttrPath(_) => f.write_str("internal"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue