feat(tvix/eval): implement trivial attribute set literals

Implements attribute set literals without nesting. Technically this
already supports dynamic key fragments (evaluating to strings), though
the only way to create these (interpolation) is not yet implemented.

However, creating simple attribute sets like `{ }`, or `{ a = 15; }`
or `{ a = 10 * 2; }` works.

Recursive attribute sets are not yet implemented as we do not have any
kind of scope access yet anyways.

This is implemented using a new instruction that creates an attribute
set with a given number of elements by popping key/value pairs off the
stack.

Change-Id: I0f9aac7a131a112d3f66b131297686b38aaeddf2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6091
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2022-08-09 16:53:09 +03:00 committed by tazjin
parent 20fc7bc0b2
commit 57a723aaa9
3 changed files with 88 additions and 3 deletions

View file

@ -29,4 +29,7 @@ pub enum OpCode {
// Logical binary operators
OpEqual,
// Attribute sets
OpAttrs(usize),
}