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:
parent
5eb523e882
commit
e8c4e26b41
1 changed files with 4 additions and 3 deletions
|
@ -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)"))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue