diff options
author | Vincent Ambo <mail@tazj.in> | 2022-08-11T13·42+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-08-26T09·02+0000 |
commit | e8c4e26b412375e6d1a5cf7eecfb3612bc33908e (patch) | |
tree | 372294fa42c789038fe2448be8aa94133b1eb3fb /tvix/eval | |
parent | 5eb523e882264ab3491ae2c6ce318e00a3fb3dfd (diff) |
feat(tvix/compiler): handle dynamic nodes for attribute access r/4494
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>
Diffstat (limited to 'tvix/eval')
-rw-r--r-- | tvix/eval/src/compiler.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tvix/eval/src/compiler.rs b/tvix/eval/src/compiler.rs index 7ab1dce19367..cfcf78f31bf6 100644 --- a/tvix/eval/src/compiler.rs +++ b/tvix/eval/src/compiler.rs @@ -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)")) } |