feat(tvix/eval): implement attrset update (//) operator
The underlying implementation does a few tricks based on which pair of attrset representations is encountered. Particularly the effect of short-circuiting the empty cases might be relevant in nixpkgs/NixOS, due to the use of lib.optionalAttrs. Change-Id: I22b978b1c69af12926489a71087c6a6219c012f3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6140 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
fa2d250d1a
commit
058e77bab2
13 changed files with 87 additions and 1 deletions
|
|
@ -136,6 +136,7 @@ impl Compiler {
|
|||
BinOpKind::Mul => OpCode::OpMul,
|
||||
BinOpKind::Div => OpCode::OpDiv,
|
||||
BinOpKind::Equal => OpCode::OpEqual,
|
||||
BinOpKind::Update => OpCode::OpAttrsUpdate,
|
||||
_ => todo!(),
|
||||
};
|
||||
|
||||
|
|
@ -187,6 +188,10 @@ impl Compiler {
|
|||
// 2. Keys can refer to nested attribute sets.
|
||||
// 3. Attribute sets can (optionally) be recursive.
|
||||
fn compile_attr_set(&mut self, node: rnix::types::AttrSet) -> EvalResult<()> {
|
||||
if node.recursive() {
|
||||
todo!("recursive attribute sets are not yet implemented")
|
||||
}
|
||||
|
||||
let mut count = 0;
|
||||
|
||||
for kv in node.entries() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue