about summary refs log tree commit diff
path: root/tvix/eval/src/compiler.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-11T13·42+0300
committertazjin <tazjin@tvl.su>2022-08-26T09·02+0000
commite8c4e26b412375e6d1a5cf7eecfb3612bc33908e (patch)
tree372294fa42c789038fe2448be8aa94133b1eb3fb /tvix/eval/src/compiler.rs
parent5eb523e882264ab3491ae2c6ce318e00a3fb3dfd (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 '')
-rw-r--r--tvix/eval/src/compiler.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/tvix/eval/src/compiler.rs b/tvix/eval/src/compiler.rs
index 7ab1dce193..cfcf78f31b 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)"))
             }