feat(tvix/compiler): handle dynamic nodes for attribute access

Dynamic nodes (essentially unquoted interpolation) simply need to be
unwrapped (and, hopefully, evaluate to a string).

Example: `let key = "a"; in { a = 1; }.${key}`
Change-Id: Idafd376e19d0e237151b7b6c26d97713beae5041
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6160
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2022-08-11 16:42:14 +03:00 committed by tazjin
parent 5eb523e882
commit e8c4e26b41

View file

@ -44,9 +44,10 @@ impl Compiler {
self.compile_string(op)
}
// The interpolation node is just a wrapper around the
// inner value of a fragment, it only requires unwrapping.
rnix::SyntaxKind::NODE_STRING_INTERPOL => {
// The interpolation & dynamic nodes are just wrappers
// around the inner value of a fragment, they only require
// unwrapping.
rnix::SyntaxKind::NODE_STRING_INTERPOL | rnix::SyntaxKind::NODE_DYNAMIC => {
self.compile(node.first_child().expect("TODO (should not be possible)"))
}